From e19f54db99c92616949001d377e4a2ca411c167b Mon Sep 17 00:00:00 2001 From: fabianbormann Date: Fri, 24 May 2024 21:01:48 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20fabianbo?= =?UTF-8?q?rmann/cardano-peer-connect@43faac5a1f95a9c9c0474363cc18a15943fe?= =?UTF-8?q?8be9=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.2.17/index.js | 3 +++ 1.2.17/index.js.LICENSE.txt | 17 +++++++++++++++++ 1.2.17/index.js.map | 1 + 3 files changed, 21 insertions(+) create mode 100644 1.2.17/index.js create mode 100644 1.2.17/index.js.LICENSE.txt create mode 100644 1.2.17/index.js.map diff --git a/1.2.17/index.js b/1.2.17/index.js new file mode 100644 index 0000000..1beb192 --- /dev/null +++ b/1.2.17/index.js @@ -0,0 +1,3 @@ +/*! For license information please see index.js.LICENSE.txt */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CardanoPeerConnect=e():t.CardanoPeerConnect=e()}(this,(()=>(()=>{var t={726:t=>{var e;self,e=function(){return(()=>{var t={"./node_modules/@basementuniverse/commonjs/common.js":t=>{Math.floatEquals=(t,e,r=Number.EPSILON)=>Math.abs(t-e)tr?r:t,Math.frac=t=>t>=0?t-Math.floor(t):t-Math.ceil(t),Math.lerp=(t,e,r)=>t+(e-t)*r,Math.unlerp=(t,e,r)=>(r-t)/(e-t),Math.blerp=(t,e,r,i,n,o)=>Math.lerp(Math.lerp(t,e,n),Math.lerp(r,i,n),o),Math.remap=(t,e,r,i,n)=>i+(t-e)*(n-i)/(r-e),Math.smoothstep=(t,e,r)=>Math.lerp(t,e,3*Math.pow(r,2)-2*Math.pow(r,3)),Math.radians=t=>Math.PI/180*t,Math.degrees=t=>180/Math.PI*t,Math.randomBetween=(t,e)=>Math.random()*(e-t)+t,Math.randomIntBetween=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,Math.cltRandom=(t=.5,e=.5,r=2)=>{let i=0;for(let t=r;t--;)i+=Math.random();return t+(i-r/2)/(r/2)*e},Math.cltRandomInt=(t,e)=>Math.floor(t+Math.cltRandom(.5,.5,2)*(e+1-t)),Math.weightedRandom=t=>{let e=t.reduce(((t,e)=>t+e),0),r=0;const i=Math.random()*e;for(;e>i;)e-=t[r++];return r-1},Math.lerpArray=(t,e,r=Math.lerp)=>{const i=e*(t.length-1),n=Math.clamp(Math.trunc(i),0,t.length-1);return r(t[n]||0,t[n+1]||0,Math.frac(i))},Math.dot=(t,e)=>t.reduce(((t,r,i)=>t+r*e[i]),0),Math.factorial=t=>{let e=1;for(let r=2;r<=t;r++)e*=r;return e},Math.permutation=(t,e)=>Math.factorial(t)/Math.factorial(t-e),Math.combination=(t,e)=>Math.factorial(t)/(Math.factorial(e)*Math.factorial(t-e)),Array.times=(t,e)=>Array(e).fill(0).map(((e,r)=>t(r))),Array.range=t=>Array.times((t=>t),t),Array.zip=(t,e)=>t.map(((t,r)=>[t,e[r]])),Object.defineProperty(Array.prototype,"at",{value:function(t){const e=this.length;return this[t<0?e-Math.abs(t+1)%e-1:t%e]}}),Object.defineProperty(Array.prototype,"chunk",{value:function(t){return Array.times((e=>this.slice(e*t,e*t+t)),Math.ceil(this.length/t))}}),Object.defineProperty(Array.prototype,"shuffle",{value:function(){return this.map((t=>[Math.random(),t])).sort(((t,e)=>t[0]-e[0])).map((t=>t[1]))}});const e=(t,e)=>t||e?"object"==typeof t?{x:t.x||0,y:t.y||0}:null==e?{x:t,y:t}:{x:t,y:e}:{x:0,y:0};e.components=t=>[t.x,t.y],e.ux=()=>e(1,0),e.uy=()=>e(0,1),e.add=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),e.mul=(t,e)=>({x:t.x*e,y:t.y*e}),e.sub=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),e.len=t=>Math.sqrt(t.x*t.x+t.y*t.y),e.manhattan=t=>Math.abs(t.x)+Math.abs(t.y),e.nor=t=>{let r=e.len(t);return r?{x:t.x/r,y:t.y/r}:e()},e.dot=(t,e)=>t.x*e.x+t.y*e.y,e.rot=(t,e)=>{let r=Math.sin(e),i=Math.cos(e);return{x:i*t.x-r*t.y,y:r*t.x+i*t.y}},e.eq=(t,e)=>t.x===e.x&&t.y===e.y,e.rad=t=>Math.atan2(t.y,t.x),e.cpy=t=>e(t),e.map=(t,e)=>({x:e(t.x,"x"),y:e(t.y,"y")}),e.str=(t,e=", ")=>`${t.x}${e}${t.y}`;const r=(t=4,e=4,r=[])=>({m:t,n:e,entries:r.concat(Array(t*e).fill(0)).slice(0,t*e)});r.identity=t=>r(t,t,Array(t*t).fill(0).map(((e,r)=>+(Math.floor(r/t)===r%t)))),r.get=(t,e,r)=>t.entries[r-1+(e-1)*t.n],r.set=(t,e,r,i)=>{t.entries[r-1+(e-1)*t.n]=i},r.row=(t,e)=>{const r=(e-1)*t.n;return t.entries.slice(r,r+t.n)},r.col=(t,e)=>Array.times((i=>r.get(t,i+1,e)),t.m),r.add=(t,e)=>t.m===e.m&&t.n===e.n&&r.map(t,((t,r)=>t+e.entries[r])),r.sub=(t,e)=>t.m===e.m&&t.n===e.n&&r.map(t,((t,r)=>t-e.entries[r])),r.mul=(t,e)=>{if(t.n!==e.m)return!1;const i=r(t.m,e.n);for(let n=1;n<=t.m;n++)for(let o=1;o<=e.n;o++)r.set(i,n,o,Math.dot(r.row(t,n),r.col(e,o)));return i},r.scale=(t,e)=>r.map(t,(t=>t*e)),r.trans=t=>r(t.n,t.m,Array.times((e=>r.col(t,e+1)),t.n).flat()),r.minor=(t,e,i)=>{if(t.m!==t.n)return!1;const n=[];for(let o=1;o<=t.m;o++)if(o!==e)for(let e=1;e<=t.n;e++)e!==i&&n.push(r.get(t,o,e));return r(t.m-1,t.n-1,n)},r.det=t=>{if(t.m!==t.n)return!1;if(1===t.m)return t.entries[0];if(2===t.m)return t.entries[0]*t.entries[3]-t.entries[1]*t.entries[2];let e=0,i=1;for(let n=1;n<=t.n;n++)e+=i*t.entries[n-1]*r.det(r.minor(t,1,n)),i*=-1;return e},r.nor=t=>{if(t.m!==t.n)return!1;const e=r.det(t);return r.map(t,(t=>t*e))},r.adj=t=>{const e=r(t.m,t.n);for(let i=1;i<=t.m;i++)for(let n=1;n<=t.n;n++)r.set(e,i,n,r.det(r.minor(t,i,n)));const i=r.map(e,((t,e)=>t*(e%2?-1:1)));return r.trans(i)},r.inv=t=>{if(t.m!==t.n)return!1;const e=r.det(t);return 0!==e&&r.scale(r.adj(t),1/e)},r.eq=(t,e)=>t.m===e.m&&t.n===e.n&&r.str(t)===r.str(e),r.cpy=t=>r(t.m,t.n,[...t.entries]),r.map=(t,e)=>r(t.m,t.n,t.entries.map(e)),r.str=(t,e=", ",r="\n")=>t.entries.chunk(t.n).map((t=>t.join(e))).join(r),t.exports={vec:e,mat:r}},"./node_modules/seed-random/index.js":(t,e,r)=>{"use strict";var i=256,n=[],o=void 0===r.g?window:r.g,s=Math.pow(i,6),a=Math.pow(2,52),h=2*a,u=255,f=Math.random;function l(t){var e,r=t.length,n=this,o=0,s=n.i=n.j=0,a=n.S=[];for(r||(t=[r++]);o=h;)t/=2,e/=2,r>>>=1;return(t+r)/e}},t.exports.resetGlobal=function(){Math.random=f},d(Math.random(),n)}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,r),o.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var i={};return(()=>{"use strict";var t=i;Object.defineProperty(t,"__esModule",{value:!0}),t.identicon=void 0;const e=r("./node_modules/seed-random/index.js"),n=r("./node_modules/@basementuniverse/commonjs/common.js"),o={size:100,baseSeed:"",font:"Helvetica",fontStyle:"bold",fontSize:.4,backgroundColours:["#16a085","#1abc9c","#2ecc71","#3498db","#1970b9","#9b59b6","#e67e22","#e74c3c","#e0395b"],initialsColours:["#ffffff"],initialsOffset:n.vec(),initialsAlpha:1,initialsCompositeOperation:"source-over",stripeColours:["#f1c40f"],stripeAlpha:.15,stripeCompositeOperation:"lighter",stripes:[3,8],stripeWidth:[.2,.7],stripeDeviation:[-.5,.5],curveAmount:[.2,.4],curveOffset:[0,.5],startWidthSign:["positive","negative"],endWidthSign:["positive","negative"]},s=2*Math.PI,a={positive:1,negative:-1};function h(t,e,r){const i=a[e.startWidthSign.shuffle()[0]],o=r+Math.randomBetween(e.stripeWidth[0],e.stripeWidth[1])*i,s=r+Math.PI+Math.randomBetween(e.curveOffset[0],e.curveOffset[1]),h=a[e.endWidthSign.shuffle()[0]],f=s+Math.randomBetween(e.stripeWidth[0],e.stripeWidth[1])*h,l=r+Math.PI/2,c=n.vec.mul(n.vec(e.size),.5),d=2*Math.sqrt(c.x*c.x+c.y*c.y),p=u(c,d,r),m=u(c,d,o),g=u(c,d,s),y=u(c,d,f),b=u(c,d*Math.randomBetween(e.curveAmount[0],e.curveAmount[1]),l);t.beginPath(),t.moveTo(p.x,p.y),t.quadraticCurveTo(b.x,b.y,g.x,g.y),t.lineTo(y.x,y.y),t.quadraticCurveTo(b.x,b.y,m.x,m.y),t.closePath(),t.fill()}function u(t,e,r){return n.vec.add(t,n.vec(e*Math.sin(r),e*Math.cos(r)))}t.identicon=function(t,r={}){const i=Object.assign({},o,r);t&&"string"==typeof t||(t="Anonymous");const a=t.split(/[\s\-']/).map((t=>t[0].toUpperCase())).join(""),u=`${r.baseSeed}${t}`;e(u,{global:!0});const f=document.createElement("canvas"),l=f.getContext("2d");return f.width=i.size,f.height=i.size,function(t,e,r){t.save();const i=Math.randomIntBetween(0,Math.max(e.backgroundColours.length,e.stripeColours.length,e.initialsColours.length)-1);t.fillStyle=e.backgroundColours[Math.clamp(i,0,e.backgroundColours.length-1)],t.fillRect(0,0,e.size,e.size),t.save(),t.fillStyle=e.stripeColours[Math.clamp(i,0,e.stripeColours.length-1)],t.globalAlpha=e.stripeAlpha,t.globalCompositeOperation=e.stripeCompositeOperation;const o=Math.randomIntBetween(e.stripes[0],e.stripes[1]);let a=Math.random()*s;for(let r=0;r{var e;self,e=()=>(()=>{var t,e,r={7557:(t,e)=>{"use strict";function r(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function i(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)}function n(t,...e){if(!((r=t)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Expected Uint8Array");var r;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function o(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(t.outputLen),r(t.blockLen)}function s(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function a(t,e){n(t);const r=e.outputLen;if(t.length{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SHA2=void 0;const i=r(7557),n=r(9175);class o extends n.Hash{constructor(t,e,r,i){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,n.createView)(this.buffer)}update(t){(0,i.exists)(this);const{view:e,buffer:r,blockLen:o}=this,s=(t=(0,n.toBytes)(t)).length;for(let i=0;io-a&&(this.process(r,0),a=0);for(let t=a;t>n&o),a=Number(r&o),h=i?4:0,u=i?0:4;t.setUint32(e+h,s,i),t.setUint32(e+u,a,i)}(r,o-8,BigInt(8*this.length),s),this.process(r,0);const h=(0,n.createView)(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const f=u/4,l=this.get();if(f>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},2623:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha224=e.sha256=void 0;const i=r(915),n=r(9175),o=(t,e,r)=>t&e^t&r^e&r,s=new Uint32Array([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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),h=new Uint32Array(64);class u extends i.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:t,B:e,C:r,D:i,E:n,F:o,G:s,H:a}=this;return[t,e,r,i,n,o,s,a]}set(t,e,r,i,n,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)h[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=h[t-15],r=h[t-2],i=(0,n.rotr)(e,7)^(0,n.rotr)(e,18)^e>>>3,o=(0,n.rotr)(r,17)^(0,n.rotr)(r,19)^r>>>10;h[t]=o+h[t-7]+i+h[t-16]|0}let{A:r,B:i,C:a,D:u,E:f,F:l,G:c,H:d}=this;for(let t=0;t<64;t++){const e=d+((0,n.rotr)(f,6)^(0,n.rotr)(f,11)^(0,n.rotr)(f,25))+((p=f)&l^~p&c)+s[t]+h[t]|0,m=((0,n.rotr)(r,2)^(0,n.rotr)(r,13)^(0,n.rotr)(r,22))+o(r,i,a)|0;d=c,c=l,l=f,f=u+e|0,u=a,a=i,i=r,r=e+m|0}var p;r=r+this.A|0,i=i+this.B|0,a=a+this.C|0,u=u+this.D|0,f=f+this.E|0,l=l+this.F|0,c=c+this.G|0,d=d+this.H|0,this.set(r,i,a,u,f,l,c,d)}roundClean(){h.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class f extends u{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}e.sha256=(0,n.wrapConstructor)((()=>new u)),e.sha224=(0,n.wrapConstructor)((()=>new f))},9175:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.isLE=e.rotr=e.createView=e.u32=e.u8=void 0;const i=r(5145);function n(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}if(e.u8=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),e.u32=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),e.createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),e.rotr=(t,e)=>t<<32-e|t>>>e,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error("Non little-endian hardware is not supported");const o=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function s(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void 0}function a(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function h(t){if("string"==typeof t&&(t=a(t)),!n(t))throw new Error("expected Uint8Array, got "+typeof t);return t}e.bytesToHex=function(t){if(!n(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r{},e.asyncLoop=async function(t,r,i){let n=Date.now();for(let o=0;o=0&&tt().update(h(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(h(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.wrapXOFConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(h(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.randomBytes=function(t=32){if(i.crypto&&"function"==typeof i.crypto.getRandomValues)return i.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}},5570:(t,e,r)=>{"use strict";const i=r(1436),n=r(7007).EventEmitter,o=r(9596);t.exports=class extends n{constructor(t,e){if(e||(e={}),super(),this.chunkLength=Number(t),!this.chunkLength)throw new Error("First argument must be a chunk length");this.closed=!1,this.destroyed=!1,this.length=Number(e.length)||1/0,this.name=e.name||"idb-chunk-store",this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=Math.ceil(this.length/this.chunkLength)-1),this.dbPromise=i.openDB(this.name,void 0,{upgrade:t=>{t.createObjectStore("chunks")},blocking:()=>{this.close()},terminated:()=>{this.closed=!0,this.emit("error",new Error("Database unexpectedly closed"))}})}put(t,e,r=(()=>{})){if(this.closed)return o((()=>r(new Error("Storage is closed"))));const i=t===this.lastChunkIndex;return i&&e.length!==this.lastChunkLength?o((()=>r(new Error("Last chunk length must be "+this.lastChunkLength)))):i||e.length===this.chunkLength?(0===e.byteOffset&&e.byteLength===e.buffer.byteLength||(e=e.slice()),void(async()=>{try{const r=await this.dbPromise;await r.put("chunks",e,t)}catch(t){return void r(t)}r(null)})()):o((()=>r(new Error("Chunk length must be "+this.chunkLength))))}get(t,e,r=(()=>{})){return"function"==typeof e?this.get(t,{},e):(e||(e={}),this.closed?o((()=>r(new Error("Storage is closed")))):void(async()=>{let i;try{const e=await this.dbPromise;i=await e.get("chunks",t)}catch(t){return void r(t)}if(null==i){const t=new Error("Chunk not found");return t.notFound=!0,void r(t)}const n=e.offset||0,o=e.length||i.length-n;0===n&&o===i.length||(i=i.slice(n,o+n)),r(null,i)})())}close(t=(()=>{})){if(this.closed)return o((()=>t(new Error("Storage is closed"))));this.closed=!0,(async()=>{try{(await this.dbPromise).close()}catch(e){return void t(e)}t(null)})()}destroy(t=(()=>{})){return this.closed?o((()=>t(new Error("Storage is closed")))):this.destroyed?o((()=>t(new Error("Storage is destroyed")))):(this.destroyed=!0,void this.close((async e=>{if(e)t(e);else{try{await i.deleteDB(this.name)}catch(e){return void t(e)}t(null)}})))}}},7568:(t,e,r)=>{var i=e;i.bignum=r(2344),i.define=r(7363).define,i.base=r(9673),i.constants=r(2153),i.decoders=r(2853),i.encoders=r(4669)},7363:(t,e,r)=>{var i=r(7568),n=r(6698);function o(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new o(t,e)},o.prototype._createNamed=function(t){var e;try{e=Object(function(){var t=new Error("Cannot find module 'vm'");throw t.code="MODULE_NOT_FOUND",t}())("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(t){e=function(t){this._initNamed(t)}}return n(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},o.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i.decoders[t])),this.decoders[t]},o.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},o.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(i.encoders[t])),this.encoders[t]},o.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},7227:(t,e,r)=>{var i=r(6698),n=r(9673).Reporter,o=r(8287).Buffer;function s(t,e){n.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function a(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof a||(t=new a(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}i(s,n),e.t=s,s.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},s.prototype.restore=function(t){var e=new s(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,n.prototype.restore.call(this,t.reporter),e},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new s(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},s.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.d=a,a.prototype.join=function(t,e){return t||(t=new o(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},9673:(t,e,r)=>{var i=e;i.Reporter=r(9220).a,i.DecoderBuffer=r(7227).t,i.EncoderBuffer=r(7227).d,i.Node=r(993)},993:(t,e,r)=>{var i=r(9673).Reporter,n=r(9673).EncoderBuffer,o=r(9673).DecoderBuffer,s=r(3349),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],h=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a);function u(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}t.exports=u;var f=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];u.prototype.clone=function(){var t=this._baseState,e={};f.forEach((function(r){e[r]=t[r]}));var r=new this.constructor(e.parent);return r._baseState=e,r},u.prototype._wrap=function(){var t=this._baseState;h.forEach((function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},u.prototype._init=function(t){var e=this._baseState;s(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),s.equal(e.children.length,1,"Root node can have only one child")},u.prototype._useArgs=function(t){var e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(s(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(s(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);var i=t[r];e[i]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){u.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),a.forEach((function(t){u.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===e.tag),e.tag=t,this._useArgs(r),this}})),u.prototype.use=function(t){s(t);var e=this._baseState;return s(null===e.use),e.use=t,this},u.prototype.optional=function(){return this._baseState.optional=!0,this},u.prototype.def=function(t){var e=this._baseState;return s(null===e.default),e.default=t,e.optional=!0,this},u.prototype.explicit=function(t){var e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.explicit=t,this},u.prototype.implicit=function(t){var e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.implicit=t,this},u.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},u.prototype.key=function(t){var e=this._baseState;return s(null===e.key),e.key=t,this},u.prototype.any=function(){return this._baseState.any=!0,this},u.prototype.choice=function(t){var e=this._baseState;return s(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},u.prototype.contains=function(t){var e=this._baseState;return s(null===e.use),e.contains=t,this},u.prototype._decode=function(t,e){var r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));var i,n=r.default,s=!0,a=null;if(null!==r.key&&(a=t.enterKey(r.key)),r.optional){var h=null;if(null!==r.explicit?h=r.explicit:null!==r.implicit?h=r.implicit:null!==r.tag&&(h=r.tag),null!==h||r.any){if(s=this._peekTag(t,h,r.any),t.isError(s))return s}else{var u=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),s=!0}catch(t){s=!1}t.restore(u)}}if(r.obj&&s&&(i=t.enterObject()),s){if(null!==r.explicit){var f=this._decodeTag(t,r.explicit);if(t.isError(f))return f;t=f}var l=t.offset;if(null===r.use&&null===r.choice){r.any&&(u=t.save());var c=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(c))return c;r.any?n=t.raw(u):t=c}if(e&&e.track&&null!==r.tag&&e.track(t.path(),l,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var d=new o(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(d,e)}}return r.obj&&s&&(n=t.leaveObject(i)),null===r.key||null===n&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,r.key,n),n},u.prototype._decodeGeneric=function(t,e,r){var i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,i.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&i.args?this._decodeObjid(e,i.args[0],i.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},u.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),s(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},u.prototype._decodeChoice=function(t,e){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some((function(o){var s=t.save(),a=r.choice[o];try{var h=a._decode(t,e);if(t.isError(h))return!1;i={type:o,value:h},n=!0}catch(e){return t.restore(s),!1}return!0}),this),n?i:t.error("Choice not matched")},u.prototype._createEncoderBuffer=function(t){return new n(t,this.reporter)},u.prototype._encode=function(t,e,r){var i=this._baseState;if(null===i.default||i.default!==t){var n=this._encodeValue(t,e,r);if(void 0!==n&&!this._skipDefault(n,e,r))return n}},u.prototype._encodeValue=function(t,e,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new i);var o=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}var s=null,a=!1;if(n.any)o=this._createEncoderBuffer(t);else if(n.choice)o=this._encodeChoice(t,e);else if(n.contains)s=this._getUse(n.contains,r)._encode(t,e),a=!0;else if(n.children)s=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");var i=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");var n=r._encode(t[r._baseState.key],e,t);return e.leaveKey(i),n}),this).filter((function(t){return t})),s=this._createEncoderBuffer(s);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");var h=this.clone();h._baseState.implicit=null,s=this._createEncoderBuffer(t.map((function(r){var i=this._baseState;return this._getUse(i.args[0],t)._encode(r,e)}),h))}else null!==n.use?o=this._getUse(n.use,r)._encode(t,e):(s=this._encodePrimitive(n.tag,t),a=!0);if(!n.any&&null===n.choice){var u=null!==n.implicit?n.implicit:n.tag,f=null===n.implicit?"universal":"context";null===u?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(u,a,f,s))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},u.prototype._encodeChoice=function(t,e){var r=this._baseState,i=r.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,e)},u.prototype._encodePrimitive=function(t,e){var r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},u.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},u.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}},9220:(t,e,r)=>{var i=r(6698);function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.a=n,n.prototype.isError=function(t){return t instanceof o},n.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},n.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},n.prototype.enterKey=function(t){return this._reporterState.path.push(t)},n.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},n.prototype.leaveKey=function(t,e,r){var i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},n.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},n.prototype.error=function(t){var e,r=this._reporterState,i=t instanceof o;if(e=i?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return i||r.errors.push(e),e},n.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},i(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},4598:(t,e,r)=>{var i=r(2153);e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=i._reverse(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=i._reverse(e.tag)},2153:(t,e,r)=>{var i=e;i._reverse=function(t){var e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);var i=t[r];e[i]=r})),e},i.der=r(4598)},2010:(t,e,r)=>{var i=r(6698),n=r(7568),o=n.base,s=n.bignum,a=n.constants.der;function h(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){o.Node.call(this,"der",t)}function f(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var i=a.tagClass[r>>6],n=!(32&r);if(31&~r)r&=31;else{var o=r;for(r=0;!(128&~o);){if(o=t.readUInt8(e),t.isError(o))return o;r<<=7,r|=127&o}}return{cls:i,primitive:n,tag:r,tagStr:a.tag[r]}}function l(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(!(128&i))return i;var n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(var o=0;o{var i=e;i.der=r(2010),i.pem=r(8903)},8903:(t,e,r)=>{var i=r(6698),n=r(8287).Buffer,o=r(2010);function s(t){o.call(this,t),this.enc="pem"}i(s,o),t.exports=s,s.prototype.decode=function(t,e){for(var r=t.toString().split(/[\r\n]+/g),i=e.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/,a=-1,h=-1,u=0;u{var i=r(6698),n=r(8287).Buffer,o=r(7568),s=o.base,a=o.constants.der;function h(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){s.Node.call(this,"der",t)}function f(t){return t<10?"0"+t:t}t.exports=h,h.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},i(u,s.Node),u.prototype._encodeComposite=function(t,e,r,i){var o,s=function(t,e,r,i){var n;if("seqof"===t?t="seq":"setof"===t&&(t="set"),a.tagByName.hasOwnProperty(t))n=a.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return i.error("Unknown tag: "+t);n=t}return n>=31?i.error("Multi-octet tag encoding unsupported"):(e||(n|=32),n|=a.tagClassByName[r||"universal"]<<6)}(t,e,r,this.reporter);if(i.length<128)return(o=new n(2))[0]=s,o[1]=i.length,this._createEncoderBuffer([o,i]);for(var h=1,u=i.length;u>=256;u>>=8)h++;(o=new n(2+h))[0]=s,o[1]=128|h,u=1+h;for(var f=i.length;f>0;u--,f>>=8)o[u]=255&f;return this._createEncoderBuffer([o,i])},u.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new n(2*t.length),i=0;i=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(i=0;i=128;s>>=7)o++}var a=new n(o),h=a.length-1;for(i=t.length-1;i>=0;i--)for(s=t[i],a[h--]=127&s;(s>>=7)>0;)a[h--]=128|127&s;return this._createEncoderBuffer(a)},u.prototype._encodeTime=function(t,e){var r,i=new Date(t);return"gentime"===e?r=[f(i.getFullYear()),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[f(i.getFullYear()%100),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!n.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new n(r)}if(n.isBuffer(t)){var i=t.length;0===t.length&&i++;var o=new n(i);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);i=1;for(var s=t;s>=256;s>>=8)i++;for(s=(o=new Array(i)).length-1;s>=0;s--)o[s]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new n(o))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},u.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i{var i=e;i.der=r(82),i.pem=r(735)},735:(t,e,r)=>{var i=r(6698),n=r(82);function o(t){n.call(this,t),this.enc="pem"}i(o,n),t.exports=o,o.prototype.encode=function(t,e){for(var r=n.prototype.encode.call(this,t).toString("base64"),i=["-----BEGIN "+e.label+"-----"],o=0;o=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],k=8191&M,S=M>>>13,x=0|s[5],A=8191&x,E=x>>>13,I=0|s[6],T=8191&I,P=I>>>13,B=0|s[7],C=8191&B,L=B>>>13,O=0|s[8],R=8191&O,j=O>>>13,N=0|s[9],D=8191&N,U=N>>>13,q=0|a[0],F=8191&q,H=q>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,G=V>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,o=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,o=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,G)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,G)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,G)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,o=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,G)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,o=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,G)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(T,F),n=(n=Math.imul(T,H))+Math.imul(P,F)|0,o=Math.imul(P,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,G)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,F),n=(n=Math.imul(C,H))+Math.imul(L,F)|0,o=Math.imul(L,H),i=i+Math.imul(T,W)|0,n=(n=n+Math.imul(T,K)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,G)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,G)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(j,F)|0,o=Math.imul(j,H),i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,K)|0,i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,G)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,G)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,F),n=(n=Math.imul(D,H))+Math.imul(U,F)|0,o=Math.imul(U,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(j,W)|0,o=o+Math.imul(j,K)|0,i=i+Math.imul(C,$)|0,n=(n=n+Math.imul(C,G)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,G)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,K))+Math.imul(U,W)|0,o=Math.imul(U,K),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,G)|0,i=i+Math.imul(C,J)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,$),n=(n=Math.imul(D,G))+Math.imul(U,$)|0,o=Math.imul(U,G),i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Y)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,ut)|0,i=i+Math.imul(C,lt)|0,n=(n=n+Math.imul(C,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Bt=(u+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;u=((o=o+Math.imul(P,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(j,lt)|0,o=o+Math.imul(j,ct)|0;var Ct=(u+(i=i+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,lt),n=(n=Math.imul(D,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Lt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Ot=(u+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Bt,h[16]=Ct,h[17]=Lt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!=(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,h=i.length-n.length;if("mod"!==e){(a=new o(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),h=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(h)):(r.isub(e),a.isub(n),h.isub(s))}return{a,b:h,gcd:r.iushln(u)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new k(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},5682:(t,e,r)=>{const i=r(6209),n=r(943),o=r(1847),s=r(6679),a=r(5435),h=255===new Uint8Array(Uint16Array.of(255).buffer)[0];function u(t){switch(t){case"ascii":return i;case"base64":return n;case"hex":return o;case"utf8":case"utf-8":case void 0:return s;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a;default:throw new Error(`Unknown encoding: ${t}`)}}function f(t){return t instanceof Uint8Array}function l(t,e,r){return"string"==typeof t?function(t,e){const r=u(e),i=new Uint8Array(r.byteLength(t));return r.write(i,t,0,i.byteLength),i}(t,e):Array.isArray(t)?function(t){const e=new Uint8Array(t.length);return e.set(t),e}(t):ArrayBuffer.isView(t)?function(t){const e=new Uint8Array(t.byteLength);return e.set(t),e}(t):function(t,e,r){return new Uint8Array(t,e,r)}(t,e,r)}function c(t,e,r,i,n){if(0===t.byteLength)return-1;if("string"==typeof r?(i=r,r=0):void 0===r?r=n?0:t.length-1:r<0&&(r+=t.byteLength),r>=t.byteLength){if(n)return-1;r=t.byteLength-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e)e=l(e,i);else if("number"==typeof e)return e&=255,n?t.indexOf(e,r):t.lastIndexOf(e,r);if(0===e.byteLength)return-1;if(n){let i=-1;for(let n=r;nt.byteLength&&(r=t.byteLength-e.byteLength);for(let i=r;i>=0;i--){let r=!0;for(let n=0;nn)return 1}return t.byteLength>e.byteLength?1:t.byteLengtht+e.byteLength),0));const r=new Uint8Array(e);let i=0;for(const e of t){if(i+e.byteLength>r.byteLength){const t=e.subarray(0,r.byteLength-i);return r.set(t,i),r}r.set(e,i),i+=e.byteLength}return r},copy:function(t,e,r=0,i=0,n=t.byteLength){if(n>0&&n=t.byteLength)throw new RangeError("sourceStart is out of range");if(n<0)throw new RangeError("sourceEnd is out of range");r>=e.byteLength&&(r=e.byteLength),n>t.byteLength&&(n=t.byteLength),e.byteLength-r=n||i<=r?"":(r<0&&(r=0),i>n&&(i=n),(0!==r||i{function e(t){return t.length}t.exports={byteLength:e,toString:function(t){const e=t.byteLength;let r="";for(let i=0;i{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256);for(let t=0;t<64;t++)r[e.charCodeAt(t)]=t;function i(t){let e=t.length;return 61===t.charCodeAt(e-1)&&e--,e>1&&61===t.charCodeAt(e-1)&&e--,3*e>>>2}r[45]=62,r[95]=63,t.exports={byteLength:i,toString:function(t){const r=t.byteLength;let i="";for(let n=0;n>2]+e[(3&t[n])<<4|t[n+1]>>4]+e[(15&t[n+1])<<2|t[n+2]>>6]+e[63&t[n+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i},write:function(t,e,n=0,o=i(e)){const s=Math.min(o,t.byteLength-n);for(let i=0,n=0;n>4,t[n++]=(15&s)<<4|a>>2,t[n++]=(3&a)<<6|63&h}return s}}},1847:t=>{function e(t){return t.length>>>1}function r(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:void 0}t.exports={byteLength:e,toString:function(t){const e=t.byteLength;t=new DataView(t.buffer,t.byteOffset,e);let r="",i=0;for(let n=e-e%4;i{function e(t){return 2*t.length}t.exports={byteLength:e,toString:function(t){const e=t.byteLength;let r="";for(let i=0;i>8,s=n%256;t[i+2*e]=s,t[i+2*e+1]=o}return o}}},6679:t=>{function e(t){let e=0;for(let r=0,i=t.length;r=55296&&n<=56319&&r+1=56320&&i<=57343){e+=4,r++;continue}}e+=n<=127?1:n<=2047?2:3}return e}let r,i;if("undefined"!=typeof TextDecoder){const t=new TextDecoder;r=function(e){return t.decode(e)}}else r=function(t){const e=t.byteLength;let r="",i=0;for(;i0){let e=0;for(;e>i,i-=6;i>=0;)t[a++]=128|e>>i&63,i-=6;s+=e>=65536?2:1}return o};t.exports={byteLength:e,toString:r,write:i}},5364:t=>{"use strict";t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,u=new Uint8Array(o);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var l=0,c=o-1;(0!==f||l>>0,u[c]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");n=l,r++}for(var d=o-n;d!==o&&0===u[d];)d++;for(var p=new Uint8Array(i+(o-d)),m=i;d!==o;)p[m++]=u[d++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var r=0,i=0,n=0,o=e.length;n!==o&&0===e[n];)n++,r++;for(var h=(o-n)*u+1>>>0,f=new Uint8Array(h);n!==o;){for(var l=e[n],c=0,d=h-1;(0!==l||c>>0,f[d]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");i=c,n++}for(var p=h-i;p!==h&&0===f[p];)p++;for(var m=a.repeat(r);p{"use strict";e.byteLength=function(t){var e=a(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,o=a(t),s=o[0],h=o[1],u=new n(function(t,e,r){return 3*(e+r)/4-r}(0,s,h)),f=0,l=h>0?s-4:s;for(r=0;r>16&255,u[f++]=e>>8&255,u[f++]=255&e;return 2===h&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[f++]=255&e),1===h&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e),u},e.fromByteArray=function(t){for(var e,i=t.length,n=i%3,o=[],s=16383,a=0,u=i-n;au?u:a+s));return 1===n?(e=t[i-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[i-2]<<8)+t[i-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],i[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,i){for(var n,o,s=[],a=e;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},1467:t=>{function e(t,e){if("string"==typeof t[0])return t.join("");if("number"==typeof t[0])return new Uint8Array(t);const r=new Uint8Array(e);let i=0;for(let e=0,n=t.length;e=r){const t=e(s,a);let i=0;for(;a>=r;)yield t.slice(i,i+r),a-=r,i+=r;s=[t.slice(i,t.length)]}a&&(yield e(s,o?r:a))}},9404:function(t,e,r){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(7790).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+t)}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,n){for(var o=0,s=0,a=Math.min(t.length,r),h=e;h=49?u-49+10:u>=17?u-17+10:u,i(u>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?""}var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),r=0!==o||s!==this.length-1?c[6-h.length]+h+r:h+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],f=p[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(f).toString(t);r=(l=l.idivn(f)).isZero()?m+r:c[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,n),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],k=8191&M,S=M>>>13,x=0|s[5],A=8191&x,E=x>>>13,I=0|s[6],T=8191&I,P=I>>>13,B=0|s[7],C=8191&B,L=B>>>13,O=0|s[8],R=8191&O,j=O>>>13,N=0|s[9],D=8191&N,U=N>>>13,q=0|a[0],F=8191&q,H=q>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,G=V>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,o=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,o=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,G)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,G)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,G)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,o=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,G)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,o=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,G)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(T,F),n=(n=Math.imul(T,H))+Math.imul(P,F)|0,o=Math.imul(P,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,G)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,F),n=(n=Math.imul(C,H))+Math.imul(L,F)|0,o=Math.imul(L,H),i=i+Math.imul(T,W)|0,n=(n=n+Math.imul(T,K)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,G)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,G)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(j,F)|0,o=Math.imul(j,H),i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,K)|0,i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,G)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,G)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,F),n=(n=Math.imul(D,H))+Math.imul(U,F)|0,o=Math.imul(U,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(j,W)|0,o=o+Math.imul(j,K)|0,i=i+Math.imul(C,$)|0,n=(n=n+Math.imul(C,G)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,G)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,K))+Math.imul(U,W)|0,o=Math.imul(U,K),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,G)|0,i=i+Math.imul(C,J)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,$),n=(n=Math.imul(D,G))+Math.imul(U,$)|0,o=Math.imul(U,G),i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Y)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,ut)|0,i=i+Math.imul(C,lt)|0,n=(n=n+Math.imul(C,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Bt=(u+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;u=((o=o+Math.imul(P,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(j,lt)|0,o=o+Math.imul(j,ct)|0;var Ct=(u+(i=i+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,lt),n=(n=Math.imul(D,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Lt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Ot=(u+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Bt,h[16]=Ct,h[17]=Lt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function b(t,e,r){return y(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?y(this,t,e):b(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},v.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[n]=67108863&s}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!=(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,h=i.length-n.length;if("mod"!==e){(a=new o(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var n,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%t;return e?-n:n},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),h=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(h)):(r.isub(e),a.isub(n),h.isub(s))}return{a,b:h,gcd:r.iushln(u)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},n(M,_),M.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new k;else if("p192"===t)e=new S;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new x}return w[t]=e,e},A.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){i(!(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(f(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}h=26}return n},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new E(t)},n(E,A),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},5037:(t,e,r)=>{var i;function n(t){this.rand=t}if(t.exports=function(t){return i||(i=new n(null)),i.generate(t)},t.exports.Rand=n,n.prototype.generate=function(t){return this._rand(t)},n.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r{var i=r(2861).Buffer;function n(t){i.isBuffer(t)||(t=i.from(t));for(var e=t.length/4|0,r=new Array(e),n=0;n>>24]^f[p>>>16&255]^l[m>>>8&255]^c[255&g]^e[y++],s=u[p>>>24]^f[m>>>16&255]^l[g>>>8&255]^c[255&d]^e[y++],a=u[m>>>24]^f[g>>>16&255]^l[d>>>8&255]^c[255&p]^e[y++],h=u[g>>>24]^f[d>>>16&255]^l[p>>>8&255]^c[255&m]^e[y++],d=o,p=s,m=a,g=h;return o=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&g])^e[y++],s=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[g>>>8&255]<<8|i[255&d])^e[y++],a=(i[m>>>24]<<24|i[g>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[y++],h=(i[g>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[y++],[o>>>=0,s>>>=0,a>>>=0,h>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,h=0;h<256;++h){var u=a^a<<1^a<<2^a<<3^a<<4;u=u>>>8^255&u^99,r[s]=u,i[u]=s;var f=t[s],l=t[f],c=t[l],d=257*t[u]^16843008*u;n[0][s]=d<<24|d>>>8,n[1][s]=d<<16|d>>>16,n[2][s]=d<<8|d>>>24,n[3][s]=d,d=16843009*c^65537*l^257*f^16843008*s,o[0][u]=d<<24|d>>>8,o[1][u]=d<<16|d>>>16,o[2][u]=d<<8|d>>>24,o[3][u]=d,0===s?s=a=1:(s=f^t[t[t[c^f]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}}();function u(t){this._key=n(t),this._reset()}u.blockSize=16,u.keySize=32,u.prototype.blockSize=u.blockSize,u.prototype.keySize=u.keySize,u.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],o=0;o>>24,s=h.SBOX[s>>>24]<<24|h.SBOX[s>>>16&255]<<16|h.SBOX[s>>>8&255]<<8|h.SBOX[255&s],s^=a[o/e|0]<<24):e>6&&o%e==4&&(s=h.SBOX[s>>>24]<<24|h.SBOX[s>>>16&255]<<16|h.SBOX[s>>>8&255]<<8|h.SBOX[255&s]),n[o]=n[o-e]^s}for(var u=[],f=0;f>>24]]^h.INV_SUB_MIX[1][h.SBOX[c>>>16&255]]^h.INV_SUB_MIX[2][h.SBOX[c>>>8&255]]^h.INV_SUB_MIX[3][h.SBOX[255&c]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=u},u.prototype.encryptBlockRaw=function(t){return s(t=n(t),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},u.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=i.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},u.prototype.decryptBlock=function(t){var e=(t=n(t))[1];t[1]=t[3],t[3]=e;var r=s(t,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),o=i.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},u.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=u},2356:(t,e,r)=>{var i=r(462),n=r(2861).Buffer,o=r(6168),s=r(6698),a=r(5892),h=r(295),u=r(5122);function f(t,e,r,s){o.call(this);var h=n.alloc(4,0);this._cipher=new i.AES(e);var f=this._cipher.encryptBlock(h);this._ghash=new a(f),r=function(t,e,r){if(12===e.length)return t._finID=n.concat([e,n.from([0,0,0,1])]),n.concat([e,n.from([0,0,0,2])]);var i=new a(r),o=e.length,s=o%16;i.update(e),s&&(s=16-s,i.update(n.alloc(s,0))),i.update(n.alloc(8,0));var h=8*o,f=n.alloc(8);f.writeUIntBE(h,0,8),i.update(f),t._finID=i.state;var l=n.from(t._finID);return u(l),l}(this,r,f),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}s(f,o),f.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=n.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},f.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=h(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var i=Math.min(t.length,e.length),n=0;n{var i=r(5799),n=r(6171),o=r(3219);e.createCipher=e.Cipher=i.createCipher,e.createCipheriv=e.Cipheriv=i.createCipheriv,e.createDecipher=e.Decipher=n.createDecipher,e.createDecipheriv=e.Decipheriv=n.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},6171:(t,e,r)=>{var i=r(2356),n=r(2861).Buffer,o=r(530),s=r(650),a=r(6168),h=r(462),u=r(8078);function f(t,e,r){a.call(this),this._cache=new l,this._last=void 0,this._cipher=new h.AES(e),this._prev=n.from(r),this._mode=t,this._autopadding=!0}function l(){this.cache=n.allocUnsafe(0)}function c(t,e,r){var a=o[t.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=n.from(e)),e.length!==a.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===a.type?new s(a.module,e,r,!0):"auth"===a.type?new i(a.module,e,r,!0):new f(a.module,e,r)}r(6698)(f,a),f.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),i.push(r);return n.concat(i)},f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=o[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=u(e,!1,r.key,r.iv);return c(t,i.key,i.iv)},e.createDecipheriv=c},5799:(t,e,r)=>{var i=r(530),n=r(2356),o=r(2861).Buffer,s=r(650),a=r(6168),h=r(462),u=r(8078);function f(t,e,r){a.call(this),this._cache=new c,this._cipher=new h.AES(e),this._prev=o.from(r),this._mode=t,this._autopadding=!0}r(6698)(f,a),f.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get();)r=this._mode.encrypt(this,e),i.push(r);return o.concat(i)};var l=o.alloc(16,16);function c(){this.cache=o.allocUnsafe(0)}function d(t,e,r){var a=i[t.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==a.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===a.type?new s(a.module,e,r):"auth"===a.type?new n(a.module,e,r):new f(a.module,e,r)}f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},c.prototype.add=function(t){this.cache=o.concat([this.cache,t])},c.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},c.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;++r{var i=r(2861).Buffer,n=i.alloc(16,0);function o(t){var e=i.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function s(t){this.h=t,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}s.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=o(n)},s.prototype.update=function(t){var e;for(this.cache=i.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},s.prototype.final=function(t,e){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=s},5122:t=>{t.exports=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}},2884:(t,e,r)=>{var i=r(295);e.encrypt=function(t,e){var r=i(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},e.decrypt=function(t,e){var r=t._prev;t._prev=e;var n=t._cipher.decryptBlock(e);return i(n,r)}},6383:(t,e,r)=>{var i=r(2861).Buffer,n=r(295);function o(t,e,r){var o=e.length,s=n(e,t._cache);return t._cache=t._cache.slice(o),t._prev=i.concat([t._prev,r?e:s]),s}e.encrypt=function(t,e,r){for(var n,s=i.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=i.allocUnsafe(0)),!(t._cache.length<=e.length)){s=i.concat([s,o(t,e,r)]);break}n=t._cache.length,s=i.concat([s,o(t,e.slice(0,n),r)]),e=e.slice(n)}return s}},5264:(t,e,r)=>{var i=r(2861).Buffer;function n(t,e,r){for(var i,n,s=-1,a=0;++s<8;)i=e&1<<7-s?128:0,a+=(128&(n=t._cipher.encryptBlock(t._prev)[0]^i))>>s%8,t._prev=o(t._prev,r?i:n);return a}function o(t,e){var r=t.length,n=-1,o=i.allocUnsafe(t.length);for(t=i.concat([t,i.from([e])]);++n>7;return o}e.encrypt=function(t,e,r){for(var o=e.length,s=i.allocUnsafe(o),a=-1;++a{var i=r(2861).Buffer;function n(t,e,r){var n=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=i.concat([t._prev.slice(1),i.from([r?e:n])]),n}e.encrypt=function(t,e,r){for(var o=e.length,s=i.allocUnsafe(o),a=-1;++a{var i=r(295),n=r(2861).Buffer,o=r(5122);function s(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}e.encrypt=function(t,e){var r=Math.ceil(e.length/16),o=t._cache.length;t._cache=n.concat([t._cache,n.allocUnsafe(16*r)]);for(var a=0;a{e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},530:(t,e,r)=>{var i={ECB:r(2632),CBC:r(2884),CFB:r(6383),CFB8:r(6975),CFB1:r(5264),OFB:r(6843),CTR:r(3053),GCM:r(3053)},n=r(3219);for(var o in n)n[o].module=i[n[o].mode];t.exports=n},6843:(t,e,r)=>{var i=r(8287).Buffer,n=r(295);function o(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}e.encrypt=function(t,e){for(;t._cache.length{var i=r(462),n=r(2861).Buffer,o=r(6168);function s(t,e,r,s){o.call(this),this._cipher=new i.AES(e),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=s,this._mode=t}r(6698)(s,o),s.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},s.prototype._final=function(){this._cipher.scrub()},t.exports=s},125:(t,e,r)=>{var i=r(4050),n=r(1241),o=r(530),s=r(2438),a=r(8078);function h(t,e,r){if(t=t.toLowerCase(),o[t])return n.createCipheriv(t,e,r);if(s[t])return new i({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function u(t,e,r){if(t=t.toLowerCase(),o[t])return n.createDecipheriv(t,e,r);if(s[t])return new i({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var r,i;if(t=t.toLowerCase(),o[t])r=o[t].key,i=o[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");r=8*s[t].key,i=s[t].iv}var n=a(e,!1,r,i);return h(t,n.key,n.iv)},e.createCipheriv=e.Cipheriv=h,e.createDecipher=e.Decipher=function(t,e){var r,i;if(t=t.toLowerCase(),o[t])r=o[t].key,i=o[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");r=8*s[t].key,i=s[t].iv}var n=a(e,!1,r,i);return u(t,n.key,n.iv)},e.createDecipheriv=e.Decipheriv=u,e.listCiphers=e.getCiphers=function(){return Object.keys(s).concat(n.getCiphers())}},4050:(t,e,r)=>{var i=r(6168),n=r(9560),o=r(6698),s=r(2861).Buffer,a={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function h(t){i.call(this);var e,r=t.mode.toLowerCase(),n=a[r];e=t.decrypt?"decrypt":"encrypt";var o=t.key;s.isBuffer(o)||(o=s.from(o)),"des-ede"!==r&&"des-ede-cbc"!==r||(o=s.concat([o,o.slice(0,8)]));var h=t.iv;s.isBuffer(h)||(h=s.from(h)),this._des=n.create({key:o,iv:h,type:e})}a.des=a["des-cbc"],a.des3=a["des-ede3-cbc"],t.exports=h,o(h,i),h.prototype._update=function(t){return s.from(this._des.update(t))},h.prototype._final=function(){return s.from(this._des.final())}},2438:(t,e)=>{e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},7332:(t,e,r)=>{var i=r(8287).Buffer,n=r(9404),o=r(3209);function s(t){var e,r=t.modulus.byteLength();do{e=new n(o(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,e){var r=function(t){var e=s(t);return{blinder:e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),o=e.modulus.byteLength(),a=new n(t).mul(r.blinder).umod(e.modulus),h=a.toRed(n.mont(e.prime1)),u=a.toRed(n.mont(e.prime2)),f=e.coefficient,l=e.prime1,c=e.prime2,d=h.redPow(e.exponent1).fromRed(),p=u.redPow(e.exponent2).fromRed(),m=d.isub(p).imul(f).umod(l).imul(c);return p.iadd(m).imul(r.unblinder).umod(e.modulus).toArrayLike(i,"be",o)}a.getr=s,t.exports=a},5715:(t,e,r)=>{"use strict";t.exports=r(2951)},20:(t,e,r)=>{"use strict";var i=r(2861).Buffer,n=r(7108),o=r(8399),s=r(6698),a=r(5359),h=r(4847),u=r(2951);function f(t){o.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function l(t){o.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function c(t){return new f(t)}function d(t){return new l(t)}Object.keys(u).forEach((function(t){u[t].id=i.from(u[t].id,"hex"),u[t.toLowerCase()]=u[t]})),s(f,o.Writable),f.prototype._write=function(t,e,r){this._hash.update(t),r()},f.prototype.update=function(t,e){return this._hash.update("string"==typeof t?i.from(t,e):t),this},f.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),i=a(r,t,this._hashType,this._signType,this._tag);return e?i.toString(e):i},s(l,o.Writable),l.prototype._write=function(t,e,r){this._hash.update(t),r()},l.prototype.update=function(t,e){return this._hash.update("string"==typeof t?i.from(t,e):t),this},l.prototype.verify=function(t,e,r){var n="string"==typeof e?i.from(e,r):e;this.end();var o=this._hash.digest();return h(n,o,t,this._signType,this._tag)},t.exports={Sign:c,Verify:d,createSign:c,createVerify:d}},5359:(t,e,r)=>{"use strict";var i=r(2861).Buffer,n=r(3507),o=r(7332),s=r(6729).ec,a=r(9404),h=r(8170),u=r(4589);function f(t,e,r,o){if((t=i.from(t.toArray())).length0&&r.ishrn(i),r}function c(t,e,r){var o,s;do{for(o=i.alloc(0);8*o.length{"use strict";var i=r(2861).Buffer,n=r(9404),o=r(6729).ec,s=r(8170),a=r(4589);function h(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=0)throw new Error("invalid sig")}t.exports=function(t,e,r,u,f){var l=s(r);if("ec"===l.type){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");return function(t,e,r){var i=a[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new o(i),s=r.data.subjectPrivateKey.data;return n.verify(e,t,s)}(t,e,l)}if("dsa"===l.type){if("dsa"!==u)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,o=r.data.q,a=r.data.g,u=r.data.pub_key,f=s.signature.decode(t,"der"),l=f.s,c=f.r;h(l,o),h(c,o);var d=n.mont(i),p=l.invm(o);return 0===a.toRed(d).redPow(new n(e).mul(p).mod(o)).fromRed().mul(u.toRed(d).redPow(c.mul(p).mod(o)).fromRed()).mod(i).mod(o).cmp(c)}(t,e,l)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");e=i.concat([f,e]);for(var c=l.modulus.byteLength(),d=[1],p=0;e.length+d.length+2{const i=r(5364);t.exports=i("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},9204:(t,e,r)=>{"use strict";var i=r(6763);t.exports=function(t){function e(e){var r=e.slice(0,-4),i=e.slice(-4),n=t(r);if(!(i[0]^n[0]|i[1]^n[1]|i[2]^n[2]|i[3]^n[3]))return r}return{encode:function(e){var r=Uint8Array.from(e),n=t(r),o=r.length+4,s=new Uint8Array(o);return s.set(r,0),s.set(n.subarray(0,4),r.length),i.encode(s,o)},decode:function(t){var r=e(i.decode(t));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(t){var r=i.decodeUnsafe(t);if(r)return e(r)}}}},1889:(t,e,r)=>{"use strict";var{sha256:i}=r(2623),n=r(9204);t.exports=n((function(t){return i(i(t))}))},295:(t,e,r)=>{var i=r(8287).Buffer;t.exports=function(t,e){for(var r=Math.min(t.length,e.length),n=new i(r),o=0;o{"use strict";const i=r(7526),n=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=h,e.SlowBuffer=function(t){return+t!=t&&(t=0),h.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,h.prototype),e}function h(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!h.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|m(t,e);let i=a(r);const n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Z(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Z(t,ArrayBuffer)||t&&Z(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Z(t,SharedArrayBuffer)||t&&Z(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return h.from(i,e,r);const n=function(t){if(h.isBuffer(t)){const e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?a(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return h.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return f(t),a(t<0?0:0|p(t))}function c(t){const e=t.length<0?0:0|p(t.length),r=a(e);for(let i=0;i=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(h.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Z(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(n)return i?-1:V(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function y(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function b(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=h.from(e,i)),h.isBuffer(e))return 0===e.length?-1:v(t,e,r,i,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,i,n){let o,s=1,a=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,h/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){let i=-1;for(o=r;oa&&(r=a-h),o=r;o>=0;o--){let r=!0;for(let i=0;in&&(i=n):i=n;const o=e.length;let s;for(i>o/2&&(i=o/2),s=0;s>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function x(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);const i=[];let n=e;for(;n239?4:e>223?3:e>191?2:1;if(n+s<=r){let r,i,a,h;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[n+1],128==(192&r)&&(h=(31&e)<<6|63&r,h>127&&(o=h));break;case 3:r=t[n+1],i=t[n+2],128==(192&r)&&128==(192&i)&&(h=(15&e)<<12|(63&r)<<6|63&i,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:r=t[n+1],i=t[n+2],a=t[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(h=(15&e)<<18|(63&r)<<12|(63&i)<<6|63&a,h>65535&&h<1114112&&(o=h))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),n+=s}return function(t){const e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);let r="",i=0;for(;ii.length?(h.isBuffer(e)||(e=h.from(e)),e.copy(i,n)):Uint8Array.prototype.set.call(i,e,n);else{if(!h.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(i,n)}n+=e.length}return i},h.byteLength=m,h.prototype._isBuffer=!0,h.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;er&&(t+=" ... "),""},o&&(h.prototype[o]=h.prototype.inspect),h.prototype.compare=function(t,e,r,i,n){if(Z(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),!h.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0);const a=Math.min(o,s),u=this.slice(i,n),f=t.slice(e,r);for(let t=0;t>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}const n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return M(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const E=4096;function I(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;ni)&&(r=i);let n="";for(let i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,i,n,o){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function O(t,e,r,i,n){H(e,i,n,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function R(t,e,r,i,n){H(e,i,n,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function j(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(t,e,r,i,o){return e=+e,r>>>=0,o||j(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function D(t,e,r,i,o){return e=+e,r>>>=0,o||j(t,0,r,8),n.write(t,e,r,i,52,8),r+8}h.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||C(t,e,this.length);let i=this[t],n=1,o=0;for(;++o>>=0,e>>>=0,r||C(t,e,this.length);let i=this[t+--e],n=1;for(;e>0&&(n*=256);)i+=this[t+--e]*n;return i},h.prototype.readUint8=h.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readBigUInt64LE=X((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const i=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,n=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(i)+(BigInt(n)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const i=e*2**24+65536*this[++t]+256*this[++t]+this[++t],n=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(i)<>>=0,e>>>=0,r||C(t,e,this.length);let i=this[t],n=1,o=0;for(;++o=n&&(i-=Math.pow(2,8*e)),i},h.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);let i=e,n=1,o=this[t+--i];for(;i>0&&(n*=256);)o+=this[t+--i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*e)),o},h.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readBigInt64LE=X((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(i)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const i=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<>>=0,e||C(t,4,this.length),n.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),n.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),n.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),n.read(this,t,!1,52,8)},h.prototype.writeUintLE=h.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||L(this,t,e,r,Math.pow(2,8*r)-1,0);let n=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,i||L(this,t,e,r,Math.pow(2,8*r)-1,0);let n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},h.prototype.writeUint8=h.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},h.prototype.writeBigUInt64LE=X((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),h.prototype.writeBigUInt64BE=X((function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),h.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}let n=0,o=1,s=0;for(this[e]=255&t;++n>>=0,!i){const i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}let n=r-1,o=1,s=0;for(this[e+n]=255&t;--n>=0&&(o*=256);)t<0&&0===s&&0!==this[e+n+1]&&(s=1),this[e+n]=(t/o|0)-s&255;return e+r},h.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},h.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},h.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},h.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},h.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},h.prototype.writeBigInt64LE=X((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeBigInt64BE=X((function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeFloatLE=function(t,e,r){return N(this,t,e,!0,r)},h.prototype.writeFloatBE=function(t,e,r){return N(this,t,e,!1,r)},h.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},h.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},h.prototype.copy=function(t,e,r,i){if(!h.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function H(t,e,r,i,n,o){if(t>r||t3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`:`>= ${e}${i} and <= ${r}${i}`,new U.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||W(e,t.length-(r+1))}(i,n,o)}function z(t,e){if("number"!=typeof t)throw new U.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new U.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new U.ERR_BUFFER_OUT_OF_BOUNDS;throw new U.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}q("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),q("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),q("ERR_OUT_OF_RANGE",(function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=F(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=F(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function V(t,e){let r;e=e||1/0;const i=t.length;let n=null;const o=[];for(let s=0;s55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function $(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,r,i){let n;for(n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const Y=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const i=16*r;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function X(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},4497:(t,e,r)=>{const i=r(8454),n=r(9596);t.exports=class{constructor(t,e){if(this.store=t,this.chunkLength=t.chunkLength,this.inProgressGets=new Map,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.cache=new i(e)}put(t,e,r=(()=>{})){if(!this.cache)return n((()=>r(new Error("CacheStore closed"))));this.cache.remove(t),this.store.put(t,e,r)}get(t,e,r=(()=>{})){if("function"==typeof e)return this.get(t,null,e);if(!this.cache)return n((()=>r(new Error("CacheStore closed"))));e||(e={});let i=this.cache.get(t);if(i){const t=e.offset||0,o=e.length||i.length-t;return 0===t&&o===i.length||(i=i.slice(t,o+t)),n((()=>r(null,i)))}let o=this.inProgressGets.get(t);const s=!!o;o||(o=[],this.inProgressGets.set(t,o)),o.push({opts:e,cb:r}),s||this.store.get(t,((e,r)=>{e||null==this.cache||this.cache.set(t,r);const i=this.inProgressGets.get(t);this.inProgressGets.delete(t);for(const{opts:t,cb:n}of i)if(e)n(e);else{const e=t.offset||0,i=t.length||r.length-e;let o=r;0===e&&i===r.length||(o=r.slice(e,i+e)),n(null,o)}}))}close(t=(()=>{})){if(!this.cache)return n((()=>t(new Error("CacheStore closed"))));this.cache=null,this.store.close(t)}destroy(t=(()=>{})){if(!this.cache)return n((()=>t(new Error("CacheStore closed"))));this.cache=null,this.store.destroy(t)}}},8075:(t,e,r)=>{"use strict";var i=r(453),n=r(487),o=n(i("String.prototype.indexOf"));t.exports=function(t,e){var r=i(t,!!e);return"function"==typeof r&&o(t,".prototype.")>-1?n(r):r}},487:(t,e,r)=>{"use strict";var i=r(6743),n=r(453),o=r(6897),s=r(9675),a=n("%Function.prototype.apply%"),h=n("%Function.prototype.call%"),u=n("%Reflect.apply%",!0)||i.call(h,a),f=r(655),l=n("%Math.max%");t.exports=function(t){if("function"!=typeof t)throw new s("a function is required");var e=u(i,h,arguments);return o(e,1+l(0,t.length-(arguments.length-1)),!0)};var c=function(){return u(i,a,arguments)};f?f(t.exports,"apply",{value:c}):t.exports.apply=c},6168:(t,e,r)=>{var i=r(2861).Buffer,n=r(8310).Transform,o=r(3141).I;function s(t){n.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(6698)(s,n),s.prototype.update=function(t,e,r){"string"==typeof t&&(t=i.from(t,e));var n=this._update(t);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,r){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{r(i)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||i.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return r&&(i+=this._decoder.end()),i},t.exports=s},5622:(t,e,r)=>{function i(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===i(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===i(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===i(t)},e.isError=function(t){return"[object Error]"===i(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(8287).Buffer.isBuffer},4018:t=>{t.exports=function(){for(var t=navigator.hardwareConcurrency||1,e=[],r=0;r{var i=r(8287).Buffer,n=r(6729),o=r(2801);t.exports=function(t){return new a(t)};var s={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function a(t){this.curveType=s[t],this.curveType||(this.curveType={name:t}),this.curve=new n.ec(this.curveType.name),this.keys=void 0}function h(t,e,r){Array.isArray(t)||(t=t.toArray());var n=new i(t);if(r&&n.length=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],k=8191&M,S=M>>>13,x=0|s[5],A=8191&x,E=x>>>13,I=0|s[6],T=8191&I,P=I>>>13,B=0|s[7],C=8191&B,L=B>>>13,O=0|s[8],R=8191&O,j=O>>>13,N=0|s[9],D=8191&N,U=N>>>13,q=0|a[0],F=8191&q,H=q>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,G=V>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,o=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,o=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,G)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,G)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,G)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,o=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,G)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,o=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,G)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(T,F),n=(n=Math.imul(T,H))+Math.imul(P,F)|0,o=Math.imul(P,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,G)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,F),n=(n=Math.imul(C,H))+Math.imul(L,F)|0,o=Math.imul(L,H),i=i+Math.imul(T,W)|0,n=(n=n+Math.imul(T,K)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,G)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,G)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(j,F)|0,o=Math.imul(j,H),i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,K)|0,i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,G)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,G)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,F),n=(n=Math.imul(D,H))+Math.imul(U,F)|0,o=Math.imul(U,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(j,W)|0,o=o+Math.imul(j,K)|0,i=i+Math.imul(C,$)|0,n=(n=n+Math.imul(C,G)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,G)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,K))+Math.imul(U,W)|0,o=Math.imul(U,K),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,G)|0,i=i+Math.imul(C,J)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,$),n=(n=Math.imul(D,G))+Math.imul(U,$)|0,o=Math.imul(U,G),i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Y)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,ut)|0,i=i+Math.imul(C,lt)|0,n=(n=n+Math.imul(C,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Bt=(u+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;u=((o=o+Math.imul(P,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(j,lt)|0,o=o+Math.imul(j,ct)|0;var Ct=(u+(i=i+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,lt),n=(n=Math.imul(D,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Lt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Ot=(u+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Bt,h[16]=Ct,h[17]=Lt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!=(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,h=i.length-n.length;if("mod"!==e){(a=new o(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),h=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(h)):(r.isub(e),a.isub(n),h.isub(s))}return{a,b:h,gcd:r.iushln(u)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new k(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},7108:(t,e,r)=>{"use strict";var i=r(6698),n=r(8276),o=r(6011),s=r(2802),a=r(6168);function h(t){a.call(this,"digest"),this._hash=t}i(h,a),h.prototype._update=function(t){this._hash.update(t)},h.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new n:"rmd160"===t||"ripemd160"===t?new o:new h(s(t))}},320:(t,e,r)=>{var i=r(8276);t.exports=function(t){return(new i).update(t).digest()}},3507:(t,e,r)=>{"use strict";var i=r(6698),n=r(1800),o=r(6168),s=r(2861).Buffer,a=r(320),h=r(6011),u=r(2802),f=s.alloc(128);function l(t,e){o.call(this,"digest"),"string"==typeof e&&(e=s.from(e));var r="sha512"===t||"sha384"===t?128:64;this._alg=t,this._key=e,e.length>r?e=("rmd160"===t?new h:u(t)).update(e).digest():e.length{"use strict";var i=r(6698),n=r(2861).Buffer,o=r(6168),s=n.alloc(128),a=64;function h(t,e){o.call(this,"digest"),"string"==typeof e&&(e=n.from(e)),this._alg=t,this._key=e,e.length>a?e=t(e):e.length{"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r(3209),e.createHash=e.Hash=r(7108),e.createHmac=e.Hmac=r(3507);var i=r(5715),n=Object.keys(i),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(n);e.getHashes=function(){return o};var s=r(8396);e.pbkdf2=s.pbkdf2,e.pbkdf2Sync=s.pbkdf2Sync;var a=r(125);e.Cipher=a.Cipher,e.createCipher=a.createCipher,e.Cipheriv=a.Cipheriv,e.createCipheriv=a.createCipheriv,e.Decipher=a.Decipher,e.createDecipher=a.createDecipher,e.Decipheriv=a.Decipheriv,e.createDecipheriv=a.createDecipheriv,e.getCiphers=a.getCiphers,e.listCiphers=a.listCiphers;var h=r(5380);e.DiffieHellmanGroup=h.DiffieHellmanGroup,e.createDiffieHellmanGroup=h.createDiffieHellmanGroup,e.getDiffieHellman=h.getDiffieHellman,e.createDiffieHellman=h.createDiffieHellman,e.DiffieHellman=h.DiffieHellman;var u=r(20);e.createSign=u.createSign,e.Sign=u.Sign,e.createVerify=u.createVerify,e.Verify=u.Verify,e.createECDH=r(1324);var f=r(7168);e.publicEncrypt=f.publicEncrypt,e.privateEncrypt=f.privateEncrypt,e.publicDecrypt=f.publicDecrypt,e.privateDecrypt=f.privateDecrypt;var l=r(6983);e.randomFill=l.randomFill,e.randomFillSync=l.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},7833:(t,e,r)=>{var i=r(5606);e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let i=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(i++,"%c"===t&&(n=i))})),e.splice(n,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}return!t&&void 0!==i&&"env"in i&&(t=i.env.DEBUG),t},e.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!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`."))}})(),e.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"],e.log=console.debug||console.log||(()=>{}),t.exports=r(736)(e);const{formatters:n}=t.exports;n.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},736:(t,e,r)=>{t.exports=function(t){function e(t){let r,n,o,s=null;function a(...t){if(!a.enabled)return;const i=a,n=Number(new Date),o=n-(r||n);i.diff=o,i.prev=r,i.curr=n,r=n,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let s=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((r,n)=>{if("%%"===r)return"%";s++;const o=e.formatters[n];if("function"==typeof o){const e=t[s];r=o.call(i,e),t.splice(s,1),s--}return r})),e.formatArgs.call(i,t),(i.log||e.log).apply(i,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=i,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(n!==e.namespaces&&(n=e.namespaces,o=e.enabled(t)),o),set:t=>{s=t}}),"function"==typeof e.init&&e.init(a),a}function i(t,r){const i=e(this.namespace+(void 0===r?":":r)+t);return i.log=this.log,i}function n(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){const t=[...e.names.map(n),...e.skips.map(n).map((t=>"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){let r;e.save(t),e.namespaces=t,e.names=[],e.skips=[];const i=("string"==typeof t?t:"").split(/[\s,]+/),n=i.length;for(r=0;r{e[r]=t[r]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let r=0;for(let e=0;e{"use strict";var i=r(655),n=r(8068),o=r(9675),s=r(5795);t.exports=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new o("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,f=arguments.length>6&&arguments[6],l=!!s&&s(t,e);if(i)i(t,e,{configurable:null===u&&l?l.configurable:!u,enumerable:null===a&&l?l.enumerable:!a,value:r,writable:null===h&&l?l.writable:!h});else{if(!f&&(a||h||u))throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}}},9560:(t,e,r)=>{"use strict";e.utils=r(7626),e.Cipher=r(2808),e.DES=r(2211),e.CBC=r(3389),e.EDE=r(5279)},3389:(t,e,r)=>{"use strict";var i=r(3349),n=r(6698),o={};function s(t){i.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e{"use strict";var i=r(3349);function n(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==t.padding}t.exports=n,n.prototype._init=function(){},n.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},n.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),i=0;i0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},n.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e{"use strict";var i=r(3349),n=r(6698),o=r(7626),s=r(2808);function a(){this.tmp=new Array(2),this.keys=null}function h(t){s.call(this,t);var e=new a;this._desState=e,this.deriveKeys(e,t.key)}n(h,s),t.exports=h,h.create=function(t){return new h(t)};var u=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];h.prototype.deriveKeys=function(t,e){t.keys=new Array(32),i.equal(e.length,this.blockSize,"Invalid key length");var r=o.readUInt32BE(e,0),n=o.readUInt32BE(e,4);o.pc1(r,n,t.tmp,0),r=t.tmp[0],n=t.tmp[1];for(var s=0;s>>1];r=o.r28shl(r,a),n=o.r28shl(n,a),o.pc2(r,n,t.keys,s)}},h.prototype._update=function(t,e,r,i){var n=this._desState,s=o.readUInt32BE(t,e),a=o.readUInt32BE(t,e+4);o.ip(s,a,n.tmp,0),s=n.tmp[0],a=n.tmp[1],"encrypt"===this.type?this._encrypt(n,s,a,n.tmp,0):this._decrypt(n,s,a,n.tmp,0),s=n.tmp[0],a=n.tmp[1],o.writeUInt32BE(r,s,i),o.writeUInt32BE(r,a,i+4)},h.prototype._pad=function(t,e){if(!1===this.padding)return!1;for(var r=t.length-e,i=e;i>>0,s=c}o.rip(a,s,i,n)},h.prototype._decrypt=function(t,e,r,i,n){for(var s=r,a=e,h=t.keys.length-2;h>=0;h-=2){var u=t.keys[h],f=t.keys[h+1];o.expand(s,t.tmp,0),u^=t.tmp[0],f^=t.tmp[1];var l=o.substitute(u,f),c=s;s=(a^o.permute(l))>>>0,a=c}o.rip(s,a,i,n)}},5279:(t,e,r)=>{"use strict";var i=r(3349),n=r(6698),o=r(2808),s=r(2211);function a(t,e){i.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),n=e.slice(8,16),o=e.slice(16,24);this.ciphers="encrypt"===t?[s.create({type:"encrypt",key:r}),s.create({type:"decrypt",key:n}),s.create({type:"encrypt",key:o})]:[s.create({type:"decrypt",key:o}),s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:r})]}function h(t){o.call(this,t);var e=new a(this.type,this.options.key);this._edeState=e}n(h,o),t.exports=h,h.create=function(t){return new h(t)},h.prototype._update=function(t,e,r,i){var n=this._edeState;n.ciphers[0]._update(t,e,r,i),n.ciphers[1]._update(r,i,r,i),n.ciphers[2]._update(r,i,r,i)},h.prototype._pad=s.prototype._pad,h.prototype._unpad=s.prototype._unpad},7626:(t,e)=>{"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,i){for(var n=0,o=0,s=6;s>=0;s-=2){for(var a=0;a<=24;a+=8)n<<=1,n|=e>>>a+s&1;for(a=0;a<=24;a+=8)n<<=1,n|=t>>>a+s&1}for(s=6;s>=0;s-=2){for(a=1;a<=25;a+=8)o<<=1,o|=e>>>a+s&1;for(a=1;a<=25;a+=8)o<<=1,o|=t>>>a+s&1}r[i+0]=n>>>0,r[i+1]=o>>>0},e.rip=function(t,e,r,i){for(var n=0,o=0,s=0;s<4;s++)for(var a=24;a>=0;a-=8)n<<=1,n|=e>>>a+s&1,n<<=1,n|=t>>>a+s&1;for(s=4;s<8;s++)for(a=24;a>=0;a-=8)o<<=1,o|=e>>>a+s&1,o<<=1,o|=t>>>a+s&1;r[i+0]=n>>>0,r[i+1]=o>>>0},e.pc1=function(t,e,r,i){for(var n=0,o=0,s=7;s>=5;s--){for(var a=0;a<=24;a+=8)n<<=1,n|=e>>a+s&1;for(a=0;a<=24;a+=8)n<<=1,n|=t>>a+s&1}for(a=0;a<=24;a+=8)n<<=1,n|=e>>a+s&1;for(s=1;s<=3;s++){for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1;for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1}for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1;r[i+0]=n>>>0,r[i+1]=o>>>0},e.r28shl=function(t,e){return t<>>28-e};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,i,n){for(var o=0,s=0,a=r.length>>>1,h=0;h>>r[h]&1;for(h=a;h>>r[h]&1;i[n+0]=o>>>0,i[n+1]=s>>>0},e.expand=function(t,e,r){var i=0,n=0;i=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)i<<=6,i|=t>>>o&63;for(o=11;o>=3;o-=4)n|=t>>>o&63,n<<=6;n|=(31&t)<<1|t>>>31,e[r+0]=i>>>0,e[r+1]=n>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var r=0,n=0;n<4;n++)r<<=4,r|=i[64*n+(t>>>18-6*n&63)];for(n=0;n<4;n++)r<<=4,r|=i[256+64*n+(e>>>18-6*n&63)];return r>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,r=0;r>>n[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var i=t.toString(2);i.length{var i=r(8287).Buffer,n=r(4934),o=r(3241),s=r(4910),a={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(t){var e=new i(o[t].prime,"hex"),r=new i(o[t].gen,"hex");return new s(e,r)},e.createDiffieHellman=e.DiffieHellman=function t(e,r,o,h){return i.isBuffer(r)||void 0===a[r]?t(e,"binary",r,o):(r=r||"binary",h=h||"binary",o=o||new i([2]),i.isBuffer(o)||(o=new i(o,h)),"number"==typeof e?new s(n(e,o),o,!0):(i.isBuffer(e)||(e=new i(e,r)),new s(e,o,!0)))}},4910:(t,e,r)=>{var i=r(8287).Buffer,n=r(6473),o=new(r(2244)),s=new n(24),a=new n(11),h=new n(10),u=new n(3),f=new n(7),l=r(4934),c=r(3209);function d(t,e){return e=e||"utf8",i.isBuffer(t)||(t=new i(t,e)),this._pub=new n(t),this}function p(t,e){return e=e||"utf8",i.isBuffer(t)||(t=new i(t,e)),this._priv=new n(t),this}t.exports=g;var m={};function g(t,e,r){this.setGenerator(e),this.__prime=new n(t),this._prime=n.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=d,this.setPrivateKey=p):this._primeCode=8}function y(t,e){var r=new i(t.toArray());return e?r.toString(e):r}Object.defineProperty(g.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString("hex"),i=[r,t.toString(16)].join("_");if(i in m)return m[i];var n,c=0;if(t.isEven()||!l.simpleSieve||!l.fermatTest(t)||!o.test(t))return c+=1,c+="02"===r||"05"===r?8:4,m[i]=c,c;switch(o.test(t.shrn(1))||(c+=2),r){case"02":t.mod(s).cmp(a)&&(c+=8);break;case"05":(n=t.mod(h)).cmp(u)&&n.cmp(f)&&(c+=8);break;default:c+=4}return m[i]=c,c}(this.__prime,this.__gen)),this._primeCode}}),g.prototype.generateKeys=function(){return this._priv||(this._priv=new n(c(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},g.prototype.computeSecret=function(t){var e=(t=(t=new n(t)).toRed(this._prime)).redPow(this._priv).fromRed(),r=new i(e.toArray()),o=this.getPrime();if(r.length{var i=r(3209);t.exports=y,y.simpleSieve=m,y.fermatTest=g;var n=r(6473),o=new n(24),s=new(r(2244)),a=new n(1),h=new n(2),u=new n(5),f=(new n(16),new n(8),new n(10)),l=new n(3),c=(new n(7),new n(11)),d=new n(4),p=(new n(12),null);function m(t){for(var e=function(){if(null!==p)return p;var t=[];t[0]=2;for(var e=1,r=3;r<1048576;r+=2){for(var i=Math.ceil(Math.sqrt(r)),n=0;nt;)r.ishrn(1);if(r.isEven()&&r.iadd(a),r.testn(1)||r.iadd(h),e.cmp(h)){if(!e.cmp(u))for(;r.mod(f).cmp(l);)r.iadd(d)}else for(;r.mod(o).cmp(c);)r.iadd(d);if(m(p=r.shrn(1))&&m(r)&&g(p)&&g(r)&&s.test(p)&&s.test(r))return r}}},6473:function(t,e,r){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6089).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],k=8191&M,S=M>>>13,x=0|s[5],A=8191&x,E=x>>>13,I=0|s[6],T=8191&I,P=I>>>13,B=0|s[7],C=8191&B,L=B>>>13,O=0|s[8],R=8191&O,j=O>>>13,N=0|s[9],D=8191&N,U=N>>>13,q=0|a[0],F=8191&q,H=q>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,G=V>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,o=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,o=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,G)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,G)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,G)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,o=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,G)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,o=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,G)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(T,F),n=(n=Math.imul(T,H))+Math.imul(P,F)|0,o=Math.imul(P,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,G)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,F),n=(n=Math.imul(C,H))+Math.imul(L,F)|0,o=Math.imul(L,H),i=i+Math.imul(T,W)|0,n=(n=n+Math.imul(T,K)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,G)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,G)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(j,F)|0,o=Math.imul(j,H),i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,K)|0,i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,G)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,G)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,F),n=(n=Math.imul(D,H))+Math.imul(U,F)|0,o=Math.imul(U,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(j,W)|0,o=o+Math.imul(j,K)|0,i=i+Math.imul(C,$)|0,n=(n=n+Math.imul(C,G)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,G)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,K))+Math.imul(U,W)|0,o=Math.imul(U,K),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,G)|0,i=i+Math.imul(C,J)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,$),n=(n=Math.imul(D,G))+Math.imul(U,$)|0,o=Math.imul(U,G),i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Y)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,ut)|0,i=i+Math.imul(C,lt)|0,n=(n=n+Math.imul(C,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Bt=(u+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;u=((o=o+Math.imul(P,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(j,lt)|0,o=o+Math.imul(j,ct)|0;var Ct=(u+(i=i+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,lt),n=(n=Math.imul(D,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Lt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Ot=(u+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Bt,h[16]=Ct,h[17]=Lt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!=(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,h=i.length-n.length;if("mod"!==e){(a=new o(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),h=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(h)):(r.isub(e),a.isub(n),h.isub(s))}return{a,b:h,gcd:r.iushln(u)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new k(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},6729:(t,e,r)=>{"use strict";var i=e;i.version=r(1636).rE,i.utils=r(7011),i.rand=r(5037),i.curve=r(894),i.curves=r(480),i.ec=r(7447),i.eddsa=r(8650)},6677:(t,e,r)=>{"use strict";var i=r(8490),n=r(7011),o=n.getNAF,s=n.getJSF,a=n.assert;function h(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=h,h.prototype.point=function(){throw new Error("Not implemented")},h.prototype.validate=function(){throw new Error("Not implemented")},h.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),i=o(e,1,this._bitLength),n=(1<=s;f--)h=(h<<1)+i[f];u.push(h)}for(var l=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=n;d>0;d--){for(s=0;s=0;u--){for(var f=0;u>=0&&0===s[u];u--)f++;if(u>=0&&f++,h=h.dblp(f),u<0)break;var l=s[u];a(0!==l),h="affine"===t.type?l>0?h.mixedAdd(n[l-1>>1]):h.mixedAdd(n[-l-1>>1].neg()):l>0?h.add(n[l-1>>1]):h.add(n[-l-1>>1].neg())}return"affine"===t.type?h.toP():h},h.prototype._wnafMulAdd=function(t,e,r,i,n){var a,h,u,f=this._wnafT1,l=this._wnafT2,c=this._wnafT3,d=0;for(a=0;a=1;a-=2){var m=a-1,g=a;if(1===f[m]&&1===f[g]){var y=[e[m],null,null,e[g]];0===e[m].y.cmp(e[g].y)?(y[1]=e[m].add(e[g]),y[2]=e[m].toJ().mixedAdd(e[g].neg())):0===e[m].y.cmp(e[g].y.redNeg())?(y[1]=e[m].toJ().mixedAdd(e[g]),y[2]=e[m].add(e[g].neg())):(y[1]=e[m].toJ().mixedAdd(e[g]),y[2]=e[m].toJ().mixedAdd(e[g].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[m],r[g]);for(d=Math.max(v[0].length,d),c[m]=new Array(d),c[g]=new Array(d),h=0;h=0;a--){for(var S=0;a>=0;){var x=!0;for(h=0;h=0&&S++,M=M.dblp(S),a<0)break;for(h=0;h0?u=l[h][A-1>>1]:A<0&&(u=l[h][-A-1>>1].neg()),M="affine"===u.type?M.mixedAdd(u):M.add(u))}}for(a=0;a=Math.ceil((t.bitLength()+1)/e.step)},u.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n{"use strict";var i=r(7011),n=r(8490),o=r(6698),s=r(6677),a=i.assert;function h(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new n(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function u(t,e,r,i,o){s.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(e,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=o&&new n(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(h,s),t.exports=h,h.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},h.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},h.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},h.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=i.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var h=a.fromRed().isOdd();return(e&&!h||!e&&h)&&(a=a.redNeg()),this.point(t,a)},h.prototype.pointFromY=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=i.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},h.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},o(u,s.BasePoint),h.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},h.prototype.point=function(t,e,r,i){return new u(this,t,e,r,i)},u.fromJSON=function(t,e){return new u(t,e[0],e[1],e[2])},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=i.redAdd(e),s=o.redSub(r),a=i.redSub(e),h=n.redMul(s),u=o.redMul(a),f=n.redMul(a),l=s.redMul(o);return this.curve.point(h,u,l,f)},u.prototype._projDbl=function(){var t,e,r,i,n,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),h=this.y.redSqr();if(this.curve.twisted){var u=(i=this.curve._mulA(a)).redAdd(h);this.zOne?(t=s.redSub(a).redSub(h).redMul(u.redSub(this.curve.two)),e=u.redMul(i.redSub(h)),r=u.redSqr().redSub(u).redSub(u)):(n=this.z.redSqr(),o=u.redSub(n).redISub(n),t=s.redSub(a).redISub(h).redMul(o),e=u.redMul(i.redSub(h)),r=u.redMul(o))}else i=a.redAdd(h),n=this.curve._mulC(this.z).redSqr(),o=i.redSub(n).redSub(n),t=this.curve._mulC(s.redISub(i)).redMul(o),e=this.curve._mulC(i).redMul(a.redISub(h)),r=i.redMul(o);return this.curve.point(t,e,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),s=n.redSub(i),a=n.redAdd(i),h=r.redAdd(e),u=o.redMul(s),f=a.redMul(h),l=o.redMul(h),c=s.redMul(a);return this.curve.point(u,f,c,l)},u.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),h=n.redSub(a),u=n.redAdd(a),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),l=i.redMul(h).redMul(f);return this.curve.twisted?(e=i.redMul(u).redMul(s.redSub(this.curve._mulA(o))),r=h.redMul(u)):(e=i.redMul(u).redMul(s.redSub(o)),r=this.curve._mulC(h).redMul(u)),this.curve.point(l,e,r)},u.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},u.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},u.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},u.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},894:(t,e,r)=>{"use strict";var i=e;i.base=r(6677),i.short=r(9188),i.mont=r(370),i.edwards=r(1298)},370:(t,e,r)=>{"use strict";var i=r(8490),n=r(6698),o=r(6677),s=r(7011);function a(t){o.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function h(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(a,o),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},n(h,o.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},a.prototype.point=function(t,e){return new h(this,t,e)},a.prototype.pointFromJSON=function(t){return h.fromJSON(this,t)},h.prototype.precompute=function(){},h.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},h.fromJSON=function(t,e){return new h(t,e[0],e[1]||t.one)},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},h.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},h.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},h.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),s=n.redMul(i),a=e.z.redMul(o.redAdd(s).redSqr()),h=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,h)},h.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var o=n.length-1;o>=0;o--)0===n[o]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},h.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},h.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},h.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},h.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},h.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},9188:(t,e,r)=>{"use strict";var i=r(7011),n=r(8490),o=r(6698),s=r(6677),a=i.assert;function h(t){s.call(this,"short",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(t,e,r,i){s.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(e,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(t,e,r,i){s.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(e,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(h,s),t.exports=h,h.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new n(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new n(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new n(t.a,16),b:new n(t.b,16)}})):this._getEndoBasis(r)}}},h.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:n.mont(t),r=new n(2).toRed(e).redInvm(),i=r.redNeg(),o=new n(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(o).fromRed(),i.redSub(o).fromRed()]},h.prototype._getEndoBasis=function(t){for(var e,r,i,o,s,a,h,u,f,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),c=t,d=this.n.clone(),p=new n(1),m=new n(0),g=new n(0),y=new n(1),b=0;0!==c.cmpn(0);){var v=d.div(c);u=d.sub(v.mul(c)),f=g.sub(v.mul(p));var w=y.sub(v.mul(m));if(!i&&u.cmp(l)<0)e=h.neg(),r=p,i=u.neg(),o=f;else if(i&&2==++b)break;h=u,d=c,c=u,g=p,p=f,y=m,m=w}s=u.neg(),a=f;var _=i.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(_)>=0&&(s=e,a=r),i.negative&&(i=i.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:i,b:o},{a:s,b:a}]},h.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=n.mul(r.a),a=o.mul(i.a),h=n.mul(r.b),u=o.mul(i.b);return{k1:t.sub(s).sub(a),k2:h.add(u).neg()}},h.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=i.fromRed().isOdd();return(e&&!o||!e&&o)&&(i=i.redNeg()),this.point(t,i)},h.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},h.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},u.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),s=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(t){return t=new n(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},u.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},u.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},u.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(f,s.BasePoint),h.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),h=o.redSub(s);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),l=i.redMul(u),c=h.redSqr().redIAdd(f).redISub(l).redISub(l),d=h.redMul(l.redISub(c)).redISub(o.redMul(f)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(c,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(i),a=n.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),u=h.redMul(s),f=r.redMul(h),l=a.redSqr().redIAdd(u).redISub(f).redISub(f),c=a.redMul(f.redISub(l)).redISub(n.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(l,c,d)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},480:(t,e,r)=>{"use strict";var i,n=e,o=r(7952),s=r(894),a=r(7011).assert;function h(t){"short"===t.type?this.curve=new s.short(t):"edwards"===t.type?this.curve=new s.edwards(t):this.curve=new s.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new h(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=h,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(4011)}catch(t){i=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},7447:(t,e,r)=>{"use strict";var i=r(8490),n=r(2723),o=r(7011),s=r(480),a=r(5037),h=o.assert,u=r(1200),f=r(8545);function l(t){if(!(this instanceof l))return new l(t);"string"==typeof t&&(h(Object.prototype.hasOwnProperty.call(s,t),"Unknown curve "+t),t=s[t]),t instanceof s.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=l,l.prototype.keyPair=function(t){return new u(this,t)},l.prototype.keyFromPrivate=function(t,e){return u.fromPrivate(this,t,e)},l.prototype.keyFromPublic=function(t,e){return u.fromPublic(this,t,e)},l.prototype.genKeyPair=function(t){t||(t={});for(var e=new n({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new i(2));;){var s=new i(e.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},l.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},l.prototype.sign=function(t,e,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new i(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),h=t.toArray("be",s),u=new n({hash:this.hash,entropy:a,nonce:h,pers:o.pers,persEnc:o.persEnc||"utf8"}),l=this.n.sub(new i(1)),c=0;;c++){var d=o.k?o.k(c):new i(u.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(l)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var y=d.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),b^=1),new f({r:g,s:y,recoveryParam:b})}}}}}},l.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n);var o=(e=new f(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,h=s.invm(this.n),u=h.mul(t).umod(this.n),l=h.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},l.prototype.recoverPubKey=function(t,e,r,n){h((3&r)===r,"The recovery param is more than two bits"),e=new f(e,n);var o=this.n,s=new i(t),a=e.r,u=e.s,l=1&r,c=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var d=e.r.invm(o),p=o.sub(s).mul(d).umod(o),m=u.mul(d).umod(o);return this.g.mulAdd(p,a,m)},l.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new f(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},1200:(t,e,r)=>{"use strict";var i=r(8490),n=r(7011).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new i(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?n(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||n(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||n(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return""}},8545:(t,e,r)=>{"use strict";var i=r(8490),n=r(7011),o=n.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new i(t.r,16),this.s=new i(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function h(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,s=e.place;o>>=0;return!(n<=127)&&(e.place=s,n)}function u(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=s,s.prototype._importDER=function(t,e){t=n.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var o=h(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var s=h(t,r);if(!1===s)return!1;var u=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var f=h(t,r);if(!1===f)return!1;if(t.length!==f+r.place)return!1;var l=t.slice(r.place,f+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new i(u),this.s=new i(l),this.recoveryParam=null,!0},s.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=u(e),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];f(i,e.length),(i=i.concat(e)).push(2),f(i,r.length);var o=i.concat(r),s=[48];return f(s,o.length),s=s.concat(o),n.encode(s,t)}},8650:(t,e,r)=>{"use strict";var i=r(7952),n=r(480),o=r(7011),s=o.assert,a=o.parseBytes,h=r(6661),u=r(220);function f(t){if(s("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof f))return new f(t);t=n[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}t.exports=f,f.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),o=this.encodePoint(n),s=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),h=i.add(s).umod(this.curve.n);return this.makeSignature({R:n,S:h,Rencoded:o})},f.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(o)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e{"use strict";var i=r(7011),n=i.assert,o=i.parseBytes,s=i.cachedProperty;function a(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return n(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return n(this._secret,"KeyPair is public only"),i.encode(this.secret(),t)},a.prototype.getPublic=function(t){return i.encode(this.pubBytes(),t)},t.exports=a},220:(t,e,r)=>{"use strict";var i=r(8490),n=r(7011),o=n.assert,s=n.cachedProperty,a=n.parseBytes;function h(t,e){this.eddsa=t,"object"!=typeof e&&(e=a(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof i&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}s(h,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(h,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(h,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(h,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),h.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},h.prototype.toHex=function(){return n.encode(this.toBytes(),"hex").toUpperCase()},t.exports=h},4011:t=>{t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},7011:(t,e,r)=>{"use strict";var i=e,n=r(8490),o=r(3349),s=r(4367);i.assert=o,i.toArray=s.toArray,i.zero2=s.zero2,i.toHex=s.toHex,i.encode=s.encode,i.getNAF=function(t,e,r){var i,n=new Array(Math.max(t.bitLength(),r)+1);for(i=0;i(o>>1)-1?(o>>1)-h:h,s.isubn(a)):a=0,n[i]=a,s.iushrn(1)}return n},i.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var s,a,h=t.andln(3)+n&3,u=e.andln(3)+o&3;3===h&&(h=-1),3===u&&(u=-1),s=1&h?3!=(i=t.andln(7)+n&7)&&5!==i||2!==u?h:-h:0,r[0].push(s),a=1&u?3!=(i=e.andln(7)+o&7)&&5!==i||2!==h?u:-u:0,r[1].push(a),2*n===s+1&&(n=1-n),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},i.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new n(t,"hex","le")}},8490:function(t,e,r){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(9368).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],k=8191&M,S=M>>>13,x=0|s[5],A=8191&x,E=x>>>13,I=0|s[6],T=8191&I,P=I>>>13,B=0|s[7],C=8191&B,L=B>>>13,O=0|s[8],R=8191&O,j=O>>>13,N=0|s[9],D=8191&N,U=N>>>13,q=0|a[0],F=8191&q,H=q>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,G=V>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,o=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,o=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,G)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,G)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,G)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,o=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,G)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,o=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,G)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(T,F),n=(n=Math.imul(T,H))+Math.imul(P,F)|0,o=Math.imul(P,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,G)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,F),n=(n=Math.imul(C,H))+Math.imul(L,F)|0,o=Math.imul(L,H),i=i+Math.imul(T,W)|0,n=(n=n+Math.imul(T,K)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,G)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,G)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(j,F)|0,o=Math.imul(j,H),i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,K)|0,i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,G)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,G)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,F),n=(n=Math.imul(D,H))+Math.imul(U,F)|0,o=Math.imul(U,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(j,W)|0,o=o+Math.imul(j,K)|0,i=i+Math.imul(C,$)|0,n=(n=n+Math.imul(C,G)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,G)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,K))+Math.imul(U,W)|0,o=Math.imul(U,K),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,G)|0,i=i+Math.imul(C,J)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,$),n=(n=Math.imul(D,G))+Math.imul(U,$)|0,o=Math.imul(U,G),i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Y)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,ut)|0,i=i+Math.imul(C,lt)|0,n=(n=n+Math.imul(C,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Bt=(u+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;u=((o=o+Math.imul(P,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(j,lt)|0,o=o+Math.imul(j,ct)|0;var Ct=(u+(i=i+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,lt),n=(n=Math.imul(D,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Lt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Ot=(u+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Bt,h[16]=Ct,h[17]=Lt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!=(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,h=i.length-n.length;if("mod"!==e){(a=new o(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),h=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(h)):(r.isub(e),a.isub(n),h.isub(s))}return{a,b:h,gcd:r.iushln(u)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new k(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},6611:(t,e,r)=>{var i=r(5606),n=r(3519),o=function(){},s=function(t,e,r){if("function"==typeof e)return s(t,null,e);e||(e={}),r=n(r||o);var a=t._writableState,h=t._readableState,u=e.readable||!1!==e.readable&&t.readable,f=e.writable||!1!==e.writable&&t.writable,l=!1,c=function(){t.writable||d()},d=function(){f=!1,u||r.call(t)},p=function(){u=!1,f||r.call(t)},m=function(e){r.call(t,e?new Error("exited with error code: "+e):null)},g=function(e){r.call(t,e)},y=function(){i.nextTick(b)},b=function(){if(!l)return(!u||h&&h.ended&&!h.destroyed)&&(!f||a&&a.ended&&!a.destroyed)?void 0:r.call(t,new Error("premature close"))},v=function(){t.req.on("finish",d)};return function(t){return t.setHeader&&"function"==typeof t.abort}(t)?(t.on("complete",d),t.on("abort",y),t.req?v():t.on("request",v)):f&&!a&&(t.on("end",c),t.on("close",c)),function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length}(t)&&t.on("exit",m),t.on("end",p),t.on("finish",d),!1!==e.error&&t.on("error",g),t.on("close",y),function(){l=!0,t.removeListener("complete",d),t.removeListener("abort",y),t.removeListener("request",v),t.req&&t.req.removeListener("finish",d),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",d),t.removeListener("exit",m),t.removeListener("end",p),t.removeListener("error",g),t.removeListener("close",y)}};t.exports=s},6310:t=>{"use strict";function e(t,e){for(const r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}t.exports=function(t,r,i){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");i||(i={}),"object"==typeof r&&(i=r,r=""),r&&(i.code=r);try{return e(t,i)}catch(r){i.message=t.message,i.stack=t.stack;const n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),e(new n,i)}}},655:(t,e,r)=>{"use strict";var i=r(453)("%Object.defineProperty%",!0)||!1;if(i)try{i({},"a",{value:1})}catch(t){i=!1}t.exports=i},1237:t=>{"use strict";t.exports=EvalError},9383:t=>{"use strict";t.exports=Error},9290:t=>{"use strict";t.exports=RangeError},9538:t=>{"use strict";t.exports=ReferenceError},8068:t=>{"use strict";t.exports=SyntaxError},9675:t=>{"use strict";t.exports=TypeError},5345:t=>{"use strict";t.exports=URIError},580:t=>{"use strict";var e=/["'&<>]/;t.exports=function(t){var r,i=""+t,n=e.exec(i);if(!n)return i;var o="",s=0,a=0;for(s=n.index;s{"use strict";var e,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var n=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(r,i){function n(r){t.removeListener(e,o),i(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",n),r([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&m(t,"error",e,{once:!0})}(t,n)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function u(t,e,r,i){var n,o,s,u;if(a(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=h(t))>0&&s.length>n&&!s.warned){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=t,f.type=e,f.count=s.length,u=f,console&&console.warn&&console.warn(u)}return t}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=f.bind(i);return n.listener=r,i.wrapFn=n,n}function c(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var h=o[t];if(void 0===h)return!1;if("function"==typeof h)i(h,this,e);else{var u=h.length,f=p(h,u);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},o.prototype.listeners=function(t){return c(this,t,!0)},o.prototype.rawListeners=function(t){return c(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},8078:(t,e,r)=>{var i=r(2861).Buffer,n=r(8276);t.exports=function(t,e,r,o){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=r/8,a=i.alloc(s),h=i.alloc(o||0),u=i.alloc(0);s>0||o>0;){var f=new n;f.update(u),f.update(t),e&&f.update(e),u=f.digest();var l=0;if(s>0){var c=a.length-s;l=Math.min(s,u.length),u.copy(a,c,0,l),s-=l}if(l0){var d=h.length-o,p=Math.min(o,u.length-l);u.copy(h,d,l,l+p),o-=p}}return u.fill(0),{key:a,iv:h}}},5809:t=>{t.exports=class{constructor(t){if(!(t>0)||t-1&t)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}clear(){this.top=this.btm=0,this.next=null,this.buffer.fill(void 0)}push(t){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){const t=this.buffer[this.btm];if(void 0!==t)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},6080:(t,e,r)=>{const i=r(5809);t.exports=class{constructor(t){this.hwm=t||16,this.head=new i(this.hwm),this.tail=this.head,this.length=0}clear(){this.head=this.tail,this.head.clear(),this.length=0}push(t){if(this.length++,!this.head.push(t)){const e=this.head;this.head=e.next=new i(2*this.head.buffer.length),this.head.push(t)}}shift(){0!==this.length&&this.length--;const t=this.tail.shift();if(void 0===t&&this.tail.next){const t=this.tail.next;return this.tail.next=null,this.tail=t,this.tail.shift()}return t}peek(){const t=this.tail.peek();return void 0===t&&this.tail.next?this.tail.next.peek():t}isEmpty(){return 0===this.length}}},3468:()=>{"undefined"!=typeof ReadableStream&&(ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=function({preventCancel:t}={}){const e=this.getReader(),r=this;let i=e.read();return{next(){const t=i;return i=e.read(),t},return:async n=>(await i,e.releaseLock(),t||r.cancel(),{done:!0,value:n}),async throw(t){throw await this.return(),t},[Symbol.asyncIterator](){return this}}}),ReadableStream.prototype.getIterator||(ReadableStream.prototype.getIterator=function({preventCancel:t}={}){return this[Symbol.asyncIterator]({preventCancel:t})}))},2682:(t,e,r)=>{"use strict";var i=r(9600),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){if(!i(e))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=r),"[object Array]"===n.call(t)?function(t,e,r){for(var i=0,n=t.length;i{"use strict";var e=Object.prototype.toString,r=Math.max,i=function(t,e){for(var r=[],i=0;i{"use strict";var i=r(9353);t.exports=Function.prototype.bind||i},5064:t=>{t.exports=function(){if("undefined"==typeof globalThis)return null;var t={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return t.RTCPeerConnection?t:null}},453:(t,e,r)=>{"use strict";var i,n=r(9383),o=r(1237),s=r(9290),a=r(9538),h=r(8068),u=r(9675),f=r(5345),l=Function,c=function(t){try{return l('"use strict"; return ('+t+").constructor;")()}catch(t){}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch(t){d=null}var p=function(){throw new u},m=d?function(){try{return p}catch(t){try{return d(arguments,"callee").get}catch(t){return p}}}():p,g=r(4039)(),y=r(24)(),b=Object.getPrototypeOf||(y?function(t){return t.__proto__}:null),v={},w="undefined"!=typeof Uint8Array&&b?b(Uint8Array):i,_={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":g&&b?b([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":v,"%AsyncGenerator%":v,"%AsyncGeneratorFunction%":v,"%AsyncIteratorPrototype%":v,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":o,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":v,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":g&&b?b(b([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&g&&b?b((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":s,"%ReferenceError%":a,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&g&&b?b((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":g&&b?b(""[Symbol.iterator]()):i,"%Symbol%":g?Symbol:i,"%SyntaxError%":h,"%ThrowTypeError%":m,"%TypedArray%":w,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":f,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet};if(b)try{null.error}catch(t){var M=b(b(t));_["%Error.prototype%"]=M}var k=function t(e){var r;if("%AsyncFunction%"===e)r=c("async function () {}");else if("%GeneratorFunction%"===e)r=c("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=c("async function* () {}");else if("%AsyncGenerator%"===e){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&b&&(r=b(n.prototype))}return _[e]=r,r},S={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},x=r(6743),A=r(9957),E=x.call(Function.call,Array.prototype.concat),I=x.call(Function.apply,Array.prototype.splice),T=x.call(Function.call,String.prototype.replace),P=x.call(Function.call,String.prototype.slice),B=x.call(Function.call,RegExp.prototype.exec),C=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,L=/\\(\\)?/g,O=function(t,e){var r,i=t;if(A(S,i)&&(i="%"+(r=S[i])[0]+"%"),A(_,i)){var n=_[i];if(n===v&&(n=k(i)),void 0===n&&!e)throw new u("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new h("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new u('"allowMissing" argument must be a boolean');if(null===B(/^%?[^%]*%?$/,t))throw new h("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=P(t,0,1),r=P(t,-1);if("%"===e&&"%"!==r)throw new h("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new h("invalid intrinsic syntax, expected opening `%`");var i=[];return T(t,C,(function(t,e,r,n){i[i.length]=r?T(n,L,"$1"):e||t})),i}(t),i=r.length>0?r[0]:"",n=O("%"+i+"%",e),o=n.name,s=n.value,a=!1,f=n.alias;f&&(i=f[0],I(r,E([0,1],f)));for(var l=1,c=!0;l=r.length){var y=d(s,p);s=(c=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:s[p]}else c=A(s,p),s=s[p];c&&!a&&(_[o]=s)}}return s}},5795:(t,e,r)=>{"use strict";var i=r(453)("%Object.getOwnPropertyDescriptor%",!0);if(i)try{i([],"length")}catch(t){i=null}t.exports=i},592:(t,e,r)=>{"use strict";var i=r(655),n=function(){return!!i};n.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],"length",{value:1}).length}catch(t){return!0}},t.exports=n},24:t=>{"use strict";var e={__proto__:null,foo:{}},r=Object;t.exports=function(){return{__proto__:e}.foo===e.foo&&!(e instanceof r)}},4039:(t,e,r)=>{"use strict";var i="undefined"!=typeof Symbol&&Symbol,n=r(1333);t.exports=function(){return"function"==typeof i&&"function"==typeof Symbol&&"symbol"==typeof i("foo")&&"symbol"==typeof Symbol("bar")&&n()}},1333:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var i=Object.getOwnPropertySymbols(t);if(1!==i.length||i[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},9092:(t,e,r)=>{"use strict";var i=r(1333);t.exports=function(){return i()&&!!Symbol.toStringTag}},4729:(t,e,r)=>{"use strict";var i=r(2861).Buffer,n=r(8310).Transform;function o(t){n.call(this),this._block=i.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(6698)(o,n),o.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(t){i=t}r(i)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!i.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");i.isBuffer(t)||(t=i.from(t,e));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},7952:(t,e,r)=>{var i=e;i.utils=r(7426),i.common=r(6166),i.sha=r(6229),i.ripemd=r(6784),i.hmac=r(8948),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},6166:(t,e,r)=>{"use strict";var i=r(7426),n=r(3349);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=o,o.prototype.update=function(t,e){if(t=i.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o{"use strict";var i=r(7426),n=r(3349);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),n(t.length<=this.blockSize);for(var e=t.length;e{"use strict";var i=r(7426),n=r(6166),o=i.rotl32,s=i.sum32,a=i.sum32_3,h=i.sum32_4,u=n.BlockHash;function f(){if(!(this instanceof f))return new f;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function c(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}i.inherits(f,u),e.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],u=this.h[3],f=this.h[4],b=r,v=i,w=n,_=u,M=f,k=0;k<80;k++){var S=s(o(h(r,l(k,i,n,u),t[p[k]+e],c(k)),g[k]),f);r=f,f=u,u=o(n,10),n=i,i=S,S=s(o(h(b,l(79-k,v,w,_),t[m[k]+e],d(k)),y[k]),M),b=M,M=_,_=o(w,10),w=v,v=S}S=a(this.h[1],n,_),this.h[1]=a(this.h[2],u,M),this.h[2]=a(this.h[3],f,b),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],i,w),this.h[0]=S},f.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},6229:(t,e,r)=>{"use strict";e.sha1=r(3917),e.sha224=r(7714),e.sha256=r(2287),e.sha384=r(1911),e.sha512=r(7766)},3917:(t,e,r)=>{"use strict";var i=r(7426),n=r(6166),o=r(6225),s=i.rotl32,a=i.sum32,h=i.sum32_5,u=o.ft_1,f=n.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function c(){if(!(this instanceof c))return new c;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(c,f),t.exports=c,c.blockSize=512,c.outSize=160,c.hmacStrength=80,c.padLength=64,c.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i{"use strict";var i=r(7426),n=r(2287);function o(){if(!(this instanceof o))return new o;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(o,n),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},2287:(t,e,r)=>{"use strict";var i=r(7426),n=r(6166),o=r(6225),s=r(3349),a=i.sum32,h=i.sum32_4,u=i.sum32_5,f=o.ch32,l=o.maj32,c=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,g=n.BlockHash,y=[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];function b(){if(!(this instanceof b))return new b;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}i.inherits(b,g),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i{"use strict";var i=r(7426),n=r(7766);function o(){if(!(this instanceof o))return new o;n.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(o,n),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},7766:(t,e,r)=>{"use strict";var i=r(7426),n=r(6166),o=r(3349),s=i.rotr64_hi,a=i.rotr64_lo,h=i.shr64_hi,u=i.shr64_lo,f=i.sum64,l=i.sum64_hi,c=i.sum64_lo,d=i.sum64_4_hi,p=i.sum64_4_lo,m=i.sum64_5_hi,g=i.sum64_5_lo,y=n.BlockHash,b=[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];function v(){if(!(this instanceof v))return new v;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function w(t,e,r,i,n){var o=t&r^~t&n;return o<0&&(o+=4294967296),o}function _(t,e,r,i,n,o){var s=e&i^~e&o;return s<0&&(s+=4294967296),s}function M(t,e,r,i,n){var o=t&r^t&n^r&n;return o<0&&(o+=4294967296),o}function k(t,e,r,i,n,o){var s=e&i^e&o^i&o;return s<0&&(s+=4294967296),s}function S(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function x(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function A(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function E(t,e){var r=s(t,e,1)^s(t,e,8)^h(t,e,7);return r<0&&(r+=4294967296),r}function I(t,e){var r=a(t,e,1)^a(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function T(t,e){var r=a(t,e,19)^a(e,t,29)^u(t,e,6);return r<0&&(r+=4294967296),r}i.inherits(v,y),t.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i{"use strict";var i=r(7426).rotr32;function n(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(t,e,r){return t^e^r}e.ft_1=function(t,e,r,i){return 0===t?n(e,r,i):1===t||3===t?s(e,r,i):2===t?o(e,r,i):void 0},e.ch32=n,e.maj32=o,e.p32=s,e.s0_256=function(t){return i(t,2)^i(t,13)^i(t,22)},e.s1_256=function(t){return i(t,6)^i(t,11)^i(t,25)},e.g0_256=function(t){return i(t,7)^i(t,18)^t>>>3},e.g1_256=function(t){return i(t,17)^i(t,19)^t>>>10}},7426:(t,e,r)=>{"use strict";var i=r(3349),n=r(6698);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function h(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=n,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=63&s|128):o(t,n)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++n)),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=63&s|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=63&s|128)}else for(n=0;n>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},e.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},e.sum64=function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,s=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,r,i){return e+i>>>0},e.sum64_4_hi=function(t,e,r,i,n,o,s,a){var h=0,u=e;return h+=(u=u+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,i,n,o,s,a){return e+i+o+a>>>0},e.sum64_5_hi=function(t,e,r,i,n,o,s,a,h,u){var f=0,l=e;return f+=(l=l+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,i,n,o,s,a,h,u){return e+i+o+a+u>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},9957:(t,e,r)=>{"use strict";var i=Function.prototype.call,n=Object.prototype.hasOwnProperty,o=r(6743);t.exports=o.call(i,n)},2723:(t,e,r)=>{"use strict";var i=r(7952),n=r(4367),o=r(3349);function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=n.toArray(t.entropy,t.entropyEnc||"hex"),r=n.toArray(t.nonce,t.nonceEnc||"hex"),i=n.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}t.exports=s,s.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},s.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var o=[];o.length{"use strict";r.r(e),r.d(e,{deleteDB:()=>m,openDB:()=>p,unwrap:()=>d,wrap:()=>c});const i=(t,e)=>e.some((e=>t instanceof e));let n,o;const s=new WeakMap,a=new WeakMap,h=new WeakMap,u=new WeakMap,f=new WeakMap;let l={get(t,e,r){if(t instanceof IDBTransaction){if("done"===e)return a.get(t);if("objectStoreNames"===e)return t.objectStoreNames||h.get(t);if("store"===e)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return c(t[e])},set:(t,e,r)=>(t[e]=r,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function c(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,r)=>{const i=()=>{t.removeEventListener("success",n),t.removeEventListener("error",o)},n=()=>{e(c(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",n),t.addEventListener("error",o)}));return e.then((e=>{e instanceof IDBCursor&&s.set(e,t)})).catch((()=>{})),f.set(e,t),e}(t);if(u.has(t))return u.get(t);const e=function(t){return"function"==typeof t?(e=t)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(o||(o=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(d(this),t),c(s.get(this))}:function(...t){return c(e.apply(d(this),t))}:function(t,...r){const i=e.call(d(this),t,...r);return h.set(i,t.sort?t.sort():[t]),c(i)}:(t instanceof IDBTransaction&&function(t){if(a.has(t))return;const e=new Promise(((e,r)=>{const i=()=>{t.removeEventListener("complete",n),t.removeEventListener("error",o),t.removeEventListener("abort",o)},n=()=>{e(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",n),t.addEventListener("error",o),t.addEventListener("abort",o)}));a.set(t,e)}(t),i(t,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,l):t);var e}(t);return e!==t&&(u.set(t,e),f.set(e,t)),e}const d=t=>f.get(t);function p(t,e,{blocked:r,upgrade:i,blocking:n,terminated:o}={}){const s=indexedDB.open(t,e),a=c(s);return i&&s.addEventListener("upgradeneeded",(t=>{i(c(s.result),t.oldVersion,t.newVersion,c(s.transaction))})),r&&s.addEventListener("blocked",(()=>r())),a.then((t=>{o&&t.addEventListener("close",(()=>o())),n&&t.addEventListener("versionchange",(()=>n()))})).catch((()=>{})),a}function m(t,{blocked:e}={}){const r=indexedDB.deleteDatabase(t);return e&&r.addEventListener("blocked",(()=>e())),c(r).then((()=>{}))}const g=["get","getKey","getAll","getAllKeys","count"],y=["put","add","delete","clear"],b=new Map;function v(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(b.get(e))return b.get(e);const r=e.replace(/FromIndex$/,""),i=e!==r,n=y.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!n&&!g.includes(r))return;const o=async function(t,...e){const o=this.transaction(t,n?"readwrite":"readonly");let s=o.store;return i&&(s=s.index(e.shift())),(await Promise.all([s[r](...e),n&&o.done]))[0]};return b.set(e,o),o}var w;w=l,l={...w,get:(t,e,r)=>v(t,e)||w.get(t,e,r),has:(t,e)=>!!v(t,e)||w.has(t,e)}},251:(t,e)=>{e.read=function(t,e,r,i,n){var o,s,a=8*n-i-1,h=(1<>1,f=-7,l=r?n-1:0,c=r?-1:1,d=t[e+l];for(l+=c,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+t[e+l],l+=c,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=i;f>0;s=256*s+t[e+l],l+=c,f-=8);if(0===o)o=1-u;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=u}return(d?-1:1)*s*Math.pow(2,o-i)},e.write=function(t,e,r,i,n,o){var s,a,h,u=8*o-n-1,f=(1<>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+l>=1?c/h:c*Math.pow(2,1-l))*h>=2&&(s++,h/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*h-1)*Math.pow(2,n),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,n),s=0));n>=8;t[r+d]=255&a,d+=p,a/=256,n-=8);for(s=s<0;t[r+d]=255&s,d+=p,s/=256,u-=8);t[r+d-p]|=128*m}},3714:(t,e,r)=>{const i=r(9596);t.exports=class{constructor(t){if(this.store=t,this.chunkLength=t.chunkLength,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.mem=[]}put(t,e,r=(()=>{})){this.mem[t]=e,this.store.put(t,e,(e=>{this.mem[t]=null,r(e)}))}get(t,e,r=(()=>{})){if("function"==typeof e)return this.get(t,null,e);let n=this.mem[t];if(!n)return this.store.get(t,e,r);e||(e={});const o=e.offset||0,s=e.length||n.length-o;0===o&&s===n.length||(n=n.slice(o,s+o)),i((()=>r(null,n)))}close(t=(()=>{})){this.store.close(t)}destroy(t=(()=>{})){this.store.destroy(t)}}},6698:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},7244:(t,e,r)=>{"use strict";var i=r(9092)(),n=r(8075)("Object.prototype.toString"),o=function(t){return!(i&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===n(t)},s=function(t){return!!o(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==n(t)&&"[object Function]"===n(t.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,t.exports=a?o:s},9600:t=>{"use strict";var e,r,i=Function.prototype.toString,n="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof n&&"function"==typeof Object.defineProperty)try{e=Object.defineProperty({},"length",{get:function(){throw r}}),r={},n((function(){throw 42}),null,e)}catch(t){t!==r&&(n=null)}else n=null;var o=/^\s*class\b/,s=function(t){try{var e=i.call(t);return o.test(e)}catch(t){return!1}},a=function(t){try{return!s(t)&&(i.call(t),!0)}catch(t){return!1}},h=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,f=!(0 in[,]),l=function(){return!1};if("object"==typeof document){var c=document.all;h.call(c)===h.call(document.all)&&(l=function(t){if((f||!t)&&(void 0===t||"object"==typeof t))try{var e=h.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}t.exports=n?function(t){if(l(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{n(t,null,e)}catch(t){if(t!==r)return!1}return!s(t)&&a(t)}:function(t){if(l(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(u)return a(t);if(s(t))return!1;var e=h.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&a(t)}},8184:(t,e,r)=>{"use strict";var i,n=Object.prototype.toString,o=Function.prototype.toString,s=/^\s*(?:function)?\*/,a=r(9092)(),h=Object.getPrototypeOf;t.exports=function(t){if("function"!=typeof t)return!1;if(s.test(o.call(t)))return!0;if(!a)return"[object GeneratorFunction]"===n.call(t);if(!h)return!1;if(void 0===i){var e=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(t){}}();i=!!e&&h(e)}return h(t)===i}},5680:(t,e,r)=>{"use strict";var i=r(5767);t.exports=function(t){return!!i(t)}},4634:t=>{var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},405:t=>{t.exports=async function*(t){for(let e of t)"function"==typeof e&&(e=e()),yield*e}},9971:(t,e,r)=>{"use strict";const i=r(3209),{EventEmitter:n}=r(7007);function o(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0,i=t.length;re.vectorClock?t:e}static distance(t,e){let r=0,i=0;const n=Math.min(t.length,e.length),o=Math.max(t.length,e.length);for(;i=0?(this._update(r,i,t),this):r.contacts.length0&&r.length[this.distance(e.id,t),e])).sort(((t,e)=>t[0]-e[0])).slice(0,e).map((t=>t[1]))}count(){let t=0;for(const e=[this.root];e.length>0;){const r=e.pop();null===r.contacts?e.push(r.right,r.left):t+=r.contacts.length}return t}_determineNode(t,e,r){const i=r>>3,n=r%8;return e.length<=i&&0!==n?t.left:e[i]&1<<7-n?t.right:t.left}get(t){s("id",t);let e=0,r=this.root;for(;null===r.contacts;)r=this._determineNode(r,t,e++);const i=this._indexOf(r,t);return i>=0?r.contacts[i]:null}_indexOf(t,e){for(let r=0;r=0){const t=r.contacts.splice(i,1)[0];this.emit("removed",t)}return this}_split(t,e){t.left={contacts:[],dontSplit:!1,left:null,right:null},t.right={contacts:[],dontSplit:!1,left:null,right:null};for(const r of t.contacts)this._determineNode(t,r.id,e).contacts.push(r);t.contacts=null;const r=this._determineNode(t,this.localNodeId,e);(t.left===r?t.right:t.left).dontSplit=!0}toArray(){let t=[];for(const e=[this.root];e.length>0;){const r=e.pop();null===r.contacts?e.push(r.right,r.left):t=t.concat(r.contacts)}return t}*toIterable(){for(const t=[this.root];t.length>0;){const e=t.pop();null===e.contacts?t.push(e.right,e.left):yield*e.contacts}}_update(t,e,r){if(!o(t.contacts[e].id,r.id))throw new Error("wrong index for _update");const i=t.contacts[e],n=this.arbiter(i,r);n===i&&i!==r||(t.contacts.splice(e,1),t.contacts.push(n),this.emit("updated",i,n))}}t.exports=a},7558:(t,e,r)=>{var i=r(8287).Buffer,n=r(2205),o=r(8394),s=r(8849).isIP,a=r(8173),h=r(537),u=r(7007),f=new Error("Query timed out");f.code="ETIMEDOUT";var l=new Error("Unexpected node id");function c(t){if(!(this instanceof c))return new c(t);t||(t={});var e=this;this.timeout=t.timeout||2e3,this.inflight=0,this.destroyed=!1,this.isIP=t.isIP||s,this.socket=t.socket||n.createSocket("udp4"),this.socket.on("message",(function(t,r){if(!e.destroyed&&r.port){try{var n=o.decode(t)}catch(t){return e.emit("warning",t)}var s=n&&n.y&&n.y.toString();if("r"===s||"e"===s){if(!i.isBuffer(n.t))return;try{var a=n.t.readUInt16BE(0)}catch(c){return e.emit("warning",c)}var h=e._ids.indexOf(a);if(-1===h||0===a)return e.emit("response",n,r),void e.emit("warning",new Error("Unexpected transaction id: "+a));var u=e._reqs[h];if(u.peer.host!==r.address)return e.emit("response",n,r),void e.emit("warning",new Error("Out of order response"));if(e._ids[h]=0,e._reqs[h]=null,e.inflight--,"e"===s){var f=Array.isArray(n.e),c=new Error(f?n.e.join(" "):"Unknown error");return c.code=f&&n.e.length&&"number"==typeof n.e[0]?n.e[0]:0,u.callback(c,n,r,u.message),e.emit("update"),void e.emit("postupdate")}var d=n.r&&n.r.id;if(u.peer&&u.peer.id&&d&&!u.peer.id.equals(d))return u.callback(l,null,r),e.emit("update"),void e.emit("postupdate");u.callback(null,n,r,u.message),e.emit("update"),e.emit("postupdate"),e.emit("response",n,r)}else"q"===s?e.emit("query",n,r):e.emit("warning",new Error("Unknown type: "+s))}})),this.socket.on("error",(function(t){"EACCES"===t.code||"EADDRINUSE"===t.code?e.emit("error",t):e.emit("warning",t)})),this.socket.on("listening",(function(){e.emit("listening")})),this._tick=0,this._ids=[],this._reqs=[],this._timer=setInterval((function(){var t=e.inflight;if(t)for(var r=0;r-1&&this._cancel(r,e)},c.prototype._cancel=function(t,e){var r=this._reqs[t];this._ids[t]=0,this._reqs[t]=null,r&&(this.inflight--,r.callback(e||new Error("Query was cancelled"),null,r.peer),this.emit("update"),this.emit("postupdate"))},c.prototype._resolveAndQuery=function(t,e,r){var i=this;a.lookup(t.host,(function(n,o){return n?r(n):i.destroyed?r(new Error("k-rpc-socket is destroyed")):void i.query({host:o,port:t.port},e,r)}))}},4662:(t,e,r)=>{var i=r(8287).Buffer;function n(t,e,r){let i=0,n=1;for(let o=e;o=48)i=10*i+(r-48);else if(o!==e||43!==r){if(o!==e||45!==r){if(46===r)break;throw new Error("not a number: buffer["+o+"] = "+r)}n=-1}}return i*n}function o(t,e,r,n){return null==t||0===t.length?null:("number"!=typeof e&&null==n&&(n=e,e=void 0),"number"!=typeof r&&null==n&&(n=r,r=void 0),o.position=0,o.encoding=n||null,o.data=i.isBuffer(t)?t.slice(e,r):i.from(t),o.bytes=o.data.length,o.next())}o.bytes=0,o.position=0,o.data=null,o.encoding=null,o.next=function(){switch(o.data[o.position]){case 100:return o.dictionary();case 108:return o.list();case 105:return o.integer();default:return o.buffer()}},o.find=function(t){let e=o.position;const r=o.data.length,i=o.data;for(;e{var i=r(8287).Buffer;const{getType:n}=r(7972);function o(t,e,r){const n=[];let s=null;return o._encode(n,t),s=i.concat(n),o.bytes=s.length,i.isBuffer(e)?(s.copy(e,r),e):s}o.bytes=-1,o._floatConversionDetected=!1,o._encode=function(t,e){if(null!=e)switch(n(e)){case"buffer":o.buffer(t,e);break;case"object":o.dict(t,e);break;case"map":o.dictMap(t,e);break;case"array":o.list(t,e);break;case"set":o.listSet(t,e);break;case"string":o.string(t,e);break;case"number":case"boolean":o.number(t,e);break;case"arraybufferview":o.buffer(t,i.from(e.buffer,e.byteOffset,e.byteLength));break;case"arraybuffer":o.buffer(t,i.from(e))}};const s=i.from("e"),a=i.from("d"),h=i.from("l");o.buffer=function(t,e){t.push(i.from(e.length+":"),e)},o.string=function(t,e){t.push(i.from(i.byteLength(e)+":"+e))},o.number=function(t,e){const r=2147483648,n=(e/r|0)*r+(e%r|0);t.push(i.from("i"+n+"e")),n===e||o._floatConversionDetected||(o._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value "'+e+'":','Bencoding only defines support for integers, value was converted to "'+n+'"'),console.trace())},o.dict=function(t,e){t.push(a);let r,i=0;const n=Object.keys(e).sort(),h=n.length;for(;i{var i=r(8287).Buffer;const{digitCount:n,getType:o}=r(7972);t.exports=function t(e){if(null==e)return 0;const r=o(e);switch(r){case"buffer":return n(e.length)+1+e.length;case"arraybufferview":return function(t){const e=t.byteLength-t.byteOffset;return n(e)+1+e}(e);case"string":return function(t){const e=i.byteLength(t);return n(e)+1+e}(e);case"array":case"set":return function(e){let r=2;for(const i of e)r+=t(i);return r}(e);case"number":return 1+n(Math.floor(e))+1;case"bigint":return 1+e.toString().length+1;case"object":return function(e){let r=2;const o=Object.keys(e);for(let s=0;s{const i=t.exports;i.encode=r(8746),i.decode=r(4662),i.byteLength=i.encodingLength=r(6814)},7972:(t,e,r)=>{var i=r(8287).Buffer;const n=t.exports;n.digitCount=function(t){const e=t<0?1:0;return t=Math.abs(Number(t||1)),Math.floor(Math.log10(t))+1+e},n.getType=function(t){return i.isBuffer(t)?"buffer":ArrayBuffer.isView(t)?"arraybufferview":Array.isArray(t)?"array":t instanceof Number?"number":t instanceof Boolean?"boolean":t instanceof Set?"set":t instanceof Map?"map":t instanceof String?"string":t instanceof ArrayBuffer?"arraybuffer":typeof t}},4988:(t,e,r)=>{var i=r(5606),n=r(8287).Buffer,o=r(7558),s=r(9971),a=r(7007),h=r(3209),u=r(537),f=[{host:"router.bittorrent.com",port:6881},{host:"router.utorrent.com",port:6881},{host:"dht.transmissionbt.com",port:6881}];function l(t){if(!(this instanceof l))return new l(t);t||(t={});var e,r=this;function i(t,e){if(t&&c(t.id,r._idLength)&&!t.id.equals(r.id)){var i=r.nodes.get(t.id);if(i)return void(i.seen=Date.now());r._addNode({id:t.id,host:e.address||e.host,port:e.port,distance:0,seen:Date.now()})}}this._idLength=t.idLength||20,this.id=function(t){if(n.isBuffer(t))return t;if(ArrayBuffer.isView(t))return n.from(t.buffer,t.byteOffset,t.byteLength);if("string"==typeof t)return n.from(t,"hex");throw new Error("Pass a buffer or a string")}(t.id||t.nodeId||h(this._idLength)),this.socket=t.krpcSocket||o(t),this.bootstrap=!1===(e=t.nodes||t.bootstrap)?[]:!0===e?f:[].concat(e||f).map(p),this.concurrency=t.concurrency||16,this.backgroundConcurrency=t.backgroundConcurrency||this.concurrency/4|0,this.k=t.k||20,this.destroyed=!1,this.pending=[],this.nodes=null,this.socket.setMaxListeners(0),this.socket.on("query",(function(t,e){i(t.a,e),r.emit("query",t,e)})),this.socket.on("response",(function(t,e){i(t.r,e)})),this.socket.on("warning",(function(t){r.emit("warning",t)})),this.socket.on("error",(function(t){r.emit("error",t)})),this.socket.on("update",(function(){for(;r.pending.length&&r.socket.inflight=300&&t.code<400&&(a=t):s++,t||n||r&&!1===r(e,h)&&(n=!0),--o||i(s?null:a||new Error("All queries failed"),s)}},l.prototype.query=function(t,e,r){this.socket.inflight>=this.concurrency?this.pending.push([t,e,r]):(e.a||(e.a={}),e.a.id||(e.a.id=this.id),t.token&&(e.a.token=t.token),this.socket.query(t,e,r))},l.prototype.destroy=function(t){this.destroyed=!0,this.socket.destroy(t)},l.prototype.clear=function(){var t=this;this.nodes=new s({localNodeId:this.id,numberOfNodesPerKBucket:this.k,numberOfNodesToPing:this.concurrency}),this.nodes.on("ping",(function(e,r){t.emit("ping",e,(function(e){e&&(e.id&&t.nodes.remove(e.id),t._addNode(r))}))}))},l.prototype.populate=function(t,e,r){this._closest(t,e,!0,null,r)},l.prototype.closest=function(t,e,r,i){this._closest(t,e,!1,r,i)},l.prototype._addNode=function(t){var e=this.nodes.get(t.id);this.nodes.add(t),e||this.emit("node",t)},l.prototype._closest=function(t,e,r,n,o){o||(o=m);var a=this,h=0,u={},f=0,l=!0,p=!1;e.a||(e.a={}),e.a.id||(e.a.id=this.id);var g=new s({localNodeId:t,numberOfNodesPerKBucket:this.k,numberOfNodesToPing:this.concurrency}),y=r?"postupdate":"update";function b(){if(!(a.destroyed||a.socket.inflight>=a.concurrency)){var n=a.pending.length+a.socket.inflight-f;if(!(r&&a.socket.inflight>=a.backgroundConcurrency&&n)){var o=g.closest(t,a.k);(!o.length||o.length=a.concurrency)return;var h=o[s],c=h.host+":"+h.port;u[c]||(u[c]=!0,f++,a.socket.query(h,e,w))}f||(a.socket.removeListener(y,b),i.nextTick(v))}}}function v(){o(null,h)}function w(t,e,r){f--,r&&(u[(r.address||r.host)+":"+r.port]=!0),r&&r.id&&a.nodes.get(r.id)&&(!t||"EUNEXPECTEDNODE"!==t.code&&"ETIMEDOUT"!==t.code||a.nodes.remove(r.id));var i=e&&e.r;if(!i)return b();!t&&c(i.id,a._idLength)&&(h++,_({id:i.id,port:r.port,host:r.host||r.address,distance:0}));for(var o=i.nodes?function(t,e){var r=[];try{for(var i=0;i{function e(t){}t.exports=function(t){var r=null,i=null,n=null,o=null;return function(t,r){o=t,s(r||e)};function s(e){if(i)return r||(r=[]),void r.push(e);var n=o;o=null,i=e,t(n,a)}function a(t){var o=i,a=n;if(n=null,i=null,r&&(n=r,r=null,s(e)),a)for(var h=0;h{e.RateLimiter=r(3065),e.TokenBucket=r(5472)},3085:(t,e,r)=>{var i=r(5606);t.exports=function(){if(void 0!==i&&i.hrtime){var t=i.hrtime(),e=t[0],r=t[1];return 1e3*e+Math.floor(r/1e6)}return(new Date).getTime()}},3065:(t,e,r)=>{var i=r(5606),n=r(5472),o=r(3085),s=function(t,e,r){this.tokenBucket=new n(t,t,e,null),this.tokenBucket.content=t,this.curIntervalStart=o(),this.tokensThisInterval=0,this.fireImmediately=r};s.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(t,e){if(t>this.tokenBucket.bucketSize)return i.nextTick(e.bind(null,"Requested tokens "+t+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var r=this,n=o();if((n=this.tokenBucket.interval)&&(this.curIntervalStart=n,this.tokensThisInterval=0),t>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)i.nextTick(e.bind(null,null,-1));else{var s=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-n);setTimeout((function(){r.tokenBucket.removeTokens(t,a)}),s)}return!1}return this.tokenBucket.removeTokens(t,a);function a(i,n){if(i)return e(i,null);r.tokensThisInterval+=t,e(null,n)}},tryRemoveTokens:function(t){if(t>this.tokenBucket.bucketSize)return!1;var e=o();if((e=this.tokenBucket.interval)&&(this.curIntervalStart=e,this.tokensThisInterval=0),t>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var r=this.tokenBucket.tryRemoveTokens(t);return r&&(this.tokensThisInterval+=t),r},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},t.exports=s},5472:(t,e,r)=>{var i=r(5606),n=function(t,e,r,i){if(this.bucketSize=t,this.tokensPerInterval=e,"string"==typeof r)switch(r){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw new Error("Invaid interval "+r)}else this.interval=r;this.parentBucket=i,this.content=0,this.lastDrip=+new Date};n.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(t,e){var r=this;return this.bucketSize?t>this.bucketSize?(i.nextTick(e.bind(null,"Requested tokens "+t+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),t>this.content?n():this.parentBucket?this.parentBucket.removeTokens(t,(function(i,o){return i?e(i,null):t>r.content?n():(r.content-=t,void e(null,Math.min(o,r.content)))})):(this.content-=t,i.nextTick(e.bind(null,null,this.content)),!0)):(i.nextTick(e.bind(null,null,t,Number.POSITIVE_INFINITY)),!0);function n(){var i=Math.ceil((t-r.content)*(r.interval/r.tokensPerInterval));return setTimeout((function(){r.removeTokens(t,e)}),i),!1}},tryRemoveTokens:function(t){return!(this.bucketSize&&(t>this.bucketSize||(this.drip(),t>this.content||this.parentBucket&&!this.parentBucket.tryRemoveTokens(t)||(this.content-=t,0))))},drip:function(){if(this.tokensPerInterval){var t=+new Date,e=Math.max(t-this.lastDrip,0);this.lastDrip=t;var r=e*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+r,this.bucketSize)}else this.content=this.bucketSize}},t.exports=n},8454:(t,e,r)=>{var i=r(7007),n=r(6698);function o(t){if(!(this instanceof o))return new o(t);"number"==typeof t&&(t={max:t}),t||(t={}),i.EventEmitter.call(this),this.cache={},this.head=this.tail=null,this.length=0,this.max=t.max||1e3,this.maxAge=t.maxAge||0}t.exports=o,n(o,i.EventEmitter),Object.defineProperty(o.prototype,"keys",{get:function(){return Object.keys(this.cache)}}),o.prototype.clear=function(){this.cache={},this.head=this.tail=null,this.length=0},o.prototype.remove=function(t){if("string"!=typeof t&&(t=""+t),this.cache.hasOwnProperty(t)){var e=this.cache[t];return delete this.cache[t],this._unlink(t,e.prev,e.next),e.value}},o.prototype._unlink=function(t,e,r){this.length--,0===this.length?this.head=this.tail=null:this.head===t?(this.head=e,this.cache[this.head].next=null):this.tail===t?(this.tail=r,this.cache[this.tail].prev=null):(this.cache[e].next=r,this.cache[r].prev=e)},o.prototype.peek=function(t){if(this.cache.hasOwnProperty(t)){var e=this.cache[t];if(this._checkAge(t,e))return e.value}},o.prototype.set=function(t,e){var r;if("string"!=typeof t&&(t=""+t),this.cache.hasOwnProperty(t)){if((r=this.cache[t]).value=e,this.maxAge&&(r.modified=Date.now()),t===this.head)return e;this._unlink(t,r.prev,r.next)}else r={value:e,modified:0,next:null,prev:null},this.maxAge&&(r.modified=Date.now()),this.cache[t]=r,this.length===this.max&&this.evict();return this.length++,r.next=null,r.prev=this.head,this.head&&(this.cache[this.head].next=t),this.head=t,this.tail||(this.tail=t),e},o.prototype._checkAge=function(t,e){return!(this.maxAge&&Date.now()-e.modified>this.maxAge&&(this.remove(t),this.emit("evict",{key:t,value:e.value}),1))},o.prototype.get=function(t){if("string"!=typeof t&&(t=""+t),this.cache.hasOwnProperty(t)){var e=this.cache[t];if(this._checkAge(t,e))return this.head!==t&&(t===this.tail?(this.tail=e.next,this.cache[this.tail].prev=null):this.cache[e.prev].next=e.next,this.cache[e.next].prev=e.prev,this.cache[this.head].next=t,e.prev=this.head,e.next=null,this.head=t),e.value}},o.prototype.evict=function(){if(this.tail){var t=this.tail,e=this.remove(this.tail);this.emit("evict",{key:t,value:e})}}},8276:(t,e,r)=>{"use strict";var i=r(6698),n=r(4729),o=r(2861).Buffer,s=new Array(16);function a(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function h(t,e){return t<>>32-e}function u(t,e,r,i,n,o,s){return h(t+(e&r|~e&i)+n+o|0,s)+e|0}function f(t,e,r,i,n,o,s){return h(t+(e&i|r&~i)+n+o|0,s)+e|0}function l(t,e,r,i,n,o,s){return h(t+(e^r^i)+n+o|0,s)+e|0}function c(t,e,r,i,n,o,s){return h(t+(r^(e|~i))+n+o|0,s)+e|0}i(a,n),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,o=this._d;r=u(r,i,n,o,t[0],3614090360,7),o=u(o,r,i,n,t[1],3905402710,12),n=u(n,o,r,i,t[2],606105819,17),i=u(i,n,o,r,t[3],3250441966,22),r=u(r,i,n,o,t[4],4118548399,7),o=u(o,r,i,n,t[5],1200080426,12),n=u(n,o,r,i,t[6],2821735955,17),i=u(i,n,o,r,t[7],4249261313,22),r=u(r,i,n,o,t[8],1770035416,7),o=u(o,r,i,n,t[9],2336552879,12),n=u(n,o,r,i,t[10],4294925233,17),i=u(i,n,o,r,t[11],2304563134,22),r=u(r,i,n,o,t[12],1804603682,7),o=u(o,r,i,n,t[13],4254626195,12),n=u(n,o,r,i,t[14],2792965006,17),r=f(r,i=u(i,n,o,r,t[15],1236535329,22),n,o,t[1],4129170786,5),o=f(o,r,i,n,t[6],3225465664,9),n=f(n,o,r,i,t[11],643717713,14),i=f(i,n,o,r,t[0],3921069994,20),r=f(r,i,n,o,t[5],3593408605,5),o=f(o,r,i,n,t[10],38016083,9),n=f(n,o,r,i,t[15],3634488961,14),i=f(i,n,o,r,t[4],3889429448,20),r=f(r,i,n,o,t[9],568446438,5),o=f(o,r,i,n,t[14],3275163606,9),n=f(n,o,r,i,t[3],4107603335,14),i=f(i,n,o,r,t[8],1163531501,20),r=f(r,i,n,o,t[13],2850285829,5),o=f(o,r,i,n,t[2],4243563512,9),n=f(n,o,r,i,t[7],1735328473,14),r=l(r,i=f(i,n,o,r,t[12],2368359562,20),n,o,t[5],4294588738,4),o=l(o,r,i,n,t[8],2272392833,11),n=l(n,o,r,i,t[11],1839030562,16),i=l(i,n,o,r,t[14],4259657740,23),r=l(r,i,n,o,t[1],2763975236,4),o=l(o,r,i,n,t[4],1272893353,11),n=l(n,o,r,i,t[7],4139469664,16),i=l(i,n,o,r,t[10],3200236656,23),r=l(r,i,n,o,t[13],681279174,4),o=l(o,r,i,n,t[0],3936430074,11),n=l(n,o,r,i,t[3],3572445317,16),i=l(i,n,o,r,t[6],76029189,23),r=l(r,i,n,o,t[9],3654602809,4),o=l(o,r,i,n,t[12],3873151461,11),n=l(n,o,r,i,t[15],530742520,16),r=c(r,i=l(i,n,o,r,t[2],3299628645,23),n,o,t[0],4096336452,6),o=c(o,r,i,n,t[7],1126891415,10),n=c(n,o,r,i,t[14],2878612391,15),i=c(i,n,o,r,t[5],4237533241,21),r=c(r,i,n,o,t[12],1700485571,6),o=c(o,r,i,n,t[3],2399980690,10),n=c(n,o,r,i,t[10],4293915773,15),i=c(i,n,o,r,t[1],2240044497,21),r=c(r,i,n,o,t[8],1873313359,6),o=c(o,r,i,n,t[15],4264355552,10),n=c(n,o,r,i,t[6],2734768916,15),i=c(i,n,o,r,t[13],1309151649,21),r=c(r,i,n,o,t[4],4149444226,6),o=c(o,r,i,n,t[11],3174756917,10),n=c(n,o,r,i,t[2],718787259,15),i=c(i,n,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},4862:(t,e,r)=>{t.exports=n;const i=r(9596);function n(t,e){if(!(this instanceof n))return new n(t,e);if(e||(e={}),this.chunkLength=Number(t),!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=Number(e.length)||1/0,this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=Math.ceil(this.length/this.chunkLength)-1)}n.prototype.put=function(t,e,r=(()=>{})){if(this.closed)return i((()=>r(new Error("Storage is closed"))));const n=t===this.lastChunkIndex;return n&&e.length!==this.lastChunkLength?i((()=>r(new Error("Last chunk length must be "+this.lastChunkLength)))):n||e.length===this.chunkLength?(this.chunks[t]=e,void i((()=>r(null)))):i((()=>r(new Error("Chunk length must be "+this.chunkLength))))},n.prototype.get=function(t,e,r=(()=>{})){if("function"==typeof e)return this.get(t,null,e);if(this.closed)return i((()=>r(new Error("Storage is closed"))));let n=this.chunks[t];if(!n){const t=new Error("Chunk not found");return t.notFound=!0,i((()=>r(t)))}e||(e={});const o=e.offset||0,s=e.length||n.length-o;0===o&&s===n.length||(n=n.slice(o,s+o)),i((()=>r(null,n)))},n.prototype.close=n.prototype.destroy=function(t=(()=>{})){if(this.closed)return i((()=>t(new Error("Storage is closed"))));this.closed=!0,this.chunks=null,i((()=>t(null)))}},2244:(t,e,r)=>{var i=r(1158),n=r(5037);function o(t){this.rand=t||new n.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(t)>=0);return n},o.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},o.prototype.test=function(t,e,r){var n=t.bitLength(),o=i.mont(t),s=new i(1).toRed(o);e||(e=Math.max(1,n/48|0));for(var a=t.subn(1),h=0;!a.testn(h);h++);for(var u=t.shrn(h),f=a.toRed(o);e>0;e--){var l=this._randrange(new i(2),a);r&&r(l);var c=l.toRed(o).redPow(u);if(0!==c.cmp(s)&&0!==c.cmp(f)){for(var d=1;d0;e--){var f=this._randrange(new i(2),s),l=t.gcd(f);if(0!==l.cmpn(1))return l;var c=f.toRed(n).redPow(h);if(0!==c.cmp(o)&&0!==c.cmp(u)){for(var d=1;d=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],k=8191&M,S=M>>>13,x=0|s[5],A=8191&x,E=x>>>13,I=0|s[6],T=8191&I,P=I>>>13,B=0|s[7],C=8191&B,L=B>>>13,O=0|s[8],R=8191&O,j=O>>>13,N=0|s[9],D=8191&N,U=N>>>13,q=0|a[0],F=8191&q,H=q>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,G=V>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,o=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,o=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,G)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,G)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,G)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,o=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,G)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,o=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,G)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(T,F),n=(n=Math.imul(T,H))+Math.imul(P,F)|0,o=Math.imul(P,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,G)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,F),n=(n=Math.imul(C,H))+Math.imul(L,F)|0,o=Math.imul(L,H),i=i+Math.imul(T,W)|0,n=(n=n+Math.imul(T,K)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,G)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,G)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(j,F)|0,o=Math.imul(j,H),i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,K)|0,i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,G)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,G)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,F),n=(n=Math.imul(D,H))+Math.imul(U,F)|0,o=Math.imul(U,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(j,W)|0,o=o+Math.imul(j,K)|0,i=i+Math.imul(C,$)|0,n=(n=n+Math.imul(C,G)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,G)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,K))+Math.imul(U,W)|0,o=Math.imul(U,K),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,G)|0,i=i+Math.imul(C,J)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,$),n=(n=Math.imul(D,G))+Math.imul(U,$)|0,o=Math.imul(U,G),i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Y)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,ut)|0,i=i+Math.imul(C,lt)|0,n=(n=n+Math.imul(C,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Bt=(u+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;u=((o=o+Math.imul(P,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(j,lt)|0,o=o+Math.imul(j,ct)|0;var Ct=(u+(i=i+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,lt),n=(n=Math.imul(D,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Lt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Ot=(u+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Bt,h[16]=Ct,h[17]=Lt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!=(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,h=i.length-n.length;if("mod"!==e){(a=new o(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),h=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(h)):(r.isub(e),a.isub(n),h.isub(s))}return{a,b:h,gcd:r.iushln(u)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new k(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},8673:t=>{"use strict";function e(){this._types=Object.create(null),this._extensions=Object.create(null);for(let t=0;t{"use strict";let i=r(8673);t.exports=new i(r(8446))},8446:t=>{t.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}},3349:t=>{function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},4367:(t,e)=>{"use strict";var r=e;function i(t){return 1===t.length?"0"+t:t}function n(t){for(var e="",r=0;r>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=i,r.toHex=n,r.encode=function(t,e){return"hex"===e?n(t):t}},6585:t=>{var e=1e3,r=60*e,i=60*r,n=24*i;function o(t,e,r,i){var n=e>=1.5*r;return Math.round(t/r)+" "+i+(n?"s":"")}t.exports=function(t,s){s=s||{};var a,h,u=typeof t;if("string"===u&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(o){var s=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*n;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(t);if("number"===u&&isFinite(t))return s.long?(a=t,(h=Math.abs(a))>=n?o(a,h,n,"day"):h>=i?o(a,h,i,"hour"):h>=r?o(a,h,r,"minute"):h>=e?o(a,h,e,"second"):a+" ms"):function(t){var o=Math.abs(t);return o>=n?Math.round(t/n)+"d":o>=i?Math.round(t/i)+"h":o>=r?Math.round(t/r)+"m":o>=e?Math.round(t/e)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},3519:(t,e,r)=>{var i=r(6587);function n(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function o(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}t.exports=i(n),t.exports.strict=i(o),n.proto=n((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},1137:(t,e,r)=>{"use strict";var i=r(7568);e.certificate=r(6413);var n=i.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));e.RSAPrivateKey=n;var o=i.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));e.RSAPublicKey=o;var s=i.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),a=i.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())}));e.PublicKey=a;var h=i.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())}));e.PrivateKey=h;var u=i.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));e.EncryptedPrivateKey=u;var f=i.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));e.DSAPrivateKey=f,e.DSAparam=i.define("DSAparam",(function(){this.int()}));var l=i.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})})),c=i.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(l),this.key("publicKey").optional().explicit(1).bitstr())}));e.ECPrivateKey=c,e.signature=i.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},6413:(t,e,r)=>{"use strict";var i=r(7568),n=i.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=i.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),s=i.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),a=i.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())})),h=i.define("RelativeDistinguishedName",(function(){this.setof(o)})),u=i.define("RDNSequence",(function(){this.seqof(h)})),f=i.define("Name",(function(){this.choice({rdnSequence:this.use(u)})})),l=i.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(n),this.key("notAfter").use(n))})),c=i.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),d=i.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(s),this.key("issuer").use(f),this.key("validity").use(l),this.key("subject").use(f),this.key("subjectPublicKeyInfo").use(a),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(c).optional())})),p=i.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(d),this.key("signatureAlgorithm").use(s),this.key("signatureValue").bitstr())}));t.exports=p},4101:(t,e,r)=>{"use strict";var i=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,n=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,s=r(8078),a=r(1241),h=r(2861).Buffer;t.exports=function(t,e){var r,u=t.toString(),f=u.match(i);if(f){var l="aes"+f[1],c=h.from(f[2],"hex"),d=h.from(f[3].replace(/[\r\n]/g,""),"base64"),p=s(e,c.slice(0,8),parseInt(f[1],10)).key,m=[],g=a.createDecipheriv(l,p,c);m.push(g.update(d)),m.push(g.final()),r=h.concat(m)}else{var y=u.match(o);r=h.from(y[2].replace(/[\r\n]/g,""),"base64")}return{tag:u.match(n)[1],data:r}}},8170:(t,e,r)=>{"use strict";var i=r(1137),n=r(5579),o=r(4101),s=r(1241),a=r(8396),h=r(2861).Buffer;function u(t){var e;"object"!=typeof t||h.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=h.from(t));var r,u,f=o(t,e),l=f.tag,c=f.data;switch(l){case"CERTIFICATE":u=i.certificate.decode(c,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(u||(u=i.PublicKey.decode(c,"der")),r=u.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPublicKey.decode(u.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return u.subjectPrivateKey=u.subjectPublicKey,{type:"ec",data:u};case"1.2.840.10040.4.1":return u.algorithm.params.pub_key=i.DSAparam.decode(u.subjectPublicKey.data,"der"),{type:"dsa",data:u.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":c=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=n[t.algorithm.decrypt.cipher.algo.join(".")],u=t.algorithm.decrypt.cipher.iv,f=t.subjectPrivateKey,l=parseInt(o.split("-")[1],10)/8,c=a.pbkdf2Sync(e,r,i,l,"sha1"),d=s.createDecipheriv(o,c,u),p=[];return p.push(d.update(f)),p.push(d.final()),h.concat(p)}(c=i.EncryptedPrivateKey.decode(c,"der"),e);case"PRIVATE KEY":switch(r=(u=i.PrivateKey.decode(c,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPrivateKey.decode(u.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:u.algorithm.curve,privateKey:i.ECPrivateKey.decode(u.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return u.algorithm.params.priv_key=i.DSAparam.decode(u.subjectPrivateKey,"der"),{type:"dsa",params:u.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return i.RSAPublicKey.decode(c,"der");case"RSA PRIVATE KEY":return i.RSAPrivateKey.decode(c,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:i.DSAPrivateKey.decode(c,"der")};case"EC PRIVATE KEY":return{curve:(c=i.ECPrivateKey.decode(c,"der")).parameters.value,privateKey:c.privateKey};default:throw new Error("unknown key type "+l)}}u.signature=i.signature,t.exports=u},7975:(t,e,r)=>{"use strict";var i=r(5606);function n(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function o(t,e){for(var r,i="",n=0,o=-1,s=0,a=0;a<=t.length;++a){if(a2){var h=i.lastIndexOf("/");if(h!==i.length-1){-1===h?(i="",n=0):n=(i=i.slice(0,h)).length-1-i.lastIndexOf("/"),o=a,s=0;continue}}else if(2===i.length||1===i.length){i="",n=0,o=a,s=0;continue}e&&(i.length>0?i+="/..":i="..",n=2)}else i.length>0?i+="/"+t.slice(o+1,a):i=t.slice(o+1,a),n=a-o-1;o=a,s=0}else 46===r&&-1!==s?++s:s=-1}return i}var s={resolve:function(){for(var t,e="",r=!1,s=arguments.length-1;s>=-1&&!r;s--){var a;s>=0?a=arguments[s]:(void 0===t&&(t=i.cwd()),a=t),n(a),0!==a.length&&(e=a+"/"+e,r=47===a.charCodeAt(0))}return e=o(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(n(t),0===t.length)return".";var e=47===t.charCodeAt(0),r=47===t.charCodeAt(t.length-1);return 0!==(t=o(t,!e)).length||e||(t="."),t.length>0&&r&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return n(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e0&&(void 0===t?t=r:t+="/"+r)}return void 0===t?".":s.normalize(t)},relative:function(t,e){if(n(t),n(e),t===e)return"";if((t=s.resolve(t))===(e=s.resolve(e)))return"";for(var r=1;ru){if(47===e.charCodeAt(a+l))return e.slice(a+l+1);if(0===l)return e.slice(a+l)}else o>u&&(47===t.charCodeAt(r+l)?f=l:0===l&&(f=0));break}var c=t.charCodeAt(r+l);if(c!==e.charCodeAt(a+l))break;47===c&&(f=l)}var d="";for(l=r+f+1;l<=i;++l)l!==i&&47!==t.charCodeAt(l)||(0===d.length?d+="..":d+="/..");return d.length>0?d+e.slice(a+f):(a+=f,47===e.charCodeAt(a)&&++a,e.slice(a))},_makeLong:function(t){return t},dirname:function(t){if(n(t),0===t.length)return".";for(var e=t.charCodeAt(0),r=47===e,i=-1,o=!0,s=t.length-1;s>=1;--s)if(47===(e=t.charCodeAt(s))){if(!o){i=s;break}}else o=!1;return-1===i?r?"/":".":r&&1===i?"//":t.slice(0,i)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');n(t);var r,i=0,o=-1,s=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var a=e.length-1,h=-1;for(r=t.length-1;r>=0;--r){var u=t.charCodeAt(r);if(47===u){if(!s){i=r+1;break}}else-1===h&&(s=!1,h=r+1),a>=0&&(u===e.charCodeAt(a)?-1==--a&&(o=r):(a=-1,o=h))}return i===o?o=h:-1===o&&(o=t.length),t.slice(i,o)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!s){i=r+1;break}}else-1===o&&(s=!1,o=r+1);return-1===o?"":t.slice(i,o)},extname:function(t){n(t);for(var e=-1,r=0,i=-1,o=!0,s=0,a=t.length-1;a>=0;--a){var h=t.charCodeAt(a);if(47!==h)-1===i&&(o=!1,i=a+1),46===h?-1===e?e=a:1!==s&&(s=1):-1!==e&&(s=-1);else if(!o){r=a+1;break}}return-1===e||-1===i||0===s||1===s&&e===i-1&&e===r+1?"":t.slice(e,i)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+i:r+"/"+i:i}(0,t)},parse:function(t){n(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var r,i=t.charCodeAt(0),o=47===i;o?(e.root="/",r=1):r=0;for(var s=-1,a=0,h=-1,u=!0,f=t.length-1,l=0;f>=r;--f)if(47!==(i=t.charCodeAt(f)))-1===h&&(u=!1,h=f+1),46===i?-1===s?s=f:1!==l&&(l=1):-1!==s&&(l=-1);else if(!u){a=f+1;break}return-1===s||-1===h||0===l||1===l&&s===h-1&&s===a+1?-1!==h&&(e.base=e.name=0===a&&o?t.slice(1,h):t.slice(a,h)):(0===a&&o?(e.name=t.slice(1,s),e.base=t.slice(1,h)):(e.name=t.slice(a,s),e.base=t.slice(a,h)),e.ext=t.slice(s,h)),a>0?e.dir=t.slice(0,a-1):o&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,t.exports=s},8396:(t,e,r)=>{e.pbkdf2=r(3832),e.pbkdf2Sync=r(1352)},3832:(t,e,r)=>{var i,n,o=r(2861).Buffer,s=r(4196),a=r(2455),h=r(1352),u=r(3382),f=globalThis.crypto&&globalThis.crypto.subtle,l={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},c=[];function d(){return n||(n=globalThis.process&&globalThis.process.nextTick?globalThis.process.nextTick:globalThis.queueMicrotask?globalThis.queueMicrotask:globalThis.setImmediate?globalThis.setImmediate:globalThis.setTimeout)}function p(t,e,r,i,n){return f.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return f.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:n}},t,i<<3)})).then((function(t){return o.from(t)}))}t.exports=function(t,e,r,n,m,g){"function"==typeof m&&(g=m,m=void 0);var y=l[(m=m||"sha1").toLowerCase()];if(y&&"function"==typeof globalThis.Promise){if(s(r,n),t=u(t,a,"Password"),e=u(e,a,"Salt"),"function"!=typeof g)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){d()((function(){e(null,t)}))}),(function(t){d()((function(){e(t)}))}))}(function(t){if(globalThis.process&&!globalThis.process.browser)return Promise.resolve(!1);if(!f||!f.importKey||!f.deriveBits)return Promise.resolve(!1);if(void 0!==c[t])return c[t];var e=p(i=i||o.alloc(8),i,10,128,t).then((function(){return!0})).catch((function(){return!1}));return c[t]=e,e}(y).then((function(i){return i?p(t,e,r,n,y):h(t,e,r,n,m)})),g)}else d()((function(){var i;try{i=h(t,e,r,n,m)}catch(t){return g(t)}g(null,i)}))}},2455:(t,e,r)=>{var i,n=r(5606);i=globalThis.process&&globalThis.process.browser?"utf-8":globalThis.process&&globalThis.process.version?parseInt(n.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",t.exports=i},4196:t=>{var e=Math.pow(2,30)-1;t.exports=function(t,r){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof r)throw new TypeError("Key length not a number");if(r<0||r>e||r!=r)throw new TypeError("Bad key length")}},1352:(t,e,r)=>{var i=r(320),n=r(6011),o=r(2802),s=r(2861).Buffer,a=r(4196),h=r(2455),u=r(3382),f=s.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function c(t,e,r){var a=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new n).update(t).digest()}:"md5"===t?i:function(e){return o(t).update(e).digest()}}(t),h="sha512"===t||"sha384"===t?128:64;e.length>h?e=a(e):e.length{var i=r(2861).Buffer;t.exports=function(t,e,r){if(i.isBuffer(t))return t;if("string"==typeof t)return i.from(t,e);if(ArrayBuffer.isView(t))return i.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},8444:t=>{t.exports=function(t){return Math.max(16384,1<{"use strict";t.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},3225:(t,e,r)=>{"use strict";var i=r(5606);void 0===i||!i.version||0===i.version.indexOf("v0.")||0===i.version.indexOf("v1.")&&0!==i.version.indexOf("v1.8.")?t.exports={nextTick:function(t,e,r,n){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return i.nextTick(t);case 2:return i.nextTick((function(){t.call(null,e)}));case 3:return i.nextTick((function(){t.call(null,e,r)}));case 4:return i.nextTick((function(){t.call(null,e,r,n)}));default:for(o=new Array(a-1),s=0;s{var e,r,i=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:n}catch(t){e=n}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var a,h=[],u=!1,f=-1;function l(){u&&a&&(u=!1,a.length?h=a.concat(h):f=-1,h.length&&c())}function c(){if(!u){var t=s(l);u=!0;for(var e=h.length;e;){for(a=h,h=[];++f1)for(var r=1;r{e.publicEncrypt=r(8902),e.privateDecrypt=r(7362),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}},8206:(t,e,r)=>{var i=r(7108),n=r(2861).Buffer;function o(t){var e=n.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var r,s=n.alloc(0),a=0;s.length=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],k=8191&M,S=M>>>13,x=0|s[5],A=8191&x,E=x>>>13,I=0|s[6],T=8191&I,P=I>>>13,B=0|s[7],C=8191&B,L=B>>>13,O=0|s[8],R=8191&O,j=O>>>13,N=0|s[9],D=8191&N,U=N>>>13,q=0|a[0],F=8191&q,H=q>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,G=V>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,o=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,o=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,G)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,G)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,G)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,o=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,G)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,o=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,G)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(T,F),n=(n=Math.imul(T,H))+Math.imul(P,F)|0,o=Math.imul(P,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,G)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,F),n=(n=Math.imul(C,H))+Math.imul(L,F)|0,o=Math.imul(L,H),i=i+Math.imul(T,W)|0,n=(n=n+Math.imul(T,K)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,G)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,G)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(j,F)|0,o=Math.imul(j,H),i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,K)|0,i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,G)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,G)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,F),n=(n=Math.imul(D,H))+Math.imul(U,F)|0,o=Math.imul(U,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(j,W)|0,o=o+Math.imul(j,K)|0,i=i+Math.imul(C,$)|0,n=(n=n+Math.imul(C,G)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,G)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,K))+Math.imul(U,W)|0,o=Math.imul(U,K),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,G)|0,i=i+Math.imul(C,J)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,$),n=(n=Math.imul(D,G))+Math.imul(U,$)|0,o=Math.imul(U,G),i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Y)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,ut)|0,i=i+Math.imul(C,lt)|0,n=(n=n+Math.imul(C,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Bt=(u+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;u=((o=o+Math.imul(P,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(j,lt)|0,o=o+Math.imul(j,ct)|0;var Ct=(u+(i=i+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,lt),n=(n=Math.imul(D,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Lt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Ot=(u+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Bt,h[16]=Ct,h[17]=Lt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!=(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,h=i.length-n.length;if("mod"!==e){(a=new o(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),h=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(h)):(r.isub(e),a.isub(n),h.isub(s))}return{a,b:h,gcd:r.iushln(u)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new k(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},7362:(t,e,r)=>{var i=r(8170),n=r(8206),o=r(2061),s=r(2509),a=r(7332),h=r(7108),u=r(9247),f=r(2861).Buffer;t.exports=function(t,e,r){var l;l=t.padding?t.padding:r?1:4;var c,d=i(t),p=d.modulus.byteLength();if(e.length>p||new s(e).cmp(d.modulus)>=0)throw new Error("decryption error");c=r?u(new s(e),d):a(e,d);var m=f.alloc(p-c.length);if(c=f.concat([m,c],p),4===l)return function(t,e){var r=t.modulus.byteLength(),i=h("sha1").update(f.alloc(0)).digest(),s=i.length;if(0!==e[0])throw new Error("decryption error");var a=e.slice(1,s+1),u=e.slice(s+1),l=o(a,n(u,s)),c=o(u,n(l,r-s-1));if(function(t,e){t=f.from(t),e=f.from(e);var r=0,i=t.length;t.length!==e.length&&(r++,i=Math.min(t.length,e.length));for(var n=-1;++n=e.length){o++;break}var s=e.slice(2,n-1);if(("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&o++,s.length<8&&o++,o)throw new Error("decryption error");return e.slice(n)}(0,c,r);if(3===l)return c;throw new Error("unknown padding")}},8902:(t,e,r)=>{var i=r(8170),n=r(3209),o=r(7108),s=r(8206),a=r(2061),h=r(2509),u=r(9247),f=r(7332),l=r(2861).Buffer;t.exports=function(t,e,r){var c;c=t.padding?t.padding:r?1:4;var d,p=i(t);if(4===c)d=function(t,e){var r=t.modulus.byteLength(),i=e.length,u=o("sha1").update(l.alloc(0)).digest(),f=u.length,c=2*f;if(i>r-c-2)throw new Error("message too long");var d=l.alloc(r-i-c-2),p=r-f-1,m=n(f),g=a(l.concat([u,d,l.alloc(1,1),e],p),s(m,p)),y=a(m,s(g,f));return new h(l.concat([l.alloc(1),y,g],r))}(p,e);else if(1===c)d=function(t,e,r){var i,o=e.length,s=t.modulus.byteLength();if(o>s-11)throw new Error("message too long");return i=r?l.alloc(s-o-3,255):function(t){for(var e,r=l.allocUnsafe(t),i=0,o=n(2*t),s=0;i=0)throw new Error("data too long for modulus")}return r?f(d,p):u(d,p)}},9247:(t,e,r)=>{var i=r(2509),n=r(2861).Buffer;t.exports=function(t,e){return n.from(t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed().toArray())}},2061:t=>{t.exports=function(t,e){for(var r=t.length,i=-1;++i{var i=r(5606),n=r(3519),o=r(6611),s=r(2376),a=function(){},h=/^v?\.0/.test(i.version),u=function(t){return"function"==typeof t},f=function(t){t()},l=function(t,e){return t.pipe(e)};t.exports=function(){var t,e=Array.prototype.slice.call(arguments),r=u(e[e.length-1]||a)&&e.pop()||a;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var i=e.map((function(l,c){var d=c0,(function(e){t||(t=e),e&&i.forEach(f),d||(i.forEach(f),r(t))}))}));return e.reduce(l)}},9596:t=>{let e;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:globalThis):t=>(e||(e=Promise.resolve())).then(t).catch((t=>setTimeout((()=>{throw t}),0)))},2133:t=>{t.exports="function"==typeof queueMicrotask?queueMicrotask:t=>Promise.resolve().then(t)},7373:t=>{t.exports=function(t){var e=0;return function(){if(e===t.length)return null;var r=t.length-e,i=Math.random()*r|0,n=t[e+i],o=t[e];return t[e]=n,t[e+i]=o,e++,n}}},3209:(t,e,r)=>{"use strict";var i=r(5606),n=65536,o=r(2861).Buffer,s=globalThis.crypto||globalThis.msCrypto;s&&s.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var r=o.allocUnsafe(t);if(t>0)if(t>n)for(var a=0;a{"use strict";var i=r(5606);function n(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=r(2861),s=r(3209),a=o.Buffer,h=o.kMaxLength,u=globalThis.crypto||globalThis.msCrypto,f=Math.pow(2,32)-1;function l(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>f||t<0)throw new TypeError("offset must be a uint32");if(t>h||t>e)throw new RangeError("offset out of range")}function c(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>f||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>h)throw new RangeError("buffer too small")}function d(t,e,r,n){if(i.browser){var o=t.buffer,a=new Uint8Array(o,e,r);return u.getRandomValues(a),n?void i.nextTick((function(){n(null,t)})):t}if(!n)return s(r).copy(t,e),t;s(r,(function(r,i){if(r)return n(r);i.copy(t,e),n(null,t)}))}u&&u.getRandomValues||!i.browser?(e.randomFill=function(t,e,r,i){if(!(a.isBuffer(t)||t instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof e)i=e,e=0,r=t.length;else if("function"==typeof r)i=r,r=t.length-e;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return l(e,t.length),c(r,e,t.length),d(t,e,r,i)},e.randomFillSync=function(t,e,r){if(void 0===e&&(e=0),!(a.isBuffer(t)||t instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return l(e,t.length),void 0===r&&(r=t.length-e),c(r,e,t.length),d(t,e,r)}):(e.randomFill=n,e.randomFillSync=n)},2878:t=>{"use strict";function e(t,e){return{start:t.start,end:t.end,index:e}}function r(t){return{start:t.start,end:t.end}}function i(t,e){return t.index-e.index}function n(t,e){return t.start-e.start}t.exports=function(t,o,s){if("string"!=typeof o)throw new TypeError("argument str must be a string");var a=o.indexOf("=");if(-1===a)return-2;var h=o.slice(a+1).split(","),u=[];u.type=o.slice(0,a);for(var f=0;ft-1&&(d=t-1),isNaN(c)||isNaN(d)||c>d||c<0||u.push({start:c,end:d})}return u.length<1?-1:s&&s.combine?function(t){for(var o=t.map(e).sort(n),s=0,a=1;au.end+1?o[++s]=h:h.end>u.end&&(u.end=h.end,u.index=Math.min(u.index,h.index))}o.length=s+1;var f=o.sort(i).map(r);return f.type=t.type,f}(u):u}},8727:t=>{"use strict";function e(t){return parseInt(t,10)===t}function r(t){function r(e){this.s=function(e){if(void 0===e){e=new Array(t);for(var r=0;r{"use strict";var i=r(3225),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=l;var o=Object.create(r(5622));o.inherits=r(6698);var s=r(5412),a=r(6708);o.inherits(l,s);for(var h=n(a.prototype),u=0;u{"use strict";t.exports=o;var i=r(4610),n=Object.create(r(5622));function o(t){if(!(this instanceof o))return new o(t);i.call(this,t)}n.inherits=r(6698),n.inherits(o,i),o.prototype._transform=function(t,e,r){r(null,t)}},5412:(t,e,r)=>{"use strict";var i=r(5606),n=r(3225);t.exports=v;var o,s=r(4634);v.ReadableState=b,r(7007).EventEmitter;var a=function(t,e){return t.listeners(e).length},h=r(345),u=r(4106).Buffer,f=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=Object.create(r(5622));l.inherits=r(6698);var c=r(9838),d=void 0;d=c&&c.debuglog?c.debuglog("stream"):function(){};var p,m=r(3222),g=r(5896);l.inherits(v,h);var y=["error","close","destroy","pause","resume"];function b(t,e){t=t||{};var i=e instanceof(o=o||r(5382));this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,s=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(3141).I),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function v(t){if(o=o||r(5382),!(this instanceof v))return new v(t);this._readableState=new b(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),h.call(this)}function w(t,e,r,i,n){var o,s=t._readableState;return null===e?(s.reading=!1,function(t,e){if(!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}}(t,s)):(n||(o=function(t,e){var r,i;return i=e,u.isBuffer(i)||i instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}(s,e)),o?t.emit("error",o):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),i?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?_(t,s,e,!1):A(t,s)):_(t,s,e,!1))):i||(s.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=M?t=M:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(x,t):x(t))}function x(t){d("emit readable"),t.emit("readable"),P(t)}function A(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(E,t,e))}function E(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;return to.length?o.length:t;if(s===o.length?n+=o:n+=o.slice(0,t),0==(t-=s)){s===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=u.allocUnsafe(t),i=e.head,n=1;for(i.data.copy(r),t-=i.data.length;i=i.next;){var o=i.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),0==(t-=s)){s===o.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=o.slice(s));break}++n}return e.length-=n,r}(t,e),i}(t,e.buffer,e.decoder),r);var r}function C(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(L,e,t))}function L(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function O(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):S(this),null;if(0===(t=k(t,e))&&e.ended)return 0===e.length&&C(this),null;var i,n=e.needReadable;return d("need readable",n),(0===e.length||e.length-t0?B(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&C(this)),null!==i&&this.emit("data",i),i},v.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,d("pipe count=%d opts=%j",o.pipesCount,e);var h=e&&!1===e.end||t===i.stdout||t===i.stderr?b:u;function u(){d("onend"),t.end()}o.endEmitted?n.nextTick(h):r.once("end",h),t.on("unpipe",(function e(i,n){d("onunpipe"),i===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,d("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),t.removeListener("drain",f),t.removeListener("error",m),t.removeListener("unpipe",e),r.removeListener("end",u),r.removeListener("end",b),r.removeListener("data",p),l=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}));var f=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,P(t))}}(r);t.on("drain",f);var l=!1,c=!1;function p(e){d("ondata"),c=!1,!1!==t.write(e)||c||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==O(o.pipes,t))&&!l&&(d("false write response, pause",o.awaitDrain),o.awaitDrain++,c=!0),r.pause())}function m(e){d("onerror",e),b(),t.removeListener("error",m),0===a(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",y),b()}function y(){d("onfinish"),t.removeListener("close",g),b()}function b(){d("unpipe"),r.unpipe(t)}return r.on("data",p),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",m),t.once("close",g),t.once("finish",y),t.emit("pipe",r),o.flowing||(d("pipe resume"),r.resume()),t},v.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o{"use strict";t.exports=s;var i=r(5382),n=Object.create(r(5622));function o(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{"use strict";var i=r(5606),n=r(3225);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(void 0),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=y;var s,a=!i.browser&&["v0.10","v0.9."].indexOf(i.version.slice(0,5))>-1?setImmediate:n.nextTick;y.WritableState=g;var h=Object.create(r(5622));h.inherits=r(6698);var u,f={deprecate:r(4643)},l=r(345),c=r(4106).Buffer,d=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},p=r(5896);function m(){}function g(t,e){s=s||r(5382),t=t||{};var i=e instanceof s;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var h=t.highWaterMark,u=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=h||0===h?h:i&&(u||0===u)?u:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,o=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,o){--e.pendingcb,r?(n.nextTick(o,i),n.nextTick(k,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(o(i),t._writableState.errorEmitted=!0,t.emit("error",i),k(t,e))}(t,r,i,e,o);else{var s=_(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(t,r),i?a(v,t,r,s,o):v(t,r,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function y(t){if(s=s||r(5382),!(u.call(y,this)||this instanceof s))return new y(t);this._writableState=new g(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),l.call(this)}function b(t,e,r,i,n,o,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function v(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),k(t,e)}function w(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var a=0,h=!0;r;)n[a]=r,r.isBuf||(h=!1),r=r.next,a+=1;n.allBuffers=h,b(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,f=r.encoding,l=r.callback;if(b(t,e,!1,e.objectMode?1:u.length,u,f,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function M(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),k(t,e)}))}function k(t,e){var r=_(e);return r&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,n.nextTick(M,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(y,l),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:f.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!u.call(this,t)||this===y&&t&&t._writableState instanceof g}})):u=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(t,e,r){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=t,c.isBuffer(i)||i instanceof d);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=m),o.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),n.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),n.nextTick(i,s),o=!1),o}(this,o,t,r))&&(o.pendingcb++,s=function(t,e,r,i,n,o){if(!r){var s=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,r)),e}(e,i,n);i!==s&&(r=!0,n="buffer",i=s)}var a=e.objectMode?1:i.length;e.length+=a;var h=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,k(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=p.destroy,y.prototype._undestroy=p.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}},3222:(t,e,r)=>{"use strict";var i=r(4106).Buffer,n=r(5340);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return i.alloc(0);for(var e,r,n=i.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=n,r=s,o.data.copy(e,r),s+=o.data.length,o=o.next;return n},t}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var t=n.inspect({length:this.length});return this.constructor.name+" "+t})},5896:(t,e,r)=>{"use strict";var i=r(3225);function n(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(n,this,t)):i.nextTick(n,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,i.nextTick(n,r,t)):i.nextTick(n,r,t):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},345:(t,e,r)=>{t.exports=r(7007).EventEmitter},4106:(t,e,r)=>{var i=r(8287),n=i.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(o(i,e),e.Buffer=s),o(n,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},8399:(t,e,r)=>{(e=t.exports=r(5412)).Stream=e,e.Readable=e,e.Writable=r(6708),e.Duplex=r(5382),e.Transform=r(4610),e.PassThrough=r(3600)},5307:(t,e,r)=>{const i=r(5682);var n=[];function o(){this.list=[],this.map=new Map}function s(){this.records=new Map,this.size=0}function a(t){if(!(this instanceof a))return new a(t);if(t||(t={}),this.maxSize=t.maxSize||1/0,this.maxAge=t.maxAge||0,this._onstale=t.onStale||t.onstale||null,this._fresh=new s,this._stale=new s,this._interval=null,this._gced=!1,this.maxAge&&this.maxAge<1/0){var e=Math.ceil(2/3*this.maxAge);this._interval=setInterval(this._gcAuto.bind(this),e),this._interval.unref&&this._interval.unref()}}function h(t){return i.isBuffer(t)?i.toString(t,"hex"):t}function u(t,e,r){var i=t[e];i.index=r,t[r].index=e,t[e]=t[r],t[r]=i}t.exports=a,o.prototype.add=function(t,e){var r=h(t),i=this.map.get(r);return!i&&(i={index:this.list.length,record:e||t},this.list.push(i),this.map.set(r,i),!0)},o.prototype.remove=function(t){var e=h(t),r=this.map.get(e);return!!r&&(u(this.list,r.index,this.list.length-1),this.list.pop(),this.map.delete(e),!0)},s.prototype.add=function(t,e,r){var i=this.records.get(t);return i||(i=new o,this.records.set(t,i)),!!i.add(e,r)&&(this.size++,!0)},s.prototype.remove=function(t,e,r){var i=this.records.get(t);return!!i&&!!i.remove(e,r)&&(this.size--,i.map.size||this.records.delete(t),!0)},s.prototype.get=function(t){var e=this.records.get(t);return e?e.list:n},Object.defineProperty(a.prototype,"size",{get:function(){return this._fresh.size+this._stale.size}}),a.prototype.add=function(t,e,r){this._stale.remove(t,e,r),this._fresh.add(t,e,r)&&this._fresh.size>this.maxSize&&this._gc()},a.prototype.remove=function(t,e,r){this._fresh.remove(t,e,r),this._stale.remove(t,e,r)},a.prototype.get=function(t,e){var r=this._fresh.get(t),i=this._stale.get(t),n=r.length,o=i.length,s=n+o;(e>s||!e)&&(e=s);for(var a=new Array(e),h=0;h0&&this._onstale(this._stale),this._stale=this._fresh,this._fresh=new s,this._gced=!0},a.prototype.clear=function(){this._gc(),this._gc()},a.prototype.destroy=function(){this.clear(),clearInterval(this._interval),this._interval=null}},6011:(t,e,r)=>{"use strict";var i=r(8287).Buffer,n=r(6698),o=r(4729),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],u=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],f=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],l=[0,1518500249,1859775393,2400959708,2840853838],c=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function m(t,e,r,i,n,o,s,a){return p(t+(e^r^i)+o+s|0,a)+n|0}function g(t,e,r,i,n,o,s,a){return p(t+(e&r|~e&i)+o+s|0,a)+n|0}function y(t,e,r,i,n,o,s,a){return p(t+((e|~r)^i)+o+s|0,a)+n|0}function b(t,e,r,i,n,o,s,a){return p(t+(e&i|r&~i)+o+s|0,a)+n|0}function v(t,e,r,i,n,o,s,a){return p(t+(e^(r|~i))+o+s|0,a)+n|0}n(d,o),d.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,M=0|this._c,k=0|this._d,S=0|this._e,x=0;x<80;x+=1){var A,E;x<16?(A=m(r,i,n,o,d,t[a[x]],l[0],u[x]),E=v(w,_,M,k,S,t[h[x]],c[0],f[x])):x<32?(A=g(r,i,n,o,d,t[a[x]],l[1],u[x]),E=b(w,_,M,k,S,t[h[x]],c[1],f[x])):x<48?(A=y(r,i,n,o,d,t[a[x]],l[2],u[x]),E=y(w,_,M,k,S,t[h[x]],c[2],f[x])):x<64?(A=b(r,i,n,o,d,t[a[x]],l[3],u[x]),E=g(w,_,M,k,S,t[h[x]],c[3],f[x])):(A=v(r,i,n,o,d,t[a[x]],l[4],u[x]),E=m(w,_,M,k,S,t[h[x]],c[4],f[x])),r=d,d=o,o=p(n,10),n=i,i=A,w=S,S=k,k=p(M,10),M=_,_=E}var I=this._b+n+k|0;this._b=this._c+o+S|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+i+M|0,this._a=I},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.alloc?i.alloc(20):new i(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},5372:(t,e,r)=>{t.exports=function(t,e,r){if("number"!=typeof e)throw new Error("second argument must be a Number");let n,o,s,a,h,u,f=!0;function l(t){function e(){r&&r(t,n),r=null}f?i(e):e()}function c(e,r,i){if(n[e]=i,r&&(h=!0),0==--s||r)l(r);else if(!h&&u{t.exports=function(t,e){let r,n,o,s=!0;function a(t){function n(){e&&e(t,r),e=null}s?i(n):n()}function h(t,e,i){r[t]=i,(0==--n||e)&&a(e)}Array.isArray(t)?(r=[],n=t.length):(o=Object.keys(t),r={},n=o.length),n?o?o.forEach((function(e){t[e]((function(t,r){h(e,t,r)}))})):t.forEach((function(t,e){t((function(t,r){h(e,t,r)}))})):a(null),s=!1};const i=r(9596)},2861:(t,e,r)=>{var i=r(8287),n=i.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(o(i,e),e.Buffer=s),s.prototype=Object.create(n.prototype),o(n,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},6897:(t,e,r)=>{"use strict";var i=r(453),n=r(41),o=r(592)(),s=r(5795),a=r(9675),h=i("%Math.floor%");t.exports=function(t,e){if("function"!=typeof t)throw new a("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||h(e)!==e)throw new a("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,u=!0;if("length"in t&&s){var f=s(t,"length");f&&!f.configurable&&(i=!1),f&&!f.writable&&(u=!1)}return(i||u||!r)&&(o?n(t,"length",e,!0,!0):n(t,"length",e)),t}},392:(t,e,r)=>{var i=r(2861).Buffer;function n(t,e){this._block=i.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}n.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=i.from(t,e));for(var r=this._block,n=this._blockSize,o=t.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},2802:(t,e,r)=>{var i=t.exports=function(t){t=t.toLowerCase();var e=i[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};i.sha=r(7816),i.sha1=r(3737),i.sha224=r(6710),i.sha256=r(4107),i.sha384=r(2827),i.sha512=r(2890)},7816:(t,e,r)=>{var i=r(6698),n=r(392),o=r(2861).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function h(){this.init(),this._w=a,n.call(this,64,56)}function u(t){return t<<30|t>>>2}function f(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(h,n),h.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},h.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,h=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=r[l-3]^r[l-8]^r[l-14]^r[l-16];for(var c=0;c<80;++c){var d=~~(c/20),p=0|((e=i)<<5|e>>>27)+f(d,n,o,a)+h+r[c]+s[d];h=a,a=o,o=u(n),n=i,i=p}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=h+this._e|0},h.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=h},3737:(t,e,r)=>{var i=r(6698),n=r(392),o=r(2861).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function h(){this.init(),this._w=a,n.call(this,64,56)}function u(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function l(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(h,n),h.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},h.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,h=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=(e=r[c-3]^r[c-8]^r[c-14]^r[c-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=u(i)+l(p,n,o,a)+h+r[d]+s[p]|0;h=a,a=o,o=f(n),n=i,i=m}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=h+this._e|0},h.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=h},6710:(t,e,r)=>{var i=r(6698),n=r(4107),o=r(392),s=r(2861).Buffer,a=new Array(64);function h(){this.init(),this._w=a,o.call(this,64,56)}i(h,n),h.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},h.prototype._hash=function(){var t=s.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=h},4107:(t,e,r)=>{var i=r(6698),n=r(392),o=r(2861).Buffer,s=[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],a=new Array(64);function h(){this.init(),this._w=a,n.call(this,64,56)}function u(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function l(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function c(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}i(h,n),h.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},h.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,h=0|this._e,p=0|this._f,m=0|this._g,g=0|this._h,y=0;y<16;++y)r[y]=t.readInt32BE(4*y);for(;y<64;++y)r[y]=0|(((e=r[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[y-7]+d(r[y-15])+r[y-16];for(var b=0;b<64;++b){var v=g+c(h)+u(h,p,m)+s[b]+r[b]|0,w=l(i)+f(i,n,o)|0;g=m,m=p,p=h,h=a+v|0,a=o,o=n,n=i,i=v+w|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=h+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},h.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=h},2827:(t,e,r)=>{var i=r(6698),n=r(2890),o=r(392),s=r(2861).Buffer,a=new Array(160);function h(){this.init(),this._w=a,o.call(this,128,112)}i(h,n),h.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},h.prototype._hash=function(){var t=s.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=h},2890:(t,e,r)=>{var i=r(6698),n=r(392),o=r(2861).Buffer,s=[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],a=new Array(160);function h(){this.init(),this._w=a,n.call(this,128,112)}function u(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function l(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function c(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0>>0?1:0}i(h,n),h.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},h.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,a=0|this._eh,h=0|this._fh,b=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,M=0|this._cl,k=0|this._dl,S=0|this._el,x=0|this._fl,A=0|this._gl,E=0|this._hl,I=0;I<32;I+=2)e[I]=t.readInt32BE(4*I),e[I+1]=t.readInt32BE(4*I+4);for(;I<160;I+=2){var T=e[I-30],P=e[I-30+1],B=d(T,P),C=p(P,T),L=m(T=e[I-4],P=e[I-4+1]),O=g(P,T),R=e[I-14],j=e[I-14+1],N=e[I-32],D=e[I-32+1],U=C+j|0,q=B+R+y(U,C)|0;q=(q=q+L+y(U=U+O|0,O)|0)+N+y(U=U+D|0,D)|0,e[I]=q,e[I+1]=U}for(var F=0;F<160;F+=2){q=e[F],U=e[F+1];var H=f(r,i,n),z=f(w,_,M),W=l(r,w),K=l(w,r),V=c(a,S),$=c(S,a),G=s[F],Z=s[F+1],J=u(a,h,b),Y=u(S,x,A),X=E+$|0,Q=v+V+y(X,E)|0;Q=(Q=(Q=Q+J+y(X=X+Y|0,Y)|0)+G+y(X=X+Z|0,Z)|0)+q+y(X=X+U|0,U)|0;var tt=K+z|0,et=W+H+y(tt,K)|0;v=b,E=A,b=h,A=x,h=a,x=S,a=o+Q+y(S=k+X|0,k)|0,o=n,k=M,n=i,M=_,i=r,_=w,r=Q+et+y(w=X+tt|0,X)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+M|0,this._dl=this._dl+k|0,this._el=this._el+S|0,this._fl=this._fl+x|0,this._gl=this._gl+A|0,this._hl=this._hl+E|0,this._ah=this._ah+r+y(this._al,w)|0,this._bh=this._bh+i+y(this._bl,_)|0,this._ch=this._ch+n+y(this._cl,M)|0,this._dh=this._dh+o+y(this._dl,k)|0,this._eh=this._eh+a+y(this._el,S)|0,this._fh=this._fh+h+y(this._fl,x)|0,this._gh=this._gh+b+y(this._gl,A)|0,this._hh=this._hh+v+y(this._hl,E)|0},h.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=h},7541:(t,e,r)=>{const i=r(8765),n=r(8499);t.exports={Throttle:i,ThrottleGroup:n}},8499:(t,e,r)=>{const{TokenBucket:i}=r(9439),n=r(8765);t.exports=class{constructor(t={}){if("object"!=typeof t)throw new Error("Options must be an object");this.throttles=[],this.setEnabled(t.enabled),this.setRate(t.rate,t.chunksize)}getEnabled(){return this._enabled}getRate(){return this.bucket.tokensPerInterval}getChunksize(){return this.chunksize}setEnabled(t=!0){if("boolean"!=typeof t)throw new Error("Enabled must be a boolean");this._enabled=t;for(const e of this.throttles)e.setEnabled(t)}setRate(t,e=null){if(!Number.isInteger(t)||t<0)throw new Error("Rate must be an integer bigger than zero");if(t=parseInt(t),e&&("number"!=typeof e||e<=0))throw new Error("Chunksize must be bigger than zero");if(e=e||Math.max(parseInt(t/10),1),e=parseInt(e),t>0&&e>t)throw new Error("Chunk size must be smaller than rate");this.bucket||(this.bucket=new i(t,t,"second",null)),this.bucket.bucketSize=t,this.bucket.tokensPerInterval=t,this.chunksize=e}setChunksize(t){if(!Number.isInteger(t)||t<=0)throw new Error("Chunk size must be an integer bigger than zero");const e=this.getRate();if(t=parseInt(t),e>0&&t>e)throw new Error("Chunk size must be smaller than rate");this.chunksize=t}throttle(t={}){if("object"!=typeof t)throw new Error("Options must be an object");return new n({...t,group:this})}destroy(){for(const t of this.throttles)t.destroy();this.throttles=[]}_addThrottle(t){if(!(t instanceof n))throw new Error("Throttle must be an instance of Throttle");this.throttles.push(t)}_removeThrottle(t){const e=this.throttles.indexOf(t);e>-1&&this.throttles.splice(e,1)}}},8765:(t,e,r)=>{const{EventEmitter:i}=r(7007),{Transform:n}=r(8179),{wait:o}=r(2072);t.exports=class extends n{constructor(t={}){if(super(),"object"!=typeof t)throw new Error("Options must be an object");const e=Object.assign({},t);if(e.group&&!(e.group instanceof s))throw new Error("Group must be an instanece of ThrottleGroup");e.group||(e.group=new s(e)),this._setEnabled(e.enabled||e.group.enabled),this._group=e.group,this._emitter=new i,this._destroyed=!1,this._group._addThrottle(this)}getEnabled(){return this._enabled}getGroup(){return this._group}_setEnabled(t=!0){if("boolean"!=typeof t)throw new Error("Enabled must be a boolean");this._enabled=t}setEnabled(t){this._setEnabled(t),this._enabled?this._emitter.emit("enabled"):this._emitter.emit("disabled")}_transform(t,e){this._processChunk(t,e)}async _waitForTokens(t){return new Promise(((e,r)=>{let i=!1;const n=this;function o(t){if(n._emitter.removeListener("disabled",o),n._emitter.removeListener("destroyed",o),!i){if(i=!0,t)return r(t);e()}}this._emitter.once("disabled",o),this._emitter.once("destroyed",o),this._group.bucket.removeTokens(t,o)}))}_areBothEnabled(){return this._enabled&&this._group.getEnabled()}async _processChunk(t,e){if(!this._areBothEnabled())return e(null,t);let r=0,i=this._group.getChunksize(),n=t.slice(r,r+i);for(;n.length>0;){if(this._areBothEnabled())try{for(;0===this._group.getRate()&&!this._destroyed&&this._areBothEnabled();)if(await o(1e3),this._destroyed)return;if(this._areBothEnabled()&&!this._group.bucket.tryRemoveTokens(n.length)&&(await this._waitForTokens(n.length),this._destroyed))return}catch(t){return e(t)}this.push(n),r+=i,i=this._areBothEnabled()?this._group.getChunksize():t.length-r,n=t.slice(r,r+i)}return e()}destroy(...t){this._group._removeThrottle(this),this._destroyed=!0,this._emitter.emit("destroyed"),super.destroy(...t)}};const s=r(8499)},2072:t=>{t.exports={wait:function(t){return new Promise((e=>setTimeout(e,t)))}}},8310:(t,e,r)=>{t.exports=n;var i=r(7007).EventEmitter;function n(){i.call(this)}r(6698)(n,i),n.Readable=r(6891),n.Writable=r(1999),n.Duplex=r(8101),n.Transform=r(9083),n.PassThrough=r(3681),n.finished=r(4257),n.pipeline=r(5267),n.Stream=n,n.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",h));var s=!1;function a(){s||(s=!0,t.end())}function h(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(f(),0===i.listenerCount(this,"error"))throw t}function f(){r.removeListener("data",n),t.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",h),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("error",u),t.on("error",u),r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t}},2463:t=>{"use strict";var e={};function r(t,r,i){i||(i=Error);var n=function(t){var e,i;function n(e,i,n){return t.call(this,function(t,e,i){return"string"==typeof r?r:r(t,e,i)}(e,i,n))||this}return i=t,(e=n).prototype=Object.create(i.prototype),e.prototype.constructor=e,e.__proto__=i,n}(i);n.prototype.name=i.name,n.prototype.code=t,e[t]=n}function i(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}r("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,o,s,a;if("string"==typeof e&&"not "===e.substr(0,4)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length)," argument"===t.substring(r-9,r)}(t))o="The ".concat(t," ").concat(n," ").concat(i(e,"type"));else{var h=("number"!=typeof a&&(a=0),a+1>(s=t).length||-1===s.indexOf(".",a)?"argument":"property");o='The "'.concat(t,'" ').concat(h," ").concat(n," ").concat(i(e,"type"))}return o+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.F=e},8101:(t,e,r)=>{"use strict";var i=r(5606),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=f;var o=r(6891),s=r(1999);r(6698)(f,o);for(var a=n(s.prototype),h=0;h{"use strict";t.exports=n;var i=r(9083);function n(t){if(!(this instanceof n))return new n(t);i.call(this,t)}r(6698)(n,i),n.prototype._transform=function(t,e,r){r(null,t)}},6891:(t,e,r)=>{"use strict";var i,n=r(5606);t.exports=x,x.ReadableState=S,r(7007).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=r(1396),h=r(8287).Buffer,u=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},f=r(7199);o=f&&f.debuglog?f.debuglog("stream"):function(){};var l,c,d,p=r(1766),m=r(4347),g=r(6644).getHighWaterMark,y=r(2463).F,b=y.ERR_INVALID_ARG_TYPE,v=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,_=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(6698)(x,a);var M=m.errorOrDestroy,k=["error","close","destroy","pause","resume"];function S(t,e,n){i=i||r(8101),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",n),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=r(3141).I),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function x(t){if(i=i||r(8101),!(this instanceof x))return new x(t);var e=this instanceof i;this._readableState=new S(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,r,i,n){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?P(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}}(t,a);else if(n||(s=function(t,e){var r,i;return i=e,h.isBuffer(i)||i instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e)),r}(a,e)),s)M(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),i)a.endEmitted?M(t,new _):E(t,a,e,!0);else if(a.ended)M(t,new v);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?E(t,a,e,!1):C(t,a)):E(t,a,e,!1)}else i||(a.reading=!1,C(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=I?t=I:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function P(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(B,t))}function B(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function C(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(L,t,e))}function L(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function R(t){o("readable nexttick read 0"),t.read(0)}function j(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function D(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function U(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(q,e,t))}function q(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function F(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):P(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&U(this),null;var i,n=e.needReadable;return o("need readable",n),(0===e.length||e.length-t0?D(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&U(this)),null!==i&&this.emit("data",i),i},x.prototype._read=function(t){M(this,new w("_read()"))},x.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,o("pipe count=%d opts=%j",i.pipesCount,e);var a=e&&!1===e.end||t===n.stdout||t===n.stderr?m:h;function h(){o("onend"),t.end()}i.endEmitted?n.nextTick(a):r.once("end",a),t.on("unpipe",(function e(n,s){o("onunpipe"),n===r&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",u),t.removeListener("error",c),t.removeListener("unpipe",e),r.removeListener("end",h),r.removeListener("end",m),r.removeListener("data",l),f=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||u())}));var u=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,N(t))}}(r);t.on("drain",u);var f=!1;function l(e){o("ondata");var n=t.write(e);o("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==F(i.pipes,t))&&!f&&(o("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function c(e){o("onerror",e),m(),t.removeListener("error",c),0===s(t,"error")&&M(t,e)}function d(){t.removeListener("finish",p),m()}function p(){o("onfinish"),t.removeListener("close",d),m()}function m(){o("unpipe"),r.unpipe(t)}return r.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",c),t.once("close",d),t.once("finish",p),t.emit("pipe",r),i.flowing||(o("pipe resume"),r.resume()),t},x.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,o("on readable",i.length,i.reading),i.length?P(this):i.reading||n.nextTick(R,this))),r},x.prototype.addListener=x.prototype.on,x.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(O,this),r},x.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(O,this),e},x.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(j,t,e))}(this,t)),t.paused=!1,this},x.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},x.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){o("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var s=0;s{"use strict";t.exports=f;var i=r(2463).F,n=i.ERR_METHOD_NOT_IMPLEMENTED,o=i.ERR_MULTIPLE_CALLBACK,s=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=i.ERR_TRANSFORM_WITH_LENGTH_0,h=r(8101);function u(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{"use strict";var i,n=r(5606);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(void 0),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=x,x.WritableState=S;var s,a={deprecate:r(4643)},h=r(1396),u=r(8287).Buffer,f=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=r(4347),c=r(6644).getHighWaterMark,d=r(2463).F,p=d.ERR_INVALID_ARG_TYPE,m=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_STREAM_CANNOT_PIPE,b=d.ERR_STREAM_DESTROYED,v=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,M=l.errorOrDestroy;function k(){}function S(t,e,s){i=i||r(8101),t=t||{},"boolean"!=typeof s&&(s=e instanceof i),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=c(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,o){--e.pendingcb,r?(n.nextTick(o,i),n.nextTick(B,t,e),t._writableState.errorEmitted=!0,M(t,i)):(o(i),t._writableState.errorEmitted=!0,M(t,i),B(t,e))}(t,r,i,e,o);else{var s=T(r)||t.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),i?n.nextTick(E,t,r,s,o):E(t,r,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function x(t){var e=this instanceof(i=i||r(8101));if(!e&&!s.call(x,this))return new x(t);this._writableState=new S(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),h.call(this)}function A(t,e,r,i,n,o,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function E(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),B(t,e)}function I(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var a=0,h=!0;r;)n[a]=r,r.isBuf||(h=!1),r=r.next,a+=1;n.allBuffers=h,A(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,f=r.encoding,l=r.callback;if(A(t,e,!1,e.objectMode?1:u.length,u,f,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(r){e.pendingcb--,r&&M(t,r),e.prefinished=!0,t.emit("prefinish"),B(t,e)}))}function B(t,e){var r=T(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,n.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}r(6698)(x,h),S.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(S.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(x,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===x&&t&&t._writableState instanceof S}})):s=function(t){return t instanceof this},x.prototype.pipe=function(){M(this,new y)},x.prototype.write=function(t,e,r){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=t,u.isBuffer(i)||i instanceof f);return a&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=k),o.ending?function(t,e){var r=new w;M(t,r),n.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var o;return null===r?o=new v:"string"==typeof r||e.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(M(t,o),n.nextTick(i,o),!1)}(this,o,t,r))&&(o.pendingcb++,s=function(t,e,r,i,n,o){if(!r){var s=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,r)),e}(e,i,n);i!==s&&(r=!0,n="buffer",i=s)}var a=e.objectMode?1:i.length;e.length+=a;var h=e.length-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(x.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(x.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),x.prototype._write=function(t,e,r){r(new m("_write()"))},x.prototype._writev=null,x.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,B(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(x.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(x.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),x.prototype.destroy=l.destroy,x.prototype._undestroy=l.undestroy,x.prototype._destroy=function(t,e){e(t)}},5034:(t,e,r)=>{"use strict";var i,n=r(5606);function o(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=r(4257),a=Symbol("lastResolve"),h=Symbol("lastReject"),u=Symbol("error"),f=Symbol("ended"),l=Symbol("lastPromise"),c=Symbol("handlePromise"),d=Symbol("stream");function p(t,e){return{value:t,done:e}}function m(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[l]=null,t[a]=null,t[h]=null,e(p(r,!1)))}}function g(t){n.nextTick(m,t)}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(i={get stream(){return this[d]},next:function(){var t=this,e=this[u];if(null!==e)return Promise.reject(e);if(this[f])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(e,r){n.nextTick((function(){t[u]?r(t[u]):e(p(void 0,!0))}))}));var r,i=this[l];if(i)r=new Promise(function(t,e){return function(r,i){t.then((function(){e[f]?r(p(void 0,!0)):e[c](r,i)}),i)}}(i,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[c])}return this[l]=r,r}},Symbol.asyncIterator,(function(){return this})),o(i,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(p(void 0,!0))}))}))})),i),y);t.exports=function(t){var e,r=Object.create(b,(o(e={},d,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,h,{value:null,writable:!0}),o(e,u,{value:null,writable:!0}),o(e,f,{value:t._readableState.endEmitted,writable:!0}),o(e,c,{value:function(t,e){var i=r[d].read();i?(r[l]=null,r[a]=null,r[h]=null,t(p(i,!1))):(r[a]=t,r[h]=e)},writable:!0}),e));return r[l]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[h];return null!==e&&(r[l]=null,r[a]=null,r[h]=null,e(t)),void(r[u]=t)}var i=r[a];null!==i&&(r[l]=null,r[a]=null,r[h]=null,i(p(void 0,!0))),r[f]=!0})),t.on("readable",g.bind(null,r)),r}},1766:(t,e,r)=>{"use strict";function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function n(t){for(var e=1;e0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,r,i,n=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=n,i=s,a.prototype.copy.call(e,r,i),s+=o.data.length,o=o.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0==(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:u,value:function(t,e){return h(this,n(n({},e),{},{depth:0,customInspect:!1}))}}])&&function(t,e){for(var r=0;r{"use strict";var i=r(5606);function n(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,a=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return a||h?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(s,this,t)):i.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted?i.nextTick(o,r):(r._writableState.errorEmitted=!0,i.nextTick(n,r,t)):i.nextTick(n,r,t):e?(i.nextTick(o,r),e(t)):i.nextTick(o,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}}},4257:(t,e,r)=>{"use strict";var i=r(2463).F.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},5267:(t,e,r)=>{"use strict";var i,n=r(2463).F,o=n.ERR_MISSING_ARGS,s=n.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function h(t){t()}function u(t,e){return t.pipe(e)}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n0,(function(t){f||(f=t),t&&c.forEach(h),o||(c.forEach(h),l(f))}))}));return e.reduce(u)}},6644:(t,e,r)=>{"use strict";var i=r(2463).F.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,n){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new i(n?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},1396:(t,e,r)=>{t.exports=r(7007).EventEmitter},8179:(t,e,r)=>{const{EventEmitter:i}=r(7007),n=new Error("Stream was destroyed"),o=new Error("Premature close"),s=r(2133),a=r(6080),h=268435455,u=1^h,f=16384,l=32768,c=131072,d=768^h,p=268402687,m=268304383,g=2<<18,y=4<<18,b=8<<18,v=32<<18,w=64<<18,_=128<<18,M=201064447,k=234881023,S=262160,x=8404992,A=8405006,E=33587200,I=33587215,T=2359311,P=Symbol.asyncIterator||Symbol("asyncIterator");class B{constructor(t,{highWaterMark:e=16384,map:r=null,mapWritable:i,byteLength:n,byteLengthWritable:o}={}){this.stream=t,this.queue=new a,this.highWaterMark=e,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=o||n||tt,this.map=i||r,this.afterWrite=D.bind(this),this.afterUpdateNextTick=F.bind(this)}get ended(){return!!(this.stream._duplexState&v)}push(t){return null!==this.map&&(t=this.map(t)),this.buffered+=this.byteLength(t),this.queue.push(t),this.buffered0,this.error=null,this.pipeline=null,this.byteLength=o||n||tt,this.map=i||r,this.pipeTo=null,this.afterRead=U.bind(this),this.afterUpdateNextTick=q.bind(this)}get ended(){return!!(this.stream._duplexState&f)}pipe(t,e){if(null!==this.pipeTo)throw new Error("Can only pipe to one destination");if("function"!=typeof e&&(e=null),this.stream._duplexState|=512,this.pipeTo=t,this.pipeline=new O(this.stream,t,e),e&&this.stream.on("error",et),Q(t))t._writableState.pipeline=this.pipeline,e&&t.on("error",et),t.on("finish",this.pipeline.finished.bind(this.pipeline));else{const e=this.pipeline.done.bind(this.pipeline,t),r=this.pipeline.done.bind(this.pipeline,t,null);t.on("error",e),t.on("close",r),t.on("finish",this.pipeline.finished.bind(this.pipeline))}t.on("drain",R.bind(this)),this.stream.emit("piping",t),t.emit("pipe",this.stream)}push(t){const e=this.stream;return null===t?(this.highWaterMark=0,e._duplexState=268369855&e._duplexState|1024,!1):(null!==this.map&&(t=this.map(t)),this.buffered+=this.byteLength(t),this.queue.push(t),e._duplexState=268369919&e._duplexState|128,this.buffered0;)e.push(this.shift());for(let t=0;t0;)i.drains.shift().resolve(!1);null!==i.pipeline&&i.pipeline.done(e,t)}}function D(t){const e=this.stream;t&&e.destroy(t),e._duplexState&=M,null!==this.drains&&function(t){for(let e=0;e=t._readableState.highWaterMark}static isPaused(t){return!(256&t._duplexState)}[P](){const t=this;let e=null,r=null,i=null;return this.on("error",(t=>{e=t})),this.on("readable",(function(){null!==r&&o(t.read())})),this.on("close",(function(){null!==r&&o(null)})),{[P](){return this},next:()=>new Promise((function(e,n){r=e,i=n;const s=t.read();null!==s?o(s):8&t._duplexState&&o(null)})),return:()=>s(null),throw:t=>s(t)};function o(o){null!==i&&(e?i(e):null!==o||t._duplexState&f?r({value:o,done:null===o}):i(n),i=r=null)}function s(e){return t.destroy(e),new Promise(((r,i)=>{if(8&t._duplexState)return r({value:void 0,done:!0});t.once("close",(function(){e?i(e):r({value:void 0,done:!0})}))}))}}}class $ extends K{constructor(t){super(t),this._duplexState|=16385,this._writableState=new B(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final),t.eagerOpen&&this._writableState.updateNextTick())}_writev(t,e){e(null)}_write(t,e){this._writableState.autoBatch(t,e)}_final(t){t(null)}static isBackpressured(t){return!!(146800654&t._duplexState)}static drained(t){if(t.destroyed)return Promise.resolve(!1);const e=t._writableState;var r;const i=((r=t)._writev!==$.prototype._writev&&r._writev!==G.prototype._writev?Math.min(1,e.queue.length):e.queue.length)+(67108864&t._duplexState?1:0);return 0===i?Promise.resolve(!0):(null===e.drains&&(e.drains=[]),new Promise((t=>{e.drains.push({writes:i,resolve:t})})))}write(t){return this._writableState.updateNextTick(),this._writableState.push(t)}end(t){return this._writableState.updateNextTick(),this._writableState.end(t),this}}class G extends V{constructor(t){super(t),this._duplexState=1|this._duplexState&c,this._writableState=new B(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final))}_writev(t,e){e(null)}_write(t,e){this._writableState.autoBatch(t,e)}_final(t){t(null)}write(t){return this._writableState.updateNextTick(),this._writableState.push(t)}end(t){return this._writableState.updateNextTick(),this._writableState.end(t),this}}class Z extends G{constructor(t){super(t),this._transformState=new L(this),t&&(t.transform&&(this._transform=t.transform),t.flush&&(this._flush=t.flush))}_write(t,e){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=t:this._transform(t,this._transformState.afterTransform)}_read(t){if(null!==this._transformState.data){const e=this._transformState.data;this._transformState.data=null,t(null),this._transform(e,this._transformState.afterTransform)}else t(null)}destroy(t){super.destroy(t),null!==this._transformState.data&&(this._transformState.data=null,this._transformState.afterTransform())}_transform(t,e){e(null,t)}_flush(t){t(null)}_final(t){this._transformState.afterFinal=t,this._flush(J.bind(this))}}function J(t,e){const r=this._transformState.afterFinal;if(t)return r(t);null!=e&&this.push(e),this.push(null),r(null)}function Y(t,...e){const r=Array.isArray(t)?[...t,...e]:[t,...e],i=r.length&&"function"==typeof r[r.length-1]?r.pop():null;if(r.length<2)throw new Error("Pipeline requires at least 2 streams");let n=r[0],s=null,a=null;for(let t=1;t1,u),n.pipe(s)),n=s;if(i){let t=!1;const e=Q(s)||!(!s._writableState||!s._writableState.autoDestroy);s.on("error",(t=>{null===a&&(a=t)})),s.on("finish",(()=>{t=!0,e||i(a)})),e&&s.on("close",(()=>i(a||(t?null:o))))}return s;function h(t,e,r,i){t.on("error",i),t.on("close",(function(){return e&&t._readableState&&!t._readableState.ended||r&&t._writableState&&!t._writableState.ended?i(o):void 0}))}function u(t){if(t&&!a){a=t;for(const e of r)e.destroy(t)}}}function X(t){return!!t._readableState||!!t._writableState}function Q(t){return"number"==typeof t._duplexState&&X(t)}function tt(t){return function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.byteLength}(t)?t.byteLength:1024}function et(){}function rt(){this.destroy(new Error("Stream aborted."))}t.exports={pipeline:Y,pipelinePromise:function(...t){return new Promise(((e,r)=>Y(...t,(t=>{if(t)return r(t);e()}))))},isStream:X,isStreamx:Q,getStreamError:function(t){const e=t._readableState&&t._readableState.error||t._writableState&&t._writableState.error;return e===n?null:e},Stream:K,Writable:$,Readable:V,Duplex:G,Transform:Z,PassThrough:class extends Z{}}},3141:(t,e,r)=>{"use strict";var i=r(5003).Buffer,n=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=h,this.end=u,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=f,this.end=l,e=3;break;default:return this.write=c,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function h(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function f(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.I=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},5003:(t,e,r)=>{var i=r(8287),n=i.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(o(i,e),e.Buffer=s),o(n,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},1035:t=>{function e(t){return(+Date.now()-t)/100&65535}t.exports=function(t){const r=+Date.now(),i=10*(t||5),n=[0];let o=1,s=e(r)-1&65535;return function(t){const a=e(r);let h=a-s&65535;for(h>i&&(h=i),s=a;h--;)o===i&&(o=0),n[o]=n[0===o?i-1:o-1],o++;t&&(n[o-1]+=t);const u=n[o-1],f=n.length{!function(t){"use strict";var e=function(t){var e,r=new Float64Array(16);if(t)for(e=0;e>24&255,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r,t[e+4]=i>>24&255,t[e+5]=i>>16&255,t[e+6]=i>>8&255,t[e+7]=255&i}function m(t,e,r,i,n){var o,s=0;for(o=0;o>>8)-1}function g(t,e,r,i){return m(t,e,r,i,16)}function y(t,e,r,i){return m(t,e,r,i,32)}function b(t,e,r,i){!function(t,e,r,i){for(var n,o=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,h=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,f=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,c=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,d=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,m=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,y=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,_=o,M=s,k=a,S=h,x=u,A=f,E=l,I=c,T=d,P=p,B=m,C=g,L=y,O=b,R=v,j=w,N=0;N<20;N+=2)_^=(n=(L^=(n=(T^=(n=(x^=(n=_+L|0)<<7|n>>>25)+_|0)<<9|n>>>23)+x|0)<<13|n>>>19)+T|0)<<18|n>>>14,A^=(n=(M^=(n=(O^=(n=(P^=(n=A+M|0)<<7|n>>>25)+A|0)<<9|n>>>23)+P|0)<<13|n>>>19)+O|0)<<18|n>>>14,B^=(n=(E^=(n=(k^=(n=(R^=(n=B+E|0)<<7|n>>>25)+B|0)<<9|n>>>23)+R|0)<<13|n>>>19)+k|0)<<18|n>>>14,j^=(n=(C^=(n=(I^=(n=(S^=(n=j+C|0)<<7|n>>>25)+j|0)<<9|n>>>23)+S|0)<<13|n>>>19)+I|0)<<18|n>>>14,_^=(n=(S^=(n=(k^=(n=(M^=(n=_+S|0)<<7|n>>>25)+_|0)<<9|n>>>23)+M|0)<<13|n>>>19)+k|0)<<18|n>>>14,A^=(n=(x^=(n=(I^=(n=(E^=(n=A+x|0)<<7|n>>>25)+A|0)<<9|n>>>23)+E|0)<<13|n>>>19)+I|0)<<18|n>>>14,B^=(n=(P^=(n=(T^=(n=(C^=(n=B+P|0)<<7|n>>>25)+B|0)<<9|n>>>23)+C|0)<<13|n>>>19)+T|0)<<18|n>>>14,j^=(n=(R^=(n=(O^=(n=(L^=(n=j+R|0)<<7|n>>>25)+j|0)<<9|n>>>23)+L|0)<<13|n>>>19)+O|0)<<18|n>>>14;_=_+o|0,M=M+s|0,k=k+a|0,S=S+h|0,x=x+u|0,A=A+f|0,E=E+l|0,I=I+c|0,T=T+d|0,P=P+p|0,B=B+m|0,C=C+g|0,L=L+y|0,O=O+b|0,R=R+v|0,j=j+w|0,t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=M>>>0&255,t[5]=M>>>8&255,t[6]=M>>>16&255,t[7]=M>>>24&255,t[8]=k>>>0&255,t[9]=k>>>8&255,t[10]=k>>>16&255,t[11]=k>>>24&255,t[12]=S>>>0&255,t[13]=S>>>8&255,t[14]=S>>>16&255,t[15]=S>>>24&255,t[16]=x>>>0&255,t[17]=x>>>8&255,t[18]=x>>>16&255,t[19]=x>>>24&255,t[20]=A>>>0&255,t[21]=A>>>8&255,t[22]=A>>>16&255,t[23]=A>>>24&255,t[24]=E>>>0&255,t[25]=E>>>8&255,t[26]=E>>>16&255,t[27]=E>>>24&255,t[28]=I>>>0&255,t[29]=I>>>8&255,t[30]=I>>>16&255,t[31]=I>>>24&255,t[32]=T>>>0&255,t[33]=T>>>8&255,t[34]=T>>>16&255,t[35]=T>>>24&255,t[36]=P>>>0&255,t[37]=P>>>8&255,t[38]=P>>>16&255,t[39]=P>>>24&255,t[40]=B>>>0&255,t[41]=B>>>8&255,t[42]=B>>>16&255,t[43]=B>>>24&255,t[44]=C>>>0&255,t[45]=C>>>8&255,t[46]=C>>>16&255,t[47]=C>>>24&255,t[48]=L>>>0&255,t[49]=L>>>8&255,t[50]=L>>>16&255,t[51]=L>>>24&255,t[52]=O>>>0&255,t[53]=O>>>8&255,t[54]=O>>>16&255,t[55]=O>>>24&255,t[56]=R>>>0&255,t[57]=R>>>8&255,t[58]=R>>>16&255,t[59]=R>>>24&255,t[60]=j>>>0&255,t[61]=j>>>8&255,t[62]=j>>>16&255,t[63]=j>>>24&255}(t,e,r,i)}function v(t,e,r,i){!function(t,e,r,i){for(var n,o=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,h=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,f=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,c=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,d=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,m=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,y=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,_=0;_<20;_+=2)o^=(n=(y^=(n=(d^=(n=(u^=(n=o+y|0)<<7|n>>>25)+o|0)<<9|n>>>23)+u|0)<<13|n>>>19)+d|0)<<18|n>>>14,f^=(n=(s^=(n=(b^=(n=(p^=(n=f+s|0)<<7|n>>>25)+f|0)<<9|n>>>23)+p|0)<<13|n>>>19)+b|0)<<18|n>>>14,m^=(n=(l^=(n=(a^=(n=(v^=(n=m+l|0)<<7|n>>>25)+m|0)<<9|n>>>23)+v|0)<<13|n>>>19)+a|0)<<18|n>>>14,w^=(n=(g^=(n=(c^=(n=(h^=(n=w+g|0)<<7|n>>>25)+w|0)<<9|n>>>23)+h|0)<<13|n>>>19)+c|0)<<18|n>>>14,o^=(n=(h^=(n=(a^=(n=(s^=(n=o+h|0)<<7|n>>>25)+o|0)<<9|n>>>23)+s|0)<<13|n>>>19)+a|0)<<18|n>>>14,f^=(n=(u^=(n=(c^=(n=(l^=(n=f+u|0)<<7|n>>>25)+f|0)<<9|n>>>23)+l|0)<<13|n>>>19)+c|0)<<18|n>>>14,m^=(n=(p^=(n=(d^=(n=(g^=(n=m+p|0)<<7|n>>>25)+m|0)<<9|n>>>23)+g|0)<<13|n>>>19)+d|0)<<18|n>>>14,w^=(n=(v^=(n=(b^=(n=(y^=(n=w+v|0)<<7|n>>>25)+w|0)<<9|n>>>23)+y|0)<<13|n>>>19)+b|0)<<18|n>>>14;t[0]=o>>>0&255,t[1]=o>>>8&255,t[2]=o>>>16&255,t[3]=o>>>24&255,t[4]=f>>>0&255,t[5]=f>>>8&255,t[6]=f>>>16&255,t[7]=f>>>24&255,t[8]=m>>>0&255,t[9]=m>>>8&255,t[10]=m>>>16&255,t[11]=m>>>24&255,t[12]=w>>>0&255,t[13]=w>>>8&255,t[14]=w>>>16&255,t[15]=w>>>24&255,t[16]=l>>>0&255,t[17]=l>>>8&255,t[18]=l>>>16&255,t[19]=l>>>24&255,t[20]=c>>>0&255,t[21]=c>>>8&255,t[22]=c>>>16&255,t[23]=c>>>24&255,t[24]=d>>>0&255,t[25]=d>>>8&255,t[26]=d>>>16&255,t[27]=d>>>24&255,t[28]=p>>>0&255,t[29]=p>>>8&255,t[30]=p>>>16&255,t[31]=p>>>24&255}(t,e,r,i)}var w=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function _(t,e,r,i,n,o,s){var a,h,u=new Uint8Array(16),f=new Uint8Array(64);for(h=0;h<16;h++)u[h]=0;for(h=0;h<8;h++)u[h]=o[h];for(;n>=64;){for(b(f,u,s,w),h=0;h<64;h++)t[e+h]=r[i+h]^f[h];for(a=1,h=8;h<16;h++)a=a+(255&u[h])|0,u[h]=255&a,a>>>=8;n-=64,e+=64,i+=64}if(n>0)for(b(f,u,s,w),h=0;h=64;){for(b(h,a,n,w),s=0;s<64;s++)t[e+s]=h[s];for(o=1,s=8;s<16;s++)o=o+(255&a[s])|0,a[s]=255&o,o>>>=8;r-=64,e+=64}if(r>0)for(b(h,a,n,w),s=0;s>>13|r<<3),i=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(r>>>10|i<<6),n=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(i>>>7|n<<9),o=255&t[8]|(255&t[9])<<8,this.r[4]=255&(n>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(s>>>11|a<<5),h=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(a>>>8|h<<8),this.r[9]=h>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function A(t,e,r,i,n,o){var s=new x(o);return s.update(r,i,n),s.finish(t,e),0}function E(t,e,r,i,n,o){var s=new Uint8Array(16);return A(s,0,r,i,n,o),g(t,e,s,0)}function I(t,e,r,i,n){var o;if(r<32)return-1;for(S(t,0,e,0,r,i,n),A(t,16,t,32,r-32,t),o=0;o<16;o++)t[o]=0;return 0}function T(t,e,r,i,n){var o,s=new Uint8Array(32);if(r<32)return-1;if(k(s,0,32,i,n),0!==E(e,16,e,32,r-32,s))return-1;for(S(t,0,e,0,r,i,n),o=0;o<32;o++)t[o]=0;return 0}function P(t,e){var r;for(r=0;r<16;r++)t[r]=0|e[r]}function B(t){var e,r,i=1;for(e=0;e<16;e++)r=t[e]+i+65535,i=Math.floor(r/65536),t[e]=r-65536*i;t[0]+=i-1+37*(i-1)}function C(t,e,r){for(var i,n=~(r-1),o=0;o<16;o++)i=n&(t[o]^e[o]),t[o]^=i,e[o]^=i}function L(t,r){var i,n,o,s=e(),a=e();for(i=0;i<16;i++)a[i]=r[i];for(B(a),B(a),B(a),n=0;n<2;n++){for(s[0]=a[0]-65517,i=1;i<15;i++)s[i]=a[i]-65535-(s[i-1]>>16&1),s[i-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,C(a,s,1-o)}for(i=0;i<16;i++)t[2*i]=255&a[i],t[2*i+1]=a[i]>>8}function O(t,e){var r=new Uint8Array(32),i=new Uint8Array(32);return L(r,t),L(i,e),y(r,0,i,0)}function R(t){var e=new Uint8Array(32);return L(e,t),1&e[0]}function j(t,e){var r;for(r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function N(t,e,r){for(var i=0;i<16;i++)t[i]=e[i]+r[i]}function D(t,e,r){for(var i=0;i<16;i++)t[i]=e[i]-r[i]}function U(t,e,r){var i,n,o=0,s=0,a=0,h=0,u=0,f=0,l=0,c=0,d=0,p=0,m=0,g=0,y=0,b=0,v=0,w=0,_=0,M=0,k=0,S=0,x=0,A=0,E=0,I=0,T=0,P=0,B=0,C=0,L=0,O=0,R=0,j=r[0],N=r[1],D=r[2],U=r[3],q=r[4],F=r[5],H=r[6],z=r[7],W=r[8],K=r[9],V=r[10],$=r[11],G=r[12],Z=r[13],J=r[14],Y=r[15];o+=(i=e[0])*j,s+=i*N,a+=i*D,h+=i*U,u+=i*q,f+=i*F,l+=i*H,c+=i*z,d+=i*W,p+=i*K,m+=i*V,g+=i*$,y+=i*G,b+=i*Z,v+=i*J,w+=i*Y,s+=(i=e[1])*j,a+=i*N,h+=i*D,u+=i*U,f+=i*q,l+=i*F,c+=i*H,d+=i*z,p+=i*W,m+=i*K,g+=i*V,y+=i*$,b+=i*G,v+=i*Z,w+=i*J,_+=i*Y,a+=(i=e[2])*j,h+=i*N,u+=i*D,f+=i*U,l+=i*q,c+=i*F,d+=i*H,p+=i*z,m+=i*W,g+=i*K,y+=i*V,b+=i*$,v+=i*G,w+=i*Z,_+=i*J,M+=i*Y,h+=(i=e[3])*j,u+=i*N,f+=i*D,l+=i*U,c+=i*q,d+=i*F,p+=i*H,m+=i*z,g+=i*W,y+=i*K,b+=i*V,v+=i*$,w+=i*G,_+=i*Z,M+=i*J,k+=i*Y,u+=(i=e[4])*j,f+=i*N,l+=i*D,c+=i*U,d+=i*q,p+=i*F,m+=i*H,g+=i*z,y+=i*W,b+=i*K,v+=i*V,w+=i*$,_+=i*G,M+=i*Z,k+=i*J,S+=i*Y,f+=(i=e[5])*j,l+=i*N,c+=i*D,d+=i*U,p+=i*q,m+=i*F,g+=i*H,y+=i*z,b+=i*W,v+=i*K,w+=i*V,_+=i*$,M+=i*G,k+=i*Z,S+=i*J,x+=i*Y,l+=(i=e[6])*j,c+=i*N,d+=i*D,p+=i*U,m+=i*q,g+=i*F,y+=i*H,b+=i*z,v+=i*W,w+=i*K,_+=i*V,M+=i*$,k+=i*G,S+=i*Z,x+=i*J,A+=i*Y,c+=(i=e[7])*j,d+=i*N,p+=i*D,m+=i*U,g+=i*q,y+=i*F,b+=i*H,v+=i*z,w+=i*W,_+=i*K,M+=i*V,k+=i*$,S+=i*G,x+=i*Z,A+=i*J,E+=i*Y,d+=(i=e[8])*j,p+=i*N,m+=i*D,g+=i*U,y+=i*q,b+=i*F,v+=i*H,w+=i*z,_+=i*W,M+=i*K,k+=i*V,S+=i*$,x+=i*G,A+=i*Z,E+=i*J,I+=i*Y,p+=(i=e[9])*j,m+=i*N,g+=i*D,y+=i*U,b+=i*q,v+=i*F,w+=i*H,_+=i*z,M+=i*W,k+=i*K,S+=i*V,x+=i*$,A+=i*G,E+=i*Z,I+=i*J,T+=i*Y,m+=(i=e[10])*j,g+=i*N,y+=i*D,b+=i*U,v+=i*q,w+=i*F,_+=i*H,M+=i*z,k+=i*W,S+=i*K,x+=i*V,A+=i*$,E+=i*G,I+=i*Z,T+=i*J,P+=i*Y,g+=(i=e[11])*j,y+=i*N,b+=i*D,v+=i*U,w+=i*q,_+=i*F,M+=i*H,k+=i*z,S+=i*W,x+=i*K,A+=i*V,E+=i*$,I+=i*G,T+=i*Z,P+=i*J,B+=i*Y,y+=(i=e[12])*j,b+=i*N,v+=i*D,w+=i*U,_+=i*q,M+=i*F,k+=i*H,S+=i*z,x+=i*W,A+=i*K,E+=i*V,I+=i*$,T+=i*G,P+=i*Z,B+=i*J,C+=i*Y,b+=(i=e[13])*j,v+=i*N,w+=i*D,_+=i*U,M+=i*q,k+=i*F,S+=i*H,x+=i*z,A+=i*W,E+=i*K,I+=i*V,T+=i*$,P+=i*G,B+=i*Z,C+=i*J,L+=i*Y,v+=(i=e[14])*j,w+=i*N,_+=i*D,M+=i*U,k+=i*q,S+=i*F,x+=i*H,A+=i*z,E+=i*W,I+=i*K,T+=i*V,P+=i*$,B+=i*G,C+=i*Z,L+=i*J,O+=i*Y,w+=(i=e[15])*j,s+=38*(M+=i*D),a+=38*(k+=i*U),h+=38*(S+=i*q),u+=38*(x+=i*F),f+=38*(A+=i*H),l+=38*(E+=i*z),c+=38*(I+=i*W),d+=38*(T+=i*K),p+=38*(P+=i*V),m+=38*(B+=i*$),g+=38*(C+=i*G),y+=38*(L+=i*Z),b+=38*(O+=i*J),v+=38*(R+=i*Y),o=(i=(o+=38*(_+=i*N))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),s=(i=s+n+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),b=(i=b+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),w=(i=w+n+65535)-65536*(n=Math.floor(i/65536)),o=(i=(o+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),s=(i=s+n+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),b=(i=b+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),w=(i=w+n+65535)-65536*(n=Math.floor(i/65536)),o+=n-1+37*(n-1),t[0]=o,t[1]=s,t[2]=a,t[3]=h,t[4]=u,t[5]=f,t[6]=l,t[7]=c,t[8]=d,t[9]=p,t[10]=m,t[11]=g,t[12]=y,t[13]=b,t[14]=v,t[15]=w}function q(t,e){U(t,e,e)}function F(t,r){var i,n=e();for(i=0;i<16;i++)n[i]=r[i];for(i=253;i>=0;i--)q(n,n),2!==i&&4!==i&&U(n,n,r);for(i=0;i<16;i++)t[i]=n[i]}function H(t,r){var i,n=e();for(i=0;i<16;i++)n[i]=r[i];for(i=250;i>=0;i--)q(n,n),1!==i&&U(n,n,r);for(i=0;i<16;i++)t[i]=n[i]}function z(t,r,i){var n,o,s=new Uint8Array(32),a=new Float64Array(80),u=e(),f=e(),l=e(),c=e(),d=e(),p=e();for(o=0;o<31;o++)s[o]=r[o];for(s[31]=127&r[31]|64,s[0]&=248,j(a,i),o=0;o<16;o++)f[o]=a[o],c[o]=u[o]=l[o]=0;for(u[0]=c[0]=1,o=254;o>=0;--o)C(u,f,n=s[o>>>3]>>>(7&o)&1),C(l,c,n),N(d,u,l),D(u,u,l),N(l,f,c),D(f,f,c),q(c,d),q(p,u),U(u,l,u),U(l,f,d),N(d,u,l),D(u,u,l),q(f,u),D(l,c,p),U(u,l,h),N(u,u,c),U(l,l,u),U(u,c,p),U(c,f,a),q(f,d),C(u,f,n),C(l,c,n);for(o=0;o<16;o++)a[o+16]=u[o],a[o+32]=l[o],a[o+48]=f[o],a[o+64]=c[o];var m=a.subarray(32),g=a.subarray(16);return F(m,m),U(g,g,m),L(t,g),0}function W(t,e){return z(t,e,o)}function K(t,e){return i(e,32),W(t,e)}function V(t,e,r){var i=new Uint8Array(32);return z(i,r,e),v(t,n,i,w)}x.prototype.blocks=function(t,e,r){for(var i,n,o,s,a,h,u,f,l,c,d,p,m,g,y,b,v,w,_,M=this.fin?0:2048,k=this.h[0],S=this.h[1],x=this.h[2],A=this.h[3],E=this.h[4],I=this.h[5],T=this.h[6],P=this.h[7],B=this.h[8],C=this.h[9],L=this.r[0],O=this.r[1],R=this.r[2],j=this.r[3],N=this.r[4],D=this.r[5],U=this.r[6],q=this.r[7],F=this.r[8],H=this.r[9];r>=16;)c=l=0,c+=(k+=8191&(i=255&t[e+0]|(255&t[e+1])<<8))*L,c+=(S+=8191&(i>>>13|(n=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*H),c+=(x+=8191&(n>>>10|(o=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*F),c+=(A+=8191&(o>>>7|(s=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*q),l=(c+=(E+=8191&(s>>>4|(a=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*U))>>>13,c&=8191,c+=(I+=a>>>1&8191)*(5*D),c+=(T+=8191&(a>>>14|(h=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*N),c+=(P+=8191&(h>>>11|(u=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*j),c+=(B+=8191&(u>>>8|(f=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*R),d=l+=(c+=(C+=f>>>5|M)*(5*O))>>>13,d+=k*O,d+=S*L,d+=x*(5*H),d+=A*(5*F),l=(d+=E*(5*q))>>>13,d&=8191,d+=I*(5*U),d+=T*(5*D),d+=P*(5*N),d+=B*(5*j),l+=(d+=C*(5*R))>>>13,d&=8191,p=l,p+=k*R,p+=S*O,p+=x*L,p+=A*(5*H),l=(p+=E*(5*F))>>>13,p&=8191,p+=I*(5*q),p+=T*(5*U),p+=P*(5*D),p+=B*(5*N),m=l+=(p+=C*(5*j))>>>13,m+=k*j,m+=S*R,m+=x*O,m+=A*L,l=(m+=E*(5*H))>>>13,m&=8191,m+=I*(5*F),m+=T*(5*q),m+=P*(5*U),m+=B*(5*D),g=l+=(m+=C*(5*N))>>>13,g+=k*N,g+=S*j,g+=x*R,g+=A*O,l=(g+=E*L)>>>13,g&=8191,g+=I*(5*H),g+=T*(5*F),g+=P*(5*q),g+=B*(5*U),y=l+=(g+=C*(5*D))>>>13,y+=k*D,y+=S*N,y+=x*j,y+=A*R,l=(y+=E*O)>>>13,y&=8191,y+=I*L,y+=T*(5*H),y+=P*(5*F),y+=B*(5*q),b=l+=(y+=C*(5*U))>>>13,b+=k*U,b+=S*D,b+=x*N,b+=A*j,l=(b+=E*R)>>>13,b&=8191,b+=I*O,b+=T*L,b+=P*(5*H),b+=B*(5*F),v=l+=(b+=C*(5*q))>>>13,v+=k*q,v+=S*U,v+=x*D,v+=A*N,l=(v+=E*j)>>>13,v&=8191,v+=I*R,v+=T*O,v+=P*L,v+=B*(5*H),w=l+=(v+=C*(5*F))>>>13,w+=k*F,w+=S*q,w+=x*U,w+=A*D,l=(w+=E*N)>>>13,w&=8191,w+=I*j,w+=T*R,w+=P*O,w+=B*L,_=l+=(w+=C*(5*H))>>>13,_+=k*H,_+=S*F,_+=x*q,_+=A*U,l=(_+=E*D)>>>13,_&=8191,_+=I*N,_+=T*j,_+=P*R,_+=B*O,k=c=8191&(l=(l=((l+=(_+=C*L)>>>13)<<2)+l|0)+(c&=8191)|0),S=d+=l>>>=13,x=p&=8191,A=m&=8191,E=g&=8191,I=y&=8191,T=b&=8191,P=v&=8191,B=w&=8191,C=_&=8191,e+=16,r-=16;this.h[0]=k,this.h[1]=S,this.h[2]=x,this.h[3]=A,this.h[4]=E,this.h[5]=I,this.h[6]=T,this.h[7]=P,this.h[8]=B,this.h[9]=C},x.prototype.finish=function(t,e){var r,i,n,o,s=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this.h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,i=(1^r)-1,o=0;o<10;o++)s[o]&=i;for(i=~i,o=0;o<10;o++)this.h[o]=this.h[o]&i|s[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),n=this.h[0]+this.pad[0],this.h[0]=65535&n,o=1;o<8;o++)n=(this.h[o]+this.pad[o]|0)+(n>>>16)|0,this.h[o]=65535&n;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},x.prototype.update=function(t,e,r){var i,n;if(this.leftover){for((n=16-this.leftover)>r&&(n=r),i=0;i=16&&(n=r-r%16,this.blocks(t,e,n),e+=n,r-=n),r){for(i=0;i=128;){for(M=0;M<16;M++)k=8*M+G,P[M]=r[k+0]<<24|r[k+1]<<16|r[k+2]<<8|r[k+3],B[M]=r[k+4]<<24|r[k+5]<<16|r[k+6]<<8|r[k+7];for(M=0;M<80;M++)if(n=C,o=L,s=O,a=R,h=j,u=N,f=D,c=q,d=F,p=H,m=z,g=W,y=K,b=V,A=65535&(x=$),E=x>>>16,I=65535&(S=U),T=S>>>16,A+=65535&(x=(W>>>14|j<<18)^(W>>>18|j<<14)^(j>>>9|W<<23)),E+=x>>>16,I+=65535&(S=(j>>>14|W<<18)^(j>>>18|W<<14)^(W>>>9|j<<23)),T+=S>>>16,A+=65535&(x=W&K^~W&V),E+=x>>>16,I+=65535&(S=j&N^~j&D),T+=S>>>16,S=Z[2*M],A+=65535&(x=Z[2*M+1]),E+=x>>>16,I+=65535&S,T+=S>>>16,S=P[M%16],E+=(x=B[M%16])>>>16,I+=65535&S,T+=S>>>16,I+=(E+=(A+=65535&x)>>>16)>>>16,A=65535&(x=_=65535&A|E<<16),E=x>>>16,I=65535&(S=w=65535&I|(T+=I>>>16)<<16),T=S>>>16,A+=65535&(x=(q>>>28|C<<4)^(C>>>2|q<<30)^(C>>>7|q<<25)),E+=x>>>16,I+=65535&(S=(C>>>28|q<<4)^(q>>>2|C<<30)^(q>>>7|C<<25)),T+=S>>>16,E+=(x=q&F^q&H^F&H)>>>16,I+=65535&(S=C&L^C&O^L&O),T+=S>>>16,l=65535&(I+=(E+=(A+=65535&x)>>>16)>>>16)|(T+=I>>>16)<<16,v=65535&A|E<<16,A=65535&(x=m),E=x>>>16,I=65535&(S=a),T=S>>>16,E+=(x=_)>>>16,I+=65535&(S=w),T+=S>>>16,L=n,O=o,R=s,j=a=65535&(I+=(E+=(A+=65535&x)>>>16)>>>16)|(T+=I>>>16)<<16,N=h,D=u,U=f,C=l,F=c,H=d,z=p,W=m=65535&A|E<<16,K=g,V=y,$=b,q=v,M%16==15)for(k=0;k<16;k++)S=P[k],A=65535&(x=B[k]),E=x>>>16,I=65535&S,T=S>>>16,S=P[(k+9)%16],A+=65535&(x=B[(k+9)%16]),E+=x>>>16,I+=65535&S,T+=S>>>16,w=P[(k+1)%16],A+=65535&(x=((_=B[(k+1)%16])>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25)),E+=x>>>16,I+=65535&(S=(w>>>1|_<<31)^(w>>>8|_<<24)^w>>>7),T+=S>>>16,w=P[(k+14)%16],E+=(x=((_=B[(k+14)%16])>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26))>>>16,I+=65535&(S=(w>>>19|_<<13)^(_>>>29|w<<3)^w>>>6),T+=S>>>16,T+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,P[k]=65535&I|T<<16,B[k]=65535&A|E<<16;A=65535&(x=q),E=x>>>16,I=65535&(S=C),T=S>>>16,S=t[0],E+=(x=e[0])>>>16,I+=65535&S,T+=S>>>16,T+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[0]=C=65535&I|T<<16,e[0]=q=65535&A|E<<16,A=65535&(x=F),E=x>>>16,I=65535&(S=L),T=S>>>16,S=t[1],E+=(x=e[1])>>>16,I+=65535&S,T+=S>>>16,T+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[1]=L=65535&I|T<<16,e[1]=F=65535&A|E<<16,A=65535&(x=H),E=x>>>16,I=65535&(S=O),T=S>>>16,S=t[2],E+=(x=e[2])>>>16,I+=65535&S,T+=S>>>16,T+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[2]=O=65535&I|T<<16,e[2]=H=65535&A|E<<16,A=65535&(x=z),E=x>>>16,I=65535&(S=R),T=S>>>16,S=t[3],E+=(x=e[3])>>>16,I+=65535&S,T+=S>>>16,T+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[3]=R=65535&I|T<<16,e[3]=z=65535&A|E<<16,A=65535&(x=W),E=x>>>16,I=65535&(S=j),T=S>>>16,S=t[4],E+=(x=e[4])>>>16,I+=65535&S,T+=S>>>16,T+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[4]=j=65535&I|T<<16,e[4]=W=65535&A|E<<16,A=65535&(x=K),E=x>>>16,I=65535&(S=N),T=S>>>16,S=t[5],E+=(x=e[5])>>>16,I+=65535&S,T+=S>>>16,T+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[5]=N=65535&I|T<<16,e[5]=K=65535&A|E<<16,A=65535&(x=V),E=x>>>16,I=65535&(S=D),T=S>>>16,S=t[6],E+=(x=e[6])>>>16,I+=65535&S,T+=S>>>16,T+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[6]=D=65535&I|T<<16,e[6]=V=65535&A|E<<16,A=65535&(x=$),E=x>>>16,I=65535&(S=U),T=S>>>16,S=t[7],E+=(x=e[7])>>>16,I+=65535&S,T+=S>>>16,T+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[7]=U=65535&I|T<<16,e[7]=$=65535&A|E<<16,G+=128,i-=128}return i}function Y(t,e,r){var i,n=new Int32Array(8),o=new Int32Array(8),s=new Uint8Array(256),a=r;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,J(n,o,e,r),r%=128,i=0;i=0;--n)Q(t,e,i=r[n/8|0]>>(7&n)&1),X(e,t),X(t,t),Q(t,e,i)}function rt(t,r){var i=[e(),e(),e(),e()];P(i[0],l),P(i[1],c),P(i[2],a),U(i[3],l,c),et(t,i,r)}function it(t,r,n){var o,s=new Uint8Array(64),a=[e(),e(),e(),e()];for(n||i(r,32),Y(s,r,32),s[0]&=248,s[31]&=127,s[31]|=64,rt(a,s),tt(t,a),o=0;o<32;o++)r[o+32]=t[o];return 0}var nt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ot(t,e){var r,i,n,o;for(i=63;i>=32;--i){for(r=0,n=i-32,o=i-12;n>4)*nt[n],r=e[n]>>8,e[n]&=255;for(n=0;n<32;n++)e[n]-=r*nt[n];for(i=0;i<32;i++)e[i+1]+=e[i]>>8,t[i]=255&e[i]}function st(t){var e,r=new Float64Array(64);for(e=0;e<64;e++)r[e]=t[e];for(e=0;e<64;e++)t[e]=0;ot(t,r)}function at(t,r,i,n){var o,s,a=new Uint8Array(64),h=new Uint8Array(64),u=new Uint8Array(64),f=new Float64Array(64),l=[e(),e(),e(),e()];Y(a,n,32),a[0]&=248,a[31]&=127,a[31]|=64;var c=i+64;for(o=0;o>7&&D(t[0],s,t[0]),U(t[3],t[0],t[1]),0)}(c,n))return-1;for(o=0;o=0},t.sign.keyPair=function(){var t=new Uint8Array(ft),e=new Uint8Array(lt);return it(t,e),{publicKey:t,secretKey:e}},t.sign.keyPair.fromSecretKey=function(t){if(dt(t),t.length!==lt)throw new Error("bad secret key size");for(var e=new Uint8Array(ft),r=0;r{t.exports=function(t,e){if(!(e>=t.length||e<0)){var r=t.pop();if(e{function e(t){try{if(!globalThis.localStorage)return!1}catch(t){return!1}var e=globalThis.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,r){if(e("noDeprecation"))return t;var i=!1;return function(){if(!i){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return t.apply(this,arguments)}}},1135:t=>{t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},9032:(t,e,r)=>{"use strict";var i=r(7244),n=r(8184),o=r(5767),s=r(5680);function a(t){return t.call.bind(t)}var h="undefined"!=typeof BigInt,u="undefined"!=typeof Symbol,f=a(Object.prototype.toString),l=a(Number.prototype.valueOf),c=a(String.prototype.valueOf),d=a(Boolean.prototype.valueOf);if(h)var p=a(BigInt.prototype.valueOf);if(u)var m=a(Symbol.prototype.valueOf);function g(t,e){if("object"!=typeof t)return!1;try{return e(t),!0}catch(t){return!1}}function y(t){return"[object Map]"===f(t)}function b(t){return"[object Set]"===f(t)}function v(t){return"[object WeakMap]"===f(t)}function w(t){return"[object WeakSet]"===f(t)}function _(t){return"[object ArrayBuffer]"===f(t)}function M(t){return"undefined"!=typeof ArrayBuffer&&(_.working?_(t):t instanceof ArrayBuffer)}function k(t){return"[object DataView]"===f(t)}function S(t){return"undefined"!=typeof DataView&&(k.working?k(t):t instanceof DataView)}e.isArgumentsObject=i,e.isGeneratorFunction=n,e.isTypedArray=s,e.isPromise=function(t){return"undefined"!=typeof Promise&&t instanceof Promise||null!==t&&"object"==typeof t&&"function"==typeof t.then&&"function"==typeof t.catch},e.isArrayBufferView=function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):s(t)||S(t)},e.isUint8Array=function(t){return"Uint8Array"===o(t)},e.isUint8ClampedArray=function(t){return"Uint8ClampedArray"===o(t)},e.isUint16Array=function(t){return"Uint16Array"===o(t)},e.isUint32Array=function(t){return"Uint32Array"===o(t)},e.isInt8Array=function(t){return"Int8Array"===o(t)},e.isInt16Array=function(t){return"Int16Array"===o(t)},e.isInt32Array=function(t){return"Int32Array"===o(t)},e.isFloat32Array=function(t){return"Float32Array"===o(t)},e.isFloat64Array=function(t){return"Float64Array"===o(t)},e.isBigInt64Array=function(t){return"BigInt64Array"===o(t)},e.isBigUint64Array=function(t){return"BigUint64Array"===o(t)},y.working="undefined"!=typeof Map&&y(new Map),e.isMap=function(t){return"undefined"!=typeof Map&&(y.working?y(t):t instanceof Map)},b.working="undefined"!=typeof Set&&b(new Set),e.isSet=function(t){return"undefined"!=typeof Set&&(b.working?b(t):t instanceof Set)},v.working="undefined"!=typeof WeakMap&&v(new WeakMap),e.isWeakMap=function(t){return"undefined"!=typeof WeakMap&&(v.working?v(t):t instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),e.isWeakSet=function(t){return w(t)},_.working="undefined"!=typeof ArrayBuffer&&_(new ArrayBuffer),e.isArrayBuffer=M,k.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&k(new DataView(new ArrayBuffer(1),0,1)),e.isDataView=S;var x="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function A(t){return"[object SharedArrayBuffer]"===f(t)}function E(t){return void 0!==x&&(void 0===A.working&&(A.working=A(new x)),A.working?A(t):t instanceof x)}function I(t){return g(t,l)}function T(t){return g(t,c)}function P(t){return g(t,d)}function B(t){return h&&g(t,p)}function C(t){return u&&g(t,m)}e.isSharedArrayBuffer=E,e.isAsyncFunction=function(t){return"[object AsyncFunction]"===f(t)},e.isMapIterator=function(t){return"[object Map Iterator]"===f(t)},e.isSetIterator=function(t){return"[object Set Iterator]"===f(t)},e.isGeneratorObject=function(t){return"[object Generator]"===f(t)},e.isWebAssemblyCompiledModule=function(t){return"[object WebAssembly.Module]"===f(t)},e.isNumberObject=I,e.isStringObject=T,e.isBooleanObject=P,e.isBigIntObject=B,e.isSymbolObject=C,e.isBoxedPrimitive=function(t){return I(t)||T(t)||P(t)||B(t)||C(t)},e.isAnyArrayBuffer=function(t){return"undefined"!=typeof Uint8Array&&(M(t)||E(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}))},537:(t,e,r)=>{var i=r(5606),n=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=n)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),a=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),g(r)?i.showHidden=r:r&&e._extend(i,r),w(i.showHidden)&&(i.showHidden=!1),w(i.depth)&&(i.depth=2),w(i.colors)&&(i.colors=!1),w(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=f),c(i,t,i.depth)}function f(t,e){var r=u.styles[e];return r?"["+u.colors[r][0]+"m"+t+"["+u.colors[r][1]+"m":t}function l(t,e){return t}function c(t,r,i){if(t.customInspect&&r&&x(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return v(n)||(n=c(t,n,i)),n}var o=function(t,e){if(w(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return b(e)?t.stylize(""+e,"number"):g(e)?t.stylize(""+e,"boolean"):y(e)?t.stylize("null","null"):void 0}(t,r);if(o)return o;var s=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(r)),S(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return d(r);if(0===s.length){if(x(r)){var h=r.name?": "+r.name:"";return t.stylize("[Function"+h+"]","special")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(k(r))return t.stylize(Date.prototype.toString.call(r),"date");if(S(r))return d(r)}var u,f="",l=!1,M=["{","}"];return m(r)&&(l=!0,M=["[","]"]),x(r)&&(f=" [Function"+(r.name?": "+r.name:"")+"]"),_(r)&&(f=" "+RegExp.prototype.toString.call(r)),k(r)&&(f=" "+Date.prototype.toUTCString.call(r)),S(r)&&(f=" "+d(r)),0!==s.length||l&&0!=r.length?i<0?_(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),u=l?function(t,e,r,i,n){for(var o=[],s=0,a=e.length;s60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}(u,f,M)):M[0]+f+M[1]}function d(t){return"["+Error.prototype.toString.call(t)+"]"}function p(t,e,r,i,n,o){var s,a,h;if((h=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?a=h.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):h.set&&(a=t.stylize("[Setter]","special")),T(i,n)||(s="["+n+"]"),a||(t.seen.indexOf(h.value)<0?(a=y(r)?c(t,h.value,null):c(t,h.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(t){return" "+t})).join("\n").slice(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),w(s)){if(o&&n.match(/^\d+$/))return a;(s=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.slice(1,-1),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function m(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function y(t){return null===t}function b(t){return"number"==typeof t}function v(t){return"string"==typeof t}function w(t){return void 0===t}function _(t){return M(t)&&"[object RegExp]"===A(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===A(t)}function S(t){return M(t)&&("[object Error]"===A(t)||t instanceof Error)}function x(t){return"function"==typeof t}function A(t){return Object.prototype.toString.call(t)}function E(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(t=t.toUpperCase(),!s[t])if(a.test(t)){var r=i.pid;s[t]=function(){var i=e.format.apply(e,arguments);console.error("%s %d: %s",t,r,i)}}else s[t]=function(){};return s[t]},e.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.types=r(9032),e.isArray=m,e.isBoolean=g,e.isNull=y,e.isNullOrUndefined=function(t){return null==t},e.isNumber=b,e.isString=v,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=w,e.isRegExp=_,e.types.isRegExp=_,e.isObject=M,e.isDate=k,e.types.isDate=k,e.isError=S,e.types.isNativeError=S,e.isFunction=x,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(1135);var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){var t,r;console.log("%s - %s",(r=[E((t=new Date).getHours()),E(t.getMinutes()),E(t.getSeconds())].join(":"),[t.getDate(),I[t.getMonth()],r].join(" ")),e.format.apply(e,arguments))},e.inherits=r(6698),e._extend=function(t,e){if(!e||!M(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var P="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function B(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(P&&t[P]){var e;if("function"!=typeof(e=t[P]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,P,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],o=0;o{"use strict";var i=r(2682),n=r(9209),o=r(487),s=r(8075),a=r(5795),h=s("Object.prototype.toString"),u=r(9092)(),f=globalThis,l=n(),c=s("String.prototype.slice"),d=Object.getPrototypeOf,p=s("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r-1?e:"Object"===e&&function(t){var e=!1;return i(m,(function(r,i){if(!e)try{r(t),e=c(i,1)}catch(t){}})),e}(t)}return a?function(t){var e=!1;return i(m,(function(r,i){if(!e)try{"$"+r(t)===i&&(e=c(i,1))}catch(t){}})),e}(t):null}},6587:t=>{t.exports=function t(e,r){if(e&&r)return t(e)(r);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach((function(t){i[t]=e[t]})),i;function i(){for(var t=new Array(arguments.length),r=0;r{},8982:()=>{},1551:()=>{},826:()=>{},61:()=>{},7936:()=>{},7790:()=>{},3776:()=>{},7965:()=>{},2532:()=>{},2123:()=>{},6089:()=>{},9368:()=>{},2205:()=>{},8173:()=>{},8849:()=>{},4688:()=>{},3208:()=>{},1069:()=>{},2376:()=>{},5340:()=>{},9838:()=>{},3779:()=>{},7199:()=>{},2799:()=>{},1281:()=>{},3095:()=>{},1438:()=>{},3643:()=>{},9748:()=>{},8585:()=>{},4206:()=>{},9334:()=>{},5725:()=>{},7237:()=>{},6636:()=>{},9209:(t,e,r)=>{"use strict";var i=r(6578),n=globalThis;t.exports=function(){for(var t=[],e=0;e{"use strict";r.d(e,{A:()=>p});var i=r(9639);function n(t){const e=t<0?1:0;return t=Math.abs(Number(t||1)),Math.floor(Math.log10(t))+1+e}function o(t){return ArrayBuffer.isView(t)?"arraybufferview":Array.isArray(t)?"array":t instanceof Number?"number":t instanceof Boolean?"boolean":t instanceof Set?"set":t instanceof Map?"map":t instanceof String?"string":t instanceof ArrayBuffer?"arraybuffer":typeof t}function s(t,e,r){const n=[];let o=null;return s._encode(n,t),o=(0,i.xW)(n),s.bytes=o.length,ArrayBuffer.isView(e)?(e.set(o,r),e):o}s.bytes=-1,s._floatConversionDetected=!1,s._encode=function(t,e){if(null!=e)switch(o(e)){case"object":s.dict(t,e);break;case"map":s.dictMap(t,e);break;case"array":s.list(t,e);break;case"set":s.listSet(t,e);break;case"string":s.string(t,e);break;case"number":case"boolean":s.number(t,e);break;case"arraybufferview":s.buffer(t,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));break;case"arraybuffer":s.buffer(t,new Uint8Array(e))}};const a=new Uint8Array([101]),h=new Uint8Array([100]),u=new Uint8Array([108]);s.buffer=function(t,e){t.push((0,i.L0)(e.length+":"),e)},s.string=function(t,e){t.push((0,i.L0)((0,i.L0)(e).byteLength+":"+e))},s.number=function(t,e){if(Number.isInteger(e))return t.push((0,i.L0)("i"+BigInt(e)+"e"));const r=2147483648,n=(e/r|0)*r+(e%r|0);t.push((0,i.L0)("i"+n+"e")),n===e||s._floatConversionDetected||(s._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value "'+e+'":','Bencoding only defines support for integers, value was converted to "'+n+'"'),console.trace())},s.dict=function(t,e){t.push(h);let r,i=0;const n=Object.keys(e).sort(),o=n.length;for(;i=48)i=10*i+(r-48);else if(o!==e||43!==r){if(o!==e||45!==r){if(46===r)break;throw new Error("not a number: buffer["+o+"] = "+r)}n=-1}}return i*n}function c(t,e,r,n){return null==t||0===t.length?null:("number"!=typeof e&&null==n&&(n=e,e=void 0),"number"!=typeof r&&null==n&&(n=r,r=void 0),c.position=0,c.encoding=n||null,c.data=ArrayBuffer.isView(t)?new Uint8Array(t.slice(e,r)):(0,i.L0)(t),c.bytes=c.data.length,c.next())}function d(t){if(null==t)return 0;const e=o(t);switch(e){case"arraybufferview":return function(t){const e=t.byteLength-t.byteOffset;return n(e)+1+e}(t);case"string":return function(t){const e=(0,i.L0)(t).byteLength;return n(e)+1+e}(t);case"array":case"set":return function(t){let e=2;for(const r of t)e+=d(r);return e}(t);case"number":return 1+n(Math.floor(t))+1;case"bigint":return 1+t.toString().length+1;case"object":return function(t){let e=2;const r=Object.keys(t);for(let o=0;o{"use strict";function i(t){return(t>>3)+Number(t%8!=0)}r.d(e,{A:()=>n});class n{get length(){return this.buffer.length<<3}constructor(t=0,e){const r=null==e?void 0:e.grow;this.grow=r?Number.isFinite(r)?i(r):r:0,this.buffer="number"==typeof t?new Uint8Array(i(t)):t}get(t){const e=t>>3;return e>t%8)}set(t,e=!0){const r=t>>3;if(e){if(r>=this.buffer.length){const t=Math.max(r+1,Math.min(2*this.buffer.length,this.grow));if(t<=this.grow){const e=new Uint8Array(t);e.set(this.buffer),this.buffer=e}}this.buffer[r]|=128>>t%8}else r>t%8))}setAll(t,e=0){const r=Math.min(i(e+t.length),this.grow);if(this.buffer.length>3,o=128>>e%8;for(let e=0;e=this.buffer.length)break;o=128}else o>>=1}forEach(t,e=0,r=8*this.buffer.length){let i=e>>3,n=128>>e%8;for(let o=e;o>=1}isEmpty(){for(let t=0;t{"use strict";r.d(e,{A:()=>P});var i=r(988),n=r(3033),o=r(1565),s=r(7833),a=r(8727),h=r(8179),u=r(9639),f=r(1035),l=r(1314);const c=s("bittorrent-protocol"),d=(0,u.L0)("BitTorrent protocol"),p=new Uint8Array([0,0,0,0]),m=new Uint8Array([0,0,0,1,0]),g=new Uint8Array([0,0,0,1,1]),y=new Uint8Array([0,0,0,1,2]),b=new Uint8Array([0,0,0,1,3]),v=[0,0,0,0,0,0,0,0],w=[0,0,0,3,9,0,0],_=new Uint8Array([0,0,0,1,14]),M=new Uint8Array([0,0,0,1,15]),k=new Uint8Array([0,0,0,0,0,0,0,0]),S=new Uint8Array([0,0,1,2]),x=new Uint8Array([0,0,0,2]);function A(t,e){for(let r=t.length;r--;)t[r]^=e[r];return t}class E{constructor(t,e,r,i){this.piece=t,this.offset=e,this.length=r,this.callback=i}}class I{constructor(){this.buffer=new Uint8Array}get(t){return!0}set(t){}}class T extends h.Duplex{constructor(t=null,e=0,r=!1){super(),this._debugId=(0,u.V5)((0,u.po)(4)),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=t,this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new n.A(0,{grow:4e5}),this.extensions={},this.peerExtensions={},this.requests=[],this.peerRequests=[],this.extendedMapping={},this.peerExtendedMapping={},this.extendedHandshake={},this.peerExtendedHandshake={},this.hasFast=!1,this.allowedFastSet=[],this.peerAllowedFastSet=[],this._ext={},this._nextExt=1,this.uploaded=0,this.downloaded=0,this.uploadSpeed=f(),this.downloadSpeed=f(),this._keepAliveInterval=null,this._timeout=null,this._timeoutMs=0,this._timeoutExpiresAt=null,this._finished=!1,this._parserSize=0,this._parser=null,this._buffer=[],this._bufferSize=0,this._peEnabled=r,r?(this._dh=o.createDiffieHellman("ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a36210000000000090563","hex",2),this._myPubKey=this._dh.generateKeys("hex")):this._myPubKey=null,this._peerPubKey=null,this._sharedSecret=null,this._peerCryptoProvide=[],this._cryptoHandshakeDone=!1,this._cryptoSyncPattern=null,this._waitMaxBytes=null,this._encryptionMethod=null,this._encryptGenerator=null,this._decryptGenerator=null,this._setGenerators=!1,this.once("finish",(()=>this._onFinish())),this.on("finish",this._onFinish),this._debug("type:",this.type),"tcpIncoming"===this.type&&this._peEnabled?this._determineHandshakeType():"tcpOutgoing"===this.type&&this._peEnabled&&0===e?this._parsePe2():this._parseHandshake(null)}setKeepAlive(t){this._debug("setKeepAlive %s",t),clearInterval(this._keepAliveInterval),!1!==t&&(this._keepAliveInterval=setInterval((()=>{this.keepAlive()}),55e3))}setTimeout(t,e){this._debug("setTimeout ms=%d unref=%s",t,e),this._timeoutMs=t,this._timeoutUnref=!!e,this._resetTimeout(!0)}destroy(){if(!this.destroyed)return this._debug("destroy"),this.end(),this}end(t){if(!this.destroyed&&!this.destroying)return this._debug("end"),this._onUninterested(),this._onChoke(),super.end(t)}use(t){const e=t.prototype.name;if(!e)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",e);const r=this._nextExt,i=new t(this);function n(){}"function"!=typeof i.onHandshake&&(i.onHandshake=n),"function"!=typeof i.onExtendedHandshake&&(i.onExtendedHandshake=n),"function"!=typeof i.onMessage&&(i.onMessage=n),this.extendedMapping[r]=e,this._ext[e]=i,this[e]=i,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(p)}sendPe1(){if(this._peEnabled){const t=Math.floor(513*Math.random()),e=(0,u.po)(t);this._push((0,u.xW)([(0,u.fk)(this._myPubKey),e]))}}sendPe2(){const t=Math.floor(513*Math.random()),e=(0,u.po)(t);this._push((0,u.xW)([(0,u.fk)(this._myPubKey),e]))}async sendPe3(t){await this.setEncrypt(this._sharedSecret,t);const e=await(0,u.tW)((0,u.fk)(this._utfToHex("req1")+this._sharedSecret)),r=A(await(0,u.tW)((0,u.fk)(this._utfToHex("req2")+t)),await(0,u.tW)((0,u.fk)(this._utfToHex("req3")+this._sharedSecret))),i=new DataView((0,u.po)(2).buffer).getUint16(0)%512,n=(0,u.po)(i);let o=new Uint8Array(14+i+2);o.set(k),o.set(S,8);const s=new DataView(o.buffer);s.setInt16(12,i),n.copy(o,14),s.setInt16(14+i,0),o=this._encryptHandshake(o),this._push((0,u.xW)([e,r,o]))}async sendPe4(t){await this.setEncrypt(this._sharedSecret,t);const e=new DataView((0,u.po)(2).buffer).getUint16(0)%512,r=(0,u.po)(e);let i=new Uint8Array(14+e);const n=new DataView(i.buffer);i.set(k),i.set(x,8),n.setInt16(12,e),i.set(r,14),i=this._encryptHandshake(i),this._push(i),this._cryptoHandshakeDone=!0,this._debug("completed crypto handshake")}handshake(t,e,r){let i,n;if("string"==typeof t?(t=t.toLowerCase(),i=(0,u.fk)(t)):(i=t,t=(0,u.V5)(i)),"string"==typeof e?n=(0,u.fk)(e):(n=e,e=(0,u.V5)(n)),this._infoHash=i,20!==i.length||20!==n.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",t,e,r);const o=new Uint8Array(v);this.extensions={extended:!0,dht:!(!r||!r.dht),fast:!(!r||!r.fast)},o[5]|=16,this.extensions.dht&&(o[7]|=1),this.extensions.fast&&(o[7]|=4),this.extensions.fast&&this.peerExtensions.fast&&(this._debug("fast extension is enabled"),this.hasFast=!0),this._push((0,u.xW)([d,o,i,n])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const t=Object.assign({},this.extendedHandshake);t.m={};for(const e in this.extendedMapping){const r=this.extendedMapping[e];t.m[r]=Number(e)}this.extended(0,i.A.encode(t)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking)if(this.amChoking=!0,this._debug("choke"),this._push(m),this.hasFast){let t=0;for(;this.peerRequests.length>t;){const e=this.peerRequests[t];this.allowedFastSet.includes(e.piece)?++t:this.reject(e.piece,e.offset,e.length)}}else for(;this.peerRequests.length;)this.peerRequests.pop()}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(g))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(y))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(b))}have(t){this._debug("have %d",t),this._message(4,[t],null)}bitfield(t){this._debug("bitfield"),ArrayBuffer.isView(t)||(t=t.buffer),this._message(5,[],t)}request(t,e,r,i){return i||(i=()=>{}),this._finished?i(new Error("wire is closed")):!this.peerChoking||this.hasFast&&this.peerAllowedFastSet.includes(t)?(this._debug("request index=%d offset=%d length=%d",t,e,r),this.requests.push(new E(t,e,r,i)),this._timeout||this._resetTimeout(!0),void this._message(6,[t,e,r],null)):i(new Error("peer is choking"))}piece(t,e,r){this._debug("piece index=%d offset=%d",t,e),this._message(7,[t,e],r),this.uploaded+=r.length,this.uploadSpeed(r.length),this.emit("upload",r.length)}cancel(t,e,r){this._debug("cancel index=%d offset=%d length=%d",t,e,r),this._callback(this._pull(this.requests,t,e,r),new Error("request was cancelled"),null),this._message(8,[t,e,r],null)}port(t){this._debug("port %d",t);const e=new Uint8Array(w);new DataView(e.buffer).setUint16(5,t),this._push(e)}suggest(t){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("suggest %d",t),this._message(13,[t],null)}haveAll(){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("have-all"),this._push(_)}haveNone(){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("have-none"),this._push(M)}reject(t,e,r){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("reject index=%d offset=%d length=%d",t,e,r),this._pull(this.peerRequests,t,e,r),this._message(16,[t,e,r],null)}allowedFast(t){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("allowed-fast %d",t),this.allowedFastSet.includes(t)||this.allowedFastSet.push(t),this._message(17,[t],null)}extended(t,e){if(this._debug("extended ext=%s",t),"string"==typeof t&&this.peerExtendedMapping[t]&&(t=this.peerExtendedMapping[t]),"number"!=typeof t)throw new Error(`Unrecognized extension: ${t}`);{const r=new Uint8Array([t]),n=ArrayBuffer.isView(e)?e:i.A.encode(e);this._message(20,[],(0,u.xW)([r,n]))}}async setEncrypt(t,e){let r,i,n,o;switch(this.type){case"tcpIncoming":r=await(0,u.tW)((0,u.fk)(this._utfToHex("keyB")+t+e)),n=await(0,u.tW)((0,u.fk)(this._utfToHex("keyA")+t+e)),i=[];for(const t of r.values())i.push(t);o=[];for(const t of n.values())o.push(t);this._encryptGenerator=new a(i),this._decryptGenerator=new a(o);break;case"tcpOutgoing":r=await(0,u.tW)((0,u.fk)(this._utfToHex("keyA")+t+e)),n=await(0,u.tW)((0,u.fk)(this._utfToHex("keyB")+t+e)),i=[];for(const t of r.values())i.push(t);o=[];for(const t of n.values())o.push(t);this._encryptGenerator=new a(i),this._decryptGenerator=new a(o);break;default:return!1}for(let t=0;t<1024;t++)this._encryptGenerator.randomByte(),this._decryptGenerator.randomByte();return this._setGenerators=!0,!0}_message(t,e,r){const i=r?r.length:0,n=new Uint8Array(5+4*e.length),o=new DataView(n.buffer);o.setUint32(0,n.length+i-4),n[4]=t;for(let t=0;t{if(n===this._pull(this.peerRequests,t,e,r))return i?(this._debug("error satisfying request index=%d offset=%d length=%d (%s)",t,e,r,i.message),void(this.hasFast&&this.reject(t,e,r))):void this.piece(t,e,o)},n=new E(t,e,r,i);this.peerRequests.push(n),this.emit("request",t,e,r,i)}_onPiece(t,e,r){this._debug("got piece index=%d offset=%d",t,e),this._callback(this._pull(this.requests,t,e,r.length),null,r),this.downloaded+=r.length,this.downloadSpeed(r.length),this.emit("download",r.length),this.emit("piece",t,e,r)}_onCancel(t,e,r){this._debug("got cancel index=%d offset=%d length=%d",t,e,r),this._pull(this.peerRequests,t,e,r),this.emit("cancel",t,e,r)}_onPort(t){this._debug("got port %d",t),this.emit("port",t)}_onSuggest(t){if(!this.hasFast)return this._debug("Error: got suggest whereas fast extension is disabled"),void this.destroy();this._debug("got suggest %d",t),this.emit("suggest",t)}_onHaveAll(){if(!this.hasFast)return this._debug("Error: got have-all whereas fast extension is disabled"),void this.destroy();this._debug("got have-all"),this.peerPieces=new I,this.emit("have-all")}_onHaveNone(){if(!this.hasFast)return this._debug("Error: got have-none whereas fast extension is disabled"),void this.destroy();this._debug("got have-none"),this.emit("have-none")}_onReject(t,e,r){if(!this.hasFast)return this._debug("Error: got reject whereas fast extension is disabled"),void this.destroy();this._debug("got reject index=%d offset=%d length=%d",t,e,r),this._callback(this._pull(this.requests,t,e,r),new Error("request was rejected"),null),this.emit("reject",t,e,r)}_onAllowedFast(t){if(!this.hasFast)return this._debug("Error: got allowed-fast whereas fast extension is disabled"),void this.destroy();this._debug("got allowed-fast %d",t),this.peerAllowedFastSet.includes(t)||this.peerAllowedFastSet.push(t),this.peerAllowedFastSet.length>100&&this.peerAllowedFastSet.shift(),this.emit("allowed-fast",t)}_onExtended(t,e){if(0===t){let r;try{r=i.A.decode(e)}catch(t){this._debug("ignoring invalid extended handshake: %s",t.message||t)}if(!r)return;if(this.peerExtendedHandshake=r,"object"==typeof r.m)for(const t in r.m)this.peerExtendedMapping[t]=Number(r.m[t].toString());for(const t in this._ext)this.peerExtendedMapping[t]&&this._ext[t].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[t]&&(t=this.extendedMapping[t],this._ext[t]&&this._ext[t].onMessage(e)),this._debug("got extended message ext=%s",t),this.emit("extended",t,e)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(t,e){if(2===this._encryptionMethod&&this._cryptoHandshakeDone&&(t=this._decrypt(t)),this._bufferSize+=t.length,this._buffer.push(t),this._buffer.length>1&&(this._buffer=[(0,u.xW)(this._buffer,this._bufferSize)]),this._cryptoSyncPattern){const e=this._buffer[0].indexOf(this._cryptoSyncPattern);if(-1!==e)this._buffer[0]=this._buffer[0].slice(e+this._cryptoSyncPattern.length),this._bufferSize-=e+this._cryptoSyncPattern.length,this._cryptoSyncPattern=null;else if(this._bufferSize+t.length>this._waitMaxBytes+this._cryptoSyncPattern.length)return this._debug("Error: could not resynchronize"),void this.destroy()}for(;this._bufferSize>=this._parserSize&&!this._cryptoSyncPattern;)if(0===this._parserSize)this._parser(new Uint8Array);else{const t=this._buffer[0];this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[t.slice(this._parserSize)]:[],this._parser(t.slice(0,this._parserSize))}e(null)}_callback(t,e,r){t&&(this._resetTimeout(!this.peerChoking&&!this._finished),t.callback(e,r))}_resetTimeout(t){if(!t||!this._timeoutMs||!this.requests.length)return clearTimeout(this._timeout),this._timeout=null,void(this._timeoutExpiresAt=null);const e=Date.now()+this._timeoutMs;if(this._timeout){if(e-this._timeoutExpiresAt<.05*this._timeoutMs)return;clearTimeout(this._timeout)}this._timeoutExpiresAt=e,this._timeout=setTimeout((()=>this._onTimeout()),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref()}_parse(t,e){this._parserSize=t,this._parser=e}_parseUntil(t,e){this._cryptoSyncPattern=t,this._waitMaxBytes=e}_onMessageLength(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(0);e>0?this._parse(e,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))}_onMessage(t){this._parse(4,this._onMessageLength);const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.getUint32(1));case 5:return this._onBitField(t.slice(1));case 6:return this._onRequest(e.getUint32(1),e.getUint32(5),e.getUint32(9));case 7:return this._onPiece(e.getUint32(1),e.getUint32(5),t.slice(9));case 8:return this._onCancel(e.getUint32(1),e.getUint32(5),e.getUint32(9));case 9:return this._onPort(e.getUint16(1));case 13:return this._onSuggest(e.getUint32(1));case 14:return this._onHaveAll();case 15:return this._onHaveNone();case 16:return this._onReject(e.getUint32(1),e.getUint32(5),e.getUint32(9));case 17:return this._onAllowedFast(e.getUint32(1));case 20:return this._onExtended(t[1],t.slice(2));default:return this._debug("got unknown message"),this.emit("unknownmessage",t)}}_determineHandshakeType(){this._parse(1,(t=>{const e=t[0];19===e?this._parse(e+48,this._onHandshakeBuffer):this._parsePe1(t)}))}_parsePe1(t){this._parse(95,(e=>{this._onPe1((0,u.xW)([t,e])),this._parsePe3()}))}_parsePe2(){this._parse(96,(t=>{for(this._onPe2(t);!this._setGenerators;);this._parsePe4()}))}async _parsePe3(){const t=await(0,u.tW)((0,u.fk)(this._utfToHex("req1")+this._sharedSecret));this._parseUntil(t,512),this._parse(20,(t=>{for(this._onPe3(t);!this._setGenerators;);this._parsePe3Encrypted()}))}_parsePe3Encrypted(){this._parse(14,(t=>{const e=this._decryptHandshake(t.slice(0,8)),r=this._decryptHandshake(t.slice(8,12)),i=new DataView(this._decryptHandshake(t.slice(12,14)).buffer).getUint16(0);this._parse(i,(t=>{t=this._decryptHandshake(t),this._parse(2,(i=>{const n=new DataView(this._decryptHandshake(i).buffer).getUint16(0);this._parse(n,(i=>{i=this._decryptHandshake(i),this._onPe3Encrypted(e,r,t,i);const o=n?i[0]:null,s=n?i.slice(1,20):null;19===o&&"BitTorrent protocol"===(0,u.dU)(s)?this._onHandshakeBuffer(i.slice(1)):this._parseHandshake()}))}))}))}))}_parsePe4(){const t=this._decryptHandshake(k);this._parseUntil(t,512),this._parse(6,(t=>{const e=this._decryptHandshake(t.slice(0,4)),r=new DataView(this._decryptHandshake(t.slice(4,6)).buffer).getUint16(0);this._parse(r,(t=>{this._decryptHandshake(t),this._onPe4(e),this._parseHandshake(null)}))}))}_parseHandshake(){this._parse(1,(t=>{const e=t[0];if(19!==e)return this._debug("Error: wire not speaking BitTorrent protocol (%s)",e.toString()),void this.end();this._parse(e+48,this._onHandshakeBuffer)}))}_onHandshakeBuffer(t){const e=t.slice(0,19);if("BitTorrent protocol"!==(0,u.dU)(e))return this._debug("Error: wire not speaking BitTorrent protocol (%s)",(0,u.dU)(e)),void this.end();t=t.slice(19),this._onHandshake(t.slice(8,28),t.slice(28,48),{dht:!!(1&t[7]),fast:!!(4&t[7]),extended:!!(16&t[5])}),this._parse(4,this._onMessageLength)}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,(()=>{}));this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)}_debug(...t){t[0]=`[${this._debugId}] ${t[0]}`,c(...t)}_pull(t,e,r,i){for(let n=0;n{"use strict";r.d(e,{NJ:()=>y,V5:()=>s,dU:()=>p,HB:()=>b,xW:()=>h,LC:()=>u,tW:()=>S,fk:()=>a,Ht:()=>v,po:()=>x,L0:()=>g});const i="0123456789abcdef",n=[],o=[];for(let t=0;t<256;t++)n[t]=i[t>>4&15]+i[15&t],t<16&&(t<10?o[48+t]=t:o[87+t]=t);const s=t=>{const e=t.length;let r="",i=0;for(;i{const e=t.length>>1,r=e<<1,i=new Uint8Array(e);let n=0,s=0;for(;s{const r=t.length||0;if(!e){let i=r;for(;i--;)e+=t[i].length}const i=new Uint8Array(e);let n=e,o=r;for(;o--;)n-=t[o].length,i.set(t[o],n);return i},u=(t,e)=>{if(t.length!==e.length)return!1;for(let r=t.length;r>-1;r-=1)if(t[r]!==e[r])return!1;return!0};for(var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l="undefined"==typeof Uint8Array?[]:new Uint8Array(256),c=0;c<64;c++)l[f.charCodeAt(c)]=c;const d=new TextDecoder,p=(t,e)=>e?new TextDecoder(e).decode(t):d.decode(t),m=new TextEncoder,g=t=>m.encode(t),y=t=>function(t){var e,r=new Uint8Array(t),i=r.length,n="";for(e=0;e>2],n+=f[(3&r[e])<<4|r[e+1]>>4],n+=f[(15&r[e+1])<<2|r[e+2]>>6],n+=f[63&r[e+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(t),b=t=>{let e,r="",n=0;const o=t.length;for(;n>4]+i[15&e];return r},v=t=>{const e=a(t);if(e.length<=65536)return String.fromCharCode(...e);let r="",i=0;for(;i{if(!M)throw new Error("no web crypto support");"string"==typeof t&&(t=g(t));const i=new Uint8Array(await M.digest(r,t));return e?k[e](i):i},x=t=>{const e=new Uint8Array(t);return _.getRandomValues(e)}},5310:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>g,enableSecure:()=>m});var i=r(7007),n=r(8179),o=r(1314),s=r(7833),a=r(6458);const h="tcpIncoming",u="tcpOutgoing",f="utpIncoming",l="utpOutgoing",c="webSeed",d=s("webtorrent:peer");let p=!1;const m=()=>{p=!0};class g extends i{constructor(t,e){super(),this.id=t,this.type=e,d("new %s Peer %s",e,t),this.addr=null,this.conn=null,this.swarm=null,this.wire=null,this.source=null,this.connected=!1,this.destroyed=!1,this.timeout=null,this.retries=0,this.sentPe1=!1,this.sentPe2=!1,this.sentPe3=!1,this.sentPe4=!1,this.sentHandshake=!1}onConnect(){if(this.destroyed)return;this.connected=!0,d("Peer %s connected",this.id),clearTimeout(this.connectTimeout);const t=this.conn;t.once("end",(()=>{this.destroy()})),t.once("close",(()=>{this.destroy()})),t.once("finish",(()=>{this.destroy()})),t.once("error",(t=>{this.destroy(t)}));const e=this.wire=new a.A(this.type,this.retries,p);e.once("end",(()=>{this.destroy()})),e.once("close",(()=>{this.destroy()})),e.once("finish",(()=>{this.destroy()})),e.once("error",(t=>{this.destroy(t)})),e.once("pe1",(()=>{this.onPe1()})),e.once("pe2",(()=>{this.onPe2()})),e.once("pe3",(()=>{this.onPe3()})),e.once("pe4",(()=>{this.onPe4()})),e.once("handshake",((t,e)=>{this.onHandshake(t,e)})),this.startHandshakeTimeout(),this.setThrottlePipes(),this.swarm&&("tcpOutgoing"===this.type?p&&0===this.retries&&!this.sentPe1?this.sendPe1():this.sentHandshake||this.handshake():"tcpIncoming"===this.type||this.sentHandshake||this.handshake())}sendPe1(){this.wire.sendPe1(),this.sentPe1=!0}onPe1(){this.sendPe2()}sendPe2(){this.wire.sendPe2(),this.sentPe2=!0}onPe2(){this.sendPe3()}sendPe3(){this.wire.sendPe3(this.swarm.infoHash),this.sentPe3=!0}onPe3(t){this.swarm&&(this.swarm.infoHashHash!==t&&this.destroy(new Error("unexpected crypto handshake info hash for this swarm")),this.sendPe4())}sendPe4(){this.wire.sendPe4(this.swarm.infoHash),this.sentPe4=!0}onPe4(){this.sentHandshake||this.handshake()}clearPipes(){this.conn.unpipe(),this.wire.unpipe()}setThrottlePipes(){const t=this;(0,n.pipeline)(this.conn,this.throttleGroups.down.throttle(),new n.Transform({transform(e,r){t.emit("download",e.length),t.destroyed||r(null,e)}}),this.wire,this.throttleGroups.up.throttle(),new n.Transform({transform(e,r){t.emit("upload",e.length),t.destroyed||r(null,e)}}),this.conn)}onHandshake(t,e){if(!this.swarm)return;if(this.destroyed)return;if(this.swarm.destroyed)return this.destroy(new Error("swarm already destroyed"));if(t!==this.swarm.infoHash)return this.destroy(new Error("unexpected handshake info hash for this swarm"));if(e===this.swarm.peerId)return this.destroy(new Error("refusing to connect to ourselves"));d("Peer %s got handshake %s",this.id,t),clearTimeout(this.handshakeTimeout),this.retries=0;let r=this.addr;!r&&this.conn.remoteAddress&&this.conn.remotePort&&(r=`${this.conn.remoteAddress}:${this.conn.remotePort}`),this.swarm._onWire(this.wire,r),this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}handshake(){const t={dht:!this.swarm.private&&!!this.swarm.client.dht,fast:!0};this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,t),this.sentHandshake=!0}startConnectTimeout(){clearTimeout(this.connectTimeout),this.connectTimeout=setTimeout((()=>{this.destroy(new Error("connect timeout"))}),{webrtc:25e3,tcpOutgoing:5e3,utpOutgoing:5e3}[this.type]),this.connectTimeout.unref&&this.connectTimeout.unref()}startHandshakeTimeout(){clearTimeout(this.handshakeTimeout),this.handshakeTimeout=setTimeout((()=>{this.destroy(new Error("handshake timeout"))}),25e3),this.handshakeTimeout.unref&&this.handshakeTimeout.unref()}destroy(t){if(this.destroyed)return;this.destroyed=!0,this.connected=!1,d("destroy %s %s (error: %s)",this.type,this.id,t&&(t.message||t)),clearTimeout(this.connectTimeout),clearTimeout(this.handshakeTimeout);const e=this.swarm,r=this.conn,i=this.wire;this.swarm=null,this.conn=null,this.wire=null,e&&i&&o(e.wires,e.wires.indexOf(i)),r&&(r.on("error",(()=>{})),r.destroy()),i&&i.destroy(),e&&e.removePeer(this.id)}}g.TYPE_TCP_INCOMING=h,g.TYPE_TCP_OUTGOING=u,g.TYPE_UTP_INCOMING=f,g.TYPE_UTP_OUTGOING=l,g.TYPE_WEBRTC="webrtc",g.TYPE_WEBSEED=c,g.SOURCE_MANUAL="manual",g.SOURCE_TRACKER="tracker",g.SOURCE_DHT="dht",g.SOURCE_LSD="lsd",g.SOURCE_UT_PEX="ut_pex",g.createWebRTCPeer=(t,e,r)=>{const i=new g(t.id,"webrtc");if(i.conn=t,i.swarm=e,i.throttleGroups=r,i.conn.connected)i.onConnect();else{const t=()=>{i.conn.removeListener("connect",e),i.conn.removeListener("error",r)},e=()=>{t(),i.onConnect()},r=e=>{t(),i.destroy(e)};i.conn.once("connect",e),i.conn.once("error",r),i.startConnectTimeout()}return i},g.createTCPIncomingPeer=(t,e)=>g._createIncomingPeer(t,h,e),g.createUTPIncomingPeer=(t,e)=>g._createIncomingPeer(t,f,e),g.createTCPOutgoingPeer=(t,e,r)=>g._createOutgoingPeer(t,e,u,r),g.createUTPOutgoingPeer=(t,e,r)=>g._createOutgoingPeer(t,e,l,r),g._createIncomingPeer=(t,e,r)=>{const i=`${t.remoteAddress}:${t.remotePort}`,n=new g(i,e);return n.conn=t,n.addr=i,n.throttleGroups=r,n.onConnect(),n},g._createOutgoingPeer=(t,e,r,i)=>{const n=new g(t,r);return n.addr=t,n.swarm=e,n.throttleGroups=i,n},g.createWebSeedPeer=(t,e,r,i)=>{const n=new g(e,c);return n.swarm=r,n.conn=t,n.throttleGroups=i,n.onConnect(),n}},3219:t=>{"use strict";t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},2951:t=>{"use strict";t.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},4589:t=>{"use strict";t.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},3241:t=>{"use strict";t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},1636:t=>{"use strict";t.exports={rE:"6.5.5"}},5579:t=>{"use strict";t.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')}},i={};function n(t){var e=i[t];if(void 0!==e)return e.exports;var o=i[t]={id:t,loaded:!1,exports:{}};return r[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,n.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"==typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"==typeof r.then)return r}var o=Object.create(null);n.r(o);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&i&&r;"object"==typeof a&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach((t=>s[t]=()=>r[t]));return s.default=()=>r,n.d(o,s),o},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var o={};return(()=>{"use strict";n.d(o,{default:()=>Lr});var t=n(8947),e=n.n(t),r=n(1889),i=n.n(r),s=n(8287),a=n(7007),h=n.n(a),u=n(7975),f=n(988),l=n(1467),c=n(8444),d=n(2123);const p=new RegExp(["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"].join("|"));var m=n(405),g=n(8190),y=n(9596),b=n(9639),v=(n(3468),n(2532));const w=[["udp://tracker.leechers-paradise.org:6969"],["udp://tracker.coppersurfer.tk:6969"],["udp://tracker.opentrackr.org:1337"],["udp://explodie.org:6969"],["udp://tracker.empire-js.us:1337"],["wss://tracker.btorrent.xyz"],["wss://tracker.openwebtorrent.com"],["wss://tracker.webtorrent.dev"]],_=Symbol("itemPath");function M(t,e,r){if("undefined"!=typeof FileList&&t instanceof FileList&&(t=Array.from(t)),Array.isArray(t)||(t=[t]),0===t.length)throw new Error("invalid input type");t.forEach((t=>{if(null==t)throw new Error(`invalid input type: ${t}`)})),1!==(t=t.map((t=>S(t)&&"string"==typeof t.path&&"function"==typeof v?t.path:t))).length||"string"==typeof t[0]||t[0].name||(t[0].name=e.name);let i=null;t.forEach(((e,r)=>{if("string"==typeof e)return;let n=e.fullPath||e.name;n||(n=`Unknown File ${r+1}`,e.unknownName=!0),e[_]=n.split("/"),e[_][0]||e[_].shift(),e[_].length<2?i=null:0===r&&t.length>1?i=e[_][0]:e[_][0]!==i&&(i=null)})),(void 0===e.filterJunkFiles||e.filterJunkFiles)&&(t=t.filter((t=>"string"==typeof t||!function(t){const e=t[t.length-1];return"."===e[0]&&function(t){return p.test(t)}(e)}(t[_])))),i&&t.forEach((t=>{const e=(ArrayBuffer.isView(t)||x(t))&&!t[_];"string"==typeof t||e||t[_].shift()})),!e.name&&i&&(e.name=i),e.name||t.some((t=>"string"==typeof t?(e.name=u.basename(t),!0):!t.unknownName&&(e.name=t[_][t[_].length-1],!0))),e.name||(e.name=`Unnamed Torrent ${Date.now()}`);const n=t.reduce(((t,e)=>t+Number("string"==typeof e)),0);let o=1===t.length;if(1===t.length&&"string"==typeof t[0]){if("function"!=typeof v)throw new Error("filesystem paths do not work in the browser");d(t[0],((t,e)=>{if(t)return r(t);o=e,s()}))}else y(s);function s(){g(t.map((t=>e=>{const r={};if(S(t))r.getStream=t.stream(),r.length=t.size;else if(ArrayBuffer.isView(t))r.getStream=[t],r.length=t.length;else{if(!x(t)){if("string"==typeof t){if("function"!=typeof v)throw new Error("filesystem paths do not work in the browser");return void v(t,n>1||o,e)}throw new Error("invalid input type")}r.getStream=async function*(t,e){for await(const r of t)e.length+=r.length,yield r}(t,r),r.length=0}r.path=t[_],e(null,r)})),((t,e)=>{if(t)return r(t);e=e.flat(),r(null,e,o)}))}}function k(t,e){return t+e.length}function S(t){return"undefined"!=typeof Blob&&t instanceof Blob}function x(t){return"object"==typeof t&&null!=t&&"function"==typeof t.pipe}var A=n(7833),E=n(7237),I=n(6636),T=n(3208);self.Blob,self.File,self.FormData,self.Headers,self.Request,self.Response,self.AbortController,self.AbortSignal;const P=self.fetch||(()=>{throw new Error("global fetch is not available!")}),B=[255,255,26,27,28,29,30,31,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255],C=function(t){const e={},r=t.split("magnet:?")[1];let i;return(r&&r.length>=0?r.split("&"):[]).forEach((t=>{const r=t.split("=");if(2!==r.length)return;const i=r[0];let n=r[1];"dn"===i&&(n=decodeURIComponent(n).replace(/\+/g," ")),"tr"!==i&&"xs"!==i&&"as"!==i&&"ws"!==i||(n=decodeURIComponent(n)),"kt"===i&&(n=decodeURIComponent(n).split("+")),"ix"===i&&(n=Number(n)),"so"===i&&(n=decodeURIComponent(n).split(",").reduce(((t,e,r,i)=>{const n=e.split("-").map((t=>parseInt(t)));return t.concat(((t,e=t)=>Array.from({length:e-t+1},((e,r)=>r+t)))(...n))}),[])),e[i]?(Array.isArray(e[i])||(e[i]=[e[i]]),e[i].push(n)):e[i]=n})),e.xt&&(Array.isArray(e.xt)?e.xt:[e.xt]).forEach((t=>{(i=t.match(/^urn:btih:(.{40})/))?e.infoHash=i[1].toLowerCase():(i=t.match(/^urn:btih:(.{32})/))?e.infoHash=(0,b.V5)(function(t){if(!ArrayBuffer.isView(t)&&"string"!=typeof t)throw new TypeError("base32.decode only takes Buffer or string as parameter");let e,r=0,i=0,n=0;ArrayBuffer.isView(t)||(t=(0,b.L0)(t));const o=new Uint8Array(Math.ceil(5*t.length/8));for(let s=0;s>>r,o[n]=e,n++,e=255&i<<8-r)}return o.subarray(0,n)}(i[1])):(i=t.match(/^urn:btmh:1220(.{64})/))&&(e.infoHashV2=i[1].toLowerCase())})),e.xs&&(Array.isArray(e.xs)?e.xs:[e.xs]).forEach((t=>{(i=t.match(/^urn:btpk:(.{64})/))&&(e.publicKey=i[1].toLowerCase())})),e.infoHash&&(e.infoHashBuffer=(0,b.fk)(e.infoHash)),e.infoHashV2&&(e.infoHashV2Buffer=(0,b.fk)(e.infoHashV2)),e.publicKey&&(e.publicKeyBuffer=(0,b.fk)(e.publicKey)),e.dn&&(e.name=e.dn),e.kt&&(e.keywords=e.kt),e.announce=[],("string"==typeof e.tr||Array.isArray(e.tr))&&(e.announce=e.announce.concat(e.tr)),e.urlList=[],("string"==typeof e.as||Array.isArray(e.as))&&(e.urlList=e.urlList.concat(e.as)),("string"==typeof e.ws||Array.isArray(e.ws))&&(e.urlList=e.urlList.concat(e.ws)),e.peerAddresses=[],("string"==typeof e["x.pe"]||Array.isArray(e["x.pe"]))&&(e.peerAddresses=e.peerAddresses.concat(e["x.pe"])),e.announce=Array.from(new Set(e.announce)),e.urlList=Array.from(new Set(e.urlList)),e.peerAddresses=Array.from(new Set(e.peerAddresses)),e};async function L(t){if("string"==typeof t&&/^(stream-)?magnet:/.test(t)){const e=C(t);if(!e.infoHash)throw new Error("Invalid torrent identifier");return e}if("string"==typeof t&&(/^[a-f0-9]{40}$/i.test(t)||/^[a-z2-7]{32}$/i.test(t)))return C(`magnet:?xt=urn:btih:${t}`);if(ArrayBuffer.isView(t)&&20===t.length)return C(`magnet:?xt=urn:btih:${(0,b.V5)(t)}`);if(ArrayBuffer.isView(t))return await async function(t){ArrayBuffer.isView(t)&&(t=f.A.decode(t)),j(t.info,"info"),j(t.info["name.utf-8"]||t.info.name,"info.name"),j(t.info["piece length"],"info['piece length']"),j(t.info.pieces,"info.pieces"),t.info.files?t.info.files.forEach((t=>{j("number"==typeof t.length,"info.files[0].length"),j(t["path.utf-8"]||t.path,"info.files[0].path")})):j("number"==typeof t.info.length,"info.length");const e={info:t.info,infoBuffer:f.A.encode(t.info),name:(0,b.dU)(t.info["name.utf-8"]||t.info.name),announce:[]};e.infoHashBuffer=await(0,b.tW)(e.infoBuffer),e.infoHash=(0,b.V5)(e.infoHashBuffer),void 0!==t.info.private&&(e.private=!!t.info.private),t["creation date"]&&(e.created=new Date(1e3*t["creation date"])),t["created by"]&&(e.createdBy=(0,b.dU)(t["created by"])),ArrayBuffer.isView(t.comment)&&(e.comment=(0,b.dU)(t.comment)),Array.isArray(t["announce-list"])&&t["announce-list"].length>0?t["announce-list"].forEach((t=>{t.forEach((t=>{e.announce.push((0,b.dU)(t))}))})):t.announce&&e.announce.push((0,b.dU)(t.announce)),ArrayBuffer.isView(t["url-list"])&&(t["url-list"]=t["url-list"].length>0?[t["url-list"]]:[]),e.urlList=(t["url-list"]||[]).map((t=>(0,b.dU)(t))),e.announce=Array.from(new Set(e.announce)),e.urlList=Array.from(new Set(e.urlList));const r=t.info.files||[t.info];e.files=r.map(((t,i)=>{const n=[].concat(e.name,t["path.utf-8"]||t.path||[]).map((t=>ArrayBuffer.isView(t)?(0,b.dU)(t):t));return{path:u.join.apply(null,[u.sep].concat(n)).slice(1),name:n[n.length-1],length:t.length,offset:r.slice(0,i).reduce(R,0)}})),e.length=r.reduce(R,0);const i=e.files[e.files.length-1];return e.pieceLength=t.info["piece length"],e.lastPieceLength=(i.offset+i.length)%e.pieceLength||e.pieceLength,e.pieces=function(t){const e=[];for(let r=0;r{r(null,i)}));else if("undefined"!=typeof Blob&&t instanceof Blob)try{n(new Uint8Array(await t.arrayBuffer()))}catch(t){return r(new Error(`Error converting Blob: ${t.message}`))}else if(/^https?:/.test(t))try{const r=await P(t,{headers:{"user-agent":"WebTorrent (https://webtorrent.io)"},signal:AbortSignal.timeout(3e4),...e});n(new Uint8Array(await r.arrayBuffer()))}catch(t){return r(new Error(`Error downloading torrent: ${t.message}`))}else"function"==typeof T.readFile&&"string"==typeof t?T.readFile(t,((t,e)=>{if(t)return r(new Error("Invalid torrent identifier"));n(e)})):y((()=>{r(new Error("Invalid torrent identifier"))}));async function n(t){try{i=await L(t)}catch(t){return r(t)}i&&i.infoHash?r(null,i):r(new Error("Invalid torrent identifier"))}}function R(t,e){return t+e.length}function j(t,e){if(!t)throw new Error(`Torrent is missing required field: ${e}`)}const N=L;var D=n(5064),U=n(8179),q=n(6310);const F=A("simple-peer"),H=65536;function z(t){return t.replace(/a=ice-options:trickle\s\n/g,"")}class W extends U.Duplex{constructor(t){if(super(t=Object.assign({allowHalfOpen:!1},t)),this.__objectMode=!!t.objectMode,this._id=(0,b.V5)((0,b.po)(4)).slice(0,7),this._debug("new peer %o",t),this.channelName=t.initiator?t.channelName||(0,b.V5)((0,b.po)(20)):null,this.initiator=t.initiator||!1,this.channelConfig=t.channelConfig||W.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},W.config,t.config),this.offerOptions=t.offerOptions||{},this.answerOptions=t.answerOptions||{},this.sdpTransform=t.sdpTransform||(t=>t),this.trickle=void 0===t.trickle||t.trickle,this.allowHalfTrickle=void 0!==t.allowHalfTrickle&&t.allowHalfTrickle,this.iceCompleteTimeout=t.iceCompleteTimeout||5e3,this._destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=t.wrtc&&"object"==typeof t.wrtc?t.wrtc:D(),!this._wrtc)throw"undefined"==typeof window?q(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):q(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(t){return void this.__destroy(q(t,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=t=>{this._onIceCandidate(t)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch((t=>{this.__destroy(q(t,"ERR_PC_PEER_IDENTITY"))})),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=t=>{this._setupData(t)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(t){if(!this._destroying){if(this.destroyed)throw q(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof t)try{t=JSON.parse(t)}catch(e){t={}}this._debug("signal()"),t.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),t.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(t.transceiverRequest.kind,t.transceiverRequest.init)),t.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(t.candidate):this._pendingCandidates.push(t.candidate)),t.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(t)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((t=>{this._addIceCandidate(t)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((t=>{this.__destroy(q(t,"ERR_SET_REMOTE_DESCRIPTION"))})),t.sdp||t.candidate||t.renegotiate||t.transceiverRequest||this.__destroy(q(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(t){const e=new this._wrtc.RTCIceCandidate(t);this._pc.addIceCandidate(e).catch((t=>{!e.address||e.address.endsWith(".local")?console.warn("Ignoring unsupported ICE candidate."):this.__destroy(q(t,"ERR_ADD_ICE_CANDIDATE"))}))}send(t){if(!this._destroying){if(this.destroyed)throw q(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(t)}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,y((()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1})))}negotiate(){if(!this._destroying){if(this.destroyed)throw q(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout((()=>{this._createOffer()}),0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}_final(t){this._readableState.ended||this.push(null),t(null)}__destroy(t){this.end(),this._destroy((()=>{}),t)}_destroy(t,e){this.destroyed||this._destroying||(this._destroying=!0,this._debug("destroying (error: %s)",e&&(e.message||e)),setTimeout((()=>{if(this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(t){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(t){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),t()}),0))}_setupData(t){if(!t.channel)return this.__destroy(q(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=t.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=H),this.channelName=this._channel.label,this._channel.onmessage=t=>{this._onChannelMessage(t)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=t=>{const e=t.error instanceof Error?t.error:new Error(`Datachannel error: ${t.message} ${t.filename}:${t.lineno}:${t.colno}`);this.__destroy(q(e,"ERR_DATA_CHANNEL"))};let e=!1;this._closingInterval=setInterval((()=>{this._channel&&"closing"===this._channel.readyState?(e&&this._onChannelClose(),e=!0):e=!1}),5e3)}_write(t,e){if(this.destroyed)return e(q(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(t)}catch(t){return this.__destroy(q(t,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>H?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=e):e(null)}else this._debug("write before connect"),this._chunk=t,this._cb=e}_onFinish(){if(this.destroyed)return;const t=()=>{setTimeout((()=>this.__destroy()),1e3)};this._connected?t():this.once("connect",t)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout((()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))}),this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then((t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=z(t.sdp)),t.sdp=this.sdpTransform(t.sdp);const e=()=>{if(this.destroyed)return;const e=this._pc.localDescription||t;this._debug("signal"),this.emit("signal",{type:e.type,sdp:e.sdp})};this._pc.setLocalDescription(t).then((()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?e():this.once("_iceComplete",e))})).catch((t=>{this.__destroy(q(t,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((t=>{this.__destroy(q(t,"ERR_CREATE_OFFER"))}))}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then((t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=z(t.sdp)),t.sdp=this.sdpTransform(t.sdp);const e=()=>{if(this.destroyed)return;const e=this._pc.localDescription||t;this._debug("signal"),this.emit("signal",{type:e.type,sdp:e.sdp}),this.initiator||this._requestMissingTransceivers?.()};this._pc.setLocalDescription(t).then((()=>{this.destroyed||(this.trickle||this._iceComplete?e():this.once("_iceComplete",e))})).catch((t=>{this.__destroy(q(t,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((t=>{this.__destroy(q(t,"ERR_CREATE_ANSWER"))}))}_onConnectionStateChange(){this.destroyed||this._destroying||"failed"===this._pc.connectionState&&this.__destroy(q(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const t=this._pc.iceConnectionState,e=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,e),this.emit("iceStateChange",t,e),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.__destroy(q(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.__destroy(q(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(t){const e=t=>("[object Array]"===Object.prototype.toString.call(t.values)&&t.values.forEach((e=>{Object.assign(t,e)})),t);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then((r=>{const i=[];r.forEach((t=>{i.push(e(t))})),t(null,i)}),(e=>t(e))):this._pc.getStats.length>0?this._pc.getStats((r=>{if(this.destroyed)return;const i=[];r.result().forEach((t=>{const r={};t.names().forEach((e=>{r[e]=t.stat(e)})),r.id=t.id,r.type=t.type,r.timestamp=t.timestamp,i.push(e(r))})),t(null,i)}),(e=>t(e))):t(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const t=()=>{this.destroyed||this._destroying||this.getStats(((e,r)=>{if(this.destroyed||this._destroying)return;e&&(r=[]);const i={},n={},o={};let s=!1;r.forEach((t=>{"remotecandidate"!==t.type&&"remote-candidate"!==t.type||(i[t.id]=t),"localcandidate"!==t.type&&"local-candidate"!==t.type||(n[t.id]=t),"candidatepair"!==t.type&&"candidate-pair"!==t.type||(o[t.id]=t)}));const a=t=>{s=!0;let e=n[t.localCandidateId];e&&(e.ip||e.address)?(this.localAddress=e.ip||e.address,this.localPort=Number(e.port)):e&&e.ipAddress?(this.localAddress=e.ipAddress,this.localPort=Number(e.portNumber)):"string"==typeof t.googLocalAddress&&(e=t.googLocalAddress.split(":"),this.localAddress=e[0],this.localPort=Number(e[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let r=i[t.remoteCandidateId];r&&(r.ip||r.address)?(this.remoteAddress=r.ip||r.address,this.remotePort=Number(r.port)):r&&r.ipAddress?(this.remoteAddress=r.ipAddress,this.remotePort=Number(r.portNumber)):"string"==typeof t.googRemoteAddress&&(r=t.googRemoteAddress.split(":"),this.remoteAddress=r[0],this.remotePort=Number(r[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(r.forEach((t=>{"transport"===t.type&&t.selectedCandidatePairId&&a(o[t.selectedCandidatePairId]),("googCandidatePair"===t.type&&"true"===t.googActiveConnection||("candidatepair"===t.type||"candidate-pair"===t.type)&&t.selected)&&a(t)})),s||Object.keys(o).length&&!Object.keys(n).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.__destroy(q(e,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const t=this._cb;this._cb=null,t(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(t,100)}))};t()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>H||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach((t=>{this._pc.removeTrack(t),this._queuedNegotiation=!0})),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(t){this.destroyed||(t.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:t.candidate.candidate,sdpMLineIndex:t.candidate.sdpMLineIndex,sdpMid:t.candidate.sdpMid}}):t.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),t.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(t){if(this.destroyed)return;let e=t.data;e instanceof ArrayBuffer?e=new Uint8Array(e):!1===this.__objectMode&&(e=(0,b.L0)(e)),this.push(e)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const t=this._cb;this._cb=null,t(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.__destroy())}_debug(){const t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],F.apply(null,t)}}W.WEBRTC_SUPPORT=!!D(),W.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},W.channelConfig={};const K=W;var V=n(1035),$=n(7541),G=n(5725),Z=n(9334),J=n(1438),Y=n(9748),X=n(8585);const Q=/^\[?([^\]]+)]?:(\d+)$/;let tt=new Map;function et(t){if(1e5===tt.size&&tt.clear(),!tt.has(t)){const e=Q.exec(t);if(!e)throw new Error(`invalid addr: ${t}`);tt.set(t,[e[1],Number(e[2])])}return tt.get(t)}var rt=n(3033),it=n(4497),nt=n(4018),ot=n(9971),st=n(4988),at=n(7180),ht=n(8454),ut=n(3209),ft=n(5307),lt=n(1565),ct=n(8287).Buffer,dt=n(5606);const pt=A("bittorrent-dht"),mt=3e5;class gt extends a.EventEmitter{constructor(t={}){super(),this._tables=new ht({maxAge:mt,max:t.maxTables||1e3}),this._values=new ht(t.maxValues||1e3),this._peers=ft({maxAge:t.maxAge||0,maxSize:t.maxPeers||1e4}),this._secrets=null,this._hash=t.hash||bt,this._hashLength=this._hash(ct.from("")).length,this._rpc=t.krpc||st(Object.assign({idLength:this._hashLength},t)),this._rpc.on("query",(function(t,e){r._onquery(t,e)})),this._rpc.on("node",(function(t){r.emit("node",t)})),this._rpc.on("warning",(function(t){r.emit("warning",t)})),this._rpc.on("error",(function(t){r.emit("error",t)})),this._rpc.on("listening",(function(){r.listening=!0,r._debug("listening %d",r.address().port),r.updateBucketTimestamp(),r._setBucketCheckInterval(),r.emit("listening")})),this._rotateSecrets(),this._verify=t.verify||null,this._host=t.host||null,this._interval=setInterval((function(){r._rotateSecrets()}),mt),this._runningBucketCheck=!1,this._bucketCheckTimeout=null,this._bucketOutdatedTimeSpan=t.timeBucketOutdated||9e5,this.listening=!1,this.destroyed=!1,this.nodeId=this._rpc.id,this.nodes=this._rpc.nodes;const e=at((function(t,e){const i=t.older,n=t.swap;r._debug("received ping",i),r._checkNodes(i,!1,((t,i)=>{if(i)return r._debug("swaping dead node with newer",i),n(i),e();r._debug("no node added, all other nodes ok"),e()}))}));this._rpc.on("ping",((t,r)=>{e({older:t,swap:r})})),dt.nextTick((function(){r.destroyed||r._bootstrap(!1!==t.bootstrap)})),this._debug("new DHT %s",this.nodeId);const r=this}_setBucketCheckInterval(){const t=this;function e(){if(Date.now()-t._rpc.nodes.metadata.lastChange{t.destroyed||(t.nodes.toArray().length<1&&t._bootstrap(!0),r())}))}function r(){if(!t._runningBucketCheck||t.destroyed)return;const r=Math.floor(6e4*Math.random()+3e4);t._bucketCheckTimeout=setTimeout(e,r)}this._runningBucketCheck=!0,r()}_pingAll(t){this._checkAndRemoveNodes(this.nodes.toArray(),t)}removeBucketCheckInterval(){this._runningBucketCheck=!1,clearTimeout(this._bucketCheckTimeout)}updateBucketTimestamp(){this._rpc.nodes.metadata.lastChange=Date.now()}_checkAndRemoveNodes(t,e){const r=this;this._checkNodes(t,!0,((t,i)=>{i&&r.removeNode(i.id),e(null,i)}))}_checkNodes(t,e,r){const i=this;!function t(n){let o=null;for(;n.length&&(o=n.pop(),o.id&&!e)&&!(Date.now()-(o.seen||0)>1e4);)o=null;if(!o)return r(null);i._sendPing(o,(e=>{if(!e)return i.updateBucketTimestamp(),t(n);r(null,o)}))}(t)}addNode(t){const e=this;if(t.id){t.id=kt(t.id);const e=!!this._rpc.nodes.get(t.id);return this._rpc.nodes.add(t),void(e||(this.emit("node",t),this.updateBucketTimestamp()))}this._sendPing(t,((t,r)=>{r&&e.addNode(r)}))}removeNode(t){this._rpc.nodes.remove(kt(t))}_sendPing(t,e){const r=this,i=t.id;this._rpc.query(t,{q:"ping"},((t,n,o)=>t?e(t):n.r&&n.r.id&&ct.isBuffer(n.r.id)&&n.r.id.length===r._hashLength?ct.isBuffer(i)&&!i.equals(n.r.id)?e(new Error("Unexpected node id")):(r.updateBucketTimestamp(),void e(null,{id:n.r.id,host:o.host||o.address,port:o.port})):e(new Error("Bad reply"))))}toJSON(){const t=this,e={};return Object.keys(this._values.cache).forEach((r=>{const i=t._values.cache[r].value;e[r]={v:i.v.toString("hex"),id:i.id.toString("hex")},null!=i.seq&&(e[r].seq=i.seq),null!=i.sig&&(e[r].sig=i.sig.toString("hex")),null!=i.k&&(e[r].k=i.k.toString("hex"))})),{nodes:this._rpc.nodes.toArray().map(Mt),values:e}}put(t,e){(ct.isBuffer(t)||"string"==typeof t)&&(t={v:t});const r=!!t.k;if(void 0===t.v)throw new Error("opts.v not given");if(t.v.length>=1e3)throw new Error("v must be less than 1000 bytes in put()");if(r&&void 0!==t.cas&&"number"!=typeof t.cas)throw new Error("opts.cas must be an integer if provided");if(r&&32!==t.k.length)throw new Error("opts.k ed25519 public key must be 32 bytes");if(r&&"function"!=typeof t.sign&&!ct.isBuffer(t.sig))throw new Error("opts.sign function or options.sig signature is required for mutable put");if(r&&t.salt&&t.salt.length>64)throw new Error("opts.salt is > 64 bytes long");if(r&&void 0===t.seq)throw new Error("opts.seq not provided for a mutable update");if(r&&"number"!=typeof t.seq)throw new Error("opts.seq not an integer");return this._put(t,e)}_put(t,e){e||(e=yt);const r=!!t.k,i="string"==typeof t.v?ct.from(t.v):t.v,n=r?this._hash(t.salt?ct.concat([t.k,t.salt]):t.k):this._hash(f.A.encode(i)),o=this._tables.get(n.toString("hex"));if(!o)return this._preput(n,t,e);const s={q:"put",a:{id:this._rpc.id,token:null,v:i}};return r?("number"==typeof t.cas&&(s.a.cas=t.cas),t.salt&&(s.a.salt=t.salt),s.a.k=t.k,s.a.seq=t.seq,"function"==typeof t.sign?s.a.sig=t.sign(_t(s.a)):ct.isBuffer(t.sig)&&(s.a.sig=t.sig)):this._values.set(n.toString("hex"),s.a),this._rpc.queryAll(o.closest(n),s,null,((t,r)=>{if(t)return e(t,n,r);e(null,n,r)})),n}_preput(t,e,r){const i=this;return this._closest(t,{q:"get",a:{id:this._rpc.id,target:t}},null,((t,n)=>{if(t)return r(t);i.put(e,r)})),t}get(t,e,r){t=kt(t),"function"==typeof e&&(r=e,e=null),e||(e={});const i=e.verify||this._verify,n=this._hash;let o=this._values.get(t.toString("hex"))||null;if(o&&!1!==e.cache)return o=vt(this._rpc.id,null,o),dt.nextTick(s);function s(t){if(t)return r(t);r(null,o)}this._closest(t,{q:"get",a:{id:this._rpc.id,target:t}},(function(r){const s=r.r;if(!s||!s.v)return!0;const a=s.k||s.sig;if(e.salt&&(s.salt=ct.from(e.salt)),a){if(!i||!s.sig||!s.k)return!0;if(!i(s.sig,_t(s),s.k))return!0;n(s.salt?ct.concat([s.k,s.salt]):s.k).equals(t)&&(!o||s.seq>o.seq)&&(o=s)}else if(n(f.A.encode(s.v)).equals(t))return o=s,!1;return!0}),s)}announce(t,e,r){if("function"==typeof e)return this.announce(t,0,e);t=kt(t),r||(r=yt);const i=this._tables.get(t.toString("hex"));if(!i)return this._preannounce(t,e,r);if(this._host){const r=this.listening?this.address().port:0;this._addPeer({host:this._host,port:e||r},t,{host:this._host,port:r})}const n={q:"announce_peer",a:{id:this._rpc.id,token:null,info_hash:t,port:e,implied_port:e?0:1}};this._debug("announce %s %d",t,e),this._rpc.queryAll(i.closest(t),n,null,r)}_preannounce(t,e,r){const i=this;this.lookup(t,(n=>i.destroyed?r(new Error("dht is destroyed")):n?r(n):void i.announce(t,e,r)))}lookup(t,e){t=kt(t),e||(e=yt);const r=this;let i=!1;function n(e,i){e||(e=r._peers.get(t.toString("hex"),100));const n=function(t){const e=[];try{for(let r=0;r{e.emit("close"),t&&t()}))}_onquery(t,e){if(void 0===t.q||null===t.q)return;const r=t.q.toString();if(this._debug("received %s query from %s:%d",r,e.address,e.port),t.a)switch(r){case"ping":return this._rpc.response(e,t,{id:this._rpc.id});case"find_node":return this._onfindnode(t,e);case"get_peers":return this._ongetpeers(t,e);case"announce_peer":return this._onannouncepeer(t,e);case"get":return this._onget(t,e);case"put":return this._onput(t,e)}}_onfindnode(t,e){const r=t.a.target;if(!r)return this._rpc.error(e,t,[203,"`find_node` missing required `a.target` field"]);this.emit("find_node",r);const i=this._rpc.nodes.closest(r);this._rpc.response(e,t,{id:this._rpc.id},i)}_ongetpeers(t,e){const r=e.address||e.host,i=t.a.info_hash;if(!i)return this._rpc.error(e,t,[203,"`get_peers` missing required `a.info_hash` field"]);this.emit("get_peers",i);const n={id:this._rpc.id,token:this._generateToken(r)},o=this._peers.get(i.toString("hex"));o.length?(n.values=o,this._rpc.response(e,t,n)):this._rpc.response(e,t,n,this._rpc.nodes.closest(i))}_onannouncepeer(t,e){const r=e.address||e.host,i=t.a.implied_port?e.port:t.a.port;if(!i||"number"!=typeof i||i<=0||i>65535)return;const n=t.a.info_hash,o=t.a.token;if(n&&o){if(!this._validateToken(r,o))return this._rpc.error(e,t,[203,"cannot `announce_peer` with bad token"]);this.emit("announce_peer",n,{host:r,port:e.port}),this._addPeer({host:r,port:i},n,{host:r,port:e.port}),this._rpc.response(e,t,{id:this._rpc.id})}}_addPeer(t,e,r){this._peers.add(e.toString("hex"),function(t,e){const r=ct.allocUnsafe(6),i=t.split(".");for(let t=0;t<4;t++)r[t]=parseInt(i[t]||0,10);return r.writeUInt16BE(e,4),r}(t.host,t.port)),this.emit("announce",t,e,r)}_onget(t,e){const r=e.address||e.host,i=t.a.target;if(!i)return;const n=this._generateToken(r),o=this._values.get(i.toString("hex"));if(this.emit("get",i,o),o)this._rpc.response(e,t,vt(this._rpc.id,n,o));else{const r=this._rpc.nodes.closest(i);this._rpc.response(e,t,{id:this._rpc.id,token:n},r)}}_onput(t,e){const r=e.address||e.host,i=t.a;if(!i)return;const n=t.a.v;if(!n)return;const o=t.a.id;if(!o)return;const s=i.token;if(!s)return;if(!this._validateToken(r,s))return this._rpc.error(e,t,[203,"cannot `put` with bad token"]);if(n.length>1e3)return this._rpc.error(e,t,[205,"data payload too large"]);const a=!(!i.k&&!i.sig);if(a&&!i.k&&!i.sig)return;const h=a?this._hash(i.salt?ct.concat([i.k,i.salt]):i.k):this._hash(f.A.encode(n)),u=h.toString("hex");if(this.emit("put",h,n),a){if(!this._verify)return this._rpc.error(e,t,[400,"verification not supported"]);if(!this._verify(i.sig,_t(i),i.k))return;const r=this._values.get(u);if(r&&"number"==typeof i.cas&&r.seq!==i.cas)return this._rpc.error(e,t,[301,"CAS mismatch, re-read and try again"]);if(r&&"number"==typeof r.seq&&!(i.seq>r.seq))return this._rpc.error(e,t,[302,"sequence number less than current"]);this._values.set(u,{v:n,k:i.k,salt:i.salt,sig:i.sig,seq:i.seq,id:o})}else this._values.set(u,{v:n,id:o});this._rpc.response(e,t,{id:this._rpc.id})}_bootstrap(t){const e=this;if(!t)return dt.nextTick(r);function r(){e.ready||(e._debug("emit ready"),e.ready=!0,e.emit("ready"))}this._rpc.populate(e._rpc.id,{q:"find_node",a:{id:e._rpc.id,target:e._rpc.id}},r)}_closest(t,e,r,i){const n=this,o=new ot({localNodeId:t,numberOfNodesPerKBucket:this._rpc.k});this._rpc.closest(t,e,(function(e,i){return!e.r||(e.r.token&&e.r.id&&ct.isBuffer(e.r.id)&&e.r.id.length===n._hashLength&&(n._debug("found node %s (target: %s)",e.r.id,t),o.add({id:e.r.id,host:i.host||i.address,port:i.port,token:e.r.token})),!r||r(e,i))}),(function(e,r){if(e)return i(e);n._tables.set(t.toString("hex"),o),n._debug("visited %d nodes",r),i(null,r)}))}_debug(){if(!pt.enabled)return;const t=[].slice.call(arguments);t[0]=`[${this.nodeId.toString("hex").substring(0,7)}] ${t[0]}`;for(let e=1;e{const e=new URL(t.replace(/^udp:/,"http:"));return t.match(/^udp:/)&&Object.defineProperties(e,{href:{value:e.href.replace(/^http/,"udp")},protocol:{value:e.protocol.replace(/^http/,"udp")},origin:{value:e.origin.replace(/^http/,"udp")}}),e},...n.t(At,2)};var It=n(826),Tt=n(61),Pt=n(2701);const Bt=A("simple-websocket"),Ct="function"!=typeof Pt?WebSocket:Pt;class Lt extends U.Duplex{constructor(t={}){if("string"==typeof t&&(t={url:t}),super(t=Object.assign({allowHalfOpen:!1},t)),this.__objectMode=!!t.objectMode,null!=t.objectMode&&delete t.objectMode,null==t.url&&null==t.socket)throw new Error("Missing required `url` or `socket` option");if(null!=t.url&&null!=t.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(this._id=(0,b.V5)((0,b.po)(4)).slice(0,7),this._debug("new websocket: %o",t),this.connected=!1,this._chunk=null,this._cb=null,this._interval=null,t.socket)this.url=t.socket.url,this._ws=t.socket,this.connected=t.socket.readyState===Ct.OPEN;else{this.url=t.url;try{this._ws="function"==typeof Pt?new Ct(t.url,{...t,encoding:void 0}):new Ct(t.url)}catch(t){return void y((()=>this.destroy(t)))}}this._ws.binaryType="arraybuffer",t.socket&&this.connected?y((()=>this._handleOpen())):this._ws.onopen=()=>this._handleOpen(),this._ws.onmessage=t=>this._handleMessage(t),this._ws.onclose=()=>this._handleClose(),this._ws.onerror=t=>this._handleError(t),this._handleFinishBound=()=>this._handleFinish(),this.once("finish",this._handleFinishBound)}send(t){this._ws.send(t)}_final(t){this._readableState.ended||this.push(null),t(null)}_destroy(t){if(!this.destroyed){if(this._writableState.ended||this.end(),this.connected=!1,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._handleFinishBound&&this.removeListener("finish",this._handleFinishBound),this._handleFinishBound=null,this._ws){const e=this._ws,r=()=>{e.onclose=null};if(e.readyState===Ct.CLOSED)r();else try{e.onclose=r,e.close()}catch(t){r()}e.onopen=null,e.onmessage=null,e.onerror=()=>{}}this._ws=null,t()}}_write(t,e){if(this.destroyed)return e(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(t)}catch(t){return this.destroy(t)}"function"!=typeof Pt&&this._ws.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=e):e(null)}else this._debug("write before connect"),this._chunk=t,this._cb=e}_handleOpen(){if(!this.connected&&!this.destroyed){if(this.connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.destroy(t)}this._chunk=null,this._debug('sent chunk from "write before connect"');const t=this._cb;this._cb=null,t(null)}"function"!=typeof Pt&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}}_handleMessage(t){if(this.destroyed)return;let e=t.data;e instanceof ArrayBuffer&&(e=new Uint8Array(e)),!1===this.__objectMode&&(e=(0,b.L0)(e)),this.push(e)}_handleClose(){this.destroyed||(this._debug("on close"),this.destroy())}_handleError(t){this.destroy(new Error(`Error connecting to ${this.url}`))}_handleFinish(){if(this.destroyed)return;const t=()=>{setTimeout((()=>this.destroy()),1e3)};this.connected?t():this.once("connect",t)}_onInterval(){if(!this._cb||!this._ws||this._ws.bufferedAmount>65536)return;this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);const t=this._cb;this._cb=null,t(null)}_debug(){const t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],Bt.apply(null,t)}}Lt.WEBSOCKET_SUPPORT=!!Ct;const Ot=class extends a{constructor(t,e){super(),this.client=t,this.announceUrl=e,this.interval=null,this.destroyed=!1}setInterval(t){null==t&&(t=this.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(this.interval),t&&(this.interval=setInterval((()=>{this.announce(this.client._defaultAnnounceOpts())}),t),this.interval.unref&&this.interval.unref())}},Rt=A("bittorrent-tracker:websocket-tracker"),jt={};class Nt extends Ot{constructor(t,e){super(t,e),Rt("new websocket tracker %s",e),this.peers={},this.socket=null,this.reconnecting=!1,this.retries=0,this.reconnectTimer=null,this.expectingResponse=!1,this._openSocket()}announce(t){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.announce(t)}));const e=Object.assign({},t,{action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(e.trackerid=this._trackerId),"stopped"===t.event||"completed"===t.event)this._send(e);else{const r=Math.min(t.numwant,5);this._generateOffers(r,(t=>{e.numwant=r,e.offers=t,this._send(e)}))}}scrape(t){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.scrape(t)}));const e={action:"scrape",info_hash:Array.isArray(t.infoHash)&&t.infoHash.length>0?t.infoHash.map((t=>(0,b.Ht)(t))):t.infoHash&&(0,b.Ht)(t.infoHash)||this.client._infoHashBinary};this._send(e)}destroy(t=Dt){if(this.destroyed)return t(null);this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer);for(const t in this.peers){const e=this.peers[t];clearTimeout(e.trackerTimeout),e.destroy()}if(this.peers=null,this.socket&&(this.socket.removeListener("connect",this._onSocketConnectBound),this.socket.removeListener("data",this._onSocketDataBound),this.socket.removeListener("close",this._onSocketCloseBound),this.socket.removeListener("error",this._onSocketErrorBound),this.socket=null),this._onSocketConnectBound=null,this._onSocketErrorBound=null,this._onSocketDataBound=null,this._onSocketCloseBound=null,jt[this.announceUrl]&&(jt[this.announceUrl].consumers-=1),jt[this.announceUrl].consumers>0)return t();let e,r=jt[this.announceUrl];if(delete jt[this.announceUrl],r.on("error",Dt),r.once("close",t),!this.expectingResponse)return i();function i(){e&&(clearTimeout(e),e=null),r.removeListener("data",i),r.destroy(),r=null}e=setTimeout(i,Et.DESTROY_TIMEOUT),r.once("data",i)}_openSocket(){if(this.destroyed=!1,this.peers||(this.peers={}),this._onSocketConnectBound=()=>{this._onSocketConnect()},this._onSocketErrorBound=t=>{this._onSocketError(t)},this._onSocketDataBound=t=>{this._onSocketData(t)},this._onSocketCloseBound=()=>{this._onSocketClose()},this.socket=jt[this.announceUrl],this.socket)jt[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound();else{const t=new URL(this.announceUrl);let e;this.client._proxyOpts&&(e="wss:"===t.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!e&&this.client._proxyOpts.socksProxy&&(e=this.client._proxyOpts.socksProxy)),this.socket=jt[this.announceUrl]=new Lt({url:this.announceUrl,agent:e}),this.socket.consumers=1,this.socket.once("connect",this._onSocketConnectBound)}this.socket.on("data",this._onSocketDataBound),this.socket.once("close",this._onSocketCloseBound),this.socket.once("error",this._onSocketErrorBound)}_onSocketConnect(){this.destroyed||this.reconnecting&&(this.reconnecting=!1,this.retries=0,this.announce(this.client._defaultAnnounceOpts()))}_onSocketData(t){if(!this.destroyed){this.expectingResponse=!1;try{t=JSON.parse((0,b.dU)(t))}catch(t){return void this.client.emit("warning",new Error("Invalid tracker response"))}"announce"===t.action?this._onAnnounceResponse(t):"scrape"===t.action?this._onScrapeResponse(t):this._onSocketError(new Error(`invalid action in WS response: ${t.action}`))}}_onAnnounceResponse(t){if(t.info_hash!==this.client._infoHashBinary)return void Rt("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,(0,b.HB)(t.info_hash),this.client.infoHash);if(t.peer_id&&t.peer_id===this.client._peerIdBinary)return;Rt("received %s from %s for %s",JSON.stringify(t),this.announceUrl,this.client.infoHash);const e=t["failure reason"];if(e)return this.client.emit("warning",new Error(e));const r=t["warning message"];r&&this.client.emit("warning",new Error(r));const i=t.interval||t["min interval"];i&&this.setInterval(1e3*i);const n=t["tracker id"];if(n&&(this._trackerId=n),null!=t.complete){const e=Object.assign({},t,{announce:this.announceUrl,infoHash:(0,b.HB)(t.info_hash)});this.client.emit("update",e)}let o;if(t.offer&&t.peer_id&&(Rt("creating peer (from remote offer)"),o=this._createPeer(),o.id=(0,b.HB)(t.peer_id),o.once("signal",(e=>{const r={action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,to_peer_id:t.peer_id,answer:e,offer_id:t.offer_id};this._trackerId&&(r.trackerid=this._trackerId),this._send(r)})),this.client.emit("peer",o),o.signal(t.offer)),t.answer&&t.peer_id){const e=(0,b.HB)(t.offer_id);o=this.peers[e],o?(o.id=(0,b.HB)(t.peer_id),this.client.emit("peer",o),o.signal(t.answer),clearTimeout(o.trackerTimeout),o.trackerTimeout=null,delete this.peers[e]):Rt(`got unexpected answer: ${JSON.stringify(t.answer)}`)}}_onScrapeResponse(t){t=t.files||{};const e=Object.keys(t);0!==e.length?e.forEach((e=>{const r=Object.assign(t[e],{announce:this.announceUrl,infoHash:(0,b.HB)(e)});this.client.emit("scrape",r)})):this.client.emit("warning",new Error("invalid scrape response"))}_onSocketClose(){this.destroyed||(this.destroy(),this._startReconnectTimer())}_onSocketError(t){this.destroyed||(this.destroy(),this.client.emit("warning",t),this._startReconnectTimer())}_startReconnectTimer(){const t=Math.floor(3e5*Math.random())+Math.min(1e4*Math.pow(2,this.retries),36e5);this.reconnecting=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout((()=>{this.retries++,this._openSocket()}),t),this.reconnectTimer.unref&&this.reconnectTimer.unref(),Rt("reconnecting socket in %s ms",t)}_send(t){if(this.destroyed)return;this.expectingResponse=!0;const e=JSON.stringify(t);Rt("send %s",e),this.socket.send(e)}_generateOffers(t,e){const r=this,i=[];Rt("generating %s offers",t);for(let e=0;e{i.push({offer:e,offer_id:(0,b.Ht)(t)}),o()})),e.trackerTimeout=setTimeout((()=>{Rt("tracker timeout: destroying peer"),e.trackerTimeout=null,delete r.peers[t],e.destroy()}),5e4),e.trackerTimeout.unref&&e.trackerTimeout.unref()}function o(){i.length===t&&(Rt("generated %s offers",t),e(i))}o()}_createPeer(t){const e=this;t=Object.assign({trickle:!1,config:e.client._rtcConfig,wrtc:e.client._wrtc},t);const r=new K(t);return r.once("error",i),r.once("connect",(function t(){r.removeListener("error",i),r.removeListener("connect",t)})),r;function i(t){e.client.emit("warning",new Error(`Connection error: ${t.message}`)),r.destroy()}}}function Dt(){}Nt.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,Nt._socketPool=jt;const Ut=Nt;var qt=n(5606);const Ft=A("bittorrent-tracker:client");class Ht extends a{constructor(t={}){if(super(),!t.peerId)throw new Error("Option `peerId` is required");if(!t.infoHash)throw new Error("Option `infoHash` is required");if(!t.announce)throw new Error("Option `announce` is required");if(!qt.browser&&!t.port)throw new Error("Option `port` is required");this.peerId="string"==typeof t.peerId?t.peerId:(0,b.V5)(t.peerId),this._peerIdBuffer=(0,b.fk)(this.peerId),this._peerIdBinary=(0,b.Ht)(this.peerId),this.infoHash="string"==typeof t.infoHash?t.infoHash.toLowerCase():(0,b.V5)(t.infoHash),this._infoHashBuffer=(0,b.fk)(this.infoHash),this._infoHashBinary=(0,b.Ht)(this.infoHash),Ft("new client %s",this.infoHash),this.destroyed=!1,this._port=t.port,this._getAnnounceOpts=t.getAnnounceOpts,this._rtcConfig=t.rtcConfig,this._userAgent=t.userAgent,this._proxyOpts=t.proxyOpts,this._wrtc="function"==typeof t.wrtc?t.wrtc():t.wrtc;let e="string"==typeof t.announce?[t.announce]:null==t.announce?[]:t.announce;e=e.map((t=>(ArrayBuffer.isView(t)&&(t=(0,b.dU)(t)),"/"===t[t.length-1]&&(t=t.substring(0,t.length-1)),t))),e=Array.from(new Set(e));const r=!1!==this._wrtc&&(!!this._wrtc||K.WEBRTC_SUPPORT),i=t=>{y((()=>{this.emit("warning",t)}))};this._trackers=e.map((t=>{let e;try{e=Et.parseUrl(t)}catch(e){return i(new Error(`Invalid tracker URL: ${t}`)),null}const n=e.port;if(n<0||n>65535)return i(new Error(`Invalid tracker port: ${t}`)),null;const o=e.protocol;return"http:"!==o&&"https:"!==o||"function"!=typeof It?"udp:"===o&&"function"==typeof Tt?new Tt(this,t):"ws:"!==o&&"wss:"!==o||!r||"ws:"===o&&"undefined"!=typeof window&&"https:"===window.location.protocol?(i(new Error(`Unsupported tracker protocol: ${t}`)),null):new Ut(this,t):new It(this,t)})).filter(Boolean)}start(t){(t=this._defaultAnnounceOpts(t)).event="started",Ft("send `start` %o",t),this._announce(t),this._trackers.forEach((t=>{t.setInterval()}))}stop(t){(t=this._defaultAnnounceOpts(t)).event="stopped",Ft("send `stop` %o",t),this._announce(t)}complete(t){t||(t={}),(t=this._defaultAnnounceOpts(t)).event="completed",Ft("send `complete` %o",t),this._announce(t)}update(t){(t=this._defaultAnnounceOpts(t)).event&&delete t.event,Ft("send `update` %o",t),this._announce(t)}_announce(t){this._trackers.forEach((e=>{e.announce(t)}))}scrape(t){Ft("send `scrape`"),t||(t={}),this._trackers.forEach((e=>{e.scrape(t)}))}setInterval(t){Ft("setInterval %d",t),this._trackers.forEach((e=>{e.setInterval(t)}))}destroy(t){if(this.destroyed)return;this.destroyed=!0,Ft("destroy");const e=this._trackers.map((t=>e=>{t.destroy(e)}));g(e,t),this._trackers=[],this._getAnnounceOpts=null}_defaultAnnounceOpts(t={}){return null==t.numwant&&(t.numwant=Et.DEFAULT_ANNOUNCE_PEERS),null==t.uploaded&&(t.uploaded=0),null==t.downloaded&&(t.downloaded=0),this._getAnnounceOpts&&(t=Object.assign({},t,this._getAnnounceOpts())),t}}Ht.scrape=(t,e)=>{if(e=xt(e),!t.infoHash)throw new Error("Option `infoHash` is required");if(!t.announce)throw new Error("Option `announce` is required");const r=Object.assign({},t,{infoHash:Array.isArray(t.infoHash)?t.infoHash[0]:t.infoHash,peerId:(0,b.L0)("01234567890123456789"),port:6881}),i=new Ht(r);i.once("error",e),i.once("warning",e);let n=Array.isArray(t.infoHash)?t.infoHash.length:1;const o={};return i.on("scrape",(t=>{if(n-=1,o[t.infoHash]=t,0===n){i.destroy();const t=Object.keys(o);1===t.length?e(null,o[t[0]]):e(null,o)}})),i.scrape({infoHash:t.infoHash}),i};const zt=Ht;n(7936);var Wt=n(2799),Kt=n(5606);const Vt=A("torrent-discovery");class $t extends a.EventEmitter{constructor(t){if(super(),!t.peerId)throw new Error("Option `peerId` is required");if(!t.infoHash)throw new Error("Option `infoHash` is required");if(!Kt.browser&&!t.port)throw new Error("Option `port` is required");this.peerId="string"==typeof t.peerId?t.peerId:t.peerId.toString("hex"),this.infoHash="string"==typeof t.infoHash?t.infoHash.toLowerCase():t.infoHash.toString("hex"),this._port=t.port,this._userAgent=t.userAgent,this.destroyed=!1,this._announce=t.announce||[],this._intervalMs=t.intervalMs||9e5,this._trackerOpts=null,this._dhtAnnouncing=!1,this._dhtTimeout=!1,this._internalDHT=!1,this._onWarning=t=>{this.emit("warning",t)},this._onError=t=>{this.emit("error",t)},this._onDHTPeer=(t,e)=>{e.toString("hex")===this.infoHash&&this.emit("peer",`${t.host}:${t.port}`,"dht")},this._onTrackerPeer=t=>{this.emit("peer",t,"tracker")},this._onTrackerAnnounce=()=>{this.emit("trackerAnnounce")},this._onLSDPeer=(t,e)=>{this.emit("peer",t,"lsd")};const e=(t,e)=>{const r=new St(e);return r.on("warning",this._onWarning),r.on("error",this._onError),r.listen(t),this._internalDHT=!0,r};!1===t.tracker?this.tracker=null:t.tracker&&"object"==typeof t.tracker?(this._trackerOpts=Object.assign({},t.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),!1===t.dht||"function"!=typeof St?this.dht=null:t.dht&&"function"==typeof t.dht.addNode?this.dht=t.dht:t.dht&&"object"==typeof t.dht?this.dht=e(t.dhtPort,t.dht):this.dht=e(t.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce()),!1===t.lsd||"function"!=typeof Wt?this.lsd=null:this.lsd=this._createLSD()}updatePort(t){t!==this._port&&(this._port=t,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy((()=>{this.tracker=this._createTracker()}))))}complete(t){this.tracker&&this.tracker.complete(t)}destroy(t){if(this.destroyed)return;this.destroyed=!0,clearTimeout(this._dhtTimeout);const e=[];this.tracker&&(this.tracker.stop(),this.tracker.removeListener("warning",this._onWarning),this.tracker.removeListener("error",this._onError),this.tracker.removeListener("peer",this._onTrackerPeer),this.tracker.removeListener("update",this._onTrackerAnnounce),e.push((t=>{this.tracker.destroy(t)}))),this.dht&&this.dht.removeListener("peer",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener("warning",this._onWarning),this.dht.removeListener("error",this._onError),e.push((t=>{this.dht.destroy(t)}))),this.lsd&&(this.lsd.removeListener("warning",this._onWarning),this.lsd.removeListener("error",this._onError),this.lsd.removeListener("peer",this._onLSDPeer),e.push((t=>{this.lsd.destroy(t)}))),g(e,t),this.dht=null,this.tracker=null,this.lsd=null,this._announce=null}_createTracker(){const t=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),e=new zt(t);return e.on("warning",this._onWarning),e.on("error",this._onError),e.on("peer",this._onTrackerPeer),e.on("update",this._onTrackerAnnounce),e.setInterval(this._intervalMs),e.start(),e}_dhtAnnounce(){this._dhtAnnouncing||(Vt("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,(t=>{this._dhtAnnouncing=!1,Vt("dht announce complete"),t&&this.emit("warning",t),this.emit("dhtAnnounce"),this.destroyed||(this._dhtTimeout=setTimeout((()=>{this._dhtAnnounce()}),this._intervalMs+Math.floor(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())})))}_createLSD(){const t=Object.assign({},{infoHash:this.infoHash,peerId:this.peerId,port:this._port}),e=new Wt(t);return e.on("warning",this._onWarning),e.on("error",this._onError),e.on("peer",this._onLSDPeer),e.start(),e}}const Gt=$t,Zt=/[<>:"/\\|?*\u0000-\u001F]/g;"undefined"!=typeof navigator&&navigator.storage?.getDirectory&&navigator.storage.getDirectory().then((t=>{t.removeEntry("chunks",{recursive:!0})}));const Jt=()=>{};class Yt{constructor(t,e={}){if(this.chunkLength=Number(t),!this.chunkLength)throw new Error("First argument must be a chunk length");if("undefined"==typeof navigator||!navigator.storage?.getDirectory)throw new Error("FSA API is not supported");if(this.closed=!1,this.name=e.name||crypto.randomUUID(),this.chunks=[],this.rootDirPromise=e.rootDir||navigator.storage.getDirectory(),this.storageDirPromise=(async()=>(await this.rootDirPromise).getDirectoryHandle(this.name,{create:!0}))(),this.chunksDirPromise=this.storageDirPromise,e.files&&e.rootDir){if(this.chunkMap=[],this.directoryMap={},this.chunksDirPromise=this._getChunksDirHandle(),this.files=e.files.map(((t,e,r)=>{if(null==t.path)throw new Error("File is missing `path` property");if(null==t.length)throw new Error("File is missing `length` property");if(null==t.offset)if(0===e)t.offset=0;else{const i=r[e-1];t.offset=i.offset+i.length}null==t.handle&&(t.handle=this._createFileHandle({path:t.path})),t.blob=this._createBlobReference(t.handle);const i=t.offset,n=t.offset+t.length,o=Math.floor(i/this.chunkLength),s=Math.floor((n-1)/this.chunkLength);for(let e=o;e<=s;++e){const r=e*this.chunkLength,o=ir+this.chunkLength?this.chunkLength:n-r,a=i>r?0:r-i;this.chunkMap[e]||(this.chunkMap[e]=[]),this.chunkMap[e].push({from:o,to:s,offset:a,file:t})}return t})),window.addEventListener("pagehide",(()=>this.cleanup())),this.length=this.files.reduce(((t,e)=>t+e.length),0),null!=e.length&&e.length!==this.length)throw new Error("total `files` length is not equal to explicit `length` option")}else this.length=Number(e.length)||1/0;this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=Math.ceil(this.length/this.chunkLength)-1)}async _getChunkHandle(t){let e=this.chunks[t];if(!e){const r=await this.chunksDirPromise;this.chunks[t]=e=await r.getFileHandle(t,{create:!0})}return e}async _createFileHandle(t){const e=t.path.slice(t.path.lastIndexOf("/")+1);return(await this._getDirectoryHandle(t)).getFileHandle(e.replace(Zt,""),{create:!0})}async _createBlobReference(t){return(await t).getFile()}async _getDirectoryHandle(t){const e=t.path.lastIndexOf("/");if(-1===e||0===e)return this.storageDirPromise;const r=t.path=t.path.slice(0,e);return this.directoryMap[r]||(this.directoryMap[r]=(async()=>(await this._getDirectoryHandle(t)).getDirectoryHandle(r.slice(r.lastIndexOf("/")+1),{create:!0}))()),this.directoryMap[r]}async _getChunksDirHandle(){const t=await navigator.storage.getDirectory();return(await t.getDirectoryHandle("chunks",{create:!0})).getDirectoryHandle(this.name,{create:!0})}async put(t,e,r=Jt){try{return await this._put(t,e),r(null),null}catch(t){return queueMicrotask((()=>r(t))),t}}async _put(t,e){if(this.closed)throw new Error("Storage is closed");const r=t===this.lastChunkIndex;if(r&&e.length!==this.lastChunkLength)throw new Error(`Last chunk length must be ${this.lastChunkLength}`);if(!r&&e.length!==this.chunkLength)throw new Error(`Chunk length must be ${this.chunkLength}`);const i=(async()=>{const r=await this._getChunkHandle(t),i=await r.createWritable({keepExistingData:!1});await i.write(e),await i.close()})();if(!this.files)return i;const n=this.chunkMap[t];if(!n)throw new Error("No files matching the request range");const o=n.map((async({file:t,offset:r,from:i,to:n})=>{t.stream||(t.stream=await(await t.handle).createWritable({keepExistingData:!0})),await t.stream.write({type:"write",position:r,data:e.slice(i,n)})}));o.push(i),await Promise.all(o)}async get(t,e,r=Jt){null==e&&(e={});try{const i=await this._get(t,e);return r(null,i),i}catch(t){return r(t),t}}async _get(t,e){if("function"==typeof e)return this.get(t,void 0,e);if(this.closed)throw new Error("Storage is closed");const r=t===this.lastChunkIndex?this.lastChunkLength:this.chunkLength,i=e.offset||0,n=e.length?i+e.length:r,o=e.length||r-i;if(i<0||i<0||n>r)throw new Error("Invalid offset and/or length");if(i===n)return new Uint8Array(0);if(!this.files||this.chunks[t]){const e=await this._getChunkHandle(t);let n=await e.getFile();0===i&&o===r||(n=n.slice(i,o+i));const s=await n.arrayBuffer();if(0===s.byteLength)throw new Error(`Index ${t} does not exist`);return new Uint8Array(s)}let s=this.chunkMap[t];if(!s)throw new Error("No files matching the request range");if(e&&(s=s.filter((({from:t,to:e})=>e>i&&t(e&&(r>n&&(r=n),tqueueMicrotask((()=>t(new Error(e)))))(t,"Storage is closed");this.closed=!0,this.chunkMap=null,this.directoryMap=null,this.files&&await this.cleanup(),queueMicrotask((()=>t(null)))}async cleanup(){const t=[];for(const e of this.files)e.stream&&(t.push(e.stream.close()),e.stream=null);const e=(async()=>{const t=await this.chunksDirPromise;this.chunks=[];for await(const e of t.keys())await t.removeEntry(e,{recursive:!0});this.chunksDirPromise=await this._getChunksDirHandle()})();await Promise.all(t);for(const t of this.files)t.blob=this._createBlobReference(t.handle);await e}async destroy(t=Jt){this.close((async e=>{if(e)t(e);else{try{const t=await this.rootDirPromise;await t.removeEntry(this.name,{recursive:!0})}catch(e){return void t(e)}t(null)}}))}}var Xt=n(5570),Qt=n(4862);const te=("undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof globalThis&&globalThis).chrome?1/0:2130706432,ee="undefined"!=typeof navigator&&navigator.storage?.getDirectory&&FileSystemFileHandle?.prototype?.createWritable,re=()=>{};class ie{constructor(t,e={}){if(this.chunkLength=Number(t),!this.chunkLength)throw new Error("First argument must be a chunk length");this.length=Number(e.length)||1/0,this.limit=e.limit||te,this.fallbackStore=null,this.dataStore=null,this.chunkCount=0,this.stores=[],this._init(e),this.dataStore&&(e.max>0&&(this.dataStore=new it(this.dataStore,{max:e.max})),this.stores.push(this.dataStore)),this.stores.push(this.fallbackStore)}_init(t){if(t.onlyMem||this.limit=this.length)return void(this.fallbackStore=new e(this.chunkLength,t));this.chunkCount=Math.floor(Math.min(this.length,this.limit)/this.chunkLength);const r=this.chunkCount*this.chunkLength,i=this.length-r;this.dataStore=new e(this.chunkLength,{...t,length:r}),this.fallbackStore=new Qt(this.chunkLength,{...t,length:i})}get(t,e,r){t>=this.chunkCount?this.fallbackStore.get(t-this.chunkCount,e,r):this.dataStore.get(t,e,r)}put(t,e,r){t>=this.chunkCount?this.fallbackStore.put(t-this.chunkCount,e,r):this.dataStore.put(t,e,r)}close(t=re){Promise.all(this.stores.map((t=>new Promise((e=>t.close(e)))))).then((e=>{const r=e.find((t=>t));t(r)}))}destroy(t=re){Promise.all(this.stores.map((t=>new Promise((e=>t.destroy(e)))))).then((e=>{const r=e.find((t=>t));t(r)}))}}var ne=n(3714),oe=n(1314);const se=A("lt_donthave"),ae=()=>{class t extends a.EventEmitter{constructor(t){super(),this._peerSupports=!1,this._wire=t}onExtendedHandshake(){this._peerSupports=!0}onMessage(t){let e;try{e=new DataView(t.buffer).getUint32(0)}catch(t){return}this._wire.peerPieces.get(e)&&(se("got donthave %d",e),this._wire.peerPieces.set(e,!1),this.emit("donthave",e),this._failRequests(e))}donthave(t){if(!this._peerSupports)return;se("donthave %d",t);const e=new Uint8Array(4);new DataView(e.buffer).setUint32(0,t),this._wire.extended("lt_donthave",e)}_failRequests(t){const e=this._wire.requests;for(let r=0;r{class e extends a.EventEmitter{constructor(e){super(),this._wire=e,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new rt.A(0,{grow:1e3}),ArrayBuffer.isView(t)&&this.setMetadata(t)}onHandshake(t,e,r){this._infoHash=t}onExtendedHandshake(t){return t.m&&t.m.ut_metadata?t.metadata_size?"number"!=typeof t.metadata_size||1e7this._metadataSize&&(r=this._metadataSize);const i=this.metadata.slice(e,r);this._data(t,i,this._metadataSize)}_onData(t,e,r){e.length>de||!this._fetching||(this.metadata.set(e,t*de),this._bitfield.set(t),this._checkDone())}_onReject(t){this._remainingRejects>0&&this._fetching?(this._request(t),this._remainingRejects-=1):this.emit("warning",new Error('Peer sent "reject" too much'))}_requestPieces(){if(this._fetching){this.metadata=new Uint8Array(this._metadataSize);for(let t=0;t0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return e.prototype.name="ut_metadata",e};var me=n(4206),ge=n(1133);const ye=A("webtorrent:file-iterator");class be extends a{constructor(t,{start:e,end:r}){super(),this._torrent=t._torrent,this._pieceLength=t._torrent.pieceLength,this._startPiece=(e+t.offset)/this._pieceLength|0,this._endPiece=(r+t.offset)/this._pieceLength|0,this._piece=this._startPiece,this._offset=e+t.offset-this._startPiece*this._pieceLength,this._missing=r-e+1,this._criticalLength=Math.min(1048576/this._pieceLength|0,2),this._torrent.select(this._startPiece,this._endPiece,!0),this.destroyed=!1}[Symbol.asyncIterator](){return this}next(){return new Promise(((t,e)=>{if(0===this._missing||this.destroyed)return t({done:!0}),this.destroy();const r=(i,n)=>{if(!this._torrent.bitfield.get(i)){const t=e=>{(e===i||this.destroyed)&&(this._torrent.removeListener("verified",t),r(i,n))};return this._torrent.on("verified",t),this._torrent.critical(i,i+this._criticalLength)}if(this._torrent.destroyed)return e(new Error("Torrent removed"));this._torrent.store.get(i,n,((r,n)=>this.destroyed?t({done:!0}):(ye("read %s and yielding (length %s) (err %s)",i,n?.length,r?.message),r?e(r):void t({value:n,done:!1}))))},i=Math.min(this._missing,this._pieceLength-this._offset);r(this._piece++,{length:i,offset:this._offset}),this._missing-=i,this._offset=0}))}async return(){return this.destroy(),{done:!0}}async throw(t){throw t}destroy(t=(()=>{}),e){this.destroyed||(this.destroyed=!0,this._torrent.destroyed||this._torrent.deselect(this._startPiece,this._endPiece,!0),this.emit("return"),t(e))}}class ve extends a{constructor(t,e){super(),this._torrent=t,this._destroyed=!1,this._fileStreams=new Set,this._iterators=new Set,this.name=e.name,this.path=e.path,this.length=e.length,this.size=e.length,this.type=ge.getType(this.name)||"application/octet-stream",this.offset=e.offset,this.done=!1;const r=e.offset,i=r+e.length-1;this._startPiece=r/this._torrent.pieceLength|0,this._endPiece=i/this._torrent.pieceLength|0,0===this.length&&(this.done=!0,this.emit("done")),this._client=t.client}get downloaded(){if(this._destroyed||!this._torrent.bitfield)return 0;const{pieces:t,bitfield:e,pieceLength:r,lastPieceLength:i}=this._torrent,{_startPiece:n,_endPiece:o}=this,s=n=>{const o=n===t.length-1?i:r;return e.get(n)?o:o-t[n].missing};let a=0;for(let e=n;e<=o;e+=1){const h=s(e);if(a+=h,e===n){const t=this.offset%r;a-=Math.min(t,h)}if(e===o){const e=(o===t.length-1?i:r)-(this.offset+this.length)%r;a-=Math.min(e,h)}}return a}get progress(){return this.length?this.downloaded/this.length:0}select(t){0!==this.length&&this._torrent.select(this._startPiece,this._endPiece,t)}deselect(){0!==this.length&&this._torrent.deselect(this._startPiece,this._endPiece,!1)}[Symbol.asyncIterator](t={}){if(0===this.length)return async function*(){}();const{start:e=0}=t??{},r=t?.end&&t.endnew Promise(((n,o)=>{t.get(e,{offset:i,length:r},((t,e)=>{t&&o(t),n(e)}))}));let s=Math.floor(n/r);const a=n%r;if(n){const t=Math.min(i,r-a);i-=t,yield o(s++,t,a)}for(let t=i;t>0;++s,t-=r)yield o(s,Math.min(t,r))}(this._torrent.store,{offset:e+this.offset,length:r-e+1});const i=new be(this,{start:e,end:r});return this._iterators.add(i),i.once("return",(()=>{this._iterators.delete(i)})),i}createReadStream(t){const e=this[Symbol.asyncIterator](t),r=U.Readable.from(e);return this._fileStreams.add(r),r.once("close",(()=>{this._fileStreams.delete(r)})),r}async arrayBuffer(t){const e=new Uint8Array(this.length);let r=0;for await(const i of this[Symbol.asyncIterator](t))e.set(i,r),r+=i.length;return e.buffer}async blob(t){return new Blob([await this.arrayBuffer(t)],{type:this.type})}stream(t){let e;return new ReadableStream({start:()=>{e=this[Symbol.asyncIterator](t)},async pull(t){const{value:r,done:i}=await e.next();i?t.close():t.enqueue(r)},cancel(){e.return()}})}get streamURL(){if(!this._client._server)throw new Error("No server created");return`${this._client._server.pathname}/${this._torrent.infoHash}/${this.path}`}streamTo(t){return t.src=this.streamURL,t}includes(t){return this._startPiece<=t&&this._endPiece>=t}_destroy(){this._destroyed=!0,this._torrent=null;for(const t of this._fileStreams)t.destroy();this._fileStreams.clear();for(const t of this._iterators)t.destroy();this._iterators.clear()}}var we=n(5310);class _e{constructor(t){this._torrent=t,this._numPieces=t.pieces.length,this._pieces=new Array(this._numPieces),this._onWire=t=>{this.recalculate(),this._initWire(t)},this._onWireHave=t=>{this._pieces[t]+=1},this._onWireBitfield=()=>{this.recalculate()},this._torrent.wires.forEach((t=>{this._initWire(t)})),this._torrent.on("wire",this._onWire),this.recalculate()}getRarestPiece(t){let e=[],r=1/0;for(let i=0;i{this._cleanupWireEvents(t)})),this._torrent=null,this._pieces=null,this._onWire=null,this._onWireHave=null,this._onWireBitfield=null}_initWire(t){t._onClose=()=>{this._cleanupWireEvents(t);for(let e=0;e{const i=await(0,b.tW)(t,"hex");if(this.destroyed)return;this.handshake(e,i);const n=this._torrent.pieces.length,o=new rt.A(n);for(let t=0;t<=n;t++)o.set(t,!0);this.bitfield(o)})),this.once("interested",(()=>{xe("interested"),this.unchoke()})),this.on("uninterested",(()=>{xe("uninterested")})),this.on("choke",(()=>{xe("choke")})),this.on("unchoke",(()=>{xe("unchoke")})),this.on("bitfield",(()=>{xe("bitfield")})),this.lt_donthave.on("donthave",(()=>{xe("donthave")})),this.on("request",((t,e,r,i)=>{xe("request pieceIndex=%d offset=%d length=%d",t,e,r),this.httpRequest(t,e,r,((e,r)=>{if(e){this.lt_donthave.donthave(t);const e=setTimeout((()=>{this.destroyed||this.have(t)}),1e4);e.unref&&e.unref()}i(e,r)}))}))}async httpRequest(t,e,r,i){i=xt(i);const n=t*this._torrent.pieceLength+e,o=n+r-1,s=this._torrent.files;let a,h;if(s.length<=1)a=[{url:this.url,start:n,end:o}];else{const t=s.filter((t=>t.offset<=o&&t.offset+t.length>n));if(t.length<1)return i(new Error("Could not find file corresponding to web seed range request"));a=t.map((t=>{const e=t.offset+t.length-1;return{url:this.url+("/"===this.url[this.url.length-1]?"":"/")+t.path.replace(this._torrent.path,""),fileOffsetInRange:Math.max(t.offset-n,0),start:Math.max(n-t.offset,0),end:Math.min(e,o-t.offset)}}))}try{h=await Promise.all(a.map((async({start:i,end:n,url:o})=>{xe("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",o,t,e,r,i,n);const s=await P(o,{cache:"no-store",method:"GET",headers:{"Cache-Control":"no-store","user-agent":`WebTorrent/${Ae} (https://webtorrent.io)`,range:`bytes=${i}-${n}`},signal:AbortSignal.timeout(6e4)});if(!s.ok)throw new Error(`Unexpected HTTP status code ${s.status}`);const a=new Uint8Array(await s.arrayBuffer());return xe("Got data of length %d",a.length),a})))}catch(t){return i(t)}i(null,(0,b.xW)(h))}destroy(){super.destroy(),this._torrent=null}}var Ie=n(5606);const Te=A("webtorrent:torrent"),Pe=5e3,Be=3*fe.BLOCK_LENGTH,Ce=Ie.browser?nt().length:2,Le=[1e3,5e3,15e3],Oe=`WebTorrent/${Se} (https://webtorrent.io)`;let Re;try{Re=u.join(J.statSync("/tmp")&&"/tmp","webtorrent")}catch(t){Re=u.join("function"==typeof X.tmpdir?X.tmpdir():"/","webtorrent")}const je="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback&&window.requestIdleCallback;class Ne extends a{constructor(t,e,r){super(),this._debugId="unknown infohash",this.client=e,this.announce=r.announce,this.urlList=r.urlList,this.path=r.path||Re,this.addUID=r.addUID||!1,this.rootDir=r.rootDir||null,this.skipVerify=!!r.skipVerify,this._store=r.store||ie,this._preloadedStore=r.preloadedStore||null,this._storeCacheSlots=void 0!==r.storeCacheSlots?r.storeCacheSlots:20,this._destroyStoreOnDestroy=r.destroyStoreOnDestroy||!1,this.store=null,this.storeOpts=r.storeOpts,this._getAnnounceOpts=r.getAnnounceOpts,"boolean"==typeof r.private&&(this.private=r.private),this.strategy=r.strategy||"sequential",this.maxWebConns=r.maxWebConns||4,this._rechokeNumSlots=!1===r.uploads||0===r.uploads?0:+r.uploads||10,this._rechokeOptimisticWire=null,this._rechokeOptimisticTime=0,this._rechokeIntervalId=null,this._noPeersIntervalId=null,this._noPeersIntervalTime=r.noPeersIntervalTime?1e3*r.noPeersIntervalTime:3e4,this.ready=!1,this.destroyed=!1,this.paused=r.paused||!1,this.done=!1,this.metadata=null,this.files=[],this.pieces=[],this._amInterested=!1,this._selections=[],this._critical=[],this.wires=[],this._queue=[],this._peers={},this._peersLength=0,this.received=0,this.uploaded=0,this._downloadSpeed=V(),this._uploadSpeed=V(),this._servers=[],this._xsRequests=[],this._fileModtimes=r.fileModtimes,null!==t&&this._onTorrentId(t),this._debug("new torrent")}get timeRemaining(){return this.done?0:0===this.downloadSpeed?1/0:(this.length-this.downloaded)/this.downloadSpeed*1e3}get downloaded(){if(!this.bitfield)return 0;let t=0;for(let e=0,r=this.pieces.length;e{this.destroyed||this._onParsedTorrent(e)}))):O(t,((t,e)=>{if(!this.destroyed)return t?this._destroy(t):void this._onParsedTorrent(e)}))}_onParsedTorrent(t){if(!this.destroyed){if(this._processParsedTorrent(t),!this.infoHash)return this._destroy(new Error("Malformed torrent data: No info hash"));this._rechokeIntervalId=setInterval((()=>{this._rechoke()}),1e4),this._rechokeIntervalId.unref&&this._rechokeIntervalId.unref(),this.emit("_infoHash",this.infoHash),this.destroyed||(this.emit("infoHash",this.infoHash),this.destroyed||(this.client.listening?this._onListening():this.client.once("listening",(()=>{this._onListening()}))))}}_processParsedTorrent(t){this._debugId=(0,b.V5)(t.infoHash).substring(0,7),void 0!==this.private&&(t.private=this.private),this.announce&&(t.announce=t.announce.concat(this.announce)),this.client.tracker&&globalThis.WEBTORRENT_ANNOUNCE&&!t.private&&(t.announce=t.announce.concat(globalThis.WEBTORRENT_ANNOUNCE)),this.urlList&&(t.urlList=t.urlList.concat(this.urlList)),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),Object.assign(this,t),this.magnetURI=function(t){t=Object.assign({},t);let e=new Set;t.xt&&"string"==typeof t.xt&&e.add(t.xt),t.xt&&Array.isArray(t.xt)&&(e=new Set(t.xt)),t.infoHashBuffer&&e.add(`urn:btih:${(0,b.V5)(t.infoHashBuffer)}`),t.infoHash&&e.add(`urn:btih:${t.infoHash}`),t.infoHashV2Buffer&&e.add(t.xt=`urn:btmh:1220${(0,b.V5)(t.infoHashV2Buffer)}`),t.infoHashV2&&e.add(`urn:btmh:1220${t.infoHashV2}`);const r=Array.from(e);1===r.length&&(t.xt=r[0]),r.length>1&&(t.xt=r),t.publicKeyBuffer&&(t.xs=`urn:btpk:${(0,b.V5)(t.publicKeyBuffer)}`),t.publicKey&&(t.xs=`urn:btpk:${t.publicKey}`),t.name&&(t.dn=t.name),t.keywords&&(t.kt=t.keywords),t.announce&&(t.tr=t.announce),t.urlList&&(t.ws=t.urlList,delete t.as),t.peerAddresses&&(t["x.pe"]=t.peerAddresses);let i="magnet:?";return Object.keys(t).filter((t=>2===t.length||"x.pe"===t)).forEach(((e,r)=>{const n=Array.isArray(t[e])?t[e]:[t[e]];var o;n.forEach(((t,n)=>{(r>0||n>0)&&("kt"!==e&&"so"!==e||0===n)&&(i+="&"),"dn"===e&&(t=encodeURIComponent(t).replace(/%20/g,"+")),"tr"!==e&&"as"!==e&&"ws"!==e||(t=encodeURIComponent(t)),"xs"!==e||t.startsWith("urn:btpk:")||(t=encodeURIComponent(t)),"kt"===e&&(t=encodeURIComponent(t)),"so"!==e&&(i+="kt"===e&&n>0?`+${t}`:`${e}=${t}`)})),"so"===e&&(i+=`${e}=${o=n,o.reduce(((t,e,r,i)=>(0!==r&&e===i[r-1]+1||t.push([]),t[t.length-1].push(e),t)),[]).map((t=>t.length>1?`${t[0]}-${t[t.length-1]}`:`${t[0]}`))}`)})),i}(t),this.torrentFile=function(t){const e={info:t.info};return e["announce-list"]=(t.announce||[]).map((t=>(e.announce||(e.announce=t),[t=(0,b.L0)(t)]))),e["url-list"]=t.urlList||[],void 0!==t.private&&(e.private=Number(t.private)),t.created&&(e["creation date"]=t.created.getTime()/1e3|0),t.createdBy&&(e["created by"]=t.createdBy),t.comment&&(e.comment=t.comment),f.A.encode(e)}(t)}_onListening(){this.destroyed||(this.info?this._onMetadata(this):(this.xs&&this._getMetadataFromServer(),this._startDiscovery()))}_startDiscovery(){if(this.discovery||this.destroyed)return;let t=this.client.tracker;t&&(t=Object.assign({},this.client.tracker,{getAnnounceOpts:()=>{if(this.destroyed)return;const t={uploaded:this.uploaded,downloaded:this.downloaded,left:Math.max(this.length-this.downloaded,0)};return this.client.tracker.getAnnounceOpts&&Object.assign(t,this.client.tracker.getAnnounceOpts()),this._getAnnounceOpts&&Object.assign(t,this._getAnnounceOpts()),t}})),this.peerAddresses&&this.peerAddresses.forEach((t=>this.addPeer(t,we.default.SOURCE_MANUAL))),this.discovery=new Gt({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:t,port:this.client.torrentPort,userAgent:Oe,lsd:this.client.lsd}),this.discovery.on("error",(t=>{this._destroy(t)})),this.discovery.on("peer",((t,e)=>{this._debug("peer %s discovered via %s",t,e),"string"==typeof t&&this.done||this.addPeer(t,e)})),this.discovery.on("trackerAnnounce",(()=>{this.emit("trackerAnnounce")})),this.discovery.on("dhtAnnounce",(()=>{this.emit("dhtAnnounce")})),this.discovery.on("warning",(t=>{this.emit("warning",t)})),this._noPeersIntervalId=setInterval((()=>{if(this.destroyed)return;const t={[we.default.SOURCE_TRACKER]:{enabled:!!this.client.tracker,numPeers:0},[we.default.SOURCE_DHT]:{enabled:!!this.client.dht,numPeers:0},[we.default.SOURCE_LSD]:{enabled:!!this.client.lsd,numPeers:0},[we.default.SOURCE_UT_PEX]:{enabled:this.client.utPex&&"function"==typeof me,numPeers:0}};for(const e of Object.values(this._peers)){const r=t[e.source];void 0!==r&&r.numPeers++}for(const e of Object.keys(t)){const r=t[e];r.enabled&&0===r.numPeers&&this.emit("noPeers",e)}}),this._noPeersIntervalTime),this._noPeersIntervalId.unref&&this._noPeersIntervalId.unref()}_getMetadataFromServer(){const t=this,e=Array.isArray(this.xs)?this.xs:[this.xs];t._xsRequestsController=new AbortController;const r=t._xsRequestsController.signal,i=e.map((e=>i=>{!async function(e,i){if(0!==e.indexOf("http://")&&0!==e.indexOf("https://"))return t.emit("warning",new Error(`skipping non-http xs param: ${e}`)),i(null);const n={method:"GET",headers:{"user-agent":Oe},signal:r};let o,s,a;try{o=await P(e,n)}catch(r){return t.emit("warning",new Error(`http error from xs param: ${e}`)),i(null)}if(t.destroyed)return i(null);if(t.metadata)return i(null);if(200!==o.status)return t.emit("warning",new Error(`non-200 status code ${o.status} from xs param: ${e}`)),i(null);try{s=new Uint8Array(await o.arrayBuffer())}catch(e){return t.emit("warning",e),i(null)}try{a=await N(s)}catch(t){}a?a.infoHash!==t.infoHash?(t.emit("warning",new Error(`got torrent file with incorrect info hash from xs param: ${e}`)),i(null)):(t._onMetadata(a),i(null)):(t.emit("warning",new Error(`got invalid torrent file from xs param: ${e}`)),i(null))}(e,i)}));g(i)}async _onMetadata(t){if(this.metadata||this.destroyed)return;let e;if(this._debug("got metadata"),this._xsRequestsController?.abort(),this._xsRequestsController=null,t&&t.infoHash)e=t;else try{e=await N(t)}catch(t){return this._destroy(t)}this._processParsedTorrent(e),this.metadata=this.torrentFile,this.client.enableWebSeeds&&this.urlList.forEach((t=>{this.addWebSeed(t)})),this._rarityMap=new _e(this),this.files=this.files.map((t=>new ve(this,t)));let r=this._preloadedStore;if(r||(r=new this._store(this.pieceLength,{...this.storeOpts,torrent:this,path:this.path,files:this.files,length:this.length,name:this.name+" - "+this.infoHash.slice(0,8),addUID:this.addUID,rootDir:this.rootDir,max:this._storeCacheSlots})),this._storeCacheSlots>0&&!(r instanceof Qt||r instanceof ie)&&(r=new it(r,{max:this._storeCacheSlots})),this.store=new ne(r),this.so?this.files.forEach(((t,e)=>{this.so.includes(e)?this.files[e].select():this.files[e].deselect()})):0!==this.pieces.length&&this.select(0,this.pieces.length-1,!1),this._hashes=this.pieces,this.pieces=this.pieces.map(((t,e)=>{const r=e===this.pieces.length-1?this.lastPieceLength:this.pieceLength;return new fe(r)})),this._reservations=this.pieces.map((()=>[])),this.bitfield=new rt.A(this.pieces.length),this.emit("metadata"),!this.destroyed)if(this.skipVerify)this._markAllVerified(),this._onStore();else{const t=t=>{if(t)return this._destroy(t);this._debug("done verifying"),this._onStore()};this._debug("verifying existing torrent data"),this._fileModtimes&&this._store===ie?this.getFileModtimes(((e,r)=>{if(e)return this._destroy(e);this.files.map(((t,e)=>r[e]===this._fileModtimes[e])).every((t=>t))?(this._markAllVerified(),this._onStore()):this._verifyPieces(t)})):this._verifyPieces(t)}}getFileModtimes(t){const e=[];he(this.files.map(((t,r)=>i=>{const n=this.addUID?u.join(this.name+" - "+this.infoHash.slice(0,8)):u.join(this.path,t.path);J.stat(n,((t,n)=>{if(t&&"ENOENT"!==t.code)return i(t);e[r]=n&&n.mtime.getTime(),i(null)}))})),Ce,(r=>{this._debug("done getting file modtimes"),t(r,e)}))}_verifyPieces(t){he(this.pieces.map(((t,e)=>t=>{if(this.destroyed)return t(new Error("torrent is destroyed"));const r={};e===this.pieces.length-1&&(r.length=this.lastPieceLength),this.store.get(e,r,(async(r,i)=>{if(this.destroyed)return t(new Error("torrent is destroyed"));if(r)return y((()=>t(null)));const n=await(0,b.tW)(i,"hex");if(this.destroyed)return t(new Error("torrent is destroyed"));n===this._hashes[e]?(this._debug("piece verified %s",e),this._markVerified(e)):(this._markUnverified(e),this._debug("piece invalid %s",e)),t(null)}))})),Ce,t)}rescanFiles(t){if(this.destroyed)throw new Error("torrent is destroyed");t||(t=Ue),this._verifyPieces((e=>{if(e)return this._destroy(e),t(e);this._checkDone(),t(null)}))}_markAllVerified(){for(let t=0;t{e.done&&e.includes(t)&&(e.done=!1)}))}_hasAllPieces(){for(let t=0;tt))return!0;return!1}_onStore(){this.destroyed||(this._debug("on store"),this._startDiscovery(),this.ready=!0,this.emit("ready"),this._checkDone(),this._updateSelections(),this.wires.forEach((t=>{t.ut_metadata&&t.ut_metadata.setMetadata(this.metadata),this._onWireWithMetadata(t)})))}destroy(t,e){if("function"==typeof t)return this.destroy(null,t);this._destroy(null,t,e)}_destroy(t,e,r){if("function"==typeof e)return this._destroy(t,null,e);if(this.destroyed)return;this.destroyed=!0,this._debug("destroy"),this.client._remove(this),clearInterval(this._rechokeIntervalId),clearInterval(this._noPeersIntervalId),this._xsRequestsController?.abort(),this._rarityMap&&this._rarityMap.destroy();for(const t in this._peers)this.removePeer(t);this.files.forEach((t=>{t instanceof ve&&t._destroy()}));const i=this._servers.map((t=>e=>{t.destroy(e)}));if(this.discovery&&i.push((t=>{this.discovery.destroy(t)})),this.store){let t=this._destroyStoreOnDestroy;e&&void 0!==e.destroyStore&&(t=e.destroyStore),i.push((e=>{t?this.store.destroy(e):this.store.close(e)}))}g(i,r),t&&(0===this.listenerCount("error")?this.client.emit("error",t):this.emit("error",t)),this.emit("close"),this.client=null,this.files=[],this.discovery=null,this.store=null,this._rarityMap=null,this._peers=null,this._servers=null,this._xsRequests=null}addPeer(t,e){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.infoHash)throw new Error("addPeer() must not be called before the `infoHash` event");let r;if(this.client.blocked){if("string"==typeof t){let i;try{i=et(t)}catch(e){return this._debug("ignoring peer: invalid %s",t),this.emit("invalidPeer",t),!1}r=i[0]}else"string"==typeof t.remoteAddress&&(r=t.remoteAddress);if(r&&this.client.blocked.contains(r))return this._debug("ignoring peer: blocked %s",t),"string"!=typeof t&&t.destroy(),this.emit("blockedPeer",t),!1}const i=this.client.utp&&this._isIPv4(r)?"utp":"tcp",n=!!this._addPeer(t,i,e);return n?this.emit("peer",t):this.emit("invalidPeer",t),n}_addPeer(t,e,r){if(this.destroyed)return"string"!=typeof t&&t.destroy(),null;if("string"==typeof t&&!this._validAddr(t))return this._debug("ignoring peer: invalid %s",t),null;const i=t&&t.id||t;if(this._peers[i])return this._debug("ignoring peer: duplicate (%s)",i),"string"!=typeof t&&t.destroy(),null;if(this.paused)return this._debug("ignoring peer: torrent is paused"),"string"!=typeof t&&t.destroy(),null;let n;return this._debug("add peer %s",i),n="string"==typeof t?"utp"===e?we.default.createUTPOutgoingPeer(t,this,this.client.throttleGroups):we.default.createTCPOutgoingPeer(t,this,this.client.throttleGroups):we.default.createWebRTCPeer(t,this,this.client.throttleGroups),this._registerPeer(n),"string"==typeof t&&(this._queue.push(n),this._drain()),n}addWebSeed(t){if(this.destroyed)throw new Error("torrent is destroyed");let e,r;if("string"==typeof t){if(e=t,!/^https?:\/\/.+/.test(e))return this.emit("warning",new Error(`ignoring invalid web seed: ${e}`)),void this.emit("invalidPeer",e);if(this._peers[e])return this.emit("warning",new Error(`ignoring duplicate web seed: ${e}`)),void this.emit("invalidPeer",e);r=new Ee(e,this)}else{if(!t||"string"!=typeof t.connId)return void this.emit("warning",new Error("addWebSeed must be passed a string or connection object with id property"));if(r=t,e=r.connId,this._peers[e])return this.emit("warning",new Error(`ignoring duplicate web seed: ${e}`)),void this.emit("invalidPeer",e)}this._debug("add web seed %s",e);const i=we.default.createWebSeedPeer(r,e,this,this.client.throttleGroups);this._registerPeer(i),this.emit("peer",e)}_addIncomingPeer(t){return this.destroyed?t.destroy(new Error("torrent is destroyed")):this.paused?t.destroy(new Error("torrent is paused")):(this._debug("add incoming peer %s",t.id),void this._registerPeer(t))}_registerPeer(t){t.on("download",(t=>{this.destroyed||(this.received+=t,this._downloadSpeed(t),this.client._downloadSpeed(t),this.emit("download",t),this.destroyed||this.client.emit("download",t))})),t.on("upload",(t=>{this.destroyed||(this.uploaded+=t,this._uploadSpeed(t),this.client._uploadSpeed(t),this.emit("upload",t),this.destroyed||this.client.emit("upload",t))})),this._peers[t.id]=t,this._peersLength+=1}removePeer(t){const e=t?.id||t;t&&!t.id&&(t=this._peers?.[e]),t&&(t.destroy(),this.destroyed||(this._debug("removePeer %s",e),delete this._peers[e],this._peersLength-=1,this._drain()))}select(t,e,r,i){if(this.destroyed)throw new Error("torrent is destroyed");if(t<0||ee.priority-t.priority)),this._updateSelections()}deselect(t,e,r){if(this.destroyed)throw new Error("torrent is destroyed");r=Number(r)||0,this._debug("deselect %s-%s (priority %s)",t,e,r);for(let i=0;i{if(!this.destroyed&&!this.client.dht.destroyed){if(!t.remoteAddress)return this._debug("ignoring PORT from peer with no address");if(0===r||r>65536)return this._debug("ignoring invalid PORT from peer");this._debug("port: %s (from %s)",r,e),this.client.dht.addNode({host:t.remoteAddress,port:r})}})),t.on("timeout",(()=>{this._debug("wire timeout (%s)",e),t.destroy()})),"webSeed"!==t.type&&t.setTimeout(3e4,!0),t.setKeepAlive(!0),t.use(pe(this.metadata)),t.ut_metadata.on("warning",(t=>{this._debug("ut_metadata warning: %s",t.message)})),this.metadata||(t.ut_metadata.on("metadata",(t=>{this._debug("got metadata via ut_metadata"),this._onMetadata(t)})),t.ut_metadata.fetch()),this.client.utPex&&"function"==typeof me&&!this.private&&(t.use(me()),t.ut_pex.on("peer",(t=>{this.done||(this._debug("ut_pex: got peer: %s (from %s)",t,e),this.addPeer(t,we.default.SOURCE_UT_PEX))})),t.ut_pex.on("dropped",(t=>{const r=this._peers[t];r&&!r.connected&&(this._debug("ut_pex: dropped peer: %s (from %s)",t,e),this.removePeer(t))})),t.once("close",(()=>{t.ut_pex.reset()}))),t.use(ae()),this.emit("wire",t,e),this.ready&&y((()=>{this._onWireWithMetadata(t)}))}_onWireWithMetadata(t){let e=null;const r=()=>{this.destroyed||t.destroyed||(this._numQueued>2*(this._numConns-this.numPeers)&&t.amInterested?t.destroy():(e=setTimeout(r,Pe),e.unref&&e.unref()))};let i;const n=()=>{if(t.peerPieces.buffer.length===this.bitfield.buffer.length){for(i=0;i{n(),this._update(),this._updateWireInterest(t)})),t.on("have",(()=>{n(),this._update(),this._updateWireInterest(t)})),t.lt_donthave.on("donthave",(()=>{n(),this._update(),this._updateWireInterest(t)})),t.on("have-all",(()=>{t.isSeeder=!0,t.choke(),this._update(),this._updateWireInterest(t)})),t.on("have-none",(()=>{t.isSeeder=!1,this._update(),this._updateWireInterest(t)})),t.on("allowed-fast",(t=>{this._update()})),t.once("interested",(()=>{t.unchoke()})),t.once("close",(()=>{clearTimeout(e)})),t.on("choke",(()=>{clearTimeout(e),e=setTimeout(r,Pe),e.unref&&e.unref()})),t.on("unchoke",(()=>{clearTimeout(e),this._update()})),t.on("request",((e,r,i,n)=>{if(i>131072)return t.destroy();this.pieces[e]||this.store.get(e,{offset:r,length:i},n)})),t.hasFast&&this._hasAllPieces()?t.haveAll():t.hasFast&&this._hasNoPieces()?t.haveNone():t.bitfield(this.bitfield),this._updateWireInterest(t),t.peerExtensions.dht&&this.client.dht&&this.client.dht.listening&&t.port(this.client.dht.address().port),"webSeed"!==t.type&&(e=setTimeout(r,Pe),e.unref&&e.unref()),t.isSeeder=!1,n()}_updateSelections(){this.ready&&!this.destroyed&&(y((()=>{this._gcSelections()})),this._updateInterest(),this._update())}_gcSelections(){for(let t=0;tthis._updateWireInterest(t))),t!==this._amInterested&&(this._amInterested?this.emit("interested"):this.emit("uninterested"))}_updateWireInterest(t){let e=!1;for(let r=0;rthis._updateWireWrapper()),{timeout:250}):this._updateWireWrapper()}_updateWireWrapper(){if(this.destroyed)return;const t=le(this.wires);let e;for(;e=t();)this._updateWire(e)}_updateWire(t){if(t.destroyed)return!1;const e=this,r=De(t,.5);if(t.requests.length>=r)return;const i=De(t,1);if(t.peerChoking)t.hasFast&&t.peerAllowedFastSet.length>0&&!this._hasMorePieces(t.peerAllowedFastSet.length-1)&&function(){if(t.requests.length>=i)return!1;for(const r of t.peerAllowedFastSet){if(t.peerPieces.get(r)&&!e.bitfield.get(r))for(;e._request(t,r,!1)&&t.requests.length=i.from+i.offset;--o)if(t.peerPieces.get(o)&&e._request(t,o,!1))return}}();s(!1)||s(!0)}function n(e,r,i,n){return o=>o>=e&&o<=r&&!(o in i)&&t.peerPieces.get(o)&&(!n||n(o))}function o(t){let r=t;for(let i=t;i=i)return!0;const s=function(){const r=t.downloadSpeed()||1;if(r>Be)return()=>!0;const i=Math.max(1,t.requests.length)*fe.BLOCK_LENGTH/r;let n=10,o=0;return t=>{if(!n||e.bitfield.get(t))return!0;let s=e.pieces[t].missing;for(;o0))return n--,!1}return!0}}();for(let a=0;a({wire:t,random:Math.random()}))).sort(((t,e)=>{const r=t.wire,i=e.wire;return r.downloadSpeed()!==i.downloadSpeed()?r.downloadSpeed()-i.downloadSpeed():r.uploadSpeed()!==i.uploadSpeed()?r.uploadSpeed()-i.uploadSpeed():r.amChoking!==i.amChoking?r.amChoking?-1:1:t.random-e.random})).map((t=>t.wire));this._rechokeOptimisticTime<=0?this._rechokeOptimisticWire=null:this._rechokeOptimisticTime-=1;let e=0;for(;t.length>0&&e0){const e=t.filter((t=>t.peerInterested));if(e.length>0){const t=e[(r=e.length,Math.random()*r|0)];t.unchoke(),this._rechokeOptimisticWire=t,this._rechokeOptimisticTime=2}}var r;t.filter((t=>t!==this._rechokeOptimisticWire)).forEach((t=>t.choke()))}_hotswap(t,e){const r=t.downloadSpeed();if(r=Be||2*a>r||a>s||(n=e,s=a)}if(!n)return!1;for(o=0;o=s)return!1;const a=i.pieces[e];let h=o?a.reserveRemaining():a.reserve();if(-1===h&&r&&i._hotswap(t,e)&&(h=o?a.reserveRemaining():a.reserve()),-1===h)return!1;let u=i._reservations[e];u||(u=i._reservations[e]=[]);let f=u.indexOf(null);-1===f&&(f=u.length),u[f]=t;const l=a.chunkOffset(h),c=o?a.chunkLengthRemaining(h):a.chunkLength(h);function d(){y((()=>{i._update()}))}return t.request(e,l,c,(async function r(n,s){if(i.destroyed)return;if(!i.ready)return i.once("ready",(()=>{r(n,s)}));if(u[f]===t&&(u[f]=null),a!==i.pieces[e])return d();if(n)return i._debug("error getting piece %s (offset: %s length: %s) from %s: %s",e,l,c,`${t.remoteAddress}:${t.remotePort}`,n.message),o?a.cancelRemaining(h):a.cancel(h),void d();if(i._debug("got piece %s (offset: %s length: %s) from %s",e,l,c,`${t.remoteAddress}:${t.remotePort}`),!a.set(h,s,t))return d();const p=a.flush(),m=await(0,b.tW)(p,"hex");i.destroyed||(m===i._hashes[e]?(i._debug("piece verified %s",e),i.store.put(e,p,(t=>{t?i._destroy(t):(i.pieces[e]=null,i._markVerified(e),i.wires.forEach((t=>{t.have(e)})),i._checkDone()&&!i.destroyed&&i.discovery.complete(),d())}))):(i.pieces[e]=new fe(a.length),i.emit("warning",new Error(`Piece ${e} failed verification`)),d()))})),!0}_checkDone(){if(this.destroyed)return;this.files.forEach((t=>{if(!t.done){for(let e=t._startPiece;e<=t._endPiece;++e)if(!this.bitfield.get(e))return;t.done=!0,t.emit("done"),this._debug(`file done: ${t.name}`)}}));let t=!0;for(const e of this._selections){for(let r=e.from;r<=e.to;r++)if(!this.bitfield.get(r)){t=!1;break}if(!t)break}return!this.done&&t?(this.done=!0,this._debug(`torrent done: ${this.infoHash}`),this.emit("done")):this.done=!1,this._gcSelections(),t}async load(t,e){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.ready)return this.once("ready",(()=>{this.load(t,e)}));Array.isArray(t)||(t=[t]),e||(e=Ue);try{await async function(t,e,r={}){if(!t?.put)throw new Error("First argument must be an abstract-chunk-store compliant store");const i=r.chunkLength||t.chunkLength;if(!i)throw new Error("missing required `chunkLength` property");const n=r.storeMaxOutstandingPuts||16;let o=0,s=0,a=()=>{},h=!1;for await(const u of l(e,i,{zeroPadding:r.zeroPadding||!1}))await new Promise((e=>{o++<=n&&e(),t.put(s++,u,(t=>{if(t)throw t;--o,e(),h&&0===o&&a()}))}));0!==o&&(h=new Promise((t=>{a=t})),await h)}(this.store,m(t),{chunkLength:this.pieceLength}),this._markAllVerified(),this._checkDone(),e(null)}catch(t){return e(t),t}}pause(){this.destroyed||(this._debug("pause"),this.paused=!0)}resume(){this.destroyed||(this._debug("resume"),this.paused=!1,this._drain())}_debug(){const t=[].slice.call(arguments);t[0]=`[${this.client?this.client._debugId:"No Client"}] [${this._debugId}] ${t[0]}`,Te(...t)}_drain(){if(this._debug("_drain numConns %s maxConns %s",this._numConns,this.client.maxConns),"function"!=typeof Y.connect||this.destroyed||this.paused||this._numConns>=this.client.maxConns)return;this._debug("drain (%s queued, %s/%s peers)",this._numQueued,this.numPeers,this.client.maxConns);const t=this._queue.shift();if(!t)return;this._debug("%s connect attempt to %s",t.type,t.addr);const e=et(t.addr),r={host:e[0],port:e[1]};this.client.utp&&t.type===we.default.TYPE_UTP_OUTGOING?t.conn=Me.connect(r.port,r.host):t.conn=Y.connect(r);const i=t.conn;i.once("connect",(()=>{this.destroyed||t.onConnect()})),i.once("error",(e=>{t.destroy(e)})),t.startConnectTimeout(),i.on("close",(()=>{if(this.destroyed)return;if(t.retries>=Le.length){if(this.client.utp){const e=this._addPeer(t.addr,"tcp",t.source);e&&(e.retries=0)}else this._debug("conn %s closed: will not re-add (max %s attempts)",t.addr,Le.length);return}const e=Le[t.retries];this._debug("conn %s closed: will re-add to queue in %sms (attempt %s)",t.addr,e,t.retries+1);const r=setTimeout((()=>{if(this.destroyed)return;const e=et(t.addr)[0],r=this.client.utp&&this._isIPv4(e)?"utp":"tcp",i=this._addPeer(t.addr,r,t.source);i&&(i.retries=t.retries+1)}),e);r.unref&&r.unref()}))}_validAddr(t){let e;try{e=et(t)}catch(t){return!1}const r=e[0],i=e[1];return i>0&&i<65535&&!("127.0.0.1"===r&&i===this.client.torrentPort)}_isIPv4(t){return/^((?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/.test(t)}}function De(t,e){let r=2+Math.ceil(e*t.downloadSpeed()/fe.BLOCK_LENGTH);if(t.peerExtendedHandshake){const e=t.peerExtendedHandshake.reqq;"number"==typeof e&&e>0&&(r=Math.min(r,e))}return r}function Ue(){}var qe=n(3643),Fe=n(580),He=n(815),ze=n(2878);class We{constructor(t,e={}){this.client=t,e.origin||(e.origin="*"),this.opts=e,this.pendingReady=new Set}static serveIndexPage(t,e,r){const i=e.map((t=>`
  • \n \n ${Fe(t.name)}\n \n (${Fe(t.length)} bytes)\n
  • `)).join("
    ");return t.status=200,t.headers["Content-Type"]="text/html",t.body=$e("WebTorrent",`

    WebTorrent

    \n
      ${i}
    `),t}isOriginAllowed(t){return!1!==this.opts.origin&&("*"===this.opts.origin||t.headers.origin===this.opts.origin)}static serveMethodNotAllowed(t){return t.status=405,t.headers["Content-Type"]="text/html",t.body=$e("405 - Method Not Allowed","

    405 - Method Not Allowed

    "),t}static serve404Page(t){return t.status=404,t.headers["Content-Type"]="text/html",t.body=$e("404 - Not Found","

    404 - Not Found

    "),t}static serveTorrentPage(t,e,r){const i=t.files.map((e=>`
  • \n \n ${Fe(e.path)}\n \n (${Fe(e.length)} bytes)\n
  • `)).join("
    ");return e.status=200,e.headers["Content-Type"]="text/html",e.body=$e(`${Fe(t.name)} - WebTorrent`,`

    ${Fe(t.name)}

    \n
      ${i}
    `),e}static serveOptionsRequest(t,e){return e.status=204,e.headers["Access-Control-Max-Age"]="600",e.headers["Access-Control-Allow-Methods"]="GET,HEAD",t.headers["access-control-request-headers"]&&(e.headers["Access-Control-Allow-Headers"]=t.headers["access-control-request-headers"]),e}static serveFile(t,e,r){r.status=200,r.headers.Expires="0",r.headers["Cache-Control"]="no-cache, no-store, must-revalidate, max-age=0",r.headers["Accept-Ranges"]="bytes",r.headers["Content-Type"]=t.type,r.headers["transferMode.dlna.org"]="Streaming",r.headers["contentFeatures.dlna.org"]="DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000","document"===e.destination?(r.headers["Content-Type"]="application/octet-stream",r.headers["Content-Disposition"]=`attachment; filename*=UTF-8''${Ge(t.name)}`,r.body="DOWNLOAD"):r.headers["Content-Disposition"]=`inline; filename*=UTF-8''${Ge(t.name)}`;let i=ze(t.length,e.headers.range||"");if(Array.isArray(i)?(r.status=206,i=i[0],r.headers["Content-Range"]=`bytes ${i.start}-${i.end}/${t.length}`,r.headers["Content-Length"]=i.end-i.start+1):(r.statusCode=200,i=null,r.headers["Content-Length"]=t.length),"GET"===e.method){const n=t[Symbol.asyncIterator](i);let o=null;t.emit("iterator",{iterator:n,req:e,file:t},(t=>{o=t}));const s=U.Readable.from(o||n);let a=null;t.emit("stream",{stream:s,req:e,file:t},(t=>{a=He(s,t)})),r.body=a||s}else r.body=!1;return r}async onRequest(t,e){let r=new URL(t.url,"http://example.com").pathname;r=r.slice(r.indexOf(this.pathname)+this.pathname.length+1);const i={headers:{"X-Content-Type-Options":"nosniff","Content-Security-Policy":"base-uri 'none'; frame-ancestors 'none'; form-action 'none';"}};if(this.isOriginAllowed(t)&&(i.headers["Access-Control-Allow-Origin"]="*"===this.opts.origin?"*":t.headers.origin),"favicon.ico"===r)return e(We.serve404Page(i));if("OPTIONS"===t.method)return this.isOriginAllowed(t)?e(We.serveOptionsRequest(t,i)):e(We.serveMethodNotAllowed(i));const n=async()=>{this.pendingReady.delete(n);const t=await o();e(t)},o=async()=>{if(""===r)return We.serveIndexPage(i,this.client.torrents,this.pathname);let[e,...n]=r.split("/");n=decodeURI(n.join("/"));const o=await this.client.get(e);if(!e||!o)return We.serve404Page(i);if(!n)return We.serveTorrentPage(o,i,this.pathname);const s=o.files.find((t=>t.path.replace(/\\/g,"/")===n));return s?We.serveFile(s,t,i):We.serve404Page(i)};if("GET"===t.method||"HEAD"===t.method){if(this.client.ready){const t=await o();return e(t)}return this.pendingReady.add(n),void this.client.once("ready",n)}return e(We.serveMethodNotAllowed(i))}close(t=(()=>{})){this.closed=!0,this.pendingReady.forEach((t=>{this.client.removeListener("ready",t)})),this.pendingReady.clear(),y(t)}destroy(t=(()=>{})){this.closed?y(t):this.close(t),this.client=null}}class Ke extends We{constructor(t,e){super(t,e),this.server=qe.createServer(),this._listen=this.server.listen,this.server.listen=this.listen.bind(this),this._close=this.server.close,this.server.close=this.close.bind(this),this.sockets=new Set,this.closed=!1,this.pathname=e?.pathname||"/webtorrent"}wrapRequest(t,e){return this.opts.hostname&&t.headers.host!==`${this.opts.hostname}:${this.server.address().port}`?t.destroy():new URL(t.url,"http://example.com").pathname.startsWith(this.pathname)?void this.onRequest(t,(({status:t,headers:r,body:i})=>{e.writeHead(t,r),i._readableState||i._writableState?He(i,e):e.end(i)})):t.destroy()}onConnection(t){t.setTimeout(36e6),this.sockets.add(t),t.once("close",(()=>{this.sockets.delete(t)}))}address(){return this.server.address()}listen(...t){return this.closed=!1,this.server.on("connection",this.onConnection.bind(this)),this.server.on("request",this.wrapRequest.bind(this)),this._listen.apply(this.server,t)}close(t=(()=>{})){this.server.removeAllListeners("connection"),this.server.removeAllListeners("request"),this.server.removeAllListeners("listening"),super.close(),this._close.call(this.server,t)}destroy(t){this.sockets.forEach((t=>{t.destroy()})),super.destroy(t)}}class Ve extends We{constructor(t,e){super(t,e),this.registration=e.controller,this.workerKeepAliveInterval=null,this.workerPortCount=0;const r=new URL(e.controller.scope);this.pathname=r.pathname+"webtorrent",this._address={port:r.port,family:"IPv4",address:r.hostname},this.boundHandler=this.wrapRequest.bind(this),navigator.serviceWorker.addEventListener("message",this.boundHandler),fetch(`${this.pathname}/cancel/`).then((t=>{t.body.cancel()}))}wrapRequest(t){const e=t.data;if("webtorrent"===!e?.type||!e.url)return null;const[r]=t.ports;this.onRequest(e,(({status:t,headers:e,body:i})=>{const n=i[Symbol.asyncIterator]?.(),o=()=>{r.onmessage=null,i?.destroy&&i.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};r.onmessage=async t=>{if(t.data){let e;try{e=(await n.next()).value}catch(t){}r.postMessage(e),e||o(),this.workerKeepAliveInterval||(this.workerKeepAliveInterval=setInterval((()=>fetch(`${this.pathname}/keepalive/`)),2e4))}else o()},this.workerPortCount++,r.postMessage({status:t,headers:e,body:n?"STREAM":i})}))}listen(t,e){e()}address(){return this._address}close(t){navigator.serviceWorker.removeEventListener("message",this.boundHandler),super.close(t)}destroy(t){super.destroy(t)}}function $e(t,e){return`\n \n \n \n \n ${t}\n \n \n ${e}\n \n \n `}function Ge(t){return encodeURIComponent(t).replace(/['()]/g,escape).replace(/\*/g,"%2A").replace(/%(?:7C|60|5E)/g,unescape)}const Ze=Se,Je=A("webtorrent"),Ye=Ze.replace(/\d*./g,(t=>("0"+t%100).slice(-2))).slice(0,4),Xe=`-WW${Ye}-`;class Qe extends a{constructor(t={}){super(),"string"==typeof t.peerId?this.peerId=t.peerId:ArrayBuffer.isView(t.peerId)?this.peerId=(0,b.V5)(t.peerId):this.peerId=(0,b.V5)((0,b.L0)(Xe+(0,b.NJ)((0,b.po)(9)))),this.peerIdBuffer=(0,b.fk)(this.peerId),"string"==typeof t.nodeId?this.nodeId=t.nodeId:ArrayBuffer.isView(t.nodeId)?this.nodeId=(0,b.V5)(t.nodeId):this.nodeId=(0,b.V5)((0,b.po)(20)),this.nodeIdBuffer=(0,b.fk)(this.nodeId),this._debugId=this.peerId.substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=t.torrentPort||0,this.dhtPort=t.dhtPort||0,this.tracker=void 0!==t.tracker?t.tracker:{},this.lsd=!1!==t.lsd,this.utPex=!1!==t.utPex,this.natUpnp=t.natUpnp??!0,this.natPmp=t.natPmp??!0,this.torrents=[],this.maxConns=Number(t.maxConns)||55,this.utp=Qe.UTP_SUPPORT&&!1!==t.utp,this._downloadLimit=Math.max("number"==typeof t.downloadLimit?t.downloadLimit:-1,-1),this._uploadLimit=Math.max("number"==typeof t.uploadLimit?t.uploadLimit:-1,-1),(this.natUpnp||this.natPmp)&&"function"==typeof G&&(this.natTraversal=new G({enableUPNP:this.natUpnp,enablePMP:this.natPmp,upnpPermanentFallback:"permanent"===t.natUpnp})),!0===t.secure&&Promise.resolve().then(n.bind(n,5310)).then((({enableSecure:t})=>t())),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new $.ThrottleGroup({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new $.ThrottleGroup({rate:Math.max(this._uploadLimit,0),enabled:this._uploadLimit>=0})},this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),globalThis.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=globalThis.WRTC)),"function"==typeof Z?this._connPool=new Z(this):y((()=>{this._onListening()})),this._downloadSpeed=V(),this._uploadSpeed=V(),!1!==t.dht&&"function"==typeof E.Client?(this.dht=new E.Client(Object.assign({},{nodeId:this.nodeId},t.dht)),this.dht.once("error",(t=>{this._destroy(t)})),this.dht.once("listening",(()=>{const t=this.dht.address();t&&(this.dhtPort=t.port,this.natTraversal&&this.natTraversal.map({publicPort:this.dhtPort,privatePort:this.dhtPort,protocol:"udp",description:"WebTorrent DHT"}).catch((t=>{Je("error mapping DHT port via UPnP/PMP: %o",t)})))})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==t.webSeeds;const e=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof I&&null!=t.blocklist?I(t.blocklist,{headers:{"user-agent":`WebTorrent/${Ze} (https://webtorrent.io)`}},((t,r)=>{if(t)return console.error(`Failed to load blocklist: ${t.message}`);this.blocked=r,e()})):y(e)}createServer(t,e){if(this.destroyed)throw new Error("torrent is destroyed");if(this._server)throw new Error("server already created");if("undefined"!=typeof window&&"node"!==e||"browser"===e){if(!(t?.controller instanceof ServiceWorkerRegistration))throw new Error("Invalid worker registration");if("activated"!==t.controller.active.state)throw new Error("Worker isn't activated");return this._server=new Ve(this,t),this._server}return this._server=new Ke(this,t),this._server}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const t=this.torrents.filter((t=>1!==t.progress));return t.reduce(((t,e)=>t+e.downloaded),0)/(t.reduce(((t,e)=>t+(e.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((t,e)=>t+e.uploaded),0)/(this.torrents.reduce(((t,e)=>t+e.received),0)||1)}async get(t){if(t instanceof Ne){if(this.torrents.includes(t))return t}else{const e=this.torrents;let r;try{r=await N(t)}catch(t){}if(!r)return null;if(!r.infoHash)throw new Error("Invalid torrent identifier");for(const t of e)if(t.infoHash===r.infoHash)return t}return null}add(t,e={},r=(()=>{})){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof e&&([e,r]=[{},e]);const i=()=>{if(!this.destroyed)for(const t of this.torrents)if(t.infoHash===o.infoHash&&t!==o)return o._destroy(new Error(`Cannot add duplicate torrent ${o.infoHash}`)),void r(t)},n=()=>{this.destroyed||(r(o),this.emit("torrent",o))};this._debug("add"),e=e?Object.assign({},e):{};const o=new Ne(t,this,e);return this.torrents.push(o),o.once("_infoHash",i),o.once("ready",n),o.once("close",(function t(){o.removeListener("_infoHash",i),o.removeListener("ready",n),o.removeListener("close",t)})),o}seed(t,e,r){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof e&&([e,r]=[{},e]),this._debug("seed"),(e=e?Object.assign({},e):{}).skipVerify=!0;const i="string"==typeof t;i&&(e.path=u.dirname(t)),e.createdBy||(e.createdBy=`WebTorrent/${Ye}`);const n=t=>{this._debug("on seed"),"function"==typeof r&&r(t),t.emit("seed"),this.emit("seed",t)},o=this.add(null,e,(t=>{const r=[r=>{if(i||e.preloadedStore)return r();t.load(s,r)}];this.dht&&r.push((e=>{t.once("dhtAnnounce",e)})),g(r,(e=>{if(!this.destroyed)return e?t._destroy(e):void n(t)}))}));let s;return"undefined"!=typeof FileList&&t instanceof FileList?t=Array.from(t):Array.isArray(t)||(t=[t]),g(t.map((t=>async r=>{if(!e.preloadedStore&&function(t){return"object"==typeof t&&null!=t&&"function"==typeof t.pipe}(t)){const e=[];try{for await(const r of t)e.push(r)}catch(t){return r(t)}const i=(0,b.xW)(e);i.name=t.name,r(null,i)}else r(null,t)})),((t,i)=>{if(!this.destroyed)return t?o._destroy(t):void function(t,e,r){"function"==typeof e&&([e,r]=[r,e]),M(t,e=e?Object.assign({},e):{},r)}(i,e,((t,n)=>{if(!this.destroyed){if(t)return o._destroy(t);s=n.map((t=>t.getStream)),function(t,e,r){"function"==typeof e&&([e,r]=[r,e]),M(t,e=e?Object.assign({},e):{},((t,i,n)=>{if(t)return r(t);e.singleFileTorrent=n,function(t,e,r){let i=e.announceList;i||("string"==typeof e.announce?i=[[e.announce]]:Array.isArray(e.announce)&&(i=e.announce.map((t=>[t])))),i||(i=[]),globalThis.WEBTORRENT_ANNOUNCE&&("string"==typeof globalThis.WEBTORRENT_ANNOUNCE?i.push([[globalThis.WEBTORRENT_ANNOUNCE]]):Array.isArray(globalThis.WEBTORRENT_ANNOUNCE)&&(i=i.concat(globalThis.WEBTORRENT_ANNOUNCE.map((t=>[t]))))),void 0===e.announce&&void 0===e.announceList&&(i=i.concat(w)),"string"==typeof e.urlList&&(e.urlList=[e.urlList]);const n={info:{name:e.name},"creation date":Math.ceil((Number(e.creationDate)||Date.now())/1e3),encoding:"UTF-8"};0!==i.length&&(n.announce=i[0][0],n["announce-list"]=i),void 0!==e.comment&&(n.comment=e.comment),void 0!==e.createdBy&&(n["created by"]=e.createdBy),void 0!==e.private&&(n.info.private=Number(e.private)),void 0!==e.info&&Object.assign(n.info,e.info),void 0!==e.sslCert&&(n.info["ssl-cert"]=e.sslCert),void 0!==e.urlList&&(n["url-list"]=e.urlList);const o=t.reduce(k,0),s=e.pieceLength||c(o);n.info["piece length"]=s,async function(t,e,r,i,n){const o=[];let s=0,a=0;const h=t.map((t=>t.getStream)),u=i.onProgress;let f=0,c=0,d=!1;const p=l(m(h),e,{zeroPadding:!1});try{for await(const t of p)await new Promise((e=>{s+=t.length;const i=c;++c,++f<5&&e(),(0,b.tW)(t,"hex").then((h=>{o[i]=h,--f,a+=t.length,u&&u(a,r),e(),d&&0===f&&n(null,(0,b.fk)(o.join("")),s)}))}));if(0===f)return n(null,(0,b.fk)(o.join("")),s);d=!0}catch(t){n(t)}}(t,s,o,e,((i,o,s)=>{if(i)return r(i);n.info.pieces=o,t.forEach((t=>{delete t.getStream})),e.singleFileTorrent?n.info.length=s:n.info.files=t,r(null,f.A.encode(n))}))}(i,e,r)}))}(i,e,(async(t,e)=>{if(this.destroyed)return;if(t)return o._destroy(t);const i=await this.get(e);i?(console.warn("A torrent with the same id is already being seeded"),o._destroy(),"function"==typeof r&&r(i)):o._onTorrentId(e)}))}}))})),o}async remove(t,e,r){if("function"==typeof e)return this.remove(t,null,e);this._debug("remove");const i=await this.get(t);if(!i)throw new Error(`No torrent with id ${t}`);this._remove(i,e,r)}_remove(t,e,r){if(t){if("function"==typeof e)return this._remove(t,null,e);this.torrents.splice(this.torrents.indexOf(t),1),t.destroy(e,r),this.dht&&this.dht._tables.remove(t.infoHash)}}address(){return this.listening?this._connPool?this._connPool.tcpServer.address():{address:"0.0.0.0",family:"IPv4",port:0}:null}throttleDownload(t){return t=Number(t),!(isNaN(t)||!isFinite(t)||t<-1)&&(this._downloadLimit=t,this._downloadLimit<0?this.throttleGroups.down.setEnabled(!1):(this.throttleGroups.down.setEnabled(!0),void this.throttleGroups.down.setRate(this._downloadLimit)))}throttleUpload(t){return t=Number(t),!(isNaN(t)||!isFinite(t)||t<-1)&&(this._uploadLimit=t,this._uploadLimit<0?this.throttleGroups.up.setEnabled(!1):(this.throttleGroups.up.setEnabled(!0),void this.throttleGroups.up.setRate(this._uploadLimit)))}destroy(t){if(this.destroyed)throw new Error("client already destroyed");this._destroy(null,t)}_destroy(t,e){this._debug("client destroy"),this.destroyed=!0;const r=this.torrents.map((t=>e=>{t.destroy(e)}));this._connPool&&r.push((t=>{this._connPool.destroy(t)})),this.dht&&r.push((t=>{this.dht.destroy(t)})),this._server&&r.push((t=>{this._server.destroy(t)})),this.natTraversal&&r.push((t=>{this.natTraversal.destroy().then((()=>t()))})),g(r,e),t&&this.emit("error",t),this.torrents=[],this._connPool=null,this.dht=null,this.throttleGroups.down.destroy(),this.throttleGroups.up.destroy()}_onListening(){if(this._debug("listening"),this.listening=!0,this._connPool){const t=this._connPool.tcpServer.address();t&&(this.torrentPort=t.port,this.natTraversal&&this.natTraversal.map({publicPort:this.torrentPort,privatePort:this.torrentPort,protocol:this.utp?null:"tcp",description:"WebTorrent Torrent"}).catch((t=>{Je("error mapping WebTorrent port via UPnP/PMP: %o",t)})))}this.emit("listening")}_debug(){const t=[].slice.call(arguments);t[0]=`[${this._debugId}] ${t[0]}`,Je(...t)}async _getByHash(t){for(const e of this.torrents)if(e.infoHashHash||(e.infoHashHash=await(0,b.tW)((0,b.fk)("72657132"+e.infoHash),"hex")),t===e.infoHashHash)return e;return null}}Qe.WEBRTC_SUPPORT=K.WEBRTC_SUPPORT,Qe.UTP_SUPPORT=Z.UTP_SUPPORT,Qe.VERSION=Ze;var tr=n(6763),er=n.n(tr),rr=n(6011),ir=n.n(rr);function nr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function or(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return sr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?sr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function sr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r=48)i=10*i+(s-48);else if(o!==e||43!==s){if(o!==e||45!==s){if(46===s)break;throw new Error("not a number: buffer["+o+"] = "+s)}n=-1}}return i*n}function dr(t){if(null==t||0===t.length)return{};var e,r=0;e=s.Buffer.isBuffer(t)?t:s.Buffer.from(t.buffer,t.byteOffset,t.byteLength);var i=function(){switch(e[r]){case 100:return a();case 108:return h();case 105:return u();default:return o()}},n=function(t){for(var i=r,n=e.length,o=e;it.length)&&(e=t.length);for(var r=0,i=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}(t);try{for(i.s();!(e=i.n()).done;){var n=e.value;r+="string"==typeof n||"number"==typeof n||"boolean"==typeof n?n+",\n":JSON.stringify(n,void 0,4)+",\n"}}catch(t){i.e(t)}finally{i.f()}return r.replace(/,\n$/,"")}},{key:"debug",value:function(){if("debug"===this.logLevel){for(var t=arguments.length,e=new Array(t),r=0;rt.length)&&(e=t.length);for(var r=0,i=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),Tr(Er(t=Sr(this,r)),"torrent",null),Tr(Er(t),"torrentCreated",!1),Tr(Er(t),"peers",{}),Tr(Er(t),"seen",{}),Tr(Er(t),"api",{}),Tr(Er(t),"callbacks",{}),Tr(Er(t),"serveraddress",null),Tr(Er(t),"heartbeattimer",null),Tr(Er(t),"logLevel",10);var o=n.identifier,a=n.announce,h=n.seed,u=n.loggingEnabled;return t.logger=new br({scope:"Meerkat",enabled:u}),t.announce=a||["wss://tracker.openwebtorrent.com","wss://dev.tracker.cf-identity-wallet.metadata.dev.cf-deployments.org","wss://tracker.files.fm:7073/announce","ws://tracker.files.fm:7072/announce","wss://tracker.openwebtorrent.com:443/announce"],t.seed=h||t.encodeseed(e().randomBytes(32)),t.keyPair=e().sign.keyPair.fromSeed(Uint8Array.from(i().decode(t.seed)).slice(2)),t.keyPairEncrypt=e().box.keyPair(),t.publicKey=er().encode(s.Buffer.from(t.keyPair.publicKey)),t.encryptedPublicKey=er().encode(s.Buffer.from(t.keyPairEncrypt.publicKey)),t.identifier=o||t.address(),t.logger.debug("Meerkat address: ".concat(t.identifier)),t.lastwirecount=null,t.webTorrent=new Qe({}),t.torrent=t.webTorrent.seed(s.Buffer.from(t.identifier),{name:t.identifier,announce:t.announce},(function(){t.emit("torrent",t.identifier,t.torrent),t.torrent.discovery.tracker&&t.torrent.discovery.tracker.on("update",(function(e){t.emit("tracker",t.identifier,e)})),t.torrent.discovery.on("trackerAnnounce",(function(){t.emit("announce",t.identifier),t.connections()}))})),t.torrentCreated=!0,t.torrent.on("wire",(function(e){return t.attach(e)})),t}var n,o,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ir(t,e)}(r,t),n=r,o=[{key:"disableLogging",value:function(){this.logger.disable()}},{key:"enableLogging",value:function(){this.logger.enable()}},{key:"setLogLevel",value:function(t){this.logger.logLevel=t}},{key:"attach",value:function(t){var e=this;t.use(this.extension(t)),t.on("close",(function(){return e.detach(t)}))}},{key:"detach",value:function(t){this.emit("wireleft",this.torrent.wires.length,t),this.connections()}},{key:"extension",value:function(t){var e,r,i,n=this,o=(e=this.identifier,r=this.publicKey,i=this.encryptedPublicKey,function(t){t.extendedHandshake.identifier=e,t.extendedHandshake.publicKey=r,t.extendedHandshake.encryptedPublicKey=i,this.wire=t});return o.prototype.name=Cr,o.prototype.onExtendedHandshake=function(e){return n.onExtendedHandshake(t,e)},o.prototype.onMessage=function(t){return n.onMessage(t)},o}},{key:"onMessage",value:function(t){var i=r.toHex(e().hash(t).slice(16)),n=(new Date).getTime();if(this.seen[i])this.logger.debug("already seen",i);else{var o=dr(t);if(o.e&&o.n&&o.ek){var s=o.ek.toString(),a=e().box.open(o.e,o.n,er().decode(s),this.keyPairEncrypt.secretKey);o=a?dr(a):null}if(o&&o.p&&o.s){var h=hr(o.p),u=dr(h);if(void 0!==u.pk&&void 0!==u.ek&&void 0!==u.t&&void 0!==u.i){var f=u.pk.toString(),l=u.i.toString(),c=u.y?u.y.toString():"",d=e().sign.detached.verify(h,o.s,er().decode(f)),p=l===this.identifier,m=u.t+Br>n;if(d&&p&&m){var g=u.ek.toString();if(this.sawPeer(f,g),"m"==c){var y=u.v.toString(),b=null;try{b=JSON.parse(y)}catch(t){this.logger.warn(t)}b&&this.emit("message",this.address(f),b,u)}else if("r"==c){var v,w=u.c.toString(),_=u.a.toString();try{v=JSON.parse(_)}catch(t){v=null,this.logger.error("Malformed args JSON: ".concat(_))}var M=u.rn||new Uint8Array;this.emit("rpc",this.address(f),w,v,r.toHex(M)),this.rpcCall(f,w,v,M)}else if("rr"===c){var k=r.toHex(u.rn);if(this.callbacks[k]){var S,x="";void 0!==u.rr?x=u.rr.toString():this.logger.debug("Empty rr in rpc response.");try{S=JSON.parse(x)}catch(t){this.logger.error("Malformed response JSON: "+x),S=null}this.callbacks[k]&&S?(this.logger.debug("rpc-response",this.address(f),k,S),this.emit("rpc-response",this.address(f),k,S),this.callbacks[k](S),delete this.callbacks[k]):this.logger.debug("RPC response nonce not known:",k)}else this.logger.debug("dropped response with no callback.",k)}else if("p"===c){var A=this.address(f);this.logger.debug("ping from",A),this.emit("ping",A)}else if("x"===c){var E=this.address(f);this.logger.debug("got left from",E),delete this.peers[E],this.emit("left",E)}else this.logger.warn("unknown packet type")}else this.logger.warn("dropping bad packet",i,d,p,m)}else this.logger.debug("skipping packet with no payload",i,o)}else this.logger.debug("packet has no payload",i,o);this.sendRaw(t)}this.seen[i]=n}},{key:"onExtendedHandshake",value:function(t,e){this.emit("wireseen",this.torrent.wires.length,t),this.connections(),this.sawPeer((new TextDecoder).decode(e.publicKey),(new TextDecoder).decode(e.encryptedPublicKey))}},{key:"register",value:function(t,e){this.api[t]=e}},{key:"rpc",value:function(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){};if(!this.peers[t])throw t+" not seen - no public key.";var s=this.peers[t].publicKey,a=e().randomBytes(8);this.callbacks[r.toHex(a)]=o,this.makeEncryptSendPacket(s,{y:"r",c:i,a:JSON.stringify(n),rn:a})}},{key:"rpcCall",value:function(t,e,r,i){var n=this,o={y:"rr",rn:i,rr:""};this.api[e]?this.api[e](this.address(t),r,(function(e){o.rr=JSON.stringify(e),n.makeEncryptSendPacket(t,o)})):(o.rr=JSON.stringify({error:"No such API call."}),this.makeEncryptSendPacket(t,o))}},{key:"makeEncryptSendPacket",value:function(t,e){var r=this.makePacket(e),i=this.encryptPacket(t,r);this.sendRaw(i)}},{key:"encryptPacket",value:function(t,r){if(!this.peers[this.address(t)])throw this.address(t)+" not seen - no encryption key.";var i=e().randomBytes(e().box.nonceLength);return hr({n:i,ek:er().encode(s.Buffer.from(this.keyPairEncrypt.publicKey)),e:e().box(r,i,er().decode(this.peers[this.address(t)].encryptedPublicKey),this.keyPairEncrypt.secretKey)})}},{key:"sawPeer",value:function(t,e){var r=(new Date).getTime(),i=this.address(t);if(i!=this.address())if(!this.peers[i]||this.peers[i].last+Br=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}(this.torrent.wires);try{for(r.s();!(e=r.n()).done;){var i=e.value,n=i.peerExtendedHandshake;n&&n.m&&n.m[Cr]&&i.extended(Cr,t)}}catch(t){r.e(t)}finally{r.f()}}},{key:"makePacket",value:function(t){var r=_r(_r({},t),{},{t:(new Date).getTime(),i:this.identifier,pk:this.publicKey,ek:this.encryptedPublicKey,n:e().randomBytes(8)}),i=hr(r);return hr({s:e().sign.detached(i,this.keyPair.secretKey),p:r})}},{key:"encodeAddress",value:function(t){return i().encode(s.Buffer.concat([s.Buffer.from("55","hex"),(new(ir())).update(s.Buffer.from(e().hash(t))).digest()]))}},{key:"address",value:function(t){var e;return e="string"==typeof t?er().decode(t):this.keyPair.publicKey,this.encodeAddress(e)}},{key:"heartbeat",value:function(t){throw new Error("Method not implemented.")}},{key:"encodeseed",value:function(t){return i().encode(s.Buffer.concat([s.Buffer.from("490a","hex"),s.Buffer.from(t)]))}}],a=[{key:"toHex",value:function(t){return void 0===t?"":s.Buffer.from(t).toString("hex")}}],o&&kr(n.prototype,o),a&&kr(n,a),Object.defineProperty(n,"prototype",{writable:!1}),r}(h())})(),o.default})(),t.exports=e()},684:(t,e,r)=>{function i(t){this.mode=o.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,r=this.data.length;e65536?(i[0]=240|(1835008&n)>>>18,i[1]=128|(258048&n)>>>12,i[2]=128|(4032&n)>>>6,i[3]=128|63&n):n>2048?(i[0]=224|(61440&n)>>>12,i[1]=128|(4032&n)>>>6,i[2]=128|63&n):n>128?(i[0]=192|(1984&n)>>>6,i[1]=128|63&n):i[0]=n,this.parsedData.push(i)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function n(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}i.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=n.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var i=-1;i<=7;i++)e+i<=-1||this.moduleCount<=e+i||(this.modules[t+r][e+i]=0<=r&&r<=6&&(0==i||6==i)||0<=i&&i<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=i&&i<=4)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var i=s.getLostPoint(this);(0==r||t>i)&&(t=i,e=r)}return e},createMovieClip:function(t,e,r){var i=t.createEmptyMovieClip(e,r);this.make();for(var n=0;n>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=i}for(r=0;r<18;r++)i=!t&&1==(e>>r&1),this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=i},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,i=s.getBCHTypeInfo(r),n=0;n<15;n++){var o=!t&&1==(i>>n&1);n<6?this.modules[n][8]=o:n<8?this.modules[n+1][8]=o:this.modules[this.moduleCount-15+n][8]=o}for(n=0;n<15;n++)o=!t&&1==(i>>n&1),n<8?this.modules[8][this.moduleCount-n-1]=o:n<9?this.modules[8][15-n-1+1]=o:this.modules[8][15-n-1]=o;this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,i=this.moduleCount-1,n=7,o=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var h=0;h<2;h++)if(null==this.modules[i][a-h]){var u=!1;o>>n&1)),s.getMask(e,i,a-h)&&(u=!u),this.modules[i][a-h]=u,-1==--n&&(o++,n=7)}if((i+=r)<0||this.moduleCount<=i){i-=r,r=-r;break}}}},n.PAD0=236,n.PAD1=17,n.createData=function(t,e,r){for(var i=f.getRSBlocks(t,e),o=new l,a=0;a8*u)throw new Error("code length overflow. ("+o.getLengthInBits()+">"+8*u+")");for(o.getLengthInBits()+4<=8*u&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(!1);for(;!(o.getLengthInBits()>=8*u||(o.put(n.PAD0,8),o.getLengthInBits()>=8*u));)o.put(n.PAD1,8);return n.createBytes(o,i)},n.createBytes=function(t,e){for(var r=0,i=0,n=0,o=new Array(e.length),a=new Array(e.length),h=0;h=0?p.get(m):0}}var g=0;for(c=0;c=0;)e^=s.G15<=0;)e^=s.G18<>>=1;return e},getPatternPosition:function(t){return s.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case 0:return(e+r)%2==0;case 1:return e%2==0;case 2:return r%3==0;case 3:return(e+r)%3==0;case 4:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case 5:return e*r%2+e*r%3==0;case 6:return(e*r%2+e*r%3)%2==0;case 7:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new u([1],0),r=0;r5&&(r+=3+o-5)}for(i=0;i=256;)t-=255;return a.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},h=0;h<8;h++)a.EXP_TABLE[h]=1<>>7-t%8&1)},put:function(t,e){for(var r=0;r>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var c=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function d(t){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M"},"string"==typeof t&&(t={content:t}),t)for(var e in t)this.options[e]=t[e];if("string"!=typeof this.options.content)throw new Error("Expected 'content' as string!");if(0===this.options.content.length)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0&&this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");var r=this.options.content,i=function(t,e){for(var r=function(t){var e=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=t?3:0)}(t),i=1,n=0,o=0,s=c.length;o<=s;o++){var a=c[o];if(!a)throw new Error("Content too long: expected "+n+" but got "+r);switch(e){case"L":n=a[0];break;case"M":n=a[1];break;case"Q":n=a[2];break;case"H":n=a[3];break;default:throw new Error("Unknwon error correction level: "+e)}if(r<=n)break;i++}if(i>c.length)throw new Error("Content too long");return i}(r,this.options.ecl),o=function(t){switch(t){case"L":return 1;case"M":return 0;case"Q":return 3;case"H":return 2;default:throw new Error("Unknwon error correction level: "+t)}}(this.options.ecl);this.qrcode=new n(i,o),this.qrcode.addData(r),this.qrcode.make()}d.prototype.svg=function(t){var e=this.options||{},r=this.qrcode.modules;void 0===t&&(t={container:e.container||"svg"});for(var i=void 0===e.pretty||!!e.pretty,n=i?" ":"",o=i?"\r\n":"",s=e.width,a=e.height,h=r.length,u=s/(h+2*e.padding),f=a/(h+2*e.padding),l=void 0!==e.join&&!!e.join,c=void 0!==e.swap&&!!e.swap,d=void 0===e.xmlDeclaration||!!e.xmlDeclaration,p=void 0!==e.predefined&&!!e.predefined,m=p?n+''+o:"",g=n+''+o,y="",b="",v=0;v'+o:n+''+o}l&&(y=n+'');var A="";switch(t.container){case"svg":d&&(A+=''+o),A+=''+o,A+=m+g+y,A+="";break;case"svg-viewbox":d&&(A+=''+o),A+=''+o,A+=m+g+y,A+="";break;case"g":A+=''+o,A+=m+g+y,A+="";break;default:A+=(m+g+y).replace(/^\s+/,"")}return A},d.prototype.save=function(t,e){var i=this.svg();"function"!=typeof e&&(e=function(t,e){});try{r(531).writeFile(t,i,e)}catch(t){e(t)}},t.exports=d},531:()=>{}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,r),o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";var t;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t,e){for(var r=0;rh,CardanoPeerConnect:()=>W,DAppPeerConnect:()=>st,ExperimentalContainer:()=>E,PeerConnectIdenticon:()=>y});var h=o((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}));t=h,s(h,"storageKey","cardano-peer-autoconnect-id"),s(h,"discoveryStorageKey","cardano-peer-discovery-id"),s(h,"walletDiscoveryStorageKey","cardano-wallet-discovery-address"),s(h,"addAutoConnectId",(function(e){var r=[],i=localStorage.getItem(t.storageKey);null!==i&&(r=JSON.parse(i)),t.isAutoConnectId(e)||(r.push(e),localStorage.setItem(t.storageKey,JSON.stringify(r)))})),s(h,"getAutoConnectIds",(function(){var e;return JSON.parse(null!==(e=localStorage.getItem(t.storageKey))&&void 0!==e?e:"[]")})),s(h,"isAutoConnectId",(function(e){return t.getAutoConnectIds().includes(e)})),s(h,"resetAutoConnectIds",(function(){localStorage.setItem(t.storageKey,JSON.stringify([]))})),s(h,"removeAutoConnectId",(function(e){var r=[],i=localStorage.getItem(t.storageKey);null!==i&&(r=JSON.parse(i));var n=r.indexOf(e);if(-1!==n)return r=r.splice(n,1),void localStorage.setItem(t.storageKey,JSON.stringify(r))})),s(h,"saveWalletAutoDiscoverySeed",(function(e){localStorage.setItem(t.discoveryStorageKey,e)})),s(h,"getWalletAutoDiscoverySeed",(function(){return localStorage.getItem(t.discoveryStorageKey)})),s(h,"saveWalletDiscoveryAddress",(function(e){localStorage.setItem(t.walletDiscoveryStorageKey,e)})),s(h,"getWalletDiscoveryAddress",(function(){return localStorage.getItem(t.walletDiscoveryStorageKey)}));var u=r(726);function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function l(t,e){for(var r=0;r=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var h=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(h&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),B(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var n=i.arg;B(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,i){return this.delegate={iterator:L(e),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=t),g}},e}function v(t){return function(t){if(Array.isArray(t))return _(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||w(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t,e){if(t){if("string"==typeof t)return _(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(t,e):void 0}}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r0&&e%10==0?"-":t})).join(""),{size:100,baseSeed:"cardano-peer-connect",fontSize:.17,initialsColours:["#000000","#FF0000","#0000FF"]}).toDataURL()},(m=d(m="getBase64Identicon"))in p?Object.defineProperty(p,m,{value:g,enumerable:!0,configurable:!0,writable:!0}):p[m]=g;var E=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,e)}var e,r;return e=t,r=[{key:"get",value:function(t){return this[t]}},{key:"set",value:function(t,e){this[t]=e}}],r&&x(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function I(t){var e=new Map;for(var r in t){var i=t[r],n=void 0;"function"==typeof i?(n="AsyncFunction"===i.constructor.name?"async_function":"function",e.set(r,{valueType:n})):"object"===S(i)?(n="object",e.set(r,{valueType:n,value:JSON.parse(JSON.stringify(i))})):(n=S(i),e.set(r,{valueType:n,value:i}))}return e}function T(t,e){return P.apply(this,arguments)}function P(){return P=k(b().mark((function t(e,r){var i,n,o,s,a,h,u=arguments;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(i=u.length,n=new Array(i>2?i-2:0),o=2;o=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}(o.keys());try{var h=function(){var r,a=n.value,h=o.get(a);if(!h)return 1;"function"===h.valueType||"async_function"===h.valueType?s[a]=function(){for(var r,n=arguments.length,o=new Array(n),s=0;st.length)&&(e=t.length);for(var r=0,i=new Array(e);r=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var h=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(h&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var n=i.arg;T(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,i){return this.delegate={iterator:B(e),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=t),g}},e}function U(t,e,r,i,n,o,s){try{var a=t[o](s),h=a.value}catch(t){return void r(t)}a.done?e(h):Promise.resolve(h).then(i,n)}function q(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var o=t.apply(e,r);function s(t){U(o,i,n,s,a,"next",t)}function a(t){U(o,i,n,s,a,"throw",t)}s(void 0)}))}}function F(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),H(this,"meerkats",new Map),H(this,"identicon",null),H(this,"meerkat",null),H(this,"logLevel","info"),H(this,"DAppDiscoveryMeerkat",null),H(this,"cip30Functions",["getNetworkId","getUtxos","getCollateral","getBalance","getUsedAddresses","getUnusedAddresses","getChangeAddress","getRewardAddresses","signTx","signData","submitTx"]),H(this,"setLogLevel",(function(t){s.logLevel=t,s.meerkat&&(s.meerkat.logger.logLevel=t),s.DAppDiscoveryMeerkat&&(s.DAppDiscoveryMeerkat.logger.logLevel=t)})),H(this,"setUpDiscoveryMeerkat",(function(){var t;s.DAppDiscoveryMeerkat=new(R())({announce:s.announceEndpoints,seed:s.discoverySeed?s.discoverySeed:void 0,loggingEnabled:!0}).setMaxListeners(20),s.clearSeen(),s.DAppDiscoveryMeerkat.logger.logLevel=s.logLevel,null===(t=s.DAppDiscoveryMeerkat)||void 0===t||t.logger.debug("WALLET: discovery address:",s.DAppDiscoveryMeerkat.address()),s.discoverySeed||h.saveWalletAutoDiscoverySeed(s.DAppDiscoveryMeerkat.seed),s.DAppDiscoveryMeerkat.register("connect",(function(t,e,r){var i;null===(i=s.DAppDiscoveryMeerkat)||void 0===i||i.logger.debug("Wallet: DApp is connecting to discovery server!",e.dappAddress),s.connect(e.dappAddress),r(!0)})),s.addMeerkat(s.DAppDiscoveryMeerkat.address(),s.DAppDiscoveryMeerkat)})),H(this,"getDiscoveryMeerkatSeed",(function(){var t,e;return null!==(t=null===(e=s.DAppDiscoveryMeerkat)||void 0===e?void 0:e.seed)&&void 0!==t?t:null})),H(this,"getDiscoveryMeerkatAddress",(function(){var t,e;return null!==(t=null===(e=s.DAppDiscoveryMeerkat)||void 0===e?void 0:e.address())&&void 0!==t?t:null})),H(this,"setOnConnect",(function(t){s.onConnect=t})),H(this,"setOnDisconnect",(function(t){s.onDisconnect=t})),H(this,"setOnServerShutdown",(function(t){s.onServerShutdown=t})),H(this,"setOnApiInject",(function(t){s.onApiInject=t})),H(this,"clearSeen",(function(){s.meerkat&&(s.meerkat.logger.debug("WALLET: meerkat clear all seen clients."),s.meerkat.seen={}),s.DAppDiscoveryMeerkat&&(s.DAppDiscoveryMeerkat.logger.debug("WALLET: discovery meerkat clear all seen clients."),s.DAppDiscoveryMeerkat.seen={})})),H(this,"injectApi",(function(t){var e,r,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!s.meerkat)throw new Error("Merrkat not connected.");var n=I(null!==(e=s._cip30ExperimentalApi)&&void 0!==e?e:new E({})),o=I(null!==(r=s._cip30EnableExperimentalApi)&&void 0!==r?r:new E({})),a={api:{apiVersion:s.walletInfo.version,name:s.walletInfo.name,icon:s.walletInfo.icon,methods:s.cip30Functions,experimentalApi:B(n),fullExperimentalApi:B(o)},overwrite:i};s.meerkat.rpc(t,"api",a,(function(t){if(!s.meerkat)throw new Error("Meerkat not connected.");t.error&&s.meerkat.logger.warn((t.errorMessage,t.errorMessage)),s.onApiInject(t)}))})),H(this,"addMeerkat",(function(t,e){var r=s.meerkats.get(t);if(r){try{r.close()}catch(t){var i;null===(i=s.meerkat)||void 0===i||i.logger.warn("Error closing meerkat connection",t)}s.meerkats.delete(t)}s.meerkats.set(t,e)})),H(this,"getMeerkat",(function(t){var e;return null!==(e=s.meerkats.get(t))&&void 0!==e?e:null})),H(this,"generateIdenticon",(function(){var t,e,r,i;if(null===(t=s.meerkat)||void 0===t||!t.address())throw new Error("Server meerkat address not defined.");if(null===(e=s.meerkat)||void 0===e||!e.identifier)throw new Error("Client meerkat address not defined.");s.identicon=y.getBase64Identicon((null===(r=s.meerkat)||void 0===r?void 0:r.address())+(null===(i=s.meerkat)||void 0===i?void 0:i.identifier))})),H(this,"getIdenticon",(function(){return s.identicon})),this.walletInfo=e,this.seed=null!==(r=a.seed)&&void 0!==r?r:null,this.discoverySeed=null!==(i=a.discoverySeed)&&void 0!==i?i:null,this.announceEndpoints=null!==(n=a.announce)&&void 0!==n?n:["wss://tracker.openwebtorrent.com","wss://dev.tracker.cf-identity-wallet.metadata.dev.cf-deployments.org","wss://tracker.files.fm:7073/announce","ws://tracker.files.fm:7072/announce","wss://tracker.openwebtorrent.com:443/announce"],this.logLevel=null!==(o=a.logLevel)&&void 0!==o?o:"info",this.onConnect=function(t){},this.onDisconnect=function(t){},this.onServerShutdown=function(){},this.onApiInject=function(){},this.setUpDiscoveryMeerkat()}var e,r;return e=t,r=[{key:"setExperimentalApi",value:function(t){this._cip30ExperimentalApi=t}},{key:"setEnableExperimentalApi",value:function(t){this._cip30EnableExperimentalApi=t}},{key:"getMeercat",value:function(t){return this.meerkats.get(t)}},{key:"connect",value:function(t){var e,r,i=this;return this.meerkat=new(R())({identifier:t,announce:this.announceEndpoints,seed:null!==(e=this.seed)&&void 0!==e?e:void 0}).setMaxListeners(20),this.meerkat.logger.logLevel=this.logLevel,null===(r=this.meerkat)||void 0===r||r.logger.debug("WALLET: calling to connect to DApp:",t),this.meerkat.register("shutdown",function(){var t=q(D().mark((function t(e,r,n){var o;return D().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e===r.dApp.address){t.next=2;break}throw new Error("Address ".concat(r.address," tries to send shutdown for server, ").concat(r.address,"."));case 2:i.clearSeen(),i.onServerShutdown(r),null===(o=i.meerkat)||void 0===o||o.logger.debug("WALLET: setup discovery again after server did shutdown."),i.setUpDiscoveryMeerkat();case 6:case"end":return t.stop()}}),t)})));return function(e,r,i){return t.apply(this,arguments)}}()),this.meerkat.register("invoke",function(){var e=q(D().mark((function e(r,n,o){var s,a;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=n[0],r!==t){e.next=6;break}return e.next=4,i[s].apply(i,function(t){if(Array.isArray(t))return N(t)}(h=n.splice(1))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(h)||function(t,e){if(t){if("string"==typeof t)return N(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(t,e):void 0}}(h)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());case 4:void 0!==(a=e.sent)&&o(a);case 6:case"end":return e.stop()}var h}),e)})));return function(t,r,i){return e.apply(this,arguments)}}()),L(this.meerkat,"invokeExperimental",this._cip30ExperimentalApi,t),L(this.meerkat,"invokeEnableExperimental",this._cip30EnableExperimentalApi,t),this.meerkat.on("server",(function(){var e;if(null===(e=i.meerkat)||void 0===e||e.logger.debug("WALLET: DApp server seen, create connection!"),!i.meerkat)throw new Error("Meerkat not connected.");i.meerkat.rpc(t,"connect",i.walletInfo,(function(e){var r,n,o,s;if(null===(r=i.meerkat)||void 0===r||r.logger.debug("WALLET: DApp now connected with status:",e),e.connected){var a;i.injectApi(t),i.DAppDiscoveryMeerkat&&(null===(a=i.meerkat)||void 0===a||a.logger.debug("WALLET: Close discovery after successfully connected to server."),i.DAppDiscoveryMeerkat.close())}else{if(!i.meerkat)throw new Error("Merrkat not connected.");i.meerkat.logger.warn("Connection failed. Another wallet has already been connected to this dApp.")}i.generateIdenticon(),null!==(n=i.DAppDiscoveryMeerkat)&&void 0!==n&&n.address()?i.meerkat.rpc(t,"setDiscovery",{walletDiscoveryAddress:i.DAppDiscoveryMeerkat.address()},(function(t){var e;null===(e=i.meerkat)||void 0===e||e.logger.debug("WALLET: result of setDiscovery call",t)})):null===(s=i.meerkat)||void 0===s||s.logger.debug("WALLET: discovery meerkat has no address ?"),null===(o=i.meerkat)||void 0===o||o.logger.debug("WALLET: calling onConnect event callback from wallet!",i.onConnect),i.onConnect(e)}))})),this.addMeerkat(t,this.meerkat),this.meerkat.seed}},{key:"disconnect",value:function(t){var e=this;if(!this.meerkat)throw new Error("Meerkat not connected.");this.meerkat.rpc(t,"disconnect",this.walletInfo,(function(t){var r;e.meerkat&&e.meerkat.close(),e.clearSeen(),e.onDisconnect(t),null===(r=e.meerkat)||void 0===r||r.logger.debug("WALLET: setup discovery after disconnect was called"),e.setUpDiscoveryMeerkat()}))}}],r&&F(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),K=r(684),V=r.n(K);function $(t){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$(t)}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}(t);try{for(i.s();!(e=i.n()).done;){var n=e.value;r+="string"==typeof n||"number"==typeof n||"boolean"==typeof n?n+",\n":JSON.stringify(n,void 0,4)+",\n"}}catch(t){i.e(t)}finally{i.f()}return r.replace(/,\n$/,"")}},{key:"debug",value:function(){if("debug"===this.logLevel){for(var t=arguments.length,e=new Array(t),r=0;rt.length)&&(e=t.length);for(var r=0,i=new Array(e);r1&&void 0!==arguments[1]&&arguments[1];r.logLevel=t,r.logger.logLevel=t,r.meerkat&&e&&(r.meerkat.logger.logLevel=t),r.walletDiscoveryMeerkat&&e&&(r.walletDiscoveryMeerkat.logger.logLevel=t)})),nt(this,"leftServer",(function(t){if(t===r.connectedWallet){r.connectedWallet=null,r.onDisconnect&&r.onDisconnect(t);var e=window.cardano||{},i=Object.keys(e).find((function(r){return e[r].identifier===t}));i?(r.logger.info("".concat(r.connectedWallet," disconnected. ").concat(i," has been removed from the global window object")),delete window.cardano[i.toLowerCase()],r.onApiEject&&r.onApiEject(i,t)):r.logger.info("".concat(r.connectedWallet," disconnected. Cleanup was not necessary."))}})),nt(this,"shutdownServer",(function(){if(r.connectedWallet){var t={connected:!1,error:!1,errorMessage:"Server is closing connections.",dApp:r.dAppInfo};r.meerkat.rpc(r.connectedWallet,"shutdown",t,(function(){}))}})),nt(this,"isWalletNameInjected",(function(t){var e=window.cardano||{};return Object.keys(e).find((function(e){return e===t.toLowerCase()}))})),nt(this,"isP2pWalletCompliantName",(function(t){return t.includes("p2p")})),nt(this,"generateIdenticon",(function(){r.identicon=y.getBase64Identicon(r.connectedWallet+r.getAddress())})),nt(this,"getIdenticon",(function(){return r.identicon})),a&&(this.enableLogging=a),s||(s=["wss://tracker.openwebtorrent.com","wss://dev.tracker.cf-identity-wallet.metadata.dev.cf-deployments.org","wss://tracker.files.fm:7073/announce","ws://tracker.files.fm:7072/announce","wss://tracker.openwebtorrent.com:443/announce"]),this.meerkat=new(R())({seed:n||localStorage.getItem("meerkat-dapp-seed")||void 0,announce:s,loggingEnabled:a}).setMaxListeners(20),this.dAppInfo=rt(rt({},i),{},{address:this.meerkat.address()}),this.logger=new Y({scope:"DAppPeerConnect",logLevel:"info",enabled:a}),this.meerkat.logger.logLevel=this.logLevel,p&&setTimeout((function(){r.setUpDiscoveryMeerkcat(s,o)}),1e3),this.onConnect=f,this.onDisconnect=l,this.onApiEject=c,this.onApiInject=d,localStorage.setItem("meerkat-dapp-seed",this.meerkat.seed),this.logger.info("The generated meerkat address is: ".concat(this.meerkat.address())),this.dAppInfo.address=this.meerkat.address();var m=!1;this.meerkat.on("connections",(function(){m||(m=!0,r.logger.info("server ready"))})),this.meerkat.on("seen",(function(t){var e=window.cardano||{};Object.keys(e).find((function(r){return e[r].identifier===t}))?r.logger.info("Saw address ".concat(t)):r.logger.info("Saw address ".concat(t," but it has not injected it's api yet"))})),this.meerkat.on("left",(function(t){r.leftServer(t)})),this.meerkat.register("connect",(function(t,e,i){if(r.connectedWallet)r.connectedWallet===t?(r.logger.info("Connection has already been established to ".concat(t,".")),i({address:t,dApp:r.dAppInfo,connected:!0,error:!1})):(i({dApp:r.dAppInfo,address:t,connected:!1,error:!1,errorMessage:"Connection failed. Another wallet has already been connected to this dApp."}),r.logger.info("Connection failed. Another wallet has already been connected to this dApp."));else{var n=function(n){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2?arguments[2]:void 0;e.requestAutoconnect&&n&&o&&h.addAutoConnectId(t),n?(r.connectedWallet=t,r.logger.info("Successfully connected ".concat(r.connectedWallet)),i({dApp:r.dAppInfo,address:t,connected:!0,error:!1,autoConnect:o}),r.generateIdenticon(),r.onConnect&&r.onConnect(t,s)):(i({dApp:r.dAppInfo,address:t,connected:!1,error:!0,errorMessage:"User denied connection to ".concat(t),autoConnect:o}),r.logger.info("User denied connection to ".concat(t)))};void 0!==u?h.isAutoConnectId(t)?n(!0,!0,e):u(rt(rt({},e),{},{address:t}),n):n(!0)}})),this.meerkat.register("disconnect",(function(t,e,i){if(r.connectedWallet)return r.connectedWallet!==t?(r.logger.info("Unregistered address ".concat(t," is calling disconnect.")),void i({dApp:r.dAppInfo,connected:!1,error:!0,errorMessage:"Unregistered address ${address} is calling disconnect."})):(r.logger.info("Wallet ".concat(r.connectedWallet," is calling disconnect.")),i({dApp:r.dAppInfo,connected:!1,error:!1}),r.leftServer(t),void(r.connectedWallet=null));r.logger.info("Calling disconnect with no connected wallet."),i({dApp:r.dAppInfo,connected:!1,error:!0,errorMessage:"No wallet is connected."})})),this.meerkat.register("setDiscovery",(function(t,e,i){return r.logger.debug("DApp: SERVER: setDiscovery with:",e),p?(h.saveWalletDiscoveryAddress(e.walletDiscoveryAddress),i(!0)):i(!1)})),this.meerkat.register("api",(function(t,e,i){if(t===r.connectedWallet)if(!r.getInjectedApis().includes(t)||e.overwrite){var n,o={},s=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Q(t))){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}(e.api.methods);try{var a=function(){var e=n.value;o[e]=function(){for(var i=arguments.length,n=new Array(i),o=0;o {\nreturn ","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(self, function() {\nreturn /******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ \"./node_modules/@basementuniverse/commonjs/common.js\":\n/*!***********************************************************!*\\\n !*** ./node_modules/@basementuniverse/commonjs/common.js ***!\n \\***********************************************************/\n/***/ ((module) => {\n\n/**\n * @overview A library of useful functions\n * @author Gordon Larrigan\n * @version 1.2.9\n */\n\n/** @class Math */\n\n/**\n * Check if two numbers are approximately equal\n * @param {number} a Number a\n * @param {number} b Number b\n * @param {number} [p=Number.EPSILON] The precision value\n * @return {boolean} True if numbers a and b are approximately equal\n */\nMath.floatEquals = (a, b, p = Number.EPSILON) => Math.abs(a - b) < p;\n\n/**\n * Clamp a number between min and max\n * @param {number} a The number to clamp\n * @param {number} [min=0] The minimum value\n * @param {number} [max=1] The maximum value\n * @return {number} A clamped number\n */\nMath.clamp = (a, min = 0, max = 1) => a < min ? min : (a > max ? max : a);\n\n/**\n * Get the fractional part of a number\n * @param {number} a The number from which to get the fractional part\n * @return {number} The fractional part of the number\n */\nMath.frac = a => a >= 0 ? a - Math.floor(a) : a - Math.ceil(a);\n\n/**\n * Do a linear interpolation between a and b\n * @param {number} a The minimum number\n * @param {number} b The maximum number\n * @param {number} i The interpolation value, should be in the interval [0, 1]\n * @return {number} An interpolated value in the interval [a, b]\n */\nMath.lerp = (a, b, i) => a + (b - a) * i;\n\n/**\n * Get the position of i between a and b\n * @param {number} a The minimum number\n * @param {number} b The maximum number\n * @param {number} i The interpolated value in the interval [a, b]\n * @return {number} The position of i between a and b\n */\nMath.unlerp = (a, b, i) => (i - a) / (b - a);\n\n/**\n * Do a bilinear interpolation\n * @param {number} c00 Top-left value\n * @param {number} c10 Top-right value\n * @param {number} c01 Bottom-left value\n * @param {number} c11 Bottom-right value\n * @param {number} ix Interpolation value along x\n * @param {number} iy Interpolation value along y\n * @return {number} A bilinear interpolated value\n */\nMath.blerp = (c00, c10, c01, c11, ix, iy) => Math.lerp(Math.lerp(c00, c10, ix), Math.lerp(c01, c11, ix), iy);\n\n/**\n * Re-map a number i from range a1...a2 to b1...b2\n * @param {number} i The number to re-map\n * @param {number} a1\n * @param {number} a2\n * @param {number} b1\n * @param {number} b2\n * @return {number}\n */\nMath.remap = (i, a1, a2, b1, b2) => b1 + (i - a1) * (b2 - b1) / (a2 - a1);\n\n/**\n * Do a smooth interpolation between a and b\n * @param {number} a The minimum number\n * @param {number} b The maximum number\n * @param {number} i The interpolation value\n * @return {number} An interpolated value in the interval [a, b]\n */\nMath.smoothstep = (a, b, i) => Math.lerp(a, b, 3 * Math.pow(i, 2) - 2 * Math.pow(i, 3));\n\n/**\n * Get an angle in radians\n * @param {number} degrees The angle in degrees\n * @return {number} The angle in radians\n */\nMath.radians = degrees => (Math.PI / 180) * degrees;\n\n/**\n * Get an angle in degrees\n * @param {number} radians The angle in radians\n * @return {number} The angle in degrees\n */\nMath.degrees = radians => (180 / Math.PI) * radians;\n\n/**\n * Get a random float in the interval [min, max)\n * @param {number} min Inclusive min\n * @param {number} max Exclusive max\n * @return {number} A random float in the interval [min, max)\n */\nMath.randomBetween = (min, max) => Math.random() * (max - min) + min;\n\n/**\n * Get a random integer in the interval [min, max]\n * @param {number} min Inclusive min\n * @param {number} max Inclusive max\n * @return {number} A random integer in the interval [min, max]\n */\nMath.randomIntBetween = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;\n\n/**\n * Get a normally-distributed random number\n * @param {number} [mu=0.5] The mean value\n * @param {number} [sigma=0.5] The standard deviation\n * @param {number} [samples=2] The number of samples\n * @return {number} A normally-distributed random number\n */\nMath.cltRandom = (mu = 0.5, sigma = 0.5, samples = 2) => {\n let total = 0;\n for (let i = samples; i--;) {\n total += Math.random();\n }\n return mu + (total - samples / 2) / (samples / 2) * sigma;\n};\n\n/**\n * Get a normally-distributed random integer in the interval [min, max]\n * @param {number} min Inclusive min\n * @param {number} max Inclusive max\n * @return {number} A normally-distributed random integer\n */\nMath.cltRandomInt = (min, max) => Math.floor(min + Math.cltRandom(0.5, 0.5, 2) * (max + 1 - min));\n\n/**\n * Return a weighted random integer\n * @param {Array} w An array of weights\n * @return {number} An index from w\n */\nMath.weightedRandom = w => {\n let total = w.reduce((a, i) => a + i, 0), n = 0;\n const r = Math.random() * total;\n while (total > r) {\n total -= w[n++];\n }\n return n - 1;\n};\n\n/**\n * An interpolation function\n * @callback interpolationCallback\n * @param {number} a The minimum number\n * @param {number} b The maximum number\n * @param {number} i The interpolation value, should be in the interval [0, 1]\n * @return {number} The interpolated value in the interval [a, b]\n */\n\n/**\n * Return an interpolated value from an array\n * @param {Array} a An array of values interpolate\n * @param {number} i A number in the interval [0, 1]\n * @param {interpolationCallback} [f=Math.lerp] The interpolation function to use\n * @return {number} An interpolated value in the interval [min(a), max(a)]\n */\nMath.lerpArray = (a, i, f = Math.lerp) => {\n const s = i * (a.length - 1);\n const p = Math.clamp(Math.trunc(s), 0, a.length - 1);\n return f(a[p] || 0, a[p + 1] || 0, Math.frac(s));\n};\n\n/**\n * Get the dot product of two vectors\n * @param {Array} a Vector a\n * @param {Array} b Vector b\n * @return {number} a ∙ b\n */\nMath.dot = (a, b) => a.reduce((n, v, i) => n + v * b[i], 0);\n\n/**\n * Get the factorial of a number\n * @param {number} a\n * @return {number} a!\n */\nMath.factorial = a => {\n let result = 1;\n for (let i = 2; i <= a; i++) {\n result *= i;\n }\n return result;\n};\n\n/**\n * Get the number of permutations of r elements from a set of n elements\n * @param {number} n\n * @param {number} r\n * @return {number} nPr\n */\nMath.permutation = (n, r) => Math.factorial(n) / Math.factorial(n - r);\n\n/**\n * Get the number of combinations of r elements from a set of n elements\n * @param {number} n\n * @param {number} r\n * @return {number} nCr\n */\nMath.combination = (n, r) => Math.factorial(n) / (Math.factorial(r) * Math.factorial(n - r));\n\n/** @class Array */\n\n/**\n * A function for generating array values\n * @callback timesCallback\n * @param {number} i The array index\n * @return {*} The array value\n */\n\n/**\n * Return a new array with length n by calling function f(i) on each element\n * @param {timesCallback} f\n * @param {number} n The size of the array\n * @return {Array<*>}\n */\nArray.times = (f, n) => Array(n).fill(0).map((_, i) => f(i));\n\n/**\n * Return an array containing numbers 0->(n - 1)\n * @param {number} n The size of the array\n * @return {Array} An array of integers 0->(n - 1)\n */\nArray.range = n => Array.times(i => i, n);\n\n/**\n * Zip 2 arrays together, i.e. ([1, 2, 3], [a, b, c]) => [[1, a], [2, b], [3, c]]\n * @param {Array<*>} a\n * @param {Array<*>} b\n * @return {Array>}\n */\nArray.zip = (a, b) => a.map((k, i) => [k, b[i]]);\n\n/**\n * Return array[i] with positive and negative wrapping\n * @name at\n * @function\n * @memberof Array.prototype\n * @param {number} i The positively/negatively wrapped array index\n * @return {*} An element from the array\n */\nObject.defineProperty(Array.prototype, 'at', {\n value: function (i) {\n const l = this.length;\n return this[i < 0 ? l - (Math.abs(i + 1) % l) - 1 : i % l];\n }\n});\n\n/**\n * Chop an array into chunks of size n\n * @name chunk\n * @function\n * @memberof Array.prototype\n * @param {number} n The chunk size\n * @return {Array>} An array of array chunks\n */\nObject.defineProperty(Array.prototype, 'chunk', {\n value: function (n) {\n return Array.times(i => this.slice(i * n, i * n + n), Math.ceil(this.length / n));\n }\n});\n\n/**\n * Randomly shuffle an array in-place\n * @name shuffle\n * @function\n * @memberof Array.prototype\n * @return {Array<*>} The shuffled array\n */\nObject.defineProperty(Array.prototype, 'shuffle', {\n value: function () {\n return this.map(a => [Math.random(), a]).sort((a, b) => a[0] - b[0]).map(a => a[1]);\n }\n});\n\n/**\n * A 2d vector\n * @typedef {Object} vec\n * @property {number} x The x component of the vector\n * @property {number} y The y component of the vector\n */\n\n/**\n * Create a new vector\n * @param {number|vec} [x] The x component of the vector, or a vector to copy\n * @param {number} [y] The y component of the vector\n * @return {vec} A new vector\n * @example Various ways to initialise a vector\n * let a = vec(3, 2); // (3, 2)\n * let b = vec(4); // (4, 4)\n * let c = vec(a); // (3, 2)\n * let d = vec(); // (0, 0)\n */\nconst vec = (x, y) => (!x && !y ?\n { x: 0, y: 0 } : (typeof x === 'object' ?\n { x: x.x || 0, y: x.y || 0 } : (y === null || y === undefined ?\n { x: x, y: x } : { x: x, y: y })\n )\n);\n\n/**\n * Get the components of a vector as an array\n * @param {vec} a The vector to get components from\n * @return {Array} The vector components as an array\n */\nvec.components = a => [a.x, a.y];\n\n/**\n * Return a unit vector (1, 0)\n * @return {vec} A unit vector (1, 0)\n */\nvec.ux = () => vec(1, 0);\n\n/**\n * Return a unit vector (0, 1)\n * @return {vec} A unit vector (0, 1)\n */\nvec.uy = () => vec(0, 1);\n\n/**\n * Add vectors\n * @param {vec} a Vector a\n * @param {vec} b Vector b\n * @return {vec} a + b\n */\nvec.add = (a, b) => ({ x: a.x + b.x, y: a.y + b.y });\n\n/**\n * Scale a vector\n * @param {vec} a Vector a\n * @param {number} b Scalar b\n * @return {vec} a * b\n */\nvec.mul = (a, b) => ({ x: a.x * b, y: a.y * b });\n\n/**\n * Subtract vectors\n * @param {vec} a Vector a\n * @param {vec} b Vector b\n * @return {vec} a - b\n */\nvec.sub = (a, b) => ({ x: a.x - b.x, y: a.y - b.y });\n\n/**\n * Get the length of a vector\n * @param {vec} a Vector a\n * @return {number} |a|\n */\nvec.len = a => Math.sqrt(a.x * a.x + a.y * a.y);\n\n/**\n * Get the length of a vector using taxicab geometry\n * @param {vec} a Vector a\n * @return {number} |a|\n */\nvec.manhattan = a => Math.abs(a.x) + Math.abs(a.y);\n\n/**\n * Normalise a vector\n * @param {vec} a The vector to normalise\n * @return {vec} ^a\n */\nvec.nor = a => {\n let len = vec.len(a);\n return len ? { x: a.x / len, y: a.y / len } : vec();\n};\n\n/**\n * Get a dot product of vectors\n * @param {vec} a Vector a\n * @param {vec} b Vector b\n * @return {number} a ∙ b\n */\nvec.dot = (a, b) => a.x * b.x + a.y * b.y;\n\n/**\n * Rotate a vector by r radians\n * @param {vec} a The vector to rotate\n * @param {number} r The angle to rotate by, measured in radians\n * @return {vec} A rotated vector\n */\nvec.rot = (a, r) => {\n let s = Math.sin(r),\n c = Math.cos(r);\n return { x: c * a.x - s * a.y, y: s * a.x + c * a.y };\n}\n\n/**\n * Check if two vectors are equal\n * @param {vec} a Vector a\n * @param {vec} b Vector b\n * @return {boolean} True if vectors a and b are equal, false otherwise\n */\nvec.eq = (a, b) => a.x === b.x && a.y === b.y;\n\n/**\n * Get the angle of a vector\n * @param {vec} a Vector a\n * @return {number} The angle of vector a in radians\n */\nvec.rad = a => Math.atan2(a.y, a.x);\n\n/**\n * Copy a vector\n * @param {vec} a The vector to copy\n * @return {vec} A copy of vector a\n */\nvec.cpy = a => vec(a);\n\n/**\n * A function to call on each component of a vector\n * @callback vectorMapCallback\n * @param {number} value The component value\n * @param {'x' | 'y'} label The component label (x or y)\n * @return {number} The mapped component\n */\n\n/**\n * Call a function on each component of a vector and build a new vector from the results\n * @param {vec} a Vector a\n * @param {vectorMapCallback} f The function to call on each component of the vector\n * @return {vec} Vector a mapped through f\n */\nvec.map = (a, f) => ({ x: f(a.x, 'x'), y: f(a.y, 'y') });\n\n/**\n * Convert a vector into a string\n * @param {vec} a The vector to convert\n * @param {string} [s=', '] The separator string\n * @return {string} A string representation of the vector\n */\nvec.str = (a, s = ', ') => `${a.x}${s}${a.y}`;\n\n/**\n * A matrix\n * @typedef {Object} mat\n * @property {number} m The number of rows in the matrix\n * @property {number} n The number of columns in the matrix\n * @property {Array} entries The matrix values\n */\n\n/**\n * Create a new matrix\n * @param {number} [m=4] The number of rows\n * @param {number} [n=4] The number of columns\n * @param {Array} [entries=[]] Matrix values in reading order\n * @return {mat} A new matrix\n */\nconst mat = (m = 4, n = 4, entries = []) => ({\n m, n,\n entries: entries.concat(Array(m * n).fill(0)).slice(0, m * n)\n});\n\n/**\n * Get an identity matrix of size n\n * @param {number} n The size of the matrix\n * @return {mat} An identity matrix\n */\nmat.identity = n => mat(n, n, Array(n * n).fill(0).map((v, i) => +(Math.floor(i / n) === i % n)));\n\n/**\n * Get an entry from a matrix\n * @param {mat} a Matrix a\n * @param {number} i The row offset\n * @param {number} j The column offset\n * @return {number} The value at position (i, j) in matrix a\n */\nmat.get = (a, i, j) => a.entries[(j - 1) + (i - 1) * a.n];\n\n/**\n * Set an entry of a matrix\n * @param {mat} a Matrix a\n * @param {number} i The row offset\n * @param {number} j The column offset\n * @param {number} v The value to set in matrix a\n */\nmat.set = (a, i, j, v) => { a.entries[(j - 1) + (i - 1) * a.n] = v; };\n\n/**\n * Get a row from a matrix as an array\n * @param {mat} a Matrix a\n * @param {number} m The row offset\n * @return {Array} Row m from matrix a\n */\nmat.row = (a, m) => {\n const s = (m - 1) * a.n;\n return a.entries.slice(s, s + a.n);\n};\n\n/**\n * Get a column from a matrix as an array\n * @param {mat} a Matrix a\n * @param {number} n The column offset\n * @return {Array} Column n from matrix a\n */\nmat.col = (a, n) => Array.times(i => mat.get(a, (i + 1), n), a.m);\n\n/**\n * Add matrices\n * @param {mat} a Matrix a\n * @param {mat} b Matrix b\n * @return {mat} a + b\n */\nmat.add = (a, b) => a.m === b.m && a.n === b.n && mat.map(a, (v, i) => v + b.entries[i]);\n\n/**\n * Subtract matrices\n * @param {mat} a Matrix a\n * @param {mat} b Matrix b\n * @return {mat} a - b\n */\nmat.sub = (a, b) => a.m === b.m && a.n === b.n && mat.map(a, (v, i) => v - b.entries[i]);\n\n/**\n * Multiply matrices\n * @param {mat} a Matrix a\n * @param {mat} b Matrix b\n * @return {mat|boolean} ab or false if the matrices cannot be multiplied\n */\nmat.mul = (a, b) => {\n if (a.n !== b.m) { return false; }\n const result = mat(a.m, b.n);\n for (let i = 1; i <= a.m; i++) {\n for (let j = 1; j <= b.n; j++) {\n mat.set(result, i, j, Math.dot(mat.row(a, i), mat.col(b, j)));\n }\n }\n return result;\n};\n\n/**\n * Scale a matrix\n * @param {mat} a Matrix a\n * @param {number} b Scalar b\n * @return {mat} a * b\n */\nmat.scale = (a, b) => mat.map(a, v => v * b);\n\n/**\n * Transpose a matrix\n * @param {mat} a The matrix to transpose\n * @return {mat} A transposed matrix\n */\nmat.trans = a => mat(a.n, a.m, Array.times(i => mat.col(a, (i + 1)), a.n).flat());\n\n/**\n * Get the minor of a matrix\n * @param {mat} a Matrix a\n * @param {number} i The row offset\n * @param {number} j The column offset\n * @return {mat|boolean} The (i, j) minor of matrix a or false if the matrix is not square\n */\nmat.minor = (a, i, j) => {\n if (a.m !== a.n) { return false; }\n const entries = [];\n for (let ii = 1; ii <= a.m; ii++) {\n if (ii === i) { continue; }\n for (let jj = 1; jj <= a.n; jj++) {\n if (jj === j) { continue; }\n entries.push(mat.get(a, ii, jj));\n }\n }\n return mat(a.m - 1, a.n - 1, entries);\n};\n\n/**\n * Get the determinant of a matrix\n * @param {mat} a Matrix a\n * @return {number|boolean} |a| or false if the matrix is not square\n */\nmat.det = a => {\n if (a.m !== a.n) { return false; }\n if (a.m === 1) {\n return a.entries[0];\n }\n if (a.m === 2) {\n return a.entries[0] * a.entries[3] - a.entries[1] * a.entries[2];\n }\n let total = 0, sign = 1;\n for (let j = 1; j <= a.n; j++) {\n total += sign * a.entries[j - 1] * mat.det(mat.minor(a, 1, j));\n sign *= -1;\n }\n return total;\n};\n\n/**\n * Normalise a matrix\n * @param {mat} a The matrix to normalise\n * @return {mat|boolean} ^a or false if the matrix is not square\n */\nmat.nor = a => {\n if (a.m !== a.n) { return false; }\n const d = mat.det(a);\n return mat.map(a, i => i * d);\n};\n\n/**\n * Get the adjugate of a matrix\n * @param {mat} a The matrix from which to get the adjugate\n * @return {mat} The adjugate of a\n */\nmat.adj = a => {\n const minors = mat(a.m, a.n);\n for (let i = 1; i <= a.m; i++) {\n for (let j = 1; j <= a.n; j++) {\n mat.set(minors, i, j, mat.det(mat.minor(a, i, j)));\n }\n }\n const cofactors = mat.map(minors, (v, i) => v * (i % 2 ? -1 : 1));\n return mat.trans(cofactors);\n};\n\n/**\n * Get the inverse of a matrix\n * @param {mat} a The matrix to invert\n * @return {mat|boolean} a^-1 or false if the matrix has no inverse\n */\nmat.inv = a => {\n if (a.m !== a.n) { return false; }\n const d = mat.det(a);\n if (d === 0) { return false; }\n return mat.scale(mat.adj(a), 1 / d);\n};\n\n/**\n * Check if two matrices are equal\n * @param {mat} a Matrix a\n * @param {mat} b Matrix b\n * @return {boolean} True if matrices a and b are identical, false otherwise\n */\nmat.eq = (a, b) => a.m === b.m && a.n === b.n && mat.str(a) === mat.str(b);\n\n/**\n * Copy a matrix\n * @param {mat} a The matrix to copy\n * @return {mat} A copy of matrix a\n */\nmat.cpy = a => mat(a.m, a.n, [...a.entries]);\n\n/**\n * A function to call on each entry of a matrix\n * @callback matrixMapCallback\n * @param {number} value The entry value\n * @param {number} index The entry index\n * @param {Array} entries The array of matrix entries\n * @return {number} The mapped entry\n */\n\n/**\n * Call a function on each entry of a matrix and build a new matrix from the results\n * @param {mat} a Matrix a\n * @param {matrixMapCallback} f The function to call on each entry of the matrix\n * @return {mat} Matrix a mapped through f\n */\nmat.map = (a, f) => mat(a.m, a.n, a.entries.map(f));\n\n/**\n * Convert a matrix into a string\n * @param {mat} a The matrix to convert\n * @param {string} [ms=', '] The separator string for columns\n * @param {string} [ns='\\n'] The separator string for rows\n * @return {string} A string representation of the matrix\n */\nmat.str = (a, ms = ', ', ns = '\\n') => a.entries.chunk(a.n).map(r => r.join(ms)).join(ns);\n\nif (true) {\n module.exports = { vec, mat };\n}\n\n\n/***/ }),\n\n/***/ \"./node_modules/seed-random/index.js\":\n/*!*******************************************!*\\\n !*** ./node_modules/seed-random/index.js ***!\n \\*******************************************/\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\"use strict\";\n\r\n\r\nvar width = 256;// each RC4 output is 0 <= x < 256\r\nvar chunks = 6;// at least six RC4 outputs for each double\r\nvar digits = 52;// there are 52 significant digits in a double\r\nvar pool = [];// pool: entropy pool starts empty\r\nvar GLOBAL = typeof __webpack_require__.g === 'undefined' ? window : __webpack_require__.g;\r\n\r\n//\r\n// The following constants are related to IEEE 754 limits.\r\n//\r\nvar startdenom = Math.pow(width, chunks),\r\n significance = Math.pow(2, digits),\r\n overflow = significance * 2,\r\n mask = width - 1;\r\n\r\n\r\nvar oldRandom = Math.random;\r\n\r\n//\r\n// seedrandom()\r\n// This is the seedrandom function described above.\r\n//\r\nmodule.exports = function(seed, options) {\r\n if (options && options.global === true) {\r\n options.global = false;\r\n Math.random = module.exports(seed, options);\r\n options.global = true;\r\n return Math.random;\r\n }\r\n var use_entropy = (options && options.entropy) || false;\r\n var key = [];\r\n\r\n // Flatten the seed string or build one from local entropy if needed.\r\n var shortseed = mixkey(flatten(\r\n use_entropy ? [seed, tostring(pool)] :\r\n 0 in arguments ? seed : autoseed(), 3), key);\r\n\r\n // Use the seed to initialize an ARC4 generator.\r\n var arc4 = new ARC4(key);\r\n\r\n // Mix the randomness into accumulated entropy.\r\n mixkey(tostring(arc4.S), pool);\r\n\r\n // Override Math.random\r\n\r\n // This function returns a random double in [0, 1) that contains\r\n // randomness in every bit of the mantissa of the IEEE 754 value.\r\n\r\n return function() { // Closure to return a random double:\r\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\r\n d = startdenom, // and denominator d = 2 ^ 48.\r\n x = 0; // and no 'extra last byte'.\r\n while (n < significance) { // Fill up all significant digits by\r\n n = (n + x) * width; // shifting numerator and\r\n d *= width; // denominator and generating a\r\n x = arc4.g(1); // new least-significant-byte.\r\n }\r\n while (n >= overflow) { // To avoid rounding up, before adding\r\n n /= 2; // last byte, shift everything\r\n d /= 2; // right using integer Math until\r\n x >>>= 1; // we have exactly the desired bits.\r\n }\r\n return (n + x) / d; // Form the number within [0, 1).\r\n };\r\n};\r\n\r\nmodule.exports.resetGlobal = function () {\r\n Math.random = oldRandom;\r\n};\r\n\r\n//\r\n// ARC4\r\n//\r\n// An ARC4 implementation. The constructor takes a key in the form of\r\n// an array of at most (width) integers that should be 0 <= x < (width).\r\n//\r\n// The g(count) method returns a pseudorandom integer that concatenates\r\n// the next (count) outputs from ARC4. Its return value is a number x\r\n// that is in the range 0 <= x < (width ^ count).\r\n//\r\n/** @constructor */\r\nfunction ARC4(key) {\r\n var t, keylen = key.length,\r\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\r\n\r\n // The empty key [] is treated as [0].\r\n if (!keylen) { key = [keylen++]; }\r\n\r\n // Set up S using the standard key scheduling algorithm.\r\n while (i < width) {\r\n s[i] = i++;\r\n }\r\n for (i = 0; i < width; i++) {\r\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\r\n s[j] = t;\r\n }\r\n\r\n // The \"g\" method returns the next (count) outputs as one number.\r\n (me.g = function(count) {\r\n // Using instance members instead of closure state nearly doubles speed.\r\n var t, r = 0,\r\n i = me.i, j = me.j, s = me.S;\r\n while (count--) {\r\n t = s[i = mask & (i + 1)];\r\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\r\n }\r\n me.i = i; me.j = j;\r\n return r;\r\n // For robust unpredictability discard an initial batch of values.\r\n // See http://www.rsa.com/rsalabs/node.asp?id=2009\r\n })(width);\r\n}\r\n\r\n//\r\n// flatten()\r\n// Converts an object tree to nested arrays of strings.\r\n//\r\nfunction flatten(obj, depth) {\r\n var result = [], typ = (typeof obj)[0], prop;\r\n if (depth && typ == 'o') {\r\n for (prop in obj) {\r\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\r\n }\r\n }\r\n return (result.length ? result : typ == 's' ? obj : obj + '\\0');\r\n}\r\n\r\n//\r\n// mixkey()\r\n// Mixes a string seed into a key that is an array of integers, and\r\n// returns a shortened string seed that is equivalent to the result key.\r\n//\r\nfunction mixkey(seed, key) {\r\n var stringseed = seed + '', smear, j = 0;\r\n while (j < stringseed.length) {\r\n key[mask & j] =\r\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\r\n }\r\n return tostring(key);\r\n}\r\n\r\n//\r\n// autoseed()\r\n// Returns an object for autoseeding, using window.crypto if available.\r\n//\r\n/** @param {Uint8Array=} seed */\r\nfunction autoseed(seed) {\r\n try {\r\n GLOBAL.crypto.getRandomValues(seed = new Uint8Array(width));\r\n return tostring(seed);\r\n } catch (e) {\r\n return [+new Date, GLOBAL, GLOBAL.navigator && GLOBAL.navigator.plugins,\r\n GLOBAL.screen, tostring(pool)];\r\n }\r\n}\r\n\r\n//\r\n// tostring()\r\n// Converts an array of charcodes to a string\r\n//\r\nfunction tostring(a) {\r\n return String.fromCharCode.apply(0, a);\r\n}\r\n\r\n//\r\n// When seedrandom.js is loaded, we immediately mix a few bits\r\n// from the built-in RNG into the entropy pool. Because we do\r\n// not want to intefere with determinstic PRNG state later,\r\n// seedrandom will not call Math.random on its own again after\r\n// initialization.\r\n//\r\nmixkey(Math.random(), pool);\r\n\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/global */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.g = (function() {\n/******/ \t\t\tif (typeof globalThis === 'object') return globalThis;\n/******/ \t\t\ttry {\n/******/ \t\t\t\treturn this || new Function('return this')();\n/******/ \t\t\t} catch (e) {\n/******/ \t\t\t\tif (typeof window === 'object') return window;\n/******/ \t\t\t}\n/******/ \t\t})();\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n// This entry need to be wrapped in an IIFE because it need to be in strict mode.\n(() => {\n\"use strict\";\nvar exports = __webpack_exports__;\n/*!**********************!*\\\n !*** ./src/index.ts ***!\n \\**********************/\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.identicon = void 0;\nconst seed = __webpack_require__(/*! seed-random */ \"./node_modules/seed-random/index.js\");\nconst commonjs_1 = __webpack_require__(/*! @basementuniverse/commonjs */ \"./node_modules/@basementuniverse/commonjs/common.js\");\nconst defaultIdenticonSettings = {\n size: 100,\n baseSeed: '',\n font: 'Helvetica',\n fontStyle: 'bold',\n fontSize: 0.4,\n backgroundColours: [\n '#16a085',\n '#1abc9c',\n '#2ecc71',\n '#3498db',\n '#1970b9',\n '#9b59b6',\n '#e67e22',\n '#e74c3c',\n '#e0395b',\n ],\n initialsColours: [\n '#ffffff',\n ],\n initialsOffset: commonjs_1.vec(),\n initialsAlpha: 1,\n initialsCompositeOperation: 'source-over',\n stripeColours: [\n '#f1c40f',\n ],\n stripeAlpha: 0.15,\n stripeCompositeOperation: 'lighter',\n stripes: [3, 8],\n stripeWidth: [0.2, 0.7],\n stripeDeviation: [-0.5, 0.5],\n curveAmount: [0.2, 0.4],\n curveOffset: [0, 0.5],\n startWidthSign: ['positive', 'negative'],\n endWidthSign: ['positive', 'negative'],\n};\nconst MIN = 0;\nconst MAX = 1;\nconst TAU = Math.PI * 2;\nconst SIGN_FACTOR = {\n positive: 1,\n negative: -1,\n};\nconst RADIUS_PADDING_FACTOR = 2;\nfunction identicon(name, settings = {}) {\n const actualSettings = Object.assign({}, defaultIdenticonSettings, settings);\n if (!name || typeof name !== 'string') {\n name = 'Anonymous';\n }\n const initials = name\n .split(/[\\s\\-']/)\n .map(i => i[0].toUpperCase())\n .join('');\n const actualSeed = `${settings.baseSeed}${name}`;\n seed(actualSeed, { global: true });\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n canvas.width = actualSettings.size;\n canvas.height = actualSettings.size;\n draw(context, actualSettings, initials);\n seed.resetGlobal();\n return canvas;\n}\nexports.identicon = identicon;\nfunction draw(context, settings, initials) {\n context.save();\n const colour = Math.randomIntBetween(0, Math.max(settings.backgroundColours.length, settings.stripeColours.length, settings.initialsColours.length) - 1);\n context.fillStyle = settings.backgroundColours[Math.clamp(colour, 0, settings.backgroundColours.length - 1)];\n context.fillRect(0, 0, settings.size, settings.size);\n context.save();\n context.fillStyle = settings.stripeColours[Math.clamp(colour, 0, settings.stripeColours.length - 1)];\n context.globalAlpha = settings.stripeAlpha;\n context.globalCompositeOperation = settings.stripeCompositeOperation;\n const countStripes = Math.randomIntBetween(settings.stripes[MIN], settings.stripes[MAX]);\n let theta = Math.random() * TAU;\n for (let i = 0; i < countStripes; i++) {\n drawStripe(context, settings, theta);\n theta += Math.randomBetween(settings.stripeDeviation[MIN], settings.stripeDeviation[MAX]);\n }\n context.restore();\n drawInitials(context, settings, initials, colour);\n context.restore();\n}\nfunction drawStripe(context, settings, t1) {\n const s1 = SIGN_FACTOR[settings.startWidthSign.shuffle()[0]];\n const t2 = t1 + Math.randomBetween(settings.stripeWidth[MIN], settings.stripeWidth[MAX]) * s1;\n const t3 = t1 + Math.PI + Math.randomBetween(settings.curveOffset[MIN], settings.curveOffset[MAX]);\n const s2 = SIGN_FACTOR[settings.endWidthSign.shuffle()[0]];\n const t4 = t3 + Math.randomBetween(settings.stripeWidth[MIN], settings.stripeWidth[MAX]) * s2;\n const t5 = t1 + Math.PI / 2;\n const center = commonjs_1.vec.mul(commonjs_1.vec(settings.size), 0.5);\n const radius = Math.sqrt(center.x * center.x + center.y * center.y) * RADIUS_PADDING_FACTOR;\n const a1 = pointOnCircle(center, radius, t1);\n const a2 = pointOnCircle(center, radius, t2);\n const b1 = pointOnCircle(center, radius, t3);\n const b2 = pointOnCircle(center, radius, t4);\n const c = pointOnCircle(center, radius * Math.randomBetween(settings.curveAmount[MIN], settings.curveAmount[MAX]), t5);\n context.beginPath();\n context.moveTo(a1.x, a1.y);\n context.quadraticCurveTo(c.x, c.y, b1.x, b1.y);\n context.lineTo(b2.x, b2.y);\n context.quadraticCurveTo(c.x, c.y, a2.x, a2.y);\n context.closePath();\n context.fill();\n}\nfunction pointOnCircle(center, radius, theta) {\n return commonjs_1.vec.add(center, commonjs_1.vec(radius * Math.sin(theta), radius * Math.cos(theta)));\n}\nfunction drawInitials(context, settings, initials, colourIndex) {\n context.save();\n context.font = `${settings.fontStyle} ${Math.floor(settings.size * settings.fontSize)}px ${settings.font}`;\n context.fillStyle = settings.initialsColours[Math.clamp(colourIndex, 0, settings.initialsColours.length - 1)];\n context.globalAlpha = settings.initialsAlpha;\n context.globalCompositeOperation = settings.initialsCompositeOperation;\n context.textAlign = 'center';\n context.textBaseline = 'middle';\n const center = commonjs_1.vec.mul(commonjs_1.vec(settings.size), 0.5);\n context.fillText(initials, center.x + settings.initialsOffset.x, center.y + settings.initialsOffset.y);\n context.restore();\n}\n\n})();\n\n/******/ \treturn __webpack_exports__;\n/******/ })()\n;\n});\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWRlbnRpY29uLmpzIiwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLENBQUM7QUFDRCxPOzs7Ozs7Ozs7QUNWQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQixZQUFZLFNBQVM7QUFDckI7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsWUFBWSxRQUFRO0FBQ3BCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsUUFBUTtBQUNuQixZQUFZLFFBQVE7QUFDcEI7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsWUFBWSxRQUFRO0FBQ3BCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFlBQVksUUFBUTtBQUNwQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQixZQUFZLFFBQVE7QUFDcEI7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQixZQUFZO0FBQ1o7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsWUFBWSxRQUFRO0FBQ3BCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsUUFBUTtBQUNuQixZQUFZLFFBQVE7QUFDcEI7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxRQUFRO0FBQ25CLFlBQVksUUFBUTtBQUNwQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFlBQVksUUFBUTtBQUNwQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFlBQVksUUFBUTtBQUNwQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQixZQUFZLFFBQVE7QUFDcEI7QUFDQTtBQUNBO0FBQ0Esd0JBQXdCLElBQUk7QUFDNUI7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsWUFBWSxRQUFRO0FBQ3BCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsZUFBZTtBQUMxQixZQUFZLFFBQVE7QUFDcEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFlBQVksUUFBUTtBQUNwQjs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxlQUFlO0FBQzFCLFdBQVcsUUFBUTtBQUNuQixXQUFXLHVCQUF1QjtBQUNsQyxZQUFZLFFBQVE7QUFDcEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLGVBQWU7QUFDMUIsV0FBVyxlQUFlO0FBQzFCLFlBQVksUUFBUTtBQUNwQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsWUFBWSxRQUFRO0FBQ3BCO0FBQ0E7QUFDQTtBQUNBLGtCQUFrQixRQUFRO0FBQzFCO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFlBQVksUUFBUTtBQUNwQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFlBQVksUUFBUTtBQUNwQjtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFdBQVcsUUFBUTtBQUNuQixZQUFZLEdBQUc7QUFDZjs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxlQUFlO0FBQzFCLFdBQVcsUUFBUTtBQUNuQixZQUFZO0FBQ1o7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxRQUFRO0FBQ25CLFlBQVksZUFBZTtBQUMzQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLFVBQVU7QUFDckIsV0FBVyxVQUFVO0FBQ3JCLFlBQVk7QUFDWjtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsWUFBWSxHQUFHO0FBQ2Y7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsQ0FBQzs7QUFFRDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsV0FBVyxRQUFRO0FBQ25CLFlBQVksaUJBQWlCO0FBQzdCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxDQUFDOztBQUVEO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxZQUFZLFVBQVU7QUFDdEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLENBQUM7O0FBRUQ7QUFDQTtBQUNBLGFBQWEsUUFBUTtBQUNyQixjQUFjLFFBQVE7QUFDdEIsY0FBYyxRQUFRO0FBQ3RCOztBQUVBO0FBQ0E7QUFDQSxXQUFXLFlBQVk7QUFDdkIsV0FBVyxRQUFRO0FBQ25CLFlBQVksS0FBSztBQUNqQjtBQUNBLHVCQUF1QjtBQUN2Qix1QkFBdUI7QUFDdkIsdUJBQXVCO0FBQ3ZCLHVCQUF1QjtBQUN2QjtBQUNBO0FBQ0EsSUFBSSxhQUFhO0FBQ2pCLE1BQU0sMkJBQTJCO0FBQ2pDLFFBQVEsYUFBYSxJQUFJLFlBQVk7QUFDckM7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxLQUFLO0FBQ2hCLFlBQVksZUFBZTtBQUMzQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxZQUFZLEtBQUs7QUFDakI7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsWUFBWSxLQUFLO0FBQ2pCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLEtBQUs7QUFDaEIsWUFBWSxLQUFLO0FBQ2pCO0FBQ0EsdUJBQXVCLDRCQUE0Qjs7QUFFbkQ7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLFFBQVE7QUFDbkIsWUFBWSxLQUFLO0FBQ2pCO0FBQ0EsdUJBQXVCLHdCQUF3Qjs7QUFFL0M7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLEtBQUs7QUFDaEIsWUFBWSxLQUFLO0FBQ2pCO0FBQ0EsdUJBQXVCLDRCQUE0Qjs7QUFFbkQ7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixZQUFZLFFBQVE7QUFDcEI7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxLQUFLO0FBQ2hCLFlBQVksUUFBUTtBQUNwQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLEtBQUs7QUFDaEIsWUFBWSxLQUFLO0FBQ2pCO0FBQ0E7QUFDQTtBQUNBLGlCQUFpQiw2QkFBNkI7QUFDOUM7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLEtBQUs7QUFDaEIsWUFBWSxRQUFRO0FBQ3BCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLFFBQVE7QUFDbkIsWUFBWSxLQUFLO0FBQ2pCO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsV0FBVztBQUNYOztBQUVBO0FBQ0E7QUFDQSxXQUFXLEtBQUs7QUFDaEIsV0FBVyxLQUFLO0FBQ2hCLFlBQVksU0FBUztBQUNyQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLEtBQUs7QUFDaEIsWUFBWSxRQUFRO0FBQ3BCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixZQUFZLEtBQUs7QUFDakI7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsV0FBVyxXQUFXO0FBQ3RCLFlBQVksUUFBUTtBQUNwQjs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxLQUFLO0FBQ2hCLFdBQVcsbUJBQW1CO0FBQzlCLFlBQVksS0FBSztBQUNqQjtBQUNBLHVCQUF1QixnQ0FBZ0M7O0FBRXZEO0FBQ0E7QUFDQSxXQUFXLEtBQUs7QUFDaEIsV0FBVyxRQUFRO0FBQ25CLFlBQVksUUFBUTtBQUNwQjtBQUNBLDhCQUE4QixJQUFJLEVBQUUsRUFBRSxFQUFFLElBQUk7O0FBRTVDO0FBQ0E7QUFDQSxhQUFhLFFBQVE7QUFDckIsY0FBYyxRQUFRO0FBQ3RCLGNBQWMsUUFBUTtBQUN0QixjQUFjLGVBQWU7QUFDN0I7O0FBRUE7QUFDQTtBQUNBLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsV0FBVyxlQUFlO0FBQzFCLFlBQVksS0FBSztBQUNqQjtBQUNBO0FBQ0E7QUFDQTtBQUNBLENBQUM7O0FBRUQ7QUFDQTtBQUNBLFdBQVcsUUFBUTtBQUNuQixZQUFZLEtBQUs7QUFDakI7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxLQUFLO0FBQ2hCLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsWUFBWSxRQUFRO0FBQ3BCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQjtBQUNBLDRCQUE0Qjs7QUFFNUI7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLFFBQVE7QUFDbkIsWUFBWSxlQUFlO0FBQzNCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLFFBQVE7QUFDbkIsWUFBWSxlQUFlO0FBQzNCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLEtBQUs7QUFDaEIsWUFBWSxLQUFLO0FBQ2pCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLEtBQUs7QUFDaEIsWUFBWSxLQUFLO0FBQ2pCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLEtBQUs7QUFDaEIsWUFBWSxhQUFhO0FBQ3pCO0FBQ0E7QUFDQSxxQkFBcUI7QUFDckI7QUFDQSxrQkFBa0IsVUFBVTtBQUM1QixvQkFBb0IsVUFBVTtBQUM5QjtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLEtBQUs7QUFDaEIsV0FBVyxRQUFRO0FBQ25CLFlBQVksS0FBSztBQUNqQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLEtBQUs7QUFDaEIsWUFBWSxLQUFLO0FBQ2pCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixXQUFXLFFBQVE7QUFDbkIsV0FBVyxRQUFRO0FBQ25CLFlBQVksYUFBYTtBQUN6QjtBQUNBO0FBQ0EscUJBQXFCO0FBQ3JCO0FBQ0EsbUJBQW1CLFdBQVc7QUFDOUIsb0JBQW9CO0FBQ3BCLHFCQUFxQixXQUFXO0FBQ2hDLHNCQUFzQjtBQUN0QjtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLEtBQUs7QUFDaEIsWUFBWSxnQkFBZ0I7QUFDNUI7QUFDQTtBQUNBLHFCQUFxQjtBQUNyQjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGtCQUFrQixVQUFVO0FBQzVCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixZQUFZLGFBQWE7QUFDekI7QUFDQTtBQUNBLHFCQUFxQjtBQUNyQjtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFdBQVcsS0FBSztBQUNoQixZQUFZLEtBQUs7QUFDakI7QUFDQTtBQUNBO0FBQ0Esa0JBQWtCLFVBQVU7QUFDNUIsb0JBQW9CLFVBQVU7QUFDOUI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLEtBQUs7QUFDaEIsWUFBWSxhQUFhO0FBQ3pCO0FBQ0E7QUFDQSxxQkFBcUI7QUFDckI7QUFDQSxpQkFBaUI7QUFDakI7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxLQUFLO0FBQ2hCLFdBQVcsS0FBSztBQUNoQixZQUFZLFNBQVM7QUFDckI7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxLQUFLO0FBQ2hCLFlBQVksS0FBSztBQUNqQjtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFdBQVcsUUFBUTtBQUNuQixXQUFXLFFBQVE7QUFDbkIsV0FBVyxlQUFlO0FBQzFCLFlBQVksUUFBUTtBQUNwQjs7QUFFQTtBQUNBO0FBQ0EsV0FBVyxLQUFLO0FBQ2hCLFdBQVcsbUJBQW1CO0FBQzlCLFlBQVksS0FBSztBQUNqQjtBQUNBOztBQUVBO0FBQ0E7QUFDQSxXQUFXLEtBQUs7QUFDaEIsV0FBVyxRQUFRO0FBQ25CLFdBQVcsUUFBUTtBQUNuQixZQUFZLFFBQVE7QUFDcEI7QUFDQTs7QUFFQSxJQUFJLElBQTZCO0FBQ2pDLHFCQUFxQjtBQUNyQjs7Ozs7Ozs7Ozs7O0FDcHFCYTtBQUNiO0FBQ0EsZ0JBQWdCO0FBQ2hCLGVBQWU7QUFDZixnQkFBZ0I7QUFDaEIsY0FBYztBQUNkLG9CQUFvQixxQkFBTSw0QkFBNEIscUJBQU07QUFDNUQ7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsOEJBQThCO0FBQzlCO0FBQ0E7QUFDQSx3Q0FBd0M7QUFDeEMsd0NBQXdDO0FBQ3hDLHdDQUF3QztBQUN4Qyx3Q0FBd0M7QUFDeEMsd0NBQXdDO0FBQ3hDO0FBQ0Esd0NBQXdDO0FBQ3hDLHdDQUF3QztBQUN4Qyx3Q0FBd0M7QUFDeEMsd0NBQXdDO0FBQ3hDO0FBQ0Esd0NBQXdDO0FBQ3hDO0FBQ0E7QUFDQTtBQUNBLDBCQUEwQjtBQUMxQjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGlCQUFpQjtBQUNqQjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsY0FBYyxXQUFXO0FBQ3pCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsY0FBYztBQUNkO0FBQ0E7QUFDQTtBQUNBLEdBQUc7QUFDSDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFlBQVksOENBQThDO0FBQzFEO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxZQUFZLGFBQWE7QUFDekI7QUFDQTtBQUNBO0FBQ0E7QUFDQSxJQUFJO0FBQ0o7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7O1VDNUtBO1VBQ0E7O1VBRUE7VUFDQTtVQUNBO1VBQ0E7VUFDQTtVQUNBO1VBQ0E7VUFDQTtVQUNBO1VBQ0E7VUFDQTtVQUNBO1VBQ0E7O1VBRUE7VUFDQTs7VUFFQTtVQUNBO1VBQ0E7Ozs7O1dDdEJBO1dBQ0E7V0FDQTtXQUNBO1dBQ0EsR0FBRztXQUNIO1dBQ0E7V0FDQSxDQUFDOzs7Ozs7Ozs7Ozs7QUNQWTtBQUNiLDhDQUE2QyxFQUFFLGFBQWEsRUFBQztBQUM3RCxpQkFBaUI7QUFDakIsYUFBYSxtQkFBTyxDQUFDLHdEQUFhO0FBQ2xDLG1CQUFtQixtQkFBTyxDQUFDLHVGQUE0QjtBQUN2RDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0Esc0NBQXNDO0FBQ3RDLDJDQUEyQztBQUMzQztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLDBCQUEwQixrQkFBa0IsRUFBRSxLQUFLO0FBQ25ELHVCQUF1QixjQUFjO0FBQ3JDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxpQkFBaUI7QUFDakI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLG9CQUFvQixrQkFBa0I7QUFDdEM7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxzQkFBc0Isb0JBQW9CLEVBQUUsOENBQThDLEtBQUssY0FBYztBQUM3RztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9AYmFzZW1lbnR1bml2ZXJzZS9tYXJibGUtaWRlbnRpY29ucy93ZWJwYWNrL3VuaXZlcnNhbE1vZHVsZURlZmluaXRpb24iLCJ3ZWJwYWNrOi8vQGJhc2VtZW50dW5pdmVyc2UvbWFyYmxlLWlkZW50aWNvbnMvLi9ub2RlX21vZHVsZXMvQGJhc2VtZW50dW5pdmVyc2UvY29tbW9uanMvY29tbW9uLmpzIiwid2VicGFjazovL0BiYXNlbWVudHVuaXZlcnNlL21hcmJsZS1pZGVudGljb25zLy4vbm9kZV9tb2R1bGVzL3NlZWQtcmFuZG9tL2luZGV4LmpzIiwid2VicGFjazovL0BiYXNlbWVudHVuaXZlcnNlL21hcmJsZS1pZGVudGljb25zL3dlYnBhY2svYm9vdHN0cmFwIiwid2VicGFjazovL0BiYXNlbWVudHVuaXZlcnNlL21hcmJsZS1pZGVudGljb25zL3dlYnBhY2svcnVudGltZS9nbG9iYWwiLCJ3ZWJwYWNrOi8vQGJhc2VtZW50dW5pdmVyc2UvbWFyYmxlLWlkZW50aWNvbnMvLi9zcmMvaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiKGZ1bmN0aW9uIHdlYnBhY2tVbml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uKHJvb3QsIGZhY3RvcnkpIHtcblx0aWYodHlwZW9mIGV4cG9ydHMgPT09ICdvYmplY3QnICYmIHR5cGVvZiBtb2R1bGUgPT09ICdvYmplY3QnKVxuXHRcdG1vZHVsZS5leHBvcnRzID0gZmFjdG9yeSgpO1xuXHRlbHNlIGlmKHR5cGVvZiBkZWZpbmUgPT09ICdmdW5jdGlvbicgJiYgZGVmaW5lLmFtZClcblx0XHRkZWZpbmUoW10sIGZhY3RvcnkpO1xuXHRlbHNlIHtcblx0XHR2YXIgYSA9IGZhY3RvcnkoKTtcblx0XHRmb3IodmFyIGkgaW4gYSkgKHR5cGVvZiBleHBvcnRzID09PSAnb2JqZWN0JyA/IGV4cG9ydHMgOiByb290KVtpXSA9IGFbaV07XG5cdH1cbn0pKHNlbGYsIGZ1bmN0aW9uKCkge1xucmV0dXJuICIsIi8qKlxuICogQG92ZXJ2aWV3IEEgbGlicmFyeSBvZiB1c2VmdWwgZnVuY3Rpb25zXG4gKiBAYXV0aG9yIEdvcmRvbiBMYXJyaWdhblxuICogQHZlcnNpb24gMS4yLjlcbiAqL1xuXG4vKiogQGNsYXNzIE1hdGggKi9cblxuLyoqXG4gKiBDaGVjayBpZiB0d28gbnVtYmVycyBhcmUgYXBwcm94aW1hdGVseSBlcXVhbFxuICogQHBhcmFtIHtudW1iZXJ9IGEgTnVtYmVyIGFcbiAqIEBwYXJhbSB7bnVtYmVyfSBiIE51bWJlciBiXG4gKiBAcGFyYW0ge251bWJlcn0gW3A9TnVtYmVyLkVQU0lMT05dIFRoZSBwcmVjaXNpb24gdmFsdWVcbiAqIEByZXR1cm4ge2Jvb2xlYW59IFRydWUgaWYgbnVtYmVycyBhIGFuZCBiIGFyZSBhcHByb3hpbWF0ZWx5IGVxdWFsXG4gKi9cbk1hdGguZmxvYXRFcXVhbHMgPSAoYSwgYiwgcCA9IE51bWJlci5FUFNJTE9OKSA9PiBNYXRoLmFicyhhIC0gYikgPCBwO1xuXG4vKipcbiAqIENsYW1wIGEgbnVtYmVyIGJldHdlZW4gbWluIGFuZCBtYXhcbiAqIEBwYXJhbSB7bnVtYmVyfSBhIFRoZSBudW1iZXIgdG8gY2xhbXBcbiAqIEBwYXJhbSB7bnVtYmVyfSBbbWluPTBdIFRoZSBtaW5pbXVtIHZhbHVlXG4gKiBAcGFyYW0ge251bWJlcn0gW21heD0xXSBUaGUgbWF4aW11bSB2YWx1ZVxuICogQHJldHVybiB7bnVtYmVyfSBBIGNsYW1wZWQgbnVtYmVyXG4gKi9cbk1hdGguY2xhbXAgPSAoYSwgbWluID0gMCwgbWF4ID0gMSkgPT4gYSA8IG1pbiA/IG1pbiA6IChhID4gbWF4ID8gbWF4IDogYSk7XG5cbi8qKlxuICogR2V0IHRoZSBmcmFjdGlvbmFsIHBhcnQgb2YgYSBudW1iZXJcbiAqIEBwYXJhbSB7bnVtYmVyfSBhIFRoZSBudW1iZXIgZnJvbSB3aGljaCB0byBnZXQgdGhlIGZyYWN0aW9uYWwgcGFydFxuICogQHJldHVybiB7bnVtYmVyfSBUaGUgZnJhY3Rpb25hbCBwYXJ0IG9mIHRoZSBudW1iZXJcbiAqL1xuTWF0aC5mcmFjID0gYSA9PiBhID49IDAgPyBhIC0gTWF0aC5mbG9vcihhKSA6IGEgLSBNYXRoLmNlaWwoYSk7XG5cbi8qKlxuICogRG8gYSBsaW5lYXIgaW50ZXJwb2xhdGlvbiBiZXR3ZWVuIGEgYW5kIGJcbiAqIEBwYXJhbSB7bnVtYmVyfSBhIFRoZSBtaW5pbXVtIG51bWJlclxuICogQHBhcmFtIHtudW1iZXJ9IGIgVGhlIG1heGltdW0gbnVtYmVyXG4gKiBAcGFyYW0ge251bWJlcn0gaSBUaGUgaW50ZXJwb2xhdGlvbiB2YWx1ZSwgc2hvdWxkIGJlIGluIHRoZSBpbnRlcnZhbCBbMCwgMV1cbiAqIEByZXR1cm4ge251bWJlcn0gQW4gaW50ZXJwb2xhdGVkIHZhbHVlIGluIHRoZSBpbnRlcnZhbCBbYSwgYl1cbiAqL1xuTWF0aC5sZXJwID0gKGEsIGIsIGkpID0+IGEgKyAoYiAtIGEpICogaTtcblxuLyoqXG4gKiBHZXQgdGhlIHBvc2l0aW9uIG9mIGkgYmV0d2VlbiBhIGFuZCBiXG4gKiBAcGFyYW0ge251bWJlcn0gYSBUaGUgbWluaW11bSBudW1iZXJcbiAqIEBwYXJhbSB7bnVtYmVyfSBiIFRoZSBtYXhpbXVtIG51bWJlclxuICogQHBhcmFtIHtudW1iZXJ9IGkgVGhlIGludGVycG9sYXRlZCB2YWx1ZSBpbiB0aGUgaW50ZXJ2YWwgW2EsIGJdXG4gKiBAcmV0dXJuIHtudW1iZXJ9IFRoZSBwb3NpdGlvbiBvZiBpIGJldHdlZW4gYSBhbmQgYlxuICovXG5NYXRoLnVubGVycCA9IChhLCBiLCBpKSA9PiAoaSAtIGEpIC8gKGIgLSBhKTtcblxuLyoqXG4gKiBEbyBhIGJpbGluZWFyIGludGVycG9sYXRpb25cbiAqIEBwYXJhbSB7bnVtYmVyfSBjMDAgVG9wLWxlZnQgdmFsdWVcbiAqIEBwYXJhbSB7bnVtYmVyfSBjMTAgVG9wLXJpZ2h0IHZhbHVlXG4gKiBAcGFyYW0ge251bWJlcn0gYzAxIEJvdHRvbS1sZWZ0IHZhbHVlXG4gKiBAcGFyYW0ge251bWJlcn0gYzExIEJvdHRvbS1yaWdodCB2YWx1ZVxuICogQHBhcmFtIHtudW1iZXJ9IGl4IEludGVycG9sYXRpb24gdmFsdWUgYWxvbmcgeFxuICogQHBhcmFtIHtudW1iZXJ9IGl5IEludGVycG9sYXRpb24gdmFsdWUgYWxvbmcgeVxuICogQHJldHVybiB7bnVtYmVyfSBBIGJpbGluZWFyIGludGVycG9sYXRlZCB2YWx1ZVxuICovXG5NYXRoLmJsZXJwID0gKGMwMCwgYzEwLCBjMDEsIGMxMSwgaXgsIGl5KSA9PiBNYXRoLmxlcnAoTWF0aC5sZXJwKGMwMCwgYzEwLCBpeCksIE1hdGgubGVycChjMDEsIGMxMSwgaXgpLCBpeSk7XG5cbi8qKlxuICogUmUtbWFwIGEgbnVtYmVyIGkgZnJvbSByYW5nZSBhMS4uLmEyIHRvIGIxLi4uYjJcbiAqIEBwYXJhbSB7bnVtYmVyfSBpIFRoZSBudW1iZXIgdG8gcmUtbWFwXG4gKiBAcGFyYW0ge251bWJlcn0gYTFcbiAqIEBwYXJhbSB7bnVtYmVyfSBhMlxuICogQHBhcmFtIHtudW1iZXJ9IGIxXG4gKiBAcGFyYW0ge251bWJlcn0gYjJcbiAqIEByZXR1cm4ge251bWJlcn1cbiAqL1xuTWF0aC5yZW1hcCA9IChpLCBhMSwgYTIsIGIxLCBiMikgPT4gYjEgKyAoaSAtIGExKSAqIChiMiAtIGIxKSAvIChhMiAtIGExKTtcblxuLyoqXG4gKiBEbyBhIHNtb290aCBpbnRlcnBvbGF0aW9uIGJldHdlZW4gYSBhbmQgYlxuICogQHBhcmFtIHtudW1iZXJ9IGEgVGhlIG1pbmltdW0gbnVtYmVyXG4gKiBAcGFyYW0ge251bWJlcn0gYiBUaGUgbWF4aW11bSBudW1iZXJcbiAqIEBwYXJhbSB7bnVtYmVyfSBpIFRoZSBpbnRlcnBvbGF0aW9uIHZhbHVlXG4gKiBAcmV0dXJuIHtudW1iZXJ9IEFuIGludGVycG9sYXRlZCB2YWx1ZSBpbiB0aGUgaW50ZXJ2YWwgW2EsIGJdXG4gKi9cbk1hdGguc21vb3Roc3RlcCA9IChhLCBiLCBpKSA9PiBNYXRoLmxlcnAoYSwgYiwgMyAqIE1hdGgucG93KGksIDIpIC0gMiAqIE1hdGgucG93KGksIDMpKTtcblxuLyoqXG4gKiBHZXQgYW4gYW5nbGUgaW4gcmFkaWFuc1xuICogQHBhcmFtIHtudW1iZXJ9IGRlZ3JlZXMgVGhlIGFuZ2xlIGluIGRlZ3JlZXNcbiAqIEByZXR1cm4ge251bWJlcn0gVGhlIGFuZ2xlIGluIHJhZGlhbnNcbiAqL1xuTWF0aC5yYWRpYW5zID0gZGVncmVlcyA9PiAoTWF0aC5QSSAvIDE4MCkgKiBkZWdyZWVzO1xuXG4vKipcbiAqIEdldCBhbiBhbmdsZSBpbiBkZWdyZWVzXG4gKiBAcGFyYW0ge251bWJlcn0gcmFkaWFucyBUaGUgYW5nbGUgaW4gcmFkaWFuc1xuICogQHJldHVybiB7bnVtYmVyfSBUaGUgYW5nbGUgaW4gZGVncmVlc1xuICovXG5NYXRoLmRlZ3JlZXMgPSByYWRpYW5zID0+ICgxODAgLyBNYXRoLlBJKSAqIHJhZGlhbnM7XG5cbi8qKlxuICogR2V0IGEgcmFuZG9tIGZsb2F0IGluIHRoZSBpbnRlcnZhbCBbbWluLCBtYXgpXG4gKiBAcGFyYW0ge251bWJlcn0gbWluIEluY2x1c2l2ZSBtaW5cbiAqIEBwYXJhbSB7bnVtYmVyfSBtYXggRXhjbHVzaXZlIG1heFxuICogQHJldHVybiB7bnVtYmVyfSBBIHJhbmRvbSBmbG9hdCBpbiB0aGUgaW50ZXJ2YWwgW21pbiwgbWF4KVxuICovXG5NYXRoLnJhbmRvbUJldHdlZW4gPSAobWluLCBtYXgpID0+IE1hdGgucmFuZG9tKCkgKiAobWF4IC0gbWluKSArIG1pbjtcblxuLyoqXG4gKiBHZXQgYSByYW5kb20gaW50ZWdlciBpbiB0aGUgaW50ZXJ2YWwgW21pbiwgbWF4XVxuICogQHBhcmFtIHtudW1iZXJ9IG1pbiBJbmNsdXNpdmUgbWluXG4gKiBAcGFyYW0ge251bWJlcn0gbWF4IEluY2x1c2l2ZSBtYXhcbiAqIEByZXR1cm4ge251bWJlcn0gQSByYW5kb20gaW50ZWdlciBpbiB0aGUgaW50ZXJ2YWwgW21pbiwgbWF4XVxuICovXG5NYXRoLnJhbmRvbUludEJldHdlZW4gPSAobWluLCBtYXgpID0+IE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIChtYXggLSBtaW4gKyAxKSkgKyBtaW47XG5cbi8qKlxuICogR2V0IGEgbm9ybWFsbHktZGlzdHJpYnV0ZWQgcmFuZG9tIG51bWJlclxuICogQHBhcmFtIHtudW1iZXJ9IFttdT0wLjVdIFRoZSBtZWFuIHZhbHVlXG4gKiBAcGFyYW0ge251bWJlcn0gW3NpZ21hPTAuNV0gVGhlIHN0YW5kYXJkIGRldmlhdGlvblxuICogQHBhcmFtIHtudW1iZXJ9IFtzYW1wbGVzPTJdIFRoZSBudW1iZXIgb2Ygc2FtcGxlc1xuICogQHJldHVybiB7bnVtYmVyfSBBIG5vcm1hbGx5LWRpc3RyaWJ1dGVkIHJhbmRvbSBudW1iZXJcbiAqL1xuTWF0aC5jbHRSYW5kb20gPSAobXUgPSAwLjUsIHNpZ21hID0gMC41LCBzYW1wbGVzID0gMikgPT4ge1xuICBsZXQgdG90YWwgPSAwO1xuICBmb3IgKGxldCBpID0gc2FtcGxlczsgaS0tOykge1xuICAgIHRvdGFsICs9IE1hdGgucmFuZG9tKCk7XG4gIH1cbiAgcmV0dXJuIG11ICsgKHRvdGFsIC0gc2FtcGxlcyAvIDIpIC8gKHNhbXBsZXMgLyAyKSAqIHNpZ21hO1xufTtcblxuLyoqXG4gKiBHZXQgYSBub3JtYWxseS1kaXN0cmlidXRlZCByYW5kb20gaW50ZWdlciBpbiB0aGUgaW50ZXJ2YWwgW21pbiwgbWF4XVxuICogQHBhcmFtIHtudW1iZXJ9IG1pbiBJbmNsdXNpdmUgbWluXG4gKiBAcGFyYW0ge251bWJlcn0gbWF4IEluY2x1c2l2ZSBtYXhcbiAqIEByZXR1cm4ge251bWJlcn0gQSBub3JtYWxseS1kaXN0cmlidXRlZCByYW5kb20gaW50ZWdlclxuICovXG5NYXRoLmNsdFJhbmRvbUludCA9IChtaW4sIG1heCkgPT4gTWF0aC5mbG9vcihtaW4gKyBNYXRoLmNsdFJhbmRvbSgwLjUsIDAuNSwgMikgKiAobWF4ICsgMSAtIG1pbikpO1xuXG4vKipcbiAqIFJldHVybiBhIHdlaWdodGVkIHJhbmRvbSBpbnRlZ2VyXG4gKiBAcGFyYW0ge0FycmF5PG51bWJlcj59IHcgQW4gYXJyYXkgb2Ygd2VpZ2h0c1xuICogQHJldHVybiB7bnVtYmVyfSBBbiBpbmRleCBmcm9tIHdcbiAqL1xuTWF0aC53ZWlnaHRlZFJhbmRvbSA9IHcgPT4ge1xuICBsZXQgdG90YWwgPSB3LnJlZHVjZSgoYSwgaSkgPT4gYSArIGksIDApLCBuID0gMDtcbiAgY29uc3QgciA9IE1hdGgucmFuZG9tKCkgKiB0b3RhbDtcbiAgd2hpbGUgKHRvdGFsID4gcikge1xuICAgIHRvdGFsIC09IHdbbisrXTtcbiAgfVxuICByZXR1cm4gbiAtIDE7XG59O1xuXG4vKipcbiAqIEFuIGludGVycG9sYXRpb24gZnVuY3Rpb25cbiAqIEBjYWxsYmFjayBpbnRlcnBvbGF0aW9uQ2FsbGJhY2tcbiAqIEBwYXJhbSB7bnVtYmVyfSBhIFRoZSBtaW5pbXVtIG51bWJlclxuICogQHBhcmFtIHtudW1iZXJ9IGIgVGhlIG1heGltdW0gbnVtYmVyXG4gKiBAcGFyYW0ge251bWJlcn0gaSBUaGUgaW50ZXJwb2xhdGlvbiB2YWx1ZSwgc2hvdWxkIGJlIGluIHRoZSBpbnRlcnZhbCBbMCwgMV1cbiAqIEByZXR1cm4ge251bWJlcn0gVGhlIGludGVycG9sYXRlZCB2YWx1ZSBpbiB0aGUgaW50ZXJ2YWwgW2EsIGJdXG4gKi9cblxuLyoqXG4gKiBSZXR1cm4gYW4gaW50ZXJwb2xhdGVkIHZhbHVlIGZyb20gYW4gYXJyYXlcbiAqIEBwYXJhbSB7QXJyYXk8bnVtYmVyPn0gYSBBbiBhcnJheSBvZiB2YWx1ZXMgaW50ZXJwb2xhdGVcbiAqIEBwYXJhbSB7bnVtYmVyfSBpIEEgbnVtYmVyIGluIHRoZSBpbnRlcnZhbCBbMCwgMV1cbiAqIEBwYXJhbSB7aW50ZXJwb2xhdGlvbkNhbGxiYWNrfSBbZj1NYXRoLmxlcnBdIFRoZSBpbnRlcnBvbGF0aW9uIGZ1bmN0aW9uIHRvIHVzZVxuICogQHJldHVybiB7bnVtYmVyfSBBbiBpbnRlcnBvbGF0ZWQgdmFsdWUgaW4gdGhlIGludGVydmFsIFttaW4oYSksIG1heChhKV1cbiAqL1xuTWF0aC5sZXJwQXJyYXkgPSAoYSwgaSwgZiA9IE1hdGgubGVycCkgPT4ge1xuICBjb25zdCBzID0gaSAqIChhLmxlbmd0aCAtIDEpO1xuICBjb25zdCBwID0gTWF0aC5jbGFtcChNYXRoLnRydW5jKHMpLCAwLCBhLmxlbmd0aCAtIDEpO1xuICByZXR1cm4gZihhW3BdIHx8IDAsIGFbcCArIDFdIHx8IDAsIE1hdGguZnJhYyhzKSk7XG59O1xuXG4vKipcbiAqIEdldCB0aGUgZG90IHByb2R1Y3Qgb2YgdHdvIHZlY3RvcnNcbiAqIEBwYXJhbSB7QXJyYXk8bnVtYmVyPn0gYSBWZWN0b3IgYVxuICogQHBhcmFtIHtBcnJheTxudW1iZXI+fSBiIFZlY3RvciBiXG4gKiBAcmV0dXJuIHtudW1iZXJ9IGEg4oiZIGJcbiAqL1xuTWF0aC5kb3QgPSAoYSwgYikgPT4gYS5yZWR1Y2UoKG4sIHYsIGkpID0+IG4gKyB2ICogYltpXSwgMCk7XG5cbi8qKlxuICogR2V0IHRoZSBmYWN0b3JpYWwgb2YgYSBudW1iZXJcbiAqIEBwYXJhbSB7bnVtYmVyfSBhXG4gKiBAcmV0dXJuIHtudW1iZXJ9IGEhXG4gKi9cbk1hdGguZmFjdG9yaWFsID0gYSA9PiB7XG4gIGxldCByZXN1bHQgPSAxO1xuICBmb3IgKGxldCBpID0gMjsgaSA8PSBhOyBpKyspIHtcbiAgICByZXN1bHQgKj0gaTtcbiAgfVxuICByZXR1cm4gcmVzdWx0O1xufTtcblxuLyoqXG4gKiBHZXQgdGhlIG51bWJlciBvZiBwZXJtdXRhdGlvbnMgb2YgciBlbGVtZW50cyBmcm9tIGEgc2V0IG9mIG4gZWxlbWVudHNcbiAqIEBwYXJhbSB7bnVtYmVyfSBuXG4gKiBAcGFyYW0ge251bWJlcn0gclxuICogQHJldHVybiB7bnVtYmVyfSBuUHJcbiAqL1xuTWF0aC5wZXJtdXRhdGlvbiA9IChuLCByKSA9PiBNYXRoLmZhY3RvcmlhbChuKSAvIE1hdGguZmFjdG9yaWFsKG4gLSByKTtcblxuLyoqXG4gKiBHZXQgdGhlIG51bWJlciBvZiBjb21iaW5hdGlvbnMgb2YgciBlbGVtZW50cyBmcm9tIGEgc2V0IG9mIG4gZWxlbWVudHNcbiAqIEBwYXJhbSB7bnVtYmVyfSBuXG4gKiBAcGFyYW0ge251bWJlcn0gclxuICogQHJldHVybiB7bnVtYmVyfSBuQ3JcbiAqL1xuTWF0aC5jb21iaW5hdGlvbiA9IChuLCByKSA9PiBNYXRoLmZhY3RvcmlhbChuKSAvIChNYXRoLmZhY3RvcmlhbChyKSAqIE1hdGguZmFjdG9yaWFsKG4gLSByKSk7XG5cbi8qKiBAY2xhc3MgQXJyYXkgKi9cblxuLyoqXG4gKiBBIGZ1bmN0aW9uIGZvciBnZW5lcmF0aW5nIGFycmF5IHZhbHVlc1xuICogQGNhbGxiYWNrIHRpbWVzQ2FsbGJhY2tcbiAqIEBwYXJhbSB7bnVtYmVyfSBpIFRoZSBhcnJheSBpbmRleFxuICogQHJldHVybiB7Kn0gVGhlIGFycmF5IHZhbHVlXG4gKi9cblxuLyoqXG4gKiBSZXR1cm4gYSBuZXcgYXJyYXkgd2l0aCBsZW5ndGggbiBieSBjYWxsaW5nIGZ1bmN0aW9uIGYoaSkgb24gZWFjaCBlbGVtZW50XG4gKiBAcGFyYW0ge3RpbWVzQ2FsbGJhY2t9IGZcbiAqIEBwYXJhbSB7bnVtYmVyfSBuIFRoZSBzaXplIG9mIHRoZSBhcnJheVxuICogQHJldHVybiB7QXJyYXk8Kj59XG4gKi9cbkFycmF5LnRpbWVzID0gKGYsIG4pID0+IEFycmF5KG4pLmZpbGwoMCkubWFwKChfLCBpKSA9PiBmKGkpKTtcblxuLyoqXG4gKiBSZXR1cm4gYW4gYXJyYXkgY29udGFpbmluZyBudW1iZXJzIDAtPihuIC0gMSlcbiAqIEBwYXJhbSB7bnVtYmVyfSBuIFRoZSBzaXplIG9mIHRoZSBhcnJheVxuICogQHJldHVybiB7QXJyYXk8bnVtYmVyPn0gQW4gYXJyYXkgb2YgaW50ZWdlcnMgMC0+KG4gLSAxKVxuICovXG5BcnJheS5yYW5nZSA9IG4gPT4gQXJyYXkudGltZXMoaSA9PiBpLCBuKTtcblxuLyoqXG4gKiBaaXAgMiBhcnJheXMgdG9nZXRoZXIsIGkuZS4gKFsxLCAyLCAzXSwgW2EsIGIsIGNdKSA9PiBbWzEsIGFdLCBbMiwgYl0sIFszLCBjXV1cbiAqIEBwYXJhbSB7QXJyYXk8Kj59IGFcbiAqIEBwYXJhbSB7QXJyYXk8Kj59IGJcbiAqIEByZXR1cm4ge0FycmF5PEFycmF5PCo+Pn1cbiAqL1xuQXJyYXkuemlwID0gKGEsIGIpID0+IGEubWFwKChrLCBpKSA9PiBbaywgYltpXV0pO1xuXG4vKipcbiAqIFJldHVybiBhcnJheVtpXSB3aXRoIHBvc2l0aXZlIGFuZCBuZWdhdGl2ZSB3cmFwcGluZ1xuICogQG5hbWUgYXRcbiAqIEBmdW5jdGlvblxuICogQG1lbWJlcm9mIEFycmF5LnByb3RvdHlwZVxuICogQHBhcmFtIHtudW1iZXJ9IGkgVGhlIHBvc2l0aXZlbHkvbmVnYXRpdmVseSB3cmFwcGVkIGFycmF5IGluZGV4XG4gKiBAcmV0dXJuIHsqfSBBbiBlbGVtZW50IGZyb20gdGhlIGFycmF5XG4gKi9cbk9iamVjdC5kZWZpbmVQcm9wZXJ0eShBcnJheS5wcm90b3R5cGUsICdhdCcsIHtcbiAgdmFsdWU6IGZ1bmN0aW9uIChpKSB7XG4gICAgY29uc3QgbCA9IHRoaXMubGVuZ3RoO1xuICAgIHJldHVybiB0aGlzW2kgPCAwID8gbCAtIChNYXRoLmFicyhpICsgMSkgJSBsKSAtIDEgOiBpICUgbF07XG4gIH1cbn0pO1xuXG4vKipcbiAqIENob3AgYW4gYXJyYXkgaW50byBjaHVua3Mgb2Ygc2l6ZSBuXG4gKiBAbmFtZSBjaHVua1xuICogQGZ1bmN0aW9uXG4gKiBAbWVtYmVyb2YgQXJyYXkucHJvdG90eXBlXG4gKiBAcGFyYW0ge251bWJlcn0gbiBUaGUgY2h1bmsgc2l6ZVxuICogQHJldHVybiB7QXJyYXk8QXJyYXk8Kj4+fSBBbiBhcnJheSBvZiBhcnJheSBjaHVua3NcbiAqL1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KEFycmF5LnByb3RvdHlwZSwgJ2NodW5rJywge1xuICB2YWx1ZTogZnVuY3Rpb24gKG4pIHtcbiAgICByZXR1cm4gQXJyYXkudGltZXMoaSA9PiB0aGlzLnNsaWNlKGkgKiBuLCBpICogbiArIG4pLCBNYXRoLmNlaWwodGhpcy5sZW5ndGggLyBuKSk7XG4gIH1cbn0pO1xuXG4vKipcbiAqIFJhbmRvbWx5IHNodWZmbGUgYW4gYXJyYXkgaW4tcGxhY2VcbiAqIEBuYW1lIHNodWZmbGVcbiAqIEBmdW5jdGlvblxuICogQG1lbWJlcm9mIEFycmF5LnByb3RvdHlwZVxuICogQHJldHVybiB7QXJyYXk8Kj59IFRoZSBzaHVmZmxlZCBhcnJheVxuICovXG5PYmplY3QuZGVmaW5lUHJvcGVydHkoQXJyYXkucHJvdG90eXBlLCAnc2h1ZmZsZScsIHtcbiAgdmFsdWU6IGZ1bmN0aW9uICgpIHtcbiAgICByZXR1cm4gdGhpcy5tYXAoYSA9PiBbTWF0aC5yYW5kb20oKSwgYV0pLnNvcnQoKGEsIGIpID0+IGFbMF0gLSBiWzBdKS5tYXAoYSA9PiBhWzFdKTtcbiAgfVxufSk7XG5cbi8qKlxuICogQSAyZCB2ZWN0b3JcbiAqIEB0eXBlZGVmIHtPYmplY3R9IHZlY1xuICogQHByb3BlcnR5IHtudW1iZXJ9IHggVGhlIHggY29tcG9uZW50IG9mIHRoZSB2ZWN0b3JcbiAqIEBwcm9wZXJ0eSB7bnVtYmVyfSB5IFRoZSB5IGNvbXBvbmVudCBvZiB0aGUgdmVjdG9yXG4gKi9cblxuLyoqXG4gKiBDcmVhdGUgYSBuZXcgdmVjdG9yXG4gKiBAcGFyYW0ge251bWJlcnx2ZWN9IFt4XSBUaGUgeCBjb21wb25lbnQgb2YgdGhlIHZlY3Rvciwgb3IgYSB2ZWN0b3IgdG8gY29weVxuICogQHBhcmFtIHtudW1iZXJ9IFt5XSBUaGUgeSBjb21wb25lbnQgb2YgdGhlIHZlY3RvclxuICogQHJldHVybiB7dmVjfSBBIG5ldyB2ZWN0b3JcbiAqIEBleGFtcGxlIDxjYXB0aW9uPlZhcmlvdXMgd2F5cyB0byBpbml0aWFsaXNlIGEgdmVjdG9yPC9jYXB0aW9uPlxuICogbGV0IGEgPSB2ZWMoMywgMik7ICAvLyAoMywgMilcbiAqIGxldCBiID0gdmVjKDQpOyAgICAgLy8gKDQsIDQpXG4gKiBsZXQgYyA9IHZlYyhhKTsgICAgIC8vICgzLCAyKVxuICogbGV0IGQgPSB2ZWMoKTsgICAgICAvLyAoMCwgMClcbiAqL1xuY29uc3QgdmVjID0gKHgsIHkpID0+ICgheCAmJiAheSA/XG4gIHsgeDogMCwgeTogMCB9IDogKHR5cGVvZiB4ID09PSAnb2JqZWN0JyA/XG4gICAgeyB4OiB4LnggfHwgMCwgeTogeC55IHx8IDAgfSA6ICh5ID09PSBudWxsIHx8IHkgPT09IHVuZGVmaW5lZCA/XG4gICAgICB7IHg6IHgsIHk6IHggfSA6IHsgeDogeCwgeTogeSB9KVxuICApXG4pO1xuXG4vKipcbiAqIEdldCB0aGUgY29tcG9uZW50cyBvZiBhIHZlY3RvciBhcyBhbiBhcnJheVxuICogQHBhcmFtIHt2ZWN9IGEgVGhlIHZlY3RvciB0byBnZXQgY29tcG9uZW50cyBmcm9tXG4gKiBAcmV0dXJuIHtBcnJheTxudW1iZXI+fSBUaGUgdmVjdG9yIGNvbXBvbmVudHMgYXMgYW4gYXJyYXlcbiAqL1xudmVjLmNvbXBvbmVudHMgPSBhID0+IFthLngsIGEueV07XG5cbi8qKlxuICogUmV0dXJuIGEgdW5pdCB2ZWN0b3IgKDEsIDApXG4gKiBAcmV0dXJuIHt2ZWN9IEEgdW5pdCB2ZWN0b3IgKDEsIDApXG4gKi9cbnZlYy51eCA9ICgpID0+IHZlYygxLCAwKTtcblxuLyoqXG4gKiBSZXR1cm4gYSB1bml0IHZlY3RvciAoMCwgMSlcbiAqIEByZXR1cm4ge3ZlY30gQSB1bml0IHZlY3RvciAoMCwgMSlcbiAqL1xudmVjLnV5ID0gKCkgPT4gdmVjKDAsIDEpO1xuXG4vKipcbiAqIEFkZCB2ZWN0b3JzXG4gKiBAcGFyYW0ge3ZlY30gYSBWZWN0b3IgYVxuICogQHBhcmFtIHt2ZWN9IGIgVmVjdG9yIGJcbiAqIEByZXR1cm4ge3ZlY30gYSArIGJcbiAqL1xudmVjLmFkZCA9IChhLCBiKSA9PiAoeyB4OiBhLnggKyBiLngsIHk6IGEueSArIGIueSB9KTtcblxuLyoqXG4gKiBTY2FsZSBhIHZlY3RvclxuICogQHBhcmFtIHt2ZWN9IGEgVmVjdG9yIGFcbiAqIEBwYXJhbSB7bnVtYmVyfSBiIFNjYWxhciBiXG4gKiBAcmV0dXJuIHt2ZWN9IGEgKiBiXG4gKi9cbnZlYy5tdWwgPSAoYSwgYikgPT4gKHsgeDogYS54ICogYiwgeTogYS55ICogYiB9KTtcblxuLyoqXG4gKiBTdWJ0cmFjdCB2ZWN0b3JzXG4gKiBAcGFyYW0ge3ZlY30gYSBWZWN0b3IgYVxuICogQHBhcmFtIHt2ZWN9IGIgVmVjdG9yIGJcbiAqIEByZXR1cm4ge3ZlY30gYSAtIGJcbiAqL1xudmVjLnN1YiA9IChhLCBiKSA9PiAoeyB4OiBhLnggLSBiLngsIHk6IGEueSAtIGIueSB9KTtcblxuLyoqXG4gKiBHZXQgdGhlIGxlbmd0aCBvZiBhIHZlY3RvclxuICogQHBhcmFtIHt2ZWN9IGEgVmVjdG9yIGFcbiAqIEByZXR1cm4ge251bWJlcn0gfGF8XG4gKi9cbnZlYy5sZW4gPSBhID0+IE1hdGguc3FydChhLnggKiBhLnggKyBhLnkgKiBhLnkpO1xuXG4vKipcbiAqIEdldCB0aGUgbGVuZ3RoIG9mIGEgdmVjdG9yIHVzaW5nIHRheGljYWIgZ2VvbWV0cnlcbiAqIEBwYXJhbSB7dmVjfSBhIFZlY3RvciBhXG4gKiBAcmV0dXJuIHtudW1iZXJ9IHxhfFxuICovXG52ZWMubWFuaGF0dGFuID0gYSA9PiBNYXRoLmFicyhhLngpICsgTWF0aC5hYnMoYS55KTtcblxuLyoqXG4gKiBOb3JtYWxpc2UgYSB2ZWN0b3JcbiAqIEBwYXJhbSB7dmVjfSBhIFRoZSB2ZWN0b3IgdG8gbm9ybWFsaXNlXG4gKiBAcmV0dXJuIHt2ZWN9IF5hXG4gKi9cbnZlYy5ub3IgPSBhID0+IHtcbiAgbGV0IGxlbiA9IHZlYy5sZW4oYSk7XG4gIHJldHVybiBsZW4gPyB7IHg6IGEueCAvIGxlbiwgeTogYS55IC8gbGVuIH0gOiB2ZWMoKTtcbn07XG5cbi8qKlxuICogR2V0IGEgZG90IHByb2R1Y3Qgb2YgdmVjdG9yc1xuICogQHBhcmFtIHt2ZWN9IGEgVmVjdG9yIGFcbiAqIEBwYXJhbSB7dmVjfSBiIFZlY3RvciBiXG4gKiBAcmV0dXJuIHtudW1iZXJ9IGEg4oiZIGJcbiAqL1xudmVjLmRvdCA9IChhLCBiKSA9PiBhLnggKiBiLnggKyBhLnkgKiBiLnk7XG5cbi8qKlxuICogUm90YXRlIGEgdmVjdG9yIGJ5IHIgcmFkaWFuc1xuICogQHBhcmFtIHt2ZWN9IGEgVGhlIHZlY3RvciB0byByb3RhdGVcbiAqIEBwYXJhbSB7bnVtYmVyfSByIFRoZSBhbmdsZSB0byByb3RhdGUgYnksIG1lYXN1cmVkIGluIHJhZGlhbnNcbiAqIEByZXR1cm4ge3ZlY30gQSByb3RhdGVkIHZlY3RvclxuICovXG52ZWMucm90ID0gKGEsIHIpID0+IHtcbiAgbGV0IHMgPSBNYXRoLnNpbihyKSxcbiAgICBjID0gTWF0aC5jb3Mocik7XG4gIHJldHVybiB7IHg6IGMgKiBhLnggLSBzICogYS55LCB5OiBzICogYS54ICsgYyAqIGEueSB9O1xufVxuXG4vKipcbiAqIENoZWNrIGlmIHR3byB2ZWN0b3JzIGFyZSBlcXVhbFxuICogQHBhcmFtIHt2ZWN9IGEgVmVjdG9yIGFcbiAqIEBwYXJhbSB7dmVjfSBiIFZlY3RvciBiXG4gKiBAcmV0dXJuIHtib29sZWFufSBUcnVlIGlmIHZlY3RvcnMgYSBhbmQgYiBhcmUgZXF1YWwsIGZhbHNlIG90aGVyd2lzZVxuICovXG52ZWMuZXEgPSAoYSwgYikgPT4gYS54ID09PSBiLnggJiYgYS55ID09PSBiLnk7XG5cbi8qKlxuICogR2V0IHRoZSBhbmdsZSBvZiBhIHZlY3RvclxuICogQHBhcmFtIHt2ZWN9IGEgVmVjdG9yIGFcbiAqIEByZXR1cm4ge251bWJlcn0gVGhlIGFuZ2xlIG9mIHZlY3RvciBhIGluIHJhZGlhbnNcbiAqL1xudmVjLnJhZCA9IGEgPT4gTWF0aC5hdGFuMihhLnksIGEueCk7XG5cbi8qKlxuICogQ29weSBhIHZlY3RvclxuICogQHBhcmFtIHt2ZWN9IGEgVGhlIHZlY3RvciB0byBjb3B5XG4gKiBAcmV0dXJuIHt2ZWN9IEEgY29weSBvZiB2ZWN0b3IgYVxuICovXG52ZWMuY3B5ID0gYSA9PiB2ZWMoYSk7XG5cbi8qKlxuICogQSBmdW5jdGlvbiB0byBjYWxsIG9uIGVhY2ggY29tcG9uZW50IG9mIGEgdmVjdG9yXG4gKiBAY2FsbGJhY2sgdmVjdG9yTWFwQ2FsbGJhY2tcbiAqIEBwYXJhbSB7bnVtYmVyfSB2YWx1ZSBUaGUgY29tcG9uZW50IHZhbHVlXG4gKiBAcGFyYW0geyd4JyB8ICd5J30gbGFiZWwgVGhlIGNvbXBvbmVudCBsYWJlbCAoeCBvciB5KVxuICogQHJldHVybiB7bnVtYmVyfSBUaGUgbWFwcGVkIGNvbXBvbmVudFxuICovXG5cbi8qKlxuICogQ2FsbCBhIGZ1bmN0aW9uIG9uIGVhY2ggY29tcG9uZW50IG9mIGEgdmVjdG9yIGFuZCBidWlsZCBhIG5ldyB2ZWN0b3IgZnJvbSB0aGUgcmVzdWx0c1xuICogQHBhcmFtIHt2ZWN9IGEgVmVjdG9yIGFcbiAqIEBwYXJhbSB7dmVjdG9yTWFwQ2FsbGJhY2t9IGYgVGhlIGZ1bmN0aW9uIHRvIGNhbGwgb24gZWFjaCBjb21wb25lbnQgb2YgdGhlIHZlY3RvclxuICogQHJldHVybiB7dmVjfSBWZWN0b3IgYSBtYXBwZWQgdGhyb3VnaCBmXG4gKi9cbnZlYy5tYXAgPSAoYSwgZikgPT4gKHsgeDogZihhLngsICd4JyksIHk6IGYoYS55LCAneScpIH0pO1xuXG4vKipcbiAqIENvbnZlcnQgYSB2ZWN0b3IgaW50byBhIHN0cmluZ1xuICogQHBhcmFtIHt2ZWN9IGEgVGhlIHZlY3RvciB0byBjb252ZXJ0XG4gKiBAcGFyYW0ge3N0cmluZ30gW3M9JywgJ10gVGhlIHNlcGFyYXRvciBzdHJpbmdcbiAqIEByZXR1cm4ge3N0cmluZ30gQSBzdHJpbmcgcmVwcmVzZW50YXRpb24gb2YgdGhlIHZlY3RvclxuICovXG52ZWMuc3RyID0gKGEsIHMgPSAnLCAnKSA9PiBgJHthLnh9JHtzfSR7YS55fWA7XG5cbi8qKlxuICogQSBtYXRyaXhcbiAqIEB0eXBlZGVmIHtPYmplY3R9IG1hdFxuICogQHByb3BlcnR5IHtudW1iZXJ9IG0gVGhlIG51bWJlciBvZiByb3dzIGluIHRoZSBtYXRyaXhcbiAqIEBwcm9wZXJ0eSB7bnVtYmVyfSBuIFRoZSBudW1iZXIgb2YgY29sdW1ucyBpbiB0aGUgbWF0cml4XG4gKiBAcHJvcGVydHkge0FycmF5PG51bWJlcj59IGVudHJpZXMgVGhlIG1hdHJpeCB2YWx1ZXNcbiAqL1xuXG4vKipcbiAqIENyZWF0ZSBhIG5ldyBtYXRyaXhcbiAqIEBwYXJhbSB7bnVtYmVyfSBbbT00XSBUaGUgbnVtYmVyIG9mIHJvd3NcbiAqIEBwYXJhbSB7bnVtYmVyfSBbbj00XSBUaGUgbnVtYmVyIG9mIGNvbHVtbnNcbiAqIEBwYXJhbSB7QXJyYXk8bnVtYmVyPn0gW2VudHJpZXM9W11dIE1hdHJpeCB2YWx1ZXMgaW4gcmVhZGluZyBvcmRlclxuICogQHJldHVybiB7bWF0fSBBIG5ldyBtYXRyaXhcbiAqL1xuY29uc3QgbWF0ID0gKG0gPSA0LCBuID0gNCwgZW50cmllcyA9IFtdKSA9PiAoe1xuICBtLCBuLFxuICBlbnRyaWVzOiBlbnRyaWVzLmNvbmNhdChBcnJheShtICogbikuZmlsbCgwKSkuc2xpY2UoMCwgbSAqIG4pXG59KTtcblxuLyoqXG4gKiBHZXQgYW4gaWRlbnRpdHkgbWF0cml4IG9mIHNpemUgblxuICogQHBhcmFtIHtudW1iZXJ9IG4gVGhlIHNpemUgb2YgdGhlIG1hdHJpeFxuICogQHJldHVybiB7bWF0fSBBbiBpZGVudGl0eSBtYXRyaXhcbiAqL1xubWF0LmlkZW50aXR5ID0gbiA9PiBtYXQobiwgbiwgQXJyYXkobiAqIG4pLmZpbGwoMCkubWFwKCh2LCBpKSA9PiArKE1hdGguZmxvb3IoaSAvIG4pID09PSBpICUgbikpKTtcblxuLyoqXG4gKiBHZXQgYW4gZW50cnkgZnJvbSBhIG1hdHJpeFxuICogQHBhcmFtIHttYXR9IGEgTWF0cml4IGFcbiAqIEBwYXJhbSB7bnVtYmVyfSBpIFRoZSByb3cgb2Zmc2V0XG4gKiBAcGFyYW0ge251bWJlcn0gaiBUaGUgY29sdW1uIG9mZnNldFxuICogQHJldHVybiB7bnVtYmVyfSBUaGUgdmFsdWUgYXQgcG9zaXRpb24gKGksIGopIGluIG1hdHJpeCBhXG4gKi9cbm1hdC5nZXQgPSAoYSwgaSwgaikgPT4gYS5lbnRyaWVzWyhqIC0gMSkgKyAoaSAtIDEpICogYS5uXTtcblxuLyoqXG4gKiBTZXQgYW4gZW50cnkgb2YgYSBtYXRyaXhcbiAqIEBwYXJhbSB7bWF0fSBhIE1hdHJpeCBhXG4gKiBAcGFyYW0ge251bWJlcn0gaSBUaGUgcm93IG9mZnNldFxuICogQHBhcmFtIHtudW1iZXJ9IGogVGhlIGNvbHVtbiBvZmZzZXRcbiAqIEBwYXJhbSB7bnVtYmVyfSB2IFRoZSB2YWx1ZSB0byBzZXQgaW4gbWF0cml4IGFcbiAqL1xubWF0LnNldCA9IChhLCBpLCBqLCB2KSA9PiB7IGEuZW50cmllc1soaiAtIDEpICsgKGkgLSAxKSAqIGEubl0gPSB2OyB9O1xuXG4vKipcbiAqIEdldCBhIHJvdyBmcm9tIGEgbWF0cml4IGFzIGFuIGFycmF5XG4gKiBAcGFyYW0ge21hdH0gYSBNYXRyaXggYVxuICogQHBhcmFtIHtudW1iZXJ9IG0gVGhlIHJvdyBvZmZzZXRcbiAqIEByZXR1cm4ge0FycmF5PG51bWJlcj59IFJvdyBtIGZyb20gbWF0cml4IGFcbiAqL1xubWF0LnJvdyA9IChhLCBtKSA9PiB7XG4gIGNvbnN0IHMgPSAobSAtIDEpICogYS5uO1xuICByZXR1cm4gYS5lbnRyaWVzLnNsaWNlKHMsIHMgKyBhLm4pO1xufTtcblxuLyoqXG4gKiBHZXQgYSBjb2x1bW4gZnJvbSBhIG1hdHJpeCBhcyBhbiBhcnJheVxuICogQHBhcmFtIHttYXR9IGEgTWF0cml4IGFcbiAqIEBwYXJhbSB7bnVtYmVyfSBuIFRoZSBjb2x1bW4gb2Zmc2V0XG4gKiBAcmV0dXJuIHtBcnJheTxudW1iZXI+fSBDb2x1bW4gbiBmcm9tIG1hdHJpeCBhXG4gKi9cbm1hdC5jb2wgPSAoYSwgbikgPT4gQXJyYXkudGltZXMoaSA9PiBtYXQuZ2V0KGEsIChpICsgMSksIG4pLCBhLm0pO1xuXG4vKipcbiAqIEFkZCBtYXRyaWNlc1xuICogQHBhcmFtIHttYXR9IGEgTWF0cml4IGFcbiAqIEBwYXJhbSB7bWF0fSBiIE1hdHJpeCBiXG4gKiBAcmV0dXJuIHttYXR9IGEgKyBiXG4gKi9cbm1hdC5hZGQgPSAoYSwgYikgPT4gYS5tID09PSBiLm0gJiYgYS5uID09PSBiLm4gJiYgbWF0Lm1hcChhLCAodiwgaSkgPT4gdiArIGIuZW50cmllc1tpXSk7XG5cbi8qKlxuICogU3VidHJhY3QgbWF0cmljZXNcbiAqIEBwYXJhbSB7bWF0fSBhIE1hdHJpeCBhXG4gKiBAcGFyYW0ge21hdH0gYiBNYXRyaXggYlxuICogQHJldHVybiB7bWF0fSBhIC0gYlxuICovXG5tYXQuc3ViID0gKGEsIGIpID0+IGEubSA9PT0gYi5tICYmIGEubiA9PT0gYi5uICYmIG1hdC5tYXAoYSwgKHYsIGkpID0+IHYgLSBiLmVudHJpZXNbaV0pO1xuXG4vKipcbiAqIE11bHRpcGx5IG1hdHJpY2VzXG4gKiBAcGFyYW0ge21hdH0gYSBNYXRyaXggYVxuICogQHBhcmFtIHttYXR9IGIgTWF0cml4IGJcbiAqIEByZXR1cm4ge21hdHxib29sZWFufSBhYiBvciBmYWxzZSBpZiB0aGUgbWF0cmljZXMgY2Fubm90IGJlIG11bHRpcGxpZWRcbiAqL1xubWF0Lm11bCA9IChhLCBiKSA9PiB7XG4gIGlmIChhLm4gIT09IGIubSkgeyByZXR1cm4gZmFsc2U7IH1cbiAgY29uc3QgcmVzdWx0ID0gbWF0KGEubSwgYi5uKTtcbiAgZm9yIChsZXQgaSA9IDE7IGkgPD0gYS5tOyBpKyspIHtcbiAgICBmb3IgKGxldCBqID0gMTsgaiA8PSBiLm47IGorKykge1xuICAgICAgbWF0LnNldChyZXN1bHQsIGksIGosIE1hdGguZG90KG1hdC5yb3coYSwgaSksIG1hdC5jb2woYiwgaikpKTtcbiAgICB9XG4gIH1cbiAgcmV0dXJuIHJlc3VsdDtcbn07XG5cbi8qKlxuICogU2NhbGUgYSBtYXRyaXhcbiAqIEBwYXJhbSB7bWF0fSBhIE1hdHJpeCBhXG4gKiBAcGFyYW0ge251bWJlcn0gYiBTY2FsYXIgYlxuICogQHJldHVybiB7bWF0fSBhICogYlxuICovXG5tYXQuc2NhbGUgPSAoYSwgYikgPT4gbWF0Lm1hcChhLCB2ID0+IHYgKiBiKTtcblxuLyoqXG4gKiBUcmFuc3Bvc2UgYSBtYXRyaXhcbiAqIEBwYXJhbSB7bWF0fSBhIFRoZSBtYXRyaXggdG8gdHJhbnNwb3NlXG4gKiBAcmV0dXJuIHttYXR9IEEgdHJhbnNwb3NlZCBtYXRyaXhcbiAqL1xubWF0LnRyYW5zID0gYSA9PiBtYXQoYS5uLCBhLm0sIEFycmF5LnRpbWVzKGkgPT4gbWF0LmNvbChhLCAoaSArIDEpKSwgYS5uKS5mbGF0KCkpO1xuXG4vKipcbiAqIEdldCB0aGUgbWlub3Igb2YgYSBtYXRyaXhcbiAqIEBwYXJhbSB7bWF0fSBhIE1hdHJpeCBhXG4gKiBAcGFyYW0ge251bWJlcn0gaSBUaGUgcm93IG9mZnNldFxuICogQHBhcmFtIHtudW1iZXJ9IGogVGhlIGNvbHVtbiBvZmZzZXRcbiAqIEByZXR1cm4ge21hdHxib29sZWFufSBUaGUgKGksIGopIG1pbm9yIG9mIG1hdHJpeCBhIG9yIGZhbHNlIGlmIHRoZSBtYXRyaXggaXMgbm90IHNxdWFyZVxuICovXG5tYXQubWlub3IgPSAoYSwgaSwgaikgPT4ge1xuICBpZiAoYS5tICE9PSBhLm4pIHsgcmV0dXJuIGZhbHNlOyB9XG4gIGNvbnN0IGVudHJpZXMgPSBbXTtcbiAgZm9yIChsZXQgaWkgPSAxOyBpaSA8PSBhLm07IGlpKyspIHtcbiAgICBpZiAoaWkgPT09IGkpIHsgY29udGludWU7IH1cbiAgICBmb3IgKGxldCBqaiA9IDE7IGpqIDw9IGEubjsgamorKykge1xuICAgICAgaWYgKGpqID09PSBqKSB7IGNvbnRpbnVlOyB9XG4gICAgICBlbnRyaWVzLnB1c2gobWF0LmdldChhLCBpaSwgamopKTtcbiAgICB9XG4gIH1cbiAgcmV0dXJuIG1hdChhLm0gLSAxLCBhLm4gLSAxLCBlbnRyaWVzKTtcbn07XG5cbi8qKlxuICogR2V0IHRoZSBkZXRlcm1pbmFudCBvZiBhIG1hdHJpeFxuICogQHBhcmFtIHttYXR9IGEgTWF0cml4IGFcbiAqIEByZXR1cm4ge251bWJlcnxib29sZWFufSB8YXwgb3IgZmFsc2UgaWYgdGhlIG1hdHJpeCBpcyBub3Qgc3F1YXJlXG4gKi9cbm1hdC5kZXQgPSBhID0+IHtcbiAgaWYgKGEubSAhPT0gYS5uKSB7IHJldHVybiBmYWxzZTsgfVxuICBpZiAoYS5tID09PSAxKSB7XG4gICAgcmV0dXJuIGEuZW50cmllc1swXTtcbiAgfVxuICBpZiAoYS5tID09PSAyKSB7XG4gICAgcmV0dXJuIGEuZW50cmllc1swXSAqIGEuZW50cmllc1szXSAtIGEuZW50cmllc1sxXSAqIGEuZW50cmllc1syXTtcbiAgfVxuICBsZXQgdG90YWwgPSAwLCBzaWduID0gMTtcbiAgZm9yIChsZXQgaiA9IDE7IGogPD0gYS5uOyBqKyspIHtcbiAgICB0b3RhbCArPSBzaWduICogYS5lbnRyaWVzW2ogLSAxXSAqIG1hdC5kZXQobWF0Lm1pbm9yKGEsIDEsIGopKTtcbiAgICBzaWduICo9IC0xO1xuICB9XG4gIHJldHVybiB0b3RhbDtcbn07XG5cbi8qKlxuICogTm9ybWFsaXNlIGEgbWF0cml4XG4gKiBAcGFyYW0ge21hdH0gYSBUaGUgbWF0cml4IHRvIG5vcm1hbGlzZVxuICogQHJldHVybiB7bWF0fGJvb2xlYW59IF5hIG9yIGZhbHNlIGlmIHRoZSBtYXRyaXggaXMgbm90IHNxdWFyZVxuICovXG5tYXQubm9yID0gYSA9PiB7XG4gIGlmIChhLm0gIT09IGEubikgeyByZXR1cm4gZmFsc2U7IH1cbiAgY29uc3QgZCA9IG1hdC5kZXQoYSk7XG4gIHJldHVybiBtYXQubWFwKGEsIGkgPT4gaSAqIGQpO1xufTtcblxuLyoqXG4gKiBHZXQgdGhlIGFkanVnYXRlIG9mIGEgbWF0cml4XG4gKiBAcGFyYW0ge21hdH0gYSBUaGUgbWF0cml4IGZyb20gd2hpY2ggdG8gZ2V0IHRoZSBhZGp1Z2F0ZVxuICogQHJldHVybiB7bWF0fSBUaGUgYWRqdWdhdGUgb2YgYVxuICovXG5tYXQuYWRqID0gYSA9PiB7XG4gIGNvbnN0IG1pbm9ycyA9IG1hdChhLm0sIGEubik7XG4gIGZvciAobGV0IGkgPSAxOyBpIDw9IGEubTsgaSsrKSB7XG4gICAgZm9yIChsZXQgaiA9IDE7IGogPD0gYS5uOyBqKyspIHtcbiAgICAgIG1hdC5zZXQobWlub3JzLCBpLCBqLCBtYXQuZGV0KG1hdC5taW5vcihhLCBpLCBqKSkpO1xuICAgIH1cbiAgfVxuICBjb25zdCBjb2ZhY3RvcnMgPSBtYXQubWFwKG1pbm9ycywgKHYsIGkpID0+IHYgKiAoaSAlIDIgPyAtMSA6IDEpKTtcbiAgcmV0dXJuIG1hdC50cmFucyhjb2ZhY3RvcnMpO1xufTtcblxuLyoqXG4gKiBHZXQgdGhlIGludmVyc2Ugb2YgYSBtYXRyaXhcbiAqIEBwYXJhbSB7bWF0fSBhIFRoZSBtYXRyaXggdG8gaW52ZXJ0XG4gKiBAcmV0dXJuIHttYXR8Ym9vbGVhbn0gYV4tMSBvciBmYWxzZSBpZiB0aGUgbWF0cml4IGhhcyBubyBpbnZlcnNlXG4gKi9cbm1hdC5pbnYgPSBhID0+IHtcbiAgaWYgKGEubSAhPT0gYS5uKSB7IHJldHVybiBmYWxzZTsgfVxuICBjb25zdCBkID0gbWF0LmRldChhKTtcbiAgaWYgKGQgPT09IDApIHsgcmV0dXJuIGZhbHNlOyB9XG4gIHJldHVybiBtYXQuc2NhbGUobWF0LmFkaihhKSwgMSAvIGQpO1xufTtcblxuLyoqXG4gKiBDaGVjayBpZiB0d28gbWF0cmljZXMgYXJlIGVxdWFsXG4gKiBAcGFyYW0ge21hdH0gYSBNYXRyaXggYVxuICogQHBhcmFtIHttYXR9IGIgTWF0cml4IGJcbiAqIEByZXR1cm4ge2Jvb2xlYW59IFRydWUgaWYgbWF0cmljZXMgYSBhbmQgYiBhcmUgaWRlbnRpY2FsLCBmYWxzZSBvdGhlcndpc2VcbiAqL1xubWF0LmVxID0gKGEsIGIpID0+IGEubSA9PT0gYi5tICYmIGEubiA9PT0gYi5uICYmIG1hdC5zdHIoYSkgPT09IG1hdC5zdHIoYik7XG5cbi8qKlxuICogQ29weSBhIG1hdHJpeFxuICogQHBhcmFtIHttYXR9IGEgVGhlIG1hdHJpeCB0byBjb3B5XG4gKiBAcmV0dXJuIHttYXR9IEEgY29weSBvZiBtYXRyaXggYVxuICovXG5tYXQuY3B5ID0gYSA9PiBtYXQoYS5tLCBhLm4sIFsuLi5hLmVudHJpZXNdKTtcblxuLyoqXG4gKiBBIGZ1bmN0aW9uIHRvIGNhbGwgb24gZWFjaCBlbnRyeSBvZiBhIG1hdHJpeFxuICogQGNhbGxiYWNrIG1hdHJpeE1hcENhbGxiYWNrXG4gKiBAcGFyYW0ge251bWJlcn0gdmFsdWUgVGhlIGVudHJ5IHZhbHVlXG4gKiBAcGFyYW0ge251bWJlcn0gaW5kZXggVGhlIGVudHJ5IGluZGV4XG4gKiBAcGFyYW0ge0FycmF5PG51bWJlcj59IGVudHJpZXMgVGhlIGFycmF5IG9mIG1hdHJpeCBlbnRyaWVzXG4gKiBAcmV0dXJuIHtudW1iZXJ9IFRoZSBtYXBwZWQgZW50cnlcbiAqL1xuXG4vKipcbiAqIENhbGwgYSBmdW5jdGlvbiBvbiBlYWNoIGVudHJ5IG9mIGEgbWF0cml4IGFuZCBidWlsZCBhIG5ldyBtYXRyaXggZnJvbSB0aGUgcmVzdWx0c1xuICogQHBhcmFtIHttYXR9IGEgTWF0cml4IGFcbiAqIEBwYXJhbSB7bWF0cml4TWFwQ2FsbGJhY2t9IGYgVGhlIGZ1bmN0aW9uIHRvIGNhbGwgb24gZWFjaCBlbnRyeSBvZiB0aGUgbWF0cml4XG4gKiBAcmV0dXJuIHttYXR9IE1hdHJpeCBhIG1hcHBlZCB0aHJvdWdoIGZcbiAqL1xubWF0Lm1hcCA9IChhLCBmKSA9PiBtYXQoYS5tLCBhLm4sIGEuZW50cmllcy5tYXAoZikpO1xuXG4vKipcbiAqIENvbnZlcnQgYSBtYXRyaXggaW50byBhIHN0cmluZ1xuICogQHBhcmFtIHttYXR9IGEgVGhlIG1hdHJpeCB0byBjb252ZXJ0XG4gKiBAcGFyYW0ge3N0cmluZ30gW21zPScsICddIFRoZSBzZXBhcmF0b3Igc3RyaW5nIGZvciBjb2x1bW5zXG4gKiBAcGFyYW0ge3N0cmluZ30gW25zPSdcXG4nXSBUaGUgc2VwYXJhdG9yIHN0cmluZyBmb3Igcm93c1xuICogQHJldHVybiB7c3RyaW5nfSBBIHN0cmluZyByZXByZXNlbnRhdGlvbiBvZiB0aGUgbWF0cml4XG4gKi9cbm1hdC5zdHIgPSAoYSwgbXMgPSAnLCAnLCBucyA9ICdcXG4nKSA9PiBhLmVudHJpZXMuY2h1bmsoYS5uKS5tYXAociA9PiByLmpvaW4obXMpKS5qb2luKG5zKTtcblxuaWYgKHR5cGVvZiBtb2R1bGUgIT09ICd1bmRlZmluZWQnKSB7XG4gIG1vZHVsZS5leHBvcnRzID0geyB2ZWMsIG1hdCB9O1xufVxuIiwiJ3VzZSBzdHJpY3QnO1xyXG5cclxudmFyIHdpZHRoID0gMjU2Oy8vIGVhY2ggUkM0IG91dHB1dCBpcyAwIDw9IHggPCAyNTZcclxudmFyIGNodW5rcyA9IDY7Ly8gYXQgbGVhc3Qgc2l4IFJDNCBvdXRwdXRzIGZvciBlYWNoIGRvdWJsZVxyXG52YXIgZGlnaXRzID0gNTI7Ly8gdGhlcmUgYXJlIDUyIHNpZ25pZmljYW50IGRpZ2l0cyBpbiBhIGRvdWJsZVxyXG52YXIgcG9vbCA9IFtdOy8vIHBvb2w6IGVudHJvcHkgcG9vbCBzdGFydHMgZW1wdHlcclxudmFyIEdMT0JBTCA9IHR5cGVvZiBnbG9iYWwgPT09ICd1bmRlZmluZWQnID8gd2luZG93IDogZ2xvYmFsO1xyXG5cclxuLy9cclxuLy8gVGhlIGZvbGxvd2luZyBjb25zdGFudHMgYXJlIHJlbGF0ZWQgdG8gSUVFRSA3NTQgbGltaXRzLlxyXG4vL1xyXG52YXIgc3RhcnRkZW5vbSA9IE1hdGgucG93KHdpZHRoLCBjaHVua3MpLFxyXG4gICAgc2lnbmlmaWNhbmNlID0gTWF0aC5wb3coMiwgZGlnaXRzKSxcclxuICAgIG92ZXJmbG93ID0gc2lnbmlmaWNhbmNlICogMixcclxuICAgIG1hc2sgPSB3aWR0aCAtIDE7XHJcblxyXG5cclxudmFyIG9sZFJhbmRvbSA9IE1hdGgucmFuZG9tO1xyXG5cclxuLy9cclxuLy8gc2VlZHJhbmRvbSgpXHJcbi8vIFRoaXMgaXMgdGhlIHNlZWRyYW5kb20gZnVuY3Rpb24gZGVzY3JpYmVkIGFib3ZlLlxyXG4vL1xyXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uKHNlZWQsIG9wdGlvbnMpIHtcclxuICBpZiAob3B0aW9ucyAmJiBvcHRpb25zLmdsb2JhbCA9PT0gdHJ1ZSkge1xyXG4gICAgb3B0aW9ucy5nbG9iYWwgPSBmYWxzZTtcclxuICAgIE1hdGgucmFuZG9tID0gbW9kdWxlLmV4cG9ydHMoc2VlZCwgb3B0aW9ucyk7XHJcbiAgICBvcHRpb25zLmdsb2JhbCA9IHRydWU7XHJcbiAgICByZXR1cm4gTWF0aC5yYW5kb207XHJcbiAgfVxyXG4gIHZhciB1c2VfZW50cm9weSA9IChvcHRpb25zICYmIG9wdGlvbnMuZW50cm9weSkgfHwgZmFsc2U7XHJcbiAgdmFyIGtleSA9IFtdO1xyXG5cclxuICAvLyBGbGF0dGVuIHRoZSBzZWVkIHN0cmluZyBvciBidWlsZCBvbmUgZnJvbSBsb2NhbCBlbnRyb3B5IGlmIG5lZWRlZC5cclxuICB2YXIgc2hvcnRzZWVkID0gbWl4a2V5KGZsYXR0ZW4oXHJcbiAgICB1c2VfZW50cm9weSA/IFtzZWVkLCB0b3N0cmluZyhwb29sKV0gOlxyXG4gICAgMCBpbiBhcmd1bWVudHMgPyBzZWVkIDogYXV0b3NlZWQoKSwgMyksIGtleSk7XHJcblxyXG4gIC8vIFVzZSB0aGUgc2VlZCB0byBpbml0aWFsaXplIGFuIEFSQzQgZ2VuZXJhdG9yLlxyXG4gIHZhciBhcmM0ID0gbmV3IEFSQzQoa2V5KTtcclxuXHJcbiAgLy8gTWl4IHRoZSByYW5kb21uZXNzIGludG8gYWNjdW11bGF0ZWQgZW50cm9weS5cclxuICBtaXhrZXkodG9zdHJpbmcoYXJjNC5TKSwgcG9vbCk7XHJcblxyXG4gIC8vIE92ZXJyaWRlIE1hdGgucmFuZG9tXHJcblxyXG4gIC8vIFRoaXMgZnVuY3Rpb24gcmV0dXJucyBhIHJhbmRvbSBkb3VibGUgaW4gWzAsIDEpIHRoYXQgY29udGFpbnNcclxuICAvLyByYW5kb21uZXNzIGluIGV2ZXJ5IGJpdCBvZiB0aGUgbWFudGlzc2Egb2YgdGhlIElFRUUgNzU0IHZhbHVlLlxyXG5cclxuICByZXR1cm4gZnVuY3Rpb24oKSB7ICAgICAgICAgLy8gQ2xvc3VyZSB0byByZXR1cm4gYSByYW5kb20gZG91YmxlOlxyXG4gICAgdmFyIG4gPSBhcmM0LmcoY2h1bmtzKSwgICAgICAgICAgICAgLy8gU3RhcnQgd2l0aCBhIG51bWVyYXRvciBuIDwgMiBeIDQ4XHJcbiAgICAgICAgZCA9IHN0YXJ0ZGVub20sICAgICAgICAgICAgICAgICAvLyAgIGFuZCBkZW5vbWluYXRvciBkID0gMiBeIDQ4LlxyXG4gICAgICAgIHggPSAwOyAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICBhbmQgbm8gJ2V4dHJhIGxhc3QgYnl0ZScuXHJcbiAgICB3aGlsZSAobiA8IHNpZ25pZmljYW5jZSkgeyAgICAgICAgICAvLyBGaWxsIHVwIGFsbCBzaWduaWZpY2FudCBkaWdpdHMgYnlcclxuICAgICAgbiA9IChuICsgeCkgKiB3aWR0aDsgICAgICAgICAgICAgIC8vICAgc2hpZnRpbmcgbnVtZXJhdG9yIGFuZFxyXG4gICAgICBkICo9IHdpZHRoOyAgICAgICAgICAgICAgICAgICAgICAgLy8gICBkZW5vbWluYXRvciBhbmQgZ2VuZXJhdGluZyBhXHJcbiAgICAgIHggPSBhcmM0LmcoMSk7ICAgICAgICAgICAgICAgICAgICAvLyAgIG5ldyBsZWFzdC1zaWduaWZpY2FudC1ieXRlLlxyXG4gICAgfVxyXG4gICAgd2hpbGUgKG4gPj0gb3ZlcmZsb3cpIHsgICAgICAgICAgICAgLy8gVG8gYXZvaWQgcm91bmRpbmcgdXAsIGJlZm9yZSBhZGRpbmdcclxuICAgICAgbiAvPSAyOyAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgbGFzdCBieXRlLCBzaGlmdCBldmVyeXRoaW5nXHJcbiAgICAgIGQgLz0gMjsgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAgIHJpZ2h0IHVzaW5nIGludGVnZXIgTWF0aCB1bnRpbFxyXG4gICAgICB4ID4+Pj0gMTsgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICB3ZSBoYXZlIGV4YWN0bHkgdGhlIGRlc2lyZWQgYml0cy5cclxuICAgIH1cclxuICAgIHJldHVybiAobiArIHgpIC8gZDsgICAgICAgICAgICAgICAgIC8vIEZvcm0gdGhlIG51bWJlciB3aXRoaW4gWzAsIDEpLlxyXG4gIH07XHJcbn07XHJcblxyXG5tb2R1bGUuZXhwb3J0cy5yZXNldEdsb2JhbCA9IGZ1bmN0aW9uICgpIHtcclxuICBNYXRoLnJhbmRvbSA9IG9sZFJhbmRvbTtcclxufTtcclxuXHJcbi8vXHJcbi8vIEFSQzRcclxuLy9cclxuLy8gQW4gQVJDNCBpbXBsZW1lbnRhdGlvbi4gIFRoZSBjb25zdHJ1Y3RvciB0YWtlcyBhIGtleSBpbiB0aGUgZm9ybSBvZlxyXG4vLyBhbiBhcnJheSBvZiBhdCBtb3N0ICh3aWR0aCkgaW50ZWdlcnMgdGhhdCBzaG91bGQgYmUgMCA8PSB4IDwgKHdpZHRoKS5cclxuLy9cclxuLy8gVGhlIGcoY291bnQpIG1ldGhvZCByZXR1cm5zIGEgcHNldWRvcmFuZG9tIGludGVnZXIgdGhhdCBjb25jYXRlbmF0ZXNcclxuLy8gdGhlIG5leHQgKGNvdW50KSBvdXRwdXRzIGZyb20gQVJDNC4gIEl0cyByZXR1cm4gdmFsdWUgaXMgYSBudW1iZXIgeFxyXG4vLyB0aGF0IGlzIGluIHRoZSByYW5nZSAwIDw9IHggPCAod2lkdGggXiBjb3VudCkuXHJcbi8vXHJcbi8qKiBAY29uc3RydWN0b3IgKi9cclxuZnVuY3Rpb24gQVJDNChrZXkpIHtcclxuICB2YXIgdCwga2V5bGVuID0ga2V5Lmxlbmd0aCxcclxuICAgICAgbWUgPSB0aGlzLCBpID0gMCwgaiA9IG1lLmkgPSBtZS5qID0gMCwgcyA9IG1lLlMgPSBbXTtcclxuXHJcbiAgLy8gVGhlIGVtcHR5IGtleSBbXSBpcyB0cmVhdGVkIGFzIFswXS5cclxuICBpZiAoIWtleWxlbikgeyBrZXkgPSBba2V5bGVuKytdOyB9XHJcblxyXG4gIC8vIFNldCB1cCBTIHVzaW5nIHRoZSBzdGFuZGFyZCBrZXkgc2NoZWR1bGluZyBhbGdvcml0aG0uXHJcbiAgd2hpbGUgKGkgPCB3aWR0aCkge1xyXG4gICAgc1tpXSA9IGkrKztcclxuICB9XHJcbiAgZm9yIChpID0gMDsgaSA8IHdpZHRoOyBpKyspIHtcclxuICAgIHNbaV0gPSBzW2ogPSBtYXNrICYgKGogKyBrZXlbaSAlIGtleWxlbl0gKyAodCA9IHNbaV0pKV07XHJcbiAgICBzW2pdID0gdDtcclxuICB9XHJcblxyXG4gIC8vIFRoZSBcImdcIiBtZXRob2QgcmV0dXJucyB0aGUgbmV4dCAoY291bnQpIG91dHB1dHMgYXMgb25lIG51bWJlci5cclxuICAobWUuZyA9IGZ1bmN0aW9uKGNvdW50KSB7XHJcbiAgICAvLyBVc2luZyBpbnN0YW5jZSBtZW1iZXJzIGluc3RlYWQgb2YgY2xvc3VyZSBzdGF0ZSBuZWFybHkgZG91YmxlcyBzcGVlZC5cclxuICAgIHZhciB0LCByID0gMCxcclxuICAgICAgICBpID0gbWUuaSwgaiA9IG1lLmosIHMgPSBtZS5TO1xyXG4gICAgd2hpbGUgKGNvdW50LS0pIHtcclxuICAgICAgdCA9IHNbaSA9IG1hc2sgJiAoaSArIDEpXTtcclxuICAgICAgciA9IHIgKiB3aWR0aCArIHNbbWFzayAmICgoc1tpXSA9IHNbaiA9IG1hc2sgJiAoaiArIHQpXSkgKyAoc1tqXSA9IHQpKV07XHJcbiAgICB9XHJcbiAgICBtZS5pID0gaTsgbWUuaiA9IGo7XHJcbiAgICByZXR1cm4gcjtcclxuICAgIC8vIEZvciByb2J1c3QgdW5wcmVkaWN0YWJpbGl0eSBkaXNjYXJkIGFuIGluaXRpYWwgYmF0Y2ggb2YgdmFsdWVzLlxyXG4gICAgLy8gU2VlIGh0dHA6Ly93d3cucnNhLmNvbS9yc2FsYWJzL25vZGUuYXNwP2lkPTIwMDlcclxuICB9KSh3aWR0aCk7XHJcbn1cclxuXHJcbi8vXHJcbi8vIGZsYXR0ZW4oKVxyXG4vLyBDb252ZXJ0cyBhbiBvYmplY3QgdHJlZSB0byBuZXN0ZWQgYXJyYXlzIG9mIHN0cmluZ3MuXHJcbi8vXHJcbmZ1bmN0aW9uIGZsYXR0ZW4ob2JqLCBkZXB0aCkge1xyXG4gIHZhciByZXN1bHQgPSBbXSwgdHlwID0gKHR5cGVvZiBvYmopWzBdLCBwcm9wO1xyXG4gIGlmIChkZXB0aCAmJiB0eXAgPT0gJ28nKSB7XHJcbiAgICBmb3IgKHByb3AgaW4gb2JqKSB7XHJcbiAgICAgIHRyeSB7IHJlc3VsdC5wdXNoKGZsYXR0ZW4ob2JqW3Byb3BdLCBkZXB0aCAtIDEpKTsgfSBjYXRjaCAoZSkge31cclxuICAgIH1cclxuICB9XHJcbiAgcmV0dXJuIChyZXN1bHQubGVuZ3RoID8gcmVzdWx0IDogdHlwID09ICdzJyA/IG9iaiA6IG9iaiArICdcXDAnKTtcclxufVxyXG5cclxuLy9cclxuLy8gbWl4a2V5KClcclxuLy8gTWl4ZXMgYSBzdHJpbmcgc2VlZCBpbnRvIGEga2V5IHRoYXQgaXMgYW4gYXJyYXkgb2YgaW50ZWdlcnMsIGFuZFxyXG4vLyByZXR1cm5zIGEgc2hvcnRlbmVkIHN0cmluZyBzZWVkIHRoYXQgaXMgZXF1aXZhbGVudCB0byB0aGUgcmVzdWx0IGtleS5cclxuLy9cclxuZnVuY3Rpb24gbWl4a2V5KHNlZWQsIGtleSkge1xyXG4gIHZhciBzdHJpbmdzZWVkID0gc2VlZCArICcnLCBzbWVhciwgaiA9IDA7XHJcbiAgd2hpbGUgKGogPCBzdHJpbmdzZWVkLmxlbmd0aCkge1xyXG4gICAga2V5W21hc2sgJiBqXSA9XHJcbiAgICAgIG1hc2sgJiAoKHNtZWFyIF49IGtleVttYXNrICYgal0gKiAxOSkgKyBzdHJpbmdzZWVkLmNoYXJDb2RlQXQoaisrKSk7XHJcbiAgfVxyXG4gIHJldHVybiB0b3N0cmluZyhrZXkpO1xyXG59XHJcblxyXG4vL1xyXG4vLyBhdXRvc2VlZCgpXHJcbi8vIFJldHVybnMgYW4gb2JqZWN0IGZvciBhdXRvc2VlZGluZywgdXNpbmcgd2luZG93LmNyeXB0byBpZiBhdmFpbGFibGUuXHJcbi8vXHJcbi8qKiBAcGFyYW0ge1VpbnQ4QXJyYXk9fSBzZWVkICovXHJcbmZ1bmN0aW9uIGF1dG9zZWVkKHNlZWQpIHtcclxuICB0cnkge1xyXG4gICAgR0xPQkFMLmNyeXB0by5nZXRSYW5kb21WYWx1ZXMoc2VlZCA9IG5ldyBVaW50OEFycmF5KHdpZHRoKSk7XHJcbiAgICByZXR1cm4gdG9zdHJpbmcoc2VlZCk7XHJcbiAgfSBjYXRjaCAoZSkge1xyXG4gICAgcmV0dXJuIFsrbmV3IERhdGUsIEdMT0JBTCwgR0xPQkFMLm5hdmlnYXRvciAmJiBHTE9CQUwubmF2aWdhdG9yLnBsdWdpbnMsXHJcbiAgICAgICAgICAgIEdMT0JBTC5zY3JlZW4sIHRvc3RyaW5nKHBvb2wpXTtcclxuICB9XHJcbn1cclxuXHJcbi8vXHJcbi8vIHRvc3RyaW5nKClcclxuLy8gQ29udmVydHMgYW4gYXJyYXkgb2YgY2hhcmNvZGVzIHRvIGEgc3RyaW5nXHJcbi8vXHJcbmZ1bmN0aW9uIHRvc3RyaW5nKGEpIHtcclxuICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZS5hcHBseSgwLCBhKTtcclxufVxyXG5cclxuLy9cclxuLy8gV2hlbiBzZWVkcmFuZG9tLmpzIGlzIGxvYWRlZCwgd2UgaW1tZWRpYXRlbHkgbWl4IGEgZmV3IGJpdHNcclxuLy8gZnJvbSB0aGUgYnVpbHQtaW4gUk5HIGludG8gdGhlIGVudHJvcHkgcG9vbC4gIEJlY2F1c2Ugd2UgZG9cclxuLy8gbm90IHdhbnQgdG8gaW50ZWZlcmUgd2l0aCBkZXRlcm1pbnN0aWMgUFJORyBzdGF0ZSBsYXRlcixcclxuLy8gc2VlZHJhbmRvbSB3aWxsIG5vdCBjYWxsIE1hdGgucmFuZG9tIG9uIGl0cyBvd24gYWdhaW4gYWZ0ZXJcclxuLy8gaW5pdGlhbGl6YXRpb24uXHJcbi8vXHJcbm1peGtleShNYXRoLnJhbmRvbSgpLCBwb29sKTtcclxuIiwiLy8gVGhlIG1vZHVsZSBjYWNoZVxudmFyIF9fd2VicGFja19tb2R1bGVfY2FjaGVfXyA9IHt9O1xuXG4vLyBUaGUgcmVxdWlyZSBmdW5jdGlvblxuZnVuY3Rpb24gX193ZWJwYWNrX3JlcXVpcmVfXyhtb2R1bGVJZCkge1xuXHQvLyBDaGVjayBpZiBtb2R1bGUgaXMgaW4gY2FjaGVcblx0dmFyIGNhY2hlZE1vZHVsZSA9IF9fd2VicGFja19tb2R1bGVfY2FjaGVfX1ttb2R1bGVJZF07XG5cdGlmIChjYWNoZWRNb2R1bGUgIT09IHVuZGVmaW5lZCkge1xuXHRcdHJldHVybiBjYWNoZWRNb2R1bGUuZXhwb3J0cztcblx0fVxuXHQvLyBDcmVhdGUgYSBuZXcgbW9kdWxlIChhbmQgcHV0IGl0IGludG8gdGhlIGNhY2hlKVxuXHR2YXIgbW9kdWxlID0gX193ZWJwYWNrX21vZHVsZV9jYWNoZV9fW21vZHVsZUlkXSA9IHtcblx0XHQvLyBubyBtb2R1bGUuaWQgbmVlZGVkXG5cdFx0Ly8gbm8gbW9kdWxlLmxvYWRlZCBuZWVkZWRcblx0XHRleHBvcnRzOiB7fVxuXHR9O1xuXG5cdC8vIEV4ZWN1dGUgdGhlIG1vZHVsZSBmdW5jdGlvblxuXHRfX3dlYnBhY2tfbW9kdWxlc19fW21vZHVsZUlkXShtb2R1bGUsIG1vZHVsZS5leHBvcnRzLCBfX3dlYnBhY2tfcmVxdWlyZV9fKTtcblxuXHQvLyBSZXR1cm4gdGhlIGV4cG9ydHMgb2YgdGhlIG1vZHVsZVxuXHRyZXR1cm4gbW9kdWxlLmV4cG9ydHM7XG59XG5cbiIsIl9fd2VicGFja19yZXF1aXJlX18uZyA9IChmdW5jdGlvbigpIHtcblx0aWYgKHR5cGVvZiBnbG9iYWxUaGlzID09PSAnb2JqZWN0JykgcmV0dXJuIGdsb2JhbFRoaXM7XG5cdHRyeSB7XG5cdFx0cmV0dXJuIHRoaXMgfHwgbmV3IEZ1bmN0aW9uKCdyZXR1cm4gdGhpcycpKCk7XG5cdH0gY2F0Y2ggKGUpIHtcblx0XHRpZiAodHlwZW9mIHdpbmRvdyA9PT0gJ29iamVjdCcpIHJldHVybiB3aW5kb3c7XG5cdH1cbn0pKCk7IiwiXCJ1c2Ugc3RyaWN0XCI7XG5PYmplY3QuZGVmaW5lUHJvcGVydHkoZXhwb3J0cywgXCJfX2VzTW9kdWxlXCIsIHsgdmFsdWU6IHRydWUgfSk7XG5leHBvcnRzLmlkZW50aWNvbiA9IHZvaWQgMDtcbmNvbnN0IHNlZWQgPSByZXF1aXJlKFwic2VlZC1yYW5kb21cIik7XG5jb25zdCBjb21tb25qc18xID0gcmVxdWlyZShcIkBiYXNlbWVudHVuaXZlcnNlL2NvbW1vbmpzXCIpO1xuY29uc3QgZGVmYXVsdElkZW50aWNvblNldHRpbmdzID0ge1xuICAgIHNpemU6IDEwMCxcbiAgICBiYXNlU2VlZDogJycsXG4gICAgZm9udDogJ0hlbHZldGljYScsXG4gICAgZm9udFN0eWxlOiAnYm9sZCcsXG4gICAgZm9udFNpemU6IDAuNCxcbiAgICBiYWNrZ3JvdW5kQ29sb3VyczogW1xuICAgICAgICAnIzE2YTA4NScsXG4gICAgICAgICcjMWFiYzljJyxcbiAgICAgICAgJyMyZWNjNzEnLFxuICAgICAgICAnIzM0OThkYicsXG4gICAgICAgICcjMTk3MGI5JyxcbiAgICAgICAgJyM5YjU5YjYnLFxuICAgICAgICAnI2U2N2UyMicsXG4gICAgICAgICcjZTc0YzNjJyxcbiAgICAgICAgJyNlMDM5NWInLFxuICAgIF0sXG4gICAgaW5pdGlhbHNDb2xvdXJzOiBbXG4gICAgICAgICcjZmZmZmZmJyxcbiAgICBdLFxuICAgIGluaXRpYWxzT2Zmc2V0OiBjb21tb25qc18xLnZlYygpLFxuICAgIGluaXRpYWxzQWxwaGE6IDEsXG4gICAgaW5pdGlhbHNDb21wb3NpdGVPcGVyYXRpb246ICdzb3VyY2Utb3ZlcicsXG4gICAgc3RyaXBlQ29sb3VyczogW1xuICAgICAgICAnI2YxYzQwZicsXG4gICAgXSxcbiAgICBzdHJpcGVBbHBoYTogMC4xNSxcbiAgICBzdHJpcGVDb21wb3NpdGVPcGVyYXRpb246ICdsaWdodGVyJyxcbiAgICBzdHJpcGVzOiBbMywgOF0sXG4gICAgc3RyaXBlV2lkdGg6IFswLjIsIDAuN10sXG4gICAgc3RyaXBlRGV2aWF0aW9uOiBbLTAuNSwgMC41XSxcbiAgICBjdXJ2ZUFtb3VudDogWzAuMiwgMC40XSxcbiAgICBjdXJ2ZU9mZnNldDogWzAsIDAuNV0sXG4gICAgc3RhcnRXaWR0aFNpZ246IFsncG9zaXRpdmUnLCAnbmVnYXRpdmUnXSxcbiAgICBlbmRXaWR0aFNpZ246IFsncG9zaXRpdmUnLCAnbmVnYXRpdmUnXSxcbn07XG5jb25zdCBNSU4gPSAwO1xuY29uc3QgTUFYID0gMTtcbmNvbnN0IFRBVSA9IE1hdGguUEkgKiAyO1xuY29uc3QgU0lHTl9GQUNUT1IgPSB7XG4gICAgcG9zaXRpdmU6IDEsXG4gICAgbmVnYXRpdmU6IC0xLFxufTtcbmNvbnN0IFJBRElVU19QQURESU5HX0ZBQ1RPUiA9IDI7XG5mdW5jdGlvbiBpZGVudGljb24obmFtZSwgc2V0dGluZ3MgPSB7fSkge1xuICAgIGNvbnN0IGFjdHVhbFNldHRpbmdzID0gT2JqZWN0LmFzc2lnbih7fSwgZGVmYXVsdElkZW50aWNvblNldHRpbmdzLCBzZXR0aW5ncyk7XG4gICAgaWYgKCFuYW1lIHx8IHR5cGVvZiBuYW1lICE9PSAnc3RyaW5nJykge1xuICAgICAgICBuYW1lID0gJ0Fub255bW91cyc7XG4gICAgfVxuICAgIGNvbnN0IGluaXRpYWxzID0gbmFtZVxuICAgICAgICAuc3BsaXQoL1tcXHNcXC0nXS8pXG4gICAgICAgIC5tYXAoaSA9PiBpWzBdLnRvVXBwZXJDYXNlKCkpXG4gICAgICAgIC5qb2luKCcnKTtcbiAgICBjb25zdCBhY3R1YWxTZWVkID0gYCR7c2V0dGluZ3MuYmFzZVNlZWR9JHtuYW1lfWA7XG4gICAgc2VlZChhY3R1YWxTZWVkLCB7IGdsb2JhbDogdHJ1ZSB9KTtcbiAgICBjb25zdCBjYW52YXMgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdjYW52YXMnKTtcbiAgICBjb25zdCBjb250ZXh0ID0gY2FudmFzLmdldENvbnRleHQoJzJkJyk7XG4gICAgY2FudmFzLndpZHRoID0gYWN0dWFsU2V0dGluZ3Muc2l6ZTtcbiAgICBjYW52YXMuaGVpZ2h0ID0gYWN0dWFsU2V0dGluZ3Muc2l6ZTtcbiAgICBkcmF3KGNvbnRleHQsIGFjdHVhbFNldHRpbmdzLCBpbml0aWFscyk7XG4gICAgc2VlZC5yZXNldEdsb2JhbCgpO1xuICAgIHJldHVybiBjYW52YXM7XG59XG5leHBvcnRzLmlkZW50aWNvbiA9IGlkZW50aWNvbjtcbmZ1bmN0aW9uIGRyYXcoY29udGV4dCwgc2V0dGluZ3MsIGluaXRpYWxzKSB7XG4gICAgY29udGV4dC5zYXZlKCk7XG4gICAgY29uc3QgY29sb3VyID0gTWF0aC5yYW5kb21JbnRCZXR3ZWVuKDAsIE1hdGgubWF4KHNldHRpbmdzLmJhY2tncm91bmRDb2xvdXJzLmxlbmd0aCwgc2V0dGluZ3Muc3RyaXBlQ29sb3Vycy5sZW5ndGgsIHNldHRpbmdzLmluaXRpYWxzQ29sb3Vycy5sZW5ndGgpIC0gMSk7XG4gICAgY29udGV4dC5maWxsU3R5bGUgPSBzZXR0aW5ncy5iYWNrZ3JvdW5kQ29sb3Vyc1tNYXRoLmNsYW1wKGNvbG91ciwgMCwgc2V0dGluZ3MuYmFja2dyb3VuZENvbG91cnMubGVuZ3RoIC0gMSldO1xuICAgIGNvbnRleHQuZmlsbFJlY3QoMCwgMCwgc2V0dGluZ3Muc2l6ZSwgc2V0dGluZ3Muc2l6ZSk7XG4gICAgY29udGV4dC5zYXZlKCk7XG4gICAgY29udGV4dC5maWxsU3R5bGUgPSBzZXR0aW5ncy5zdHJpcGVDb2xvdXJzW01hdGguY2xhbXAoY29sb3VyLCAwLCBzZXR0aW5ncy5zdHJpcGVDb2xvdXJzLmxlbmd0aCAtIDEpXTtcbiAgICBjb250ZXh0Lmdsb2JhbEFscGhhID0gc2V0dGluZ3Muc3RyaXBlQWxwaGE7XG4gICAgY29udGV4dC5nbG9iYWxDb21wb3NpdGVPcGVyYXRpb24gPSBzZXR0aW5ncy5zdHJpcGVDb21wb3NpdGVPcGVyYXRpb247XG4gICAgY29uc3QgY291bnRTdHJpcGVzID0gTWF0aC5yYW5kb21JbnRCZXR3ZWVuKHNldHRpbmdzLnN0cmlwZXNbTUlOXSwgc2V0dGluZ3Muc3RyaXBlc1tNQVhdKTtcbiAgICBsZXQgdGhldGEgPSBNYXRoLnJhbmRvbSgpICogVEFVO1xuICAgIGZvciAobGV0IGkgPSAwOyBpIDwgY291bnRTdHJpcGVzOyBpKyspIHtcbiAgICAgICAgZHJhd1N0cmlwZShjb250ZXh0LCBzZXR0aW5ncywgdGhldGEpO1xuICAgICAgICB0aGV0YSArPSBNYXRoLnJhbmRvbUJldHdlZW4oc2V0dGluZ3Muc3RyaXBlRGV2aWF0aW9uW01JTl0sIHNldHRpbmdzLnN0cmlwZURldmlhdGlvbltNQVhdKTtcbiAgICB9XG4gICAgY29udGV4dC5yZXN0b3JlKCk7XG4gICAgZHJhd0luaXRpYWxzKGNvbnRleHQsIHNldHRpbmdzLCBpbml0aWFscywgY29sb3VyKTtcbiAgICBjb250ZXh0LnJlc3RvcmUoKTtcbn1cbmZ1bmN0aW9uIGRyYXdTdHJpcGUoY29udGV4dCwgc2V0dGluZ3MsIHQxKSB7XG4gICAgY29uc3QgczEgPSBTSUdOX0ZBQ1RPUltzZXR0aW5ncy5zdGFydFdpZHRoU2lnbi5zaHVmZmxlKClbMF1dO1xuICAgIGNvbnN0IHQyID0gdDEgKyBNYXRoLnJhbmRvbUJldHdlZW4oc2V0dGluZ3Muc3RyaXBlV2lkdGhbTUlOXSwgc2V0dGluZ3Muc3RyaXBlV2lkdGhbTUFYXSkgKiBzMTtcbiAgICBjb25zdCB0MyA9IHQxICsgTWF0aC5QSSArIE1hdGgucmFuZG9tQmV0d2VlbihzZXR0aW5ncy5jdXJ2ZU9mZnNldFtNSU5dLCBzZXR0aW5ncy5jdXJ2ZU9mZnNldFtNQVhdKTtcbiAgICBjb25zdCBzMiA9IFNJR05fRkFDVE9SW3NldHRpbmdzLmVuZFdpZHRoU2lnbi5zaHVmZmxlKClbMF1dO1xuICAgIGNvbnN0IHQ0ID0gdDMgKyBNYXRoLnJhbmRvbUJldHdlZW4oc2V0dGluZ3Muc3RyaXBlV2lkdGhbTUlOXSwgc2V0dGluZ3Muc3RyaXBlV2lkdGhbTUFYXSkgKiBzMjtcbiAgICBjb25zdCB0NSA9IHQxICsgTWF0aC5QSSAvIDI7XG4gICAgY29uc3QgY2VudGVyID0gY29tbW9uanNfMS52ZWMubXVsKGNvbW1vbmpzXzEudmVjKHNldHRpbmdzLnNpemUpLCAwLjUpO1xuICAgIGNvbnN0IHJhZGl1cyA9IE1hdGguc3FydChjZW50ZXIueCAqIGNlbnRlci54ICsgY2VudGVyLnkgKiBjZW50ZXIueSkgKiBSQURJVVNfUEFERElOR19GQUNUT1I7XG4gICAgY29uc3QgYTEgPSBwb2ludE9uQ2lyY2xlKGNlbnRlciwgcmFkaXVzLCB0MSk7XG4gICAgY29uc3QgYTIgPSBwb2ludE9uQ2lyY2xlKGNlbnRlciwgcmFkaXVzLCB0Mik7XG4gICAgY29uc3QgYjEgPSBwb2ludE9uQ2lyY2xlKGNlbnRlciwgcmFkaXVzLCB0Myk7XG4gICAgY29uc3QgYjIgPSBwb2ludE9uQ2lyY2xlKGNlbnRlciwgcmFkaXVzLCB0NCk7XG4gICAgY29uc3QgYyA9IHBvaW50T25DaXJjbGUoY2VudGVyLCByYWRpdXMgKiBNYXRoLnJhbmRvbUJldHdlZW4oc2V0dGluZ3MuY3VydmVBbW91bnRbTUlOXSwgc2V0dGluZ3MuY3VydmVBbW91bnRbTUFYXSksIHQ1KTtcbiAgICBjb250ZXh0LmJlZ2luUGF0aCgpO1xuICAgIGNvbnRleHQubW92ZVRvKGExLngsIGExLnkpO1xuICAgIGNvbnRleHQucXVhZHJhdGljQ3VydmVUbyhjLngsIGMueSwgYjEueCwgYjEueSk7XG4gICAgY29udGV4dC5saW5lVG8oYjIueCwgYjIueSk7XG4gICAgY29udGV4dC5xdWFkcmF0aWNDdXJ2ZVRvKGMueCwgYy55LCBhMi54LCBhMi55KTtcbiAgICBjb250ZXh0LmNsb3NlUGF0aCgpO1xuICAgIGNvbnRleHQuZmlsbCgpO1xufVxuZnVuY3Rpb24gcG9pbnRPbkNpcmNsZShjZW50ZXIsIHJhZGl1cywgdGhldGEpIHtcbiAgICByZXR1cm4gY29tbW9uanNfMS52ZWMuYWRkKGNlbnRlciwgY29tbW9uanNfMS52ZWMocmFkaXVzICogTWF0aC5zaW4odGhldGEpLCByYWRpdXMgKiBNYXRoLmNvcyh0aGV0YSkpKTtcbn1cbmZ1bmN0aW9uIGRyYXdJbml0aWFscyhjb250ZXh0LCBzZXR0aW5ncywgaW5pdGlhbHMsIGNvbG91ckluZGV4KSB7XG4gICAgY29udGV4dC5zYXZlKCk7XG4gICAgY29udGV4dC5mb250ID0gYCR7c2V0dGluZ3MuZm9udFN0eWxlfSAke01hdGguZmxvb3Ioc2V0dGluZ3Muc2l6ZSAqIHNldHRpbmdzLmZvbnRTaXplKX1weCAke3NldHRpbmdzLmZvbnR9YDtcbiAgICBjb250ZXh0LmZpbGxTdHlsZSA9IHNldHRpbmdzLmluaXRpYWxzQ29sb3Vyc1tNYXRoLmNsYW1wKGNvbG91ckluZGV4LCAwLCBzZXR0aW5ncy5pbml0aWFsc0NvbG91cnMubGVuZ3RoIC0gMSldO1xuICAgIGNvbnRleHQuZ2xvYmFsQWxwaGEgPSBzZXR0aW5ncy5pbml0aWFsc0FscGhhO1xuICAgIGNvbnRleHQuZ2xvYmFsQ29tcG9zaXRlT3BlcmF0aW9uID0gc2V0dGluZ3MuaW5pdGlhbHNDb21wb3NpdGVPcGVyYXRpb247XG4gICAgY29udGV4dC50ZXh0QWxpZ24gPSAnY2VudGVyJztcbiAgICBjb250ZXh0LnRleHRCYXNlbGluZSA9ICdtaWRkbGUnO1xuICAgIGNvbnN0IGNlbnRlciA9IGNvbW1vbmpzXzEudmVjLm11bChjb21tb25qc18xLnZlYyhzZXR0aW5ncy5zaXplKSwgMC41KTtcbiAgICBjb250ZXh0LmZpbGxUZXh0KGluaXRpYWxzLCBjZW50ZXIueCArIHNldHRpbmdzLmluaXRpYWxzT2Zmc2V0LngsIGNlbnRlci55ICsgc2V0dGluZ3MuaW5pdGlhbHNPZmZzZXQueSk7XG4gICAgY29udGV4dC5yZXN0b3JlKCk7XG59XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=","/*! For license information please see meerkat.min.js.LICENSE.txt */\n!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define([],e):\"object\"==typeof exports?exports.Meerkat=e():t.Meerkat=e()}(self,(()=>(()=>{var t,e,r={7557:(t,e)=>{\"use strict\";function r(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function i(t){if(\"boolean\"!=typeof t)throw new Error(`Expected boolean, not ${t}`)}function n(t,...e){if(!((r=t)instanceof Uint8Array||null!=r&&\"object\"==typeof r&&\"Uint8Array\"===r.constructor.name))throw new Error(\"Expected Uint8Array\");var r;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function s(t){if(\"function\"!=typeof t||\"function\"!=typeof t.create)throw new Error(\"Hash should be wrapped by utils.wrapConstructor\");r(t.outputLen),r(t.blockLen)}function o(t,e=!0){if(t.destroyed)throw new Error(\"Hash instance has been destroyed\");if(e&&t.finished)throw new Error(\"Hash#digest() has already been called\")}function a(t,e){n(t);const r=e.outputLen;if(t.length{\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SHA2=void 0;const i=r(7557),n=r(9175);class s extends n.Hash{constructor(t,e,r,i){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,n.createView)(this.buffer)}update(t){(0,i.exists)(this);const{view:e,buffer:r,blockLen:s}=this,o=(t=(0,n.toBytes)(t)).length;for(let i=0;is-a&&(this.process(r,0),a=0);for(let t=a;t>n&s),a=Number(r&s),h=i?4:0,u=i?0:4;t.setUint32(e+h,o,i),t.setUint32(e+u,a,i)}(r,s-8,BigInt(8*this.length),o),this.process(r,0);const h=(0,n.createView)(t),u=this.outputLen;if(u%4)throw new Error(\"_sha2: outputLen should be aligned to 32bit\");const f=u/4,l=this.get();if(f>l.length)throw new Error(\"_sha2: outputLen bigger than state\");for(let t=0;t{\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.crypto=void 0,e.crypto=\"object\"==typeof globalThis&&\"crypto\"in globalThis?globalThis.crypto:void 0},2623:(t,e,r)=>{\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.sha224=e.sha256=void 0;const i=r(915),n=r(9175),s=(t,e,r)=>t&e^t&r^e&r,o=new Uint32Array([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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),h=new Uint32Array(64);class u extends i.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:t,B:e,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[t,e,r,i,n,s,o,a]}set(t,e,r,i,n,s,o,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)h[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=h[t-15],r=h[t-2],i=(0,n.rotr)(e,7)^(0,n.rotr)(e,18)^e>>>3,s=(0,n.rotr)(r,17)^(0,n.rotr)(r,19)^r>>>10;h[t]=s+h[t-7]+i+h[t-16]|0}let{A:r,B:i,C:a,D:u,E:f,F:l,G:c,H:d}=this;for(let t=0;t<64;t++){const e=d+((0,n.rotr)(f,6)^(0,n.rotr)(f,11)^(0,n.rotr)(f,25))+((p=f)&l^~p&c)+o[t]+h[t]|0,m=((0,n.rotr)(r,2)^(0,n.rotr)(r,13)^(0,n.rotr)(r,22))+s(r,i,a)|0;d=c,c=l,l=f,f=u+e|0,u=a,a=i,i=r,r=e+m|0}var p;r=r+this.A|0,i=i+this.B|0,a=a+this.C|0,u=u+this.D|0,f=f+this.E|0,l=l+this.F|0,c=c+this.G|0,d=d+this.H|0,this.set(r,i,a,u,f,l,c,d)}roundClean(){h.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class f extends u{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}e.sha256=(0,n.wrapConstructor)((()=>new u)),e.sha224=(0,n.wrapConstructor)((()=>new f))},9175:(t,e,r)=>{\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.isLE=e.rotr=e.createView=e.u32=e.u8=void 0;const i=r(5145);function n(t){return t instanceof Uint8Array||null!=t&&\"object\"==typeof t&&\"Uint8Array\"===t.constructor.name}if(e.u8=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),e.u32=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),e.createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),e.rotr=(t,e)=>t<<32-e|t>>>e,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error(\"Non little-endian hardware is not supported\");const s=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,\"0\")));e.bytesToHex=function(t){if(!n(t))throw new Error(\"Uint8Array expected\");let e=\"\";for(let r=0;r=o&&t<=a?t-o:t>=h&&t<=u?t-(h-10):t>=f&&t<=l?t-(f-10):void 0}function d(t){if(\"string\"!=typeof t)throw new Error(\"utf8ToBytes expected string, got \"+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function p(t){if(\"string\"==typeof t&&(t=d(t)),!n(t))throw new Error(\"expected Uint8Array, got \"+typeof t);return t}e.hexToBytes=function(t){if(\"string\"!=typeof t)throw new Error(\"hex string expected, got \"+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error(\"padded hex string expected, got unpadded hex of length \"+e);const i=new Uint8Array(r);for(let e=0,n=0;e{},e.asyncLoop=async function(t,r,i){let n=Date.now();for(let s=0;s=0&&tt().update(p(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(p(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.wrapXOFConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(p(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.randomBytes=function(t=32){if(i.crypto&&\"function\"==typeof i.crypto.getRandomValues)return i.crypto.getRandomValues(new Uint8Array(t));throw new Error(\"crypto.getRandomValues must be defined\")}},5570:(t,e,r)=>{\"use strict\";const i=r(1436),n=r(7007).EventEmitter,s=r(9596);t.exports=class extends n{constructor(t,e){if(e||(e={}),super(),this.chunkLength=Number(t),!this.chunkLength)throw new Error(\"First argument must be a chunk length\");this.closed=!1,this.destroyed=!1,this.length=Number(e.length)||1/0,this.name=e.name||\"idb-chunk-store\",this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=Math.ceil(this.length/this.chunkLength)-1),this.dbPromise=i.openDB(this.name,void 0,{upgrade:t=>{t.createObjectStore(\"chunks\")},blocking:()=>{this.close()},terminated:()=>{this.closed=!0,this.emit(\"error\",new Error(\"Database unexpectedly closed\"))}})}put(t,e,r=(()=>{})){if(this.closed)return s((()=>r(new Error(\"Storage is closed\"))));const i=t===this.lastChunkIndex;return i&&e.length!==this.lastChunkLength?s((()=>r(new Error(\"Last chunk length must be \"+this.lastChunkLength)))):i||e.length===this.chunkLength?(0===e.byteOffset&&e.byteLength===e.buffer.byteLength||(e=e.slice()),void(async()=>{try{const r=await this.dbPromise;await r.put(\"chunks\",e,t)}catch(t){return void r(t)}r(null)})()):s((()=>r(new Error(\"Chunk length must be \"+this.chunkLength))))}get(t,e,r=(()=>{})){return\"function\"==typeof e?this.get(t,{},e):(e||(e={}),this.closed?s((()=>r(new Error(\"Storage is closed\")))):void(async()=>{let i;try{const e=await this.dbPromise;i=await e.get(\"chunks\",t)}catch(t){return void r(t)}if(null==i){const t=new Error(\"Chunk not found\");return t.notFound=!0,void r(t)}const n=e.offset||0,s=e.length||i.length-n;0===n&&s===i.length||(i=i.slice(n,s+n)),r(null,i)})())}close(t=(()=>{})){if(this.closed)return s((()=>t(new Error(\"Storage is closed\"))));this.closed=!0,(async()=>{try{(await this.dbPromise).close()}catch(e){return void t(e)}t(null)})()}destroy(t=(()=>{})){return this.closed?s((()=>t(new Error(\"Storage is closed\")))):this.destroyed?s((()=>t(new Error(\"Storage is destroyed\")))):(this.destroyed=!0,void this.close((async e=>{if(e)t(e);else{try{await i.deleteDB(this.name)}catch(e){return void t(e)}t(null)}})))}}},7568:(t,e,r)=>{var i=e;i.bignum=r(2344),i.define=r(7363).define,i.base=r(9673),i.constants=r(2153),i.decoders=r(2853),i.encoders=r(4669)},7363:(t,e,r)=>{var i=r(7568),n=r(6698);function s(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new s(t,e)},s.prototype._createNamed=function(t){var e;try{e=Object(function(){var t=new Error(\"Cannot find module 'vm'\");throw t.code=\"MODULE_NOT_FOUND\",t}())(\"(function \"+this.name+\"(entity) {\\n this._initNamed(entity);\\n})\")}catch(t){e=function(t){this._initNamed(t)}}return n(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},s.prototype._getDecoder=function(t){return t=t||\"der\",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i.decoders[t])),this.decoders[t]},s.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},s.prototype._getEncoder=function(t){return t=t||\"der\",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(i.encoders[t])),this.encoders[t]},s.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},7227:(t,e,r)=>{var i=r(6698),n=r(9673).Reporter,s=r(8287).Buffer;function o(t,e){n.call(this,e),s.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error(\"Input not Buffer\")}function a(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof a||(t=new a(t,e)),this.length+=t.length,t}),this);else if(\"number\"==typeof t){if(!(0<=t&&t<=255))return e.error(\"non-byte EncoderBuffer value\");this.value=t,this.length=1}else if(\"string\"==typeof t)this.value=t,this.length=s.byteLength(t);else{if(!s.isBuffer(t))return e.error(\"Unsupported type: \"+typeof t);this.value=t,this.length=t.length}}i(o,n),e.t=o,o.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},o.prototype.restore=function(t){var e=new o(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,n.prototype.restore.call(this,t.reporter),e},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||\"DecoderBuffer overrun\")},o.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||\"DecoderBuffer overrun\");var r=new o(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},o.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.d=a,a.prototype.join=function(t,e){return t||(t=new s(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):(\"number\"==typeof this.value?t[e]=this.value:\"string\"==typeof this.value?t.write(this.value,e):s.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},9673:(t,e,r)=>{var i=e;i.Reporter=r(9220).a,i.DecoderBuffer=r(7227).t,i.EncoderBuffer=r(7227).d,i.Node=r(993)},993:(t,e,r)=>{var i=r(9673).Reporter,n=r(9673).EncoderBuffer,s=r(9673).DecoderBuffer,o=r(3349),a=[\"seq\",\"seqof\",\"set\",\"setof\",\"objid\",\"bool\",\"gentime\",\"utctime\",\"null_\",\"enum\",\"int\",\"objDesc\",\"bitstr\",\"bmpstr\",\"charstr\",\"genstr\",\"graphstr\",\"ia5str\",\"iso646str\",\"numstr\",\"octstr\",\"printstr\",\"t61str\",\"unistr\",\"utf8str\",\"videostr\"],h=[\"key\",\"obj\",\"use\",\"optional\",\"explicit\",\"implicit\",\"def\",\"choice\",\"any\",\"contains\"].concat(a);function u(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}t.exports=u;var f=[\"enc\",\"parent\",\"children\",\"tag\",\"args\",\"reverseArgs\",\"choice\",\"optional\",\"any\",\"obj\",\"use\",\"alteredUse\",\"key\",\"default\",\"explicit\",\"implicit\",\"contains\"];u.prototype.clone=function(){var t=this._baseState,e={};f.forEach((function(r){e[r]=t[r]}));var r=new this.constructor(e.parent);return r._baseState=e,r},u.prototype._wrap=function(){var t=this._baseState;h.forEach((function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},u.prototype._init=function(t){var e=this._baseState;o(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),o.equal(e.children.length,1,\"Root node can have only one child\")},u.prototype._useArgs=function(t){var e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(o(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(o(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if(\"object\"!=typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);var i=t[r];e[i]=r})),e})))},[\"_peekTag\",\"_decodeTag\",\"_use\",\"_decodeStr\",\"_decodeObjid\",\"_decodeTime\",\"_decodeNull\",\"_decodeInt\",\"_decodeBool\",\"_decodeList\",\"_encodeComposite\",\"_encodeStr\",\"_encodeObjid\",\"_encodeTime\",\"_encodeNull\",\"_encodeInt\",\"_encodeBool\"].forEach((function(t){u.prototype[t]=function(){var e=this._baseState;throw new Error(t+\" not implemented for encoding: \"+e.enc)}})),a.forEach((function(t){u.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===e.tag),e.tag=t,this._useArgs(r),this}})),u.prototype.use=function(t){o(t);var e=this._baseState;return o(null===e.use),e.use=t,this},u.prototype.optional=function(){return this._baseState.optional=!0,this},u.prototype.def=function(t){var e=this._baseState;return o(null===e.default),e.default=t,e.optional=!0,this},u.prototype.explicit=function(t){var e=this._baseState;return o(null===e.explicit&&null===e.implicit),e.explicit=t,this},u.prototype.implicit=function(t){var e=this._baseState;return o(null===e.explicit&&null===e.implicit),e.implicit=t,this},u.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},u.prototype.key=function(t){var e=this._baseState;return o(null===e.key),e.key=t,this},u.prototype.any=function(){return this._baseState.any=!0,this},u.prototype.choice=function(t){var e=this._baseState;return o(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},u.prototype.contains=function(t){var e=this._baseState;return o(null===e.use),e.contains=t,this},u.prototype._decode=function(t,e){var r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));var i,n=r.default,o=!0,a=null;if(null!==r.key&&(a=t.enterKey(r.key)),r.optional){var h=null;if(null!==r.explicit?h=r.explicit:null!==r.implicit?h=r.implicit:null!==r.tag&&(h=r.tag),null!==h||r.any){if(o=this._peekTag(t,h,r.any),t.isError(o))return o}else{var u=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),o=!0}catch(t){o=!1}t.restore(u)}}if(r.obj&&o&&(i=t.enterObject()),o){if(null!==r.explicit){var f=this._decodeTag(t,r.explicit);if(t.isError(f))return f;t=f}var l=t.offset;if(null===r.use&&null===r.choice){r.any&&(u=t.save());var c=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(c))return c;r.any?n=t.raw(u):t=c}if(e&&e.track&&null!==r.tag&&e.track(t.path(),l,t.length,\"tagged\"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,\"content\"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&(\"octstr\"===r.tag||\"bitstr\"===r.tag)){var d=new s(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(d,e)}}return r.obj&&o&&(n=t.leaveObject(i)),null===r.key||null===n&&!0!==o?null!==a&&t.exitKey(a):t.leaveKey(a,r.key,n),n},u.prototype._decodeGeneric=function(t,e,r){var i=this._baseState;return\"seq\"===t||\"set\"===t?null:\"seqof\"===t||\"setof\"===t?this._decodeList(e,t,i.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):\"objid\"===t&&i.args?this._decodeObjid(e,i.args[0],i.args[1],r):\"objid\"===t?this._decodeObjid(e,null,null,r):\"gentime\"===t||\"utctime\"===t?this._decodeTime(e,t,r):\"null_\"===t?this._decodeNull(e,r):\"bool\"===t?this._decodeBool(e,r):\"objDesc\"===t?this._decodeStr(e,t,r):\"int\"===t||\"enum\"===t?this._decodeInt(e,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,e._reporterState.obj)._decode(e,r):e.error(\"unknown tag: \"+t)},u.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),o(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},u.prototype._decodeChoice=function(t,e){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some((function(s){var o=t.save(),a=r.choice[s];try{var h=a._decode(t,e);if(t.isError(h))return!1;i={type:s,value:h},n=!0}catch(e){return t.restore(o),!1}return!0}),this),n?i:t.error(\"Choice not matched\")},u.prototype._createEncoderBuffer=function(t){return new n(t,this.reporter)},u.prototype._encode=function(t,e,r){var i=this._baseState;if(null===i.default||i.default!==t){var n=this._encodeValue(t,e,r);if(void 0!==n&&!this._skipDefault(n,e,r))return n}},u.prototype._encodeValue=function(t,e,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new i);var s=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}var o=null,a=!1;if(n.any)s=this._createEncoderBuffer(t);else if(n.choice)s=this._encodeChoice(t,e);else if(n.contains)o=this._getUse(n.contains,r)._encode(t,e),a=!0;else if(n.children)o=n.children.map((function(r){if(\"null_\"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error(\"Child should have a key\");var i=e.enterKey(r._baseState.key);if(\"object\"!=typeof t)return e.error(\"Child expected, but input is not object\");var n=r._encode(t[r._baseState.key],e,t);return e.leaveKey(i),n}),this).filter((function(t){return t})),o=this._createEncoderBuffer(o);else if(\"seqof\"===n.tag||\"setof\"===n.tag){if(!n.args||1!==n.args.length)return e.error(\"Too many args for : \"+n.tag);if(!Array.isArray(t))return e.error(\"seqof/setof, but data is not Array\");var h=this.clone();h._baseState.implicit=null,o=this._createEncoderBuffer(t.map((function(r){var i=this._baseState;return this._getUse(i.args[0],t)._encode(r,e)}),h))}else null!==n.use?s=this._getUse(n.use,r)._encode(t,e):(o=this._encodePrimitive(n.tag,t),a=!0);if(!n.any&&null===n.choice){var u=null!==n.implicit?n.implicit:n.tag,f=null===n.implicit?\"universal\":\"context\";null===u?null===n.use&&e.error(\"Tag could be omitted only for .use()\"):null===n.use&&(s=this._encodeComposite(u,a,f,o))}return null!==n.explicit&&(s=this._encodeComposite(n.explicit,!1,\"context\",s)),s},u.prototype._encodeChoice=function(t,e){var r=this._baseState,i=r.choice[t.type];return i||o(!1,t.type+\" not found in \"+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,e)},u.prototype._encodePrimitive=function(t,e){var r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if(\"objid\"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if(\"objid\"===t)return this._encodeObjid(e,null,null);if(\"gentime\"===t||\"utctime\"===t)return this._encodeTime(e,t);if(\"null_\"===t)return this._encodeNull();if(\"int\"===t||\"enum\"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if(\"bool\"===t)return this._encodeBool(e);if(\"objDesc\"===t)return this._encodeStr(e,t);throw new Error(\"Unsupported tag: \"+t)},u.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},u.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\\(\\)\\+,\\-\\.\\/:=\\?]*$/.test(t)}},9220:(t,e,r)=>{var i=r(6698);function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function s(t,e){this.path=t,this.rethrow(e)}e.a=n,n.prototype.isError=function(t){return t instanceof s},n.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},n.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},n.prototype.enterKey=function(t){return this._reporterState.path.push(t)},n.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},n.prototype.leaveKey=function(t,e,r){var i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},n.prototype.path=function(){return this._reporterState.path.join(\"/\")},n.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},n.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},n.prototype.error=function(t){var e,r=this._reporterState,i=t instanceof s;if(e=i?t:new s(r.path.map((function(t){return\"[\"+JSON.stringify(t)+\"]\"})).join(\"\"),t.message||t,t.stack),!r.options.partial)throw e;return i||r.errors.push(e),e},n.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},i(s,Error),s.prototype.rethrow=function(t){if(this.message=t+\" at: \"+(this.path||\"(shallow)\"),Error.captureStackTrace&&Error.captureStackTrace(this,s),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},4598:(t,e,r)=>{var i=r(2153);e.tagClass={0:\"universal\",1:\"application\",2:\"context\",3:\"private\"},e.tagClassByName=i._reverse(e.tagClass),e.tag={0:\"end\",1:\"bool\",2:\"int\",3:\"bitstr\",4:\"octstr\",5:\"null_\",6:\"objid\",7:\"objDesc\",8:\"external\",9:\"real\",10:\"enum\",11:\"embed\",12:\"utf8str\",13:\"relativeOid\",16:\"seq\",17:\"set\",18:\"numstr\",19:\"printstr\",20:\"t61str\",21:\"videostr\",22:\"ia5str\",23:\"utctime\",24:\"gentime\",25:\"graphstr\",26:\"iso646str\",27:\"genstr\",28:\"unistr\",29:\"charstr\",30:\"bmpstr\"},e.tagByName=i._reverse(e.tag)},2153:(t,e,r)=>{var i=e;i._reverse=function(t){var e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);var i=t[r];e[i]=r})),e},i.der=r(4598)},2010:(t,e,r)=>{var i=r(6698),n=r(7568),s=n.base,o=n.bignum,a=n.constants.der;function h(t){this.enc=\"der\",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){s.Node.call(this,\"der\",t)}function f(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var i=a.tagClass[r>>6],n=!(32&r);if(31&~r)r&=31;else{var s=r;for(r=0;!(128&~s);){if(s=t.readUInt8(e),t.isError(s))return s;r<<=7,r|=127&s}}return{cls:i,primitive:n,tag:r,tagStr:a.tag[r]}}function l(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(!(128&i))return i;var n=127&i;if(n>4)return t.error(\"length octect is too long\");i=0;for(var s=0;s{var i=e;i.der=r(2010),i.pem=r(8903)},8903:(t,e,r)=>{var i=r(6698),n=r(8287).Buffer,s=r(2010);function o(t){s.call(this,t),this.enc=\"pem\"}i(o,s),t.exports=o,o.prototype.decode=function(t,e){for(var r=t.toString().split(/[\\r\\n]+/g),i=e.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/,a=-1,h=-1,u=0;u{var i=r(6698),n=r(8287).Buffer,s=r(7568),o=s.base,a=s.constants.der;function h(t){this.enc=\"der\",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){o.Node.call(this,\"der\",t)}function f(t){return t<10?\"0\"+t:t}t.exports=h,h.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},i(u,o.Node),u.prototype._encodeComposite=function(t,e,r,i){var s,o=function(t,e,r,i){var n;if(\"seqof\"===t?t=\"seq\":\"setof\"===t&&(t=\"set\"),a.tagByName.hasOwnProperty(t))n=a.tagByName[t];else{if(\"number\"!=typeof t||(0|t)!==t)return i.error(\"Unknown tag: \"+t);n=t}return n>=31?i.error(\"Multi-octet tag encoding unsupported\"):(e||(n|=32),n|=a.tagClassByName[r||\"universal\"]<<6)}(t,e,r,this.reporter);if(i.length<128)return(s=new n(2))[0]=o,s[1]=i.length,this._createEncoderBuffer([s,i]);for(var h=1,u=i.length;u>=256;u>>=8)h++;(s=new n(2+h))[0]=o,s[1]=128|h,u=1+h;for(var f=i.length;f>0;u--,f>>=8)s[u]=255&f;return this._createEncoderBuffer([s,i])},u.prototype._encodeStr=function(t,e){if(\"bitstr\"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if(\"bmpstr\"===e){for(var r=new n(2*t.length),i=0;i=40)return this.reporter.error(\"Second objid identifier OOB\");t.splice(0,2,40*t[0]+t[1])}var s=0;for(i=0;i=128;o>>=7)s++}var a=new n(s),h=a.length-1;for(i=t.length-1;i>=0;i--)for(o=t[i],a[h--]=127&o;(o>>=7)>0;)a[h--]=128|127&o;return this._createEncoderBuffer(a)},u.prototype._encodeTime=function(t,e){var r,i=new Date(t);return\"gentime\"===e?r=[f(i.getFullYear()),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),\"Z\"].join(\"\"):\"utctime\"===e?r=[f(i.getFullYear()%100),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),\"Z\"].join(\"\"):this.reporter.error(\"Encoding \"+e+\" time is not supported yet\"),this._encodeStr(r,\"octstr\")},u.prototype._encodeNull=function(){return this._createEncoderBuffer(\"\")},u.prototype._encodeInt=function(t,e){if(\"string\"==typeof t){if(!e)return this.reporter.error(\"String int or enum given, but no values map\");if(!e.hasOwnProperty(t))return this.reporter.error(\"Values map doesn't contain: \"+JSON.stringify(t));t=e[t]}if(\"number\"!=typeof t&&!n.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new n(r)}if(n.isBuffer(t)){var i=t.length;0===t.length&&i++;var s=new n(i);return t.copy(s),0===t.length&&(s[0]=0),this._createEncoderBuffer(s)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);i=1;for(var o=t;o>=256;o>>=8)i++;for(o=(s=new Array(i)).length-1;o>=0;o--)s[o]=255&t,t>>=8;return 128&s[0]&&s.unshift(0),this._createEncoderBuffer(new n(s))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return\"function\"==typeof t&&(t=t(e)),t._getEncoder(\"der\").tree},u.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var s=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),s.length!==n.defaultBuffer.length)return!1;for(i=0;i{var i=e;i.der=r(82),i.pem=r(735)},735:(t,e,r)=>{var i=r(6698),n=r(82);function s(t){n.call(this,t),this.enc=\"pem\"}i(s,n),t.exports=s,s.prototype.encode=function(t,e){for(var r=n.prototype.encode.call(this,t).toString(\"base64\"),i=[\"-----BEGIN \"+e.label+\"-----\"],s=0;s=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,s=Math.min(t.length,r),o=e;o=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(t){return t instanceof s||null!==t&&\"object\"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if(\"number\"==typeof t)return this._initNumber(t,e,r);if(\"object\"==typeof t)return this._initArray(t,e,r);\"hex\"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;\"-\"===(t=t.toString().replace(/\\s+/g,\"\"))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if(\"le\"===r)for(n=0,s=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?\"\"};var f=[\"\",\"0\",\"00\",\"000\",\"0000\",\"00000\",\"000000\",\"0000000\",\"00000000\",\"000000000\",\"0000000000\",\"00000000000\",\"000000000000\",\"0000000000000\",\"00000000000000\",\"000000000000000\",\"0000000000000000\",\"00000000000000000\",\"000000000000000000\",\"0000000000000000000\",\"00000000000000000000\",\"000000000000000000000\",\"0000000000000000000000\",\"00000000000000000000000\",\"000000000000000000000000\",\"0000000000000000000000000\"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,h=o/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(s=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||\"hex\"===t){r=\"\";for(var n=0,s=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r=\"\";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r=\"0\"+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}i(!1,\"Base should be between 2 and 36\")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,\"Number can only safely store up to 53 bits\"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,\"byte array longer than desired length\"),i(s>0,\"Requested array length <= 0\"),this.strip();var o,a,h=\"le\"===e,u=new t(s),f=this.clone();if(h){for(a=0;!f.isZero();a++)o=f.andln(255),f.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i(\"number\"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i(\"number\"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,b=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,M=0|o[4],k=8191&M,S=M>>>13,x=0|o[5],A=8191&x,E=x>>>13,I=0|o[6],B=8191&I,T=I>>>13,P=0|o[7],R=8191&P,C=P>>>13,L=0|o[8],O=8191&L,j=L>>>13,N=0|o[9],U=8191&N,q=N>>>13,D=0|a[0],F=8191&D,H=D>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,Z=V>>>13,G=0|a[3],J=8191&G,Y=G>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((s=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,s=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((s=s+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,s=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,s=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((s=s+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,s=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,s=s+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((s=s+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,s=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,s=s+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((s=s+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,H))+Math.imul(T,F)|0,s=Math.imul(T,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,Z)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,s=s+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,s=s+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,st)|0))<<13)|0;u=((s=s+Math.imul(c,ot)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(C,F)|0,s=Math.imul(C,H),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,Z)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,s=s+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,s=s+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,it)|0,i=i+Math.imul(p,st)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((s=s+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,F),n=(n=Math.imul(O,H))+Math.imul(j,F)|0,s=Math.imul(j,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(C,W)|0,s=s+Math.imul(C,K)|0,i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,Z)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,Z)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,s=s+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,it)|0,i=i+Math.imul(y,st)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,s=s+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((s=s+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,H))+Math.imul(q,F)|0,s=Math.imul(q,H),i=i+Math.imul(O,W)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(j,W)|0,s=s+Math.imul(j,K)|0,i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(C,$)|0,s=s+Math.imul(C,Z)|0,i=i+Math.imul(B,J)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,s=s+Math.imul(S,it)|0,i=i+Math.imul(w,st)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,s=s+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,s=s+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((s=s+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,W),n=(n=Math.imul(U,K))+Math.imul(q,W)|0,s=Math.imul(q,K),i=i+Math.imul(O,$)|0,n=(n=n+Math.imul(O,Z)|0)+Math.imul(j,$)|0,s=s+Math.imul(j,Z)|0,i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(C,J)|0,s=s+Math.imul(C,Y)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(S,st)|0,s=s+Math.imul(S,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,s=s+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,s=s+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((s=s+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,Z))+Math.imul(q,$)|0,s=Math.imul(q,Z),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(j,J)|0,s=s+Math.imul(j,Y)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(C,Q)|0,s=s+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(A,st)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,s=s+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,s=s+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((s=s+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,J),n=(n=Math.imul(U,Y))+Math.imul(q,J)|0,s=Math.imul(q,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(j,Q)|0,s=s+Math.imul(j,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(C,rt)|0,s=s+Math.imul(C,it)|0,i=i+Math.imul(B,st)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,s=s+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,s=s+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((s=s+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(q,Q)|0,s=Math.imul(q,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(j,rt)|0,s=s+Math.imul(j,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,ot)|0,i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(T,ht)|0,s=s+Math.imul(T,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,s=s+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((s=s+Math.imul(S,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(q,rt)|0,s=Math.imul(q,it),i=i+Math.imul(O,st)|0,n=(n=n+Math.imul(O,ot)|0)+Math.imul(j,st)|0,s=s+Math.imul(j,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(C,ht)|0,s=s+Math.imul(C,ut)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,s=s+Math.imul(T,ct)|0;var Tt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((s=s+Math.imul(E,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,st),n=(n=Math.imul(U,ot))+Math.imul(q,st)|0,s=Math.imul(q,ot),i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(j,ht)|0,s=s+Math.imul(j,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(C,lt)|0,s=s+Math.imul(C,ct)|0;var Pt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((s=s+Math.imul(T,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ht),n=(n=Math.imul(U,ut))+Math.imul(q,ht)|0,s=Math.imul(q,ut),i=i+Math.imul(O,lt)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(j,lt)|0,s=s+Math.imul(j,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((s=s+Math.imul(C,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,lt),n=(n=Math.imul(U,ct))+Math.imul(q,lt)|0,s=Math.imul(q,ct);var Ct=(u+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((s=s+Math.imul(j,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Lt=(u+(i=Math.imul(U,pt))|0)+((8191&(n=(n=Math.imul(U,mt))+Math.imul(q,pt)|0))<<13)|0;return u=((s=Math.imul(q,mt))+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Bt,h[14]=Tt,h[15]=Pt,h[16]=Rt,h[17]=Ct,h[18]=Lt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),s.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-s|l>>>s,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i(\"number\"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,\"imaskn works only with positive numbers\"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i(\"number\"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&s}for(;n>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,h=i.length-n.length;if(\"mod\"!==e){(a=new s(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),\"div\"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),\"mod\"!==e&&(n=a.div.neg()),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),\"mod\"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?\"div\"===e?{div:this.divn(t.words[0]),mod:null}:\"mod\"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,\"div\",!1).div},s.prototype.mod=function(t){return this.divmod(t,\"mod\",!1).mod},s.prototype.umod=function(t){return this.divmod(t,\"mod\",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},s.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),h=new s(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(h)):(r.isub(e),a.isub(n),h.isub(o))}return{a,b:h,gcd:r.iushln(u)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return!(1&this.words[0])},s.prototype.isOdd=function(){return!(1&~this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i(\"number\"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,\"Number is too big\");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new k(t)},s.prototype.toRed=function(t){return i(!this.red,\"Already a number in reduction context\"),i(0===this.negative,\"red works only with positives\"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,\"fromRed works only with numbers in reduction context\"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,\"Already a number in reduction context\"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,\"redAdd works only with red numbers\"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,\"redIAdd works only with red numbers\"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,\"redSub works only with red numbers\"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,\"redISub works only with red numbers\"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,\"redShl works only with red numbers\"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,\"redSqr works only with red numbers\"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,\"redISqr works only with red numbers\"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,\"redSqrt works only with red numbers\"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,\"redInvm works only with red numbers\"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,\"redNeg works only with red numbers\"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,\"redPow(normalNum)\"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,\"k256\",\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\")}function w(){b.call(this,\"p224\",\"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\")}function _(){b.call(this,\"p192\",\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\")}function M(){b.call(this,\"25519\",\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\")}function k(t){if(\"string\"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),\"modulus must be greater than 1\"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,s=o}s>>>=22,t.words[n-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(y[t])return y[t];var e;if(\"k256\"===t)e=new v;else if(\"p224\"===t)e=new w;else if(\"p192\"===t)e=new _;else{if(\"p25519\"!==t)throw new Error(\"Unknown prime \"+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,\"red works only with positives\"),i(t.red,\"red works only with red numbers\")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),\"red works only with positives\"),i(t.red&&t.red===e.red,\"red works only with red numbers\")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},5682:(t,e,r)=>{const i=r(6209),n=r(943),s=r(1847),o=r(6679),a=r(5435),h=255===new Uint8Array(Uint16Array.of(255).buffer)[0];function u(t){switch(t){case\"ascii\":return i;case\"base64\":return n;case\"hex\":return s;case\"utf8\":case\"utf-8\":case void 0:return o;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return a;default:throw new Error(`Unknown encoding: ${t}`)}}function f(t){return t instanceof Uint8Array}function l(t,e,r){return\"string\"==typeof t?function(t,e){const r=u(e),i=new Uint8Array(r.byteLength(t));return r.write(i,t,0,i.byteLength),i}(t,e):Array.isArray(t)?function(t){const e=new Uint8Array(t.length);return e.set(t),e}(t):ArrayBuffer.isView(t)?function(t){const e=new Uint8Array(t.byteLength);return e.set(t),e}(t):function(t,e,r){return new Uint8Array(t,e,r)}(t,e,r)}function c(t,e,r,i,n){if(0===t.byteLength)return-1;if(\"string\"==typeof r?(i=r,r=0):void 0===r?r=n?0:t.length-1:r<0&&(r+=t.byteLength),r>=t.byteLength){if(n)return-1;r=t.byteLength-1}else if(r<0){if(!n)return-1;r=0}if(\"string\"==typeof e)e=l(e,i);else if(\"number\"==typeof e)return e&=255,n?t.indexOf(e,r):t.lastIndexOf(e,r);if(0===e.byteLength)return-1;if(n){let i=-1;for(let n=r;nt.byteLength&&(r=t.byteLength-e.byteLength);for(let i=r;i>=0;i--){let r=!0;for(let n=0;nn)return 1}return t.byteLength>e.byteLength?1:t.byteLengtht+e.byteLength),0));const r=new Uint8Array(e);let i=0;for(const e of t){if(i+e.byteLength>r.byteLength){const t=e.subarray(0,r.byteLength-i);return r.set(t,i),r}r.set(e,i),i+=e.byteLength}return r},copy:function(t,e,r=0,i=0,n=t.byteLength){if(n>0&&n=t.byteLength)throw new RangeError(\"sourceStart is out of range\");if(n<0)throw new RangeError(\"sourceEnd is out of range\");r>=e.byteLength&&(r=e.byteLength),n>t.byteLength&&(n=t.byteLength),e.byteLength-r=n||i<=r?\"\":(r<0&&(r=0),i>n&&(i=n),(0!==r||i{function e(t){return t.length}t.exports={byteLength:e,toString:function(t){const e=t.byteLength;let r=\"\";for(let i=0;i{const e=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",r=new Uint8Array(256);for(let t=0;t<64;t++)r[e.charCodeAt(t)]=t;function i(t){let e=t.length;return 61===t.charCodeAt(e-1)&&e--,e>1&&61===t.charCodeAt(e-1)&&e--,3*e>>>2}r[45]=62,r[95]=63,t.exports={byteLength:i,toString:function(t){const r=t.byteLength;let i=\"\";for(let n=0;n>2]+e[(3&t[n])<<4|t[n+1]>>4]+e[(15&t[n+1])<<2|t[n+2]>>6]+e[63&t[n+2]];return r%3==2?i=i.substring(0,i.length-1)+\"=\":r%3==1&&(i=i.substring(0,i.length-2)+\"==\"),i},write:function(t,e,n=0,s=i(e)){const o=Math.min(s,t.byteLength-n);for(let i=0,n=0;n>4,t[n++]=(15&o)<<4|a>>2,t[n++]=(3&a)<<6|63&h}return o}}},1847:t=>{function e(t){return t.length>>>1}function r(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:void 0}t.exports={byteLength:e,toString:function(t){const e=t.byteLength;t=new DataView(t.buffer,t.byteOffset,e);let r=\"\",i=0;for(let n=e-e%4;i{function e(t){return 2*t.length}t.exports={byteLength:e,toString:function(t){const e=t.byteLength;let r=\"\";for(let i=0;i>8,o=n%256;t[i+2*e]=o,t[i+2*e+1]=s}return s}}},6679:t=>{function e(t){let e=0;for(let r=0,i=t.length;r=55296&&n<=56319&&r+1=56320&&i<=57343){e+=4,r++;continue}}e+=n<=127?1:n<=2047?2:3}return e}let r,i;if(\"undefined\"!=typeof TextDecoder){const t=new TextDecoder;r=function(e){return t.decode(e)}}else r=function(t){const e=t.byteLength;let r=\"\",i=0;for(;i0){let e=0;for(;e>i,i-=6;i>=0;)t[a++]=128|e>>i&63,i-=6;o+=e>=65536?2:1}return s};t.exports={byteLength:e,toString:r,write:i}},5364:t=>{\"use strict\";t.exports=function(t){if(t.length>=255)throw new TypeError(\"Alphabet too long\");for(var e=new Uint8Array(256),r=0;r>>0,u=new Uint8Array(s);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var l=0,c=s-1;(0!==f||l>>0,u[c]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error(\"Non-zero carry\");n=l,r++}for(var d=s-n;d!==s&&0===u[d];)d++;for(var p=new Uint8Array(i+(s-d)),m=i;d!==s;)p[m++]=u[d++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError(\"Expected Uint8Array\");if(0===e.length)return\"\";for(var r=0,i=0,n=0,s=e.length;n!==s&&0===e[n];)n++,r++;for(var h=(s-n)*u+1>>>0,f=new Uint8Array(h);n!==s;){for(var l=e[n],c=0,d=h-1;(0!==l||c>>0,f[d]=l%o>>>0,l=l/o>>>0;if(0!==l)throw new Error(\"Non-zero carry\");i=c,n++}for(var p=h-i;p!==h&&0===f[p];)p++;for(var m=a.repeat(r);p{\"use strict\";e.byteLength=function(t){var e=a(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,s=a(t),o=s[0],h=s[1],u=new n(function(t,e,r){return 3*(e+r)/4-r}(0,o,h)),f=0,l=h>0?o-4:o;for(r=0;r>16&255,u[f++]=e>>8&255,u[f++]=255&e;return 2===h&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[f++]=255&e),1===h&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e),u},e.fromByteArray=function(t){for(var e,i=t.length,n=i%3,s=[],o=16383,a=0,u=i-n;au?u:a+o));return 1===n?(e=t[i-1],s.push(r[e>>2]+r[e<<4&63]+\"==\")):2===n&&(e=(t[i-2]<<8)+t[i-1],s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+\"=\")),s.join(\"\")};for(var r=[],i=[],n=\"undefined\"!=typeof Uint8Array?Uint8Array:Array,s=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",o=0;o<64;++o)r[o]=s[o],i[s.charCodeAt(o)]=o;function a(t){var e=t.length;if(e%4>0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var r=t.indexOf(\"=\");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,i){for(var n,s,o=[],a=e;a>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join(\"\")}i[\"-\".charCodeAt(0)]=62,i[\"_\".charCodeAt(0)]=63},1467:t=>{function e(t,e){if(\"string\"==typeof t[0])return t.join(\"\");if(\"number\"==typeof t[0])return new Uint8Array(t);const r=new Uint8Array(e);let i=0;for(let e=0,n=t.length;e=r){const t=e(o,a);let i=0;for(;a>=r;)yield t.slice(i,i+r),a-=r,i+=r;o=[t.slice(i,t.length)]}a&&(yield e(o,s?r:a))}},9404:function(t,e,r){!function(t,e){\"use strict\";function i(t,e){if(!t)throw new Error(e||\"Assertion failed\")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&(\"le\"!==e&&\"be\"!==e||(r=e,e=10),this._init(t||0,e||10,r||\"be\"))}var o;\"object\"==typeof t?t.exports=s:e.BN=s,s.BN=s,s.wordSize=26;try{o=\"undefined\"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(7790).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,\"Invalid character in \"+t)}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,n){for(var s=0,o=0,a=Math.min(t.length,r),h=e;h=49?u-49+10:u>=17?u-17+10:u,i(u>=0&&o0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if(\"number\"==typeof t)return this._initNumber(t,e,r);if(\"object\"==typeof t)return this._initArray(t,e,r);\"hex\"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;\"-\"===(t=t.toString().replace(/\\s+/g,\"\"))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if(\"le\"===r)for(n=0,s=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this._strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this._strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},\"undefined\"!=typeof Symbol&&\"function\"==typeof Symbol.for)try{s.prototype[Symbol.for(\"nodejs.util.inspect.custom\")]=l}catch(t){s.prototype.inspect=l}else s.prototype.inspect=l;function l(){return(this.red?\"\"}var c=[\"\",\"0\",\"00\",\"000\",\"0000\",\"00000\",\"000000\",\"0000000\",\"00000000\",\"000000000\",\"0000000000\",\"00000000000\",\"000000000000\",\"0000000000000\",\"00000000000000\",\"000000000000000\",\"0000000000000000\",\"00000000000000000\",\"000000000000000000\",\"0000000000000000000\",\"00000000000000000000\",\"000000000000000000000\",\"0000000000000000000000\",\"00000000000000000000000\",\"000000000000000000000000\",\"0000000000000000000000000\"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,h=o/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(s=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||\"hex\"===t){r=\"\";for(var n=0,s=0,o=0;o>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?c[6-h.length]+h+r:h+r}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],f=p[t];r=\"\";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(f).toString(t);r=(l=l.idivn(f)).isZero()?m+r:c[u-m.length]+m+r}for(this.isZero()&&(r=\"0\"+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}i(!1,\"Base should be between 2 and 36\")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,\"Number can only safely store up to 53 bits\"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,\"byte array longer than desired length\"),i(s>0,\"Requested array length <= 0\");var o=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,s);return this[\"_toArrayLike\"+(\"le\"===e?\"LE\":\"BE\")](o,n),o},s.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,s=0;n>8&255),r>16&255),6===s?(r>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===s?(r>=0&&(t[r--]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i(\"number\"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i(\"number\"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,b=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,M=0|o[4],k=8191&M,S=M>>>13,x=0|o[5],A=8191&x,E=x>>>13,I=0|o[6],B=8191&I,T=I>>>13,P=0|o[7],R=8191&P,C=P>>>13,L=0|o[8],O=8191&L,j=L>>>13,N=0|o[9],U=8191&N,q=N>>>13,D=0|a[0],F=8191&D,H=D>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,Z=V>>>13,G=0|a[3],J=8191&G,Y=G>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((s=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,s=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((s=s+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,s=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,s=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((s=s+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,s=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,s=s+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((s=s+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,s=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,s=s+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((s=s+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,H))+Math.imul(T,F)|0,s=Math.imul(T,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,Z)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,s=s+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,s=s+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,st)|0))<<13)|0;u=((s=s+Math.imul(c,ot)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(C,F)|0,s=Math.imul(C,H),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,Z)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,s=s+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,s=s+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,it)|0,i=i+Math.imul(p,st)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((s=s+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,F),n=(n=Math.imul(O,H))+Math.imul(j,F)|0,s=Math.imul(j,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(C,W)|0,s=s+Math.imul(C,K)|0,i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,Z)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,Z)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,s=s+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,it)|0,i=i+Math.imul(y,st)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,s=s+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((s=s+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,H))+Math.imul(q,F)|0,s=Math.imul(q,H),i=i+Math.imul(O,W)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(j,W)|0,s=s+Math.imul(j,K)|0,i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(C,$)|0,s=s+Math.imul(C,Z)|0,i=i+Math.imul(B,J)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,s=s+Math.imul(S,it)|0,i=i+Math.imul(w,st)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,s=s+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,s=s+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((s=s+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,W),n=(n=Math.imul(U,K))+Math.imul(q,W)|0,s=Math.imul(q,K),i=i+Math.imul(O,$)|0,n=(n=n+Math.imul(O,Z)|0)+Math.imul(j,$)|0,s=s+Math.imul(j,Z)|0,i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(C,J)|0,s=s+Math.imul(C,Y)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(S,st)|0,s=s+Math.imul(S,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,s=s+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,s=s+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((s=s+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,Z))+Math.imul(q,$)|0,s=Math.imul(q,Z),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(j,J)|0,s=s+Math.imul(j,Y)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(C,Q)|0,s=s+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(A,st)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,s=s+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,s=s+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((s=s+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,J),n=(n=Math.imul(U,Y))+Math.imul(q,J)|0,s=Math.imul(q,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(j,Q)|0,s=s+Math.imul(j,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(C,rt)|0,s=s+Math.imul(C,it)|0,i=i+Math.imul(B,st)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,s=s+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,s=s+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((s=s+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(q,Q)|0,s=Math.imul(q,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(j,rt)|0,s=s+Math.imul(j,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,ot)|0,i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(T,ht)|0,s=s+Math.imul(T,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,s=s+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((s=s+Math.imul(S,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(q,rt)|0,s=Math.imul(q,it),i=i+Math.imul(O,st)|0,n=(n=n+Math.imul(O,ot)|0)+Math.imul(j,st)|0,s=s+Math.imul(j,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(C,ht)|0,s=s+Math.imul(C,ut)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,s=s+Math.imul(T,ct)|0;var Tt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((s=s+Math.imul(E,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,st),n=(n=Math.imul(U,ot))+Math.imul(q,st)|0,s=Math.imul(q,ot),i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(j,ht)|0,s=s+Math.imul(j,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(C,lt)|0,s=s+Math.imul(C,ct)|0;var Pt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((s=s+Math.imul(T,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ht),n=(n=Math.imul(U,ut))+Math.imul(q,ht)|0,s=Math.imul(q,ut),i=i+Math.imul(O,lt)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(j,lt)|0,s=s+Math.imul(j,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((s=s+Math.imul(C,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,lt),n=(n=Math.imul(U,ct))+Math.imul(q,lt)|0,s=Math.imul(q,ct);var Ct=(u+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((s=s+Math.imul(j,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Lt=(u+(i=Math.imul(U,pt))|0)+((8191&(n=(n=Math.imul(U,mt))+Math.imul(q,pt)|0))<<13)|0;return u=((s=Math.imul(q,mt))+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Bt,h[14]=Tt,h[15]=Pt,h[16]=Rt,h[17]=Ct,h[18]=Lt,0!==u&&(h[19]=u,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r._strip()}function b(t,e,r){return y(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(g=m),s.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?y(this,t,e):b(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,i=0;i>=1;return i},v.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,r+=s/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n&1}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-s|l>>>s,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i(\"number\"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,\"imaskn works only with positive numbers\"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i(\"number\"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&s}for(;n>26,this.words[n+r]=67108863&s;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,h=i.length-n.length;if(\"mod\"!==e){(a=new s(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a._strip(),i._strip(),\"div\"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),\"mod\"!==e&&(n=a.div.neg()),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),\"mod\"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?\"div\"===e?{div:this.divn(t.words[0]),mod:null}:\"mod\"===e?{div:null,mod:new s(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modrn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,\"div\",!1).div},s.prototype.mod=function(t){return this.divmod(t,\"mod\",!1).mod},s.prototype.umod=function(t){return this.divmod(t,\"mod\",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=(1<<26)%t,n=0,s=this.length-1;s>=0;s--)n=(r*n+(0|this.words[s]))%t;return e?-n:n},s.prototype.modn=function(t){return this.modrn(t)},s.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var s=(0|this.words[n])+67108864*r;this.words[n]=s/t|0,r=s%t}return this._strip(),e?this.ineg():this},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),h=new s(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(h)):(r.isub(e),a.isub(n),h.isub(o))}return{a,b:h,gcd:r.iushln(u)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return!(1&this.words[0])},s.prototype.isOdd=function(){return!(1&~this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i(\"number\"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,\"Number is too big\");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new A(t)},s.prototype.toRed=function(t){return i(!this.red,\"Already a number in reduction context\"),i(0===this.negative,\"red works only with positives\"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,\"fromRed works only with numbers in reduction context\"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,\"Already a number in reduction context\"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,\"redAdd works only with red numbers\"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,\"redIAdd works only with red numbers\"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,\"redSub works only with red numbers\"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,\"redISub works only with red numbers\"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,\"redShl works only with red numbers\"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,\"redSqr works only with red numbers\"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,\"redISqr works only with red numbers\"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,\"redSqrt works only with red numbers\"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,\"redInvm works only with red numbers\"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,\"redNeg works only with red numbers\"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,\"redPow(normalNum)\"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){_.call(this,\"k256\",\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\")}function k(){_.call(this,\"p224\",\"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\")}function S(){_.call(this,\"p192\",\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\")}function x(){_.call(this,\"25519\",\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\")}function A(t){if(\"string\"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),\"modulus must be greater than 1\"),this.m=t,this.prime=null}function E(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},n(M,_),M.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,s=o}s>>>=22,t.words[n-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(w[t])return w[t];var e;if(\"k256\"===t)e=new M;else if(\"p224\"===t)e=new k;else if(\"p192\"===t)e=new S;else{if(\"p25519\"!==t)throw new Error(\"Unknown prime \"+t);e=new x}return w[t]=e,e},A.prototype._verify1=function(t){i(0===t.negative,\"red works only with positives\"),i(t.red,\"red works only with red numbers\")},A.prototype._verify2=function(t,e){i(!(t.negative|e.negative),\"red works only with positives\"),i(t.red&&t.red===e.red,\"red works only with red numbers\")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(f(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}h=26}return n},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new E(t)},n(E,A),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},5037:(t,e,r)=>{var i;function n(t){this.rand=t}if(t.exports=function(t){return i||(i=new n(null)),i.generate(t)},t.exports.Rand=n,n.prototype.generate=function(t){return this._rand(t)},n.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r{var i=r(2861).Buffer;function n(t){i.isBuffer(t)||(t=i.from(t));for(var e=t.length/4|0,r=new Array(e),n=0;n>>24]^f[p>>>16&255]^l[m>>>8&255]^c[255&g]^e[y++],o=u[p>>>24]^f[m>>>16&255]^l[g>>>8&255]^c[255&d]^e[y++],a=u[m>>>24]^f[g>>>16&255]^l[d>>>8&255]^c[255&p]^e[y++],h=u[g>>>24]^f[d>>>16&255]^l[p>>>8&255]^c[255&m]^e[y++],d=s,p=o,m=a,g=h;return s=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&g])^e[y++],o=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[g>>>8&255]<<8|i[255&d])^e[y++],a=(i[m>>>24]<<24|i[g>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[y++],h=(i[g>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[y++],[s>>>=0,o>>>=0,a>>>=0,h>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],s=[[],[],[],[]],o=0,a=0,h=0;h<256;++h){var u=a^a<<1^a<<2^a<<3^a<<4;u=u>>>8^255&u^99,r[o]=u,i[u]=o;var f=t[o],l=t[f],c=t[l],d=257*t[u]^16843008*u;n[0][o]=d<<24|d>>>8,n[1][o]=d<<16|d>>>16,n[2][o]=d<<8|d>>>24,n[3][o]=d,d=16843009*c^65537*l^257*f^16843008*o,s[0][u]=d<<24|d>>>8,s[1][u]=d<<16|d>>>16,s[2][u]=d<<8|d>>>24,s[3][u]=d,0===o?o=a=1:(o=f^t[t[t[c^f]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:s}}();function u(t){this._key=n(t),this._reset()}u.blockSize=16,u.keySize=32,u.prototype.blockSize=u.blockSize,u.prototype.keySize=u.keySize,u.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],s=0;s>>24,o=h.SBOX[o>>>24]<<24|h.SBOX[o>>>16&255]<<16|h.SBOX[o>>>8&255]<<8|h.SBOX[255&o],o^=a[s/e|0]<<24):e>6&&s%e==4&&(o=h.SBOX[o>>>24]<<24|h.SBOX[o>>>16&255]<<16|h.SBOX[o>>>8&255]<<8|h.SBOX[255&o]),n[s]=n[s-e]^o}for(var u=[],f=0;f>>24]]^h.INV_SUB_MIX[1][h.SBOX[c>>>16&255]]^h.INV_SUB_MIX[2][h.SBOX[c>>>8&255]]^h.INV_SUB_MIX[3][h.SBOX[255&c]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=u},u.prototype.encryptBlockRaw=function(t){return o(t=n(t),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},u.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=i.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},u.prototype.decryptBlock=function(t){var e=(t=n(t))[1];t[1]=t[3],t[3]=e;var r=o(t,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),s=i.allocUnsafe(16);return s.writeUInt32BE(r[0],0),s.writeUInt32BE(r[3],4),s.writeUInt32BE(r[2],8),s.writeUInt32BE(r[1],12),s},u.prototype.scrub=function(){s(this._keySchedule),s(this._invKeySchedule),s(this._key)},t.exports.AES=u},2356:(t,e,r)=>{var i=r(462),n=r(2861).Buffer,s=r(6168),o=r(6698),a=r(5892),h=r(295),u=r(5122);function f(t,e,r,o){s.call(this);var h=n.alloc(4,0);this._cipher=new i.AES(e);var f=this._cipher.encryptBlock(h);this._ghash=new a(f),r=function(t,e,r){if(12===e.length)return t._finID=n.concat([e,n.from([0,0,0,1])]),n.concat([e,n.from([0,0,0,2])]);var i=new a(r),s=e.length,o=s%16;i.update(e),o&&(o=16-o,i.update(n.alloc(o,0))),i.update(n.alloc(8,0));var h=8*s,f=n.alloc(8);f.writeUIntBE(h,0,8),i.update(f),t._finID=i.state;var l=n.from(t._finID);return u(l),l}(this,r,f),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=o,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}o(f,s),f.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=n.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},f.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error(\"Unsupported state or unable to authenticate data\");var t=h(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var i=Math.min(t.length,e.length),n=0;n{var i=r(5799),n=r(6171),s=r(3219);e.createCipher=e.Cipher=i.createCipher,e.createCipheriv=e.Cipheriv=i.createCipheriv,e.createDecipher=e.Decipher=n.createDecipher,e.createDecipheriv=e.Decipheriv=n.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(s)}},6171:(t,e,r)=>{var i=r(2356),n=r(2861).Buffer,s=r(530),o=r(650),a=r(6168),h=r(462),u=r(8078);function f(t,e,r){a.call(this),this._cache=new l,this._last=void 0,this._cipher=new h.AES(e),this._prev=n.from(r),this._mode=t,this._autopadding=!0}function l(){this.cache=n.allocUnsafe(0)}function c(t,e,r){var a=s[t.toLowerCase()];if(!a)throw new TypeError(\"invalid suite type\");if(\"string\"==typeof r&&(r=n.from(r)),\"GCM\"!==a.mode&&r.length!==a.iv)throw new TypeError(\"invalid iv length \"+r.length);if(\"string\"==typeof e&&(e=n.from(e)),e.length!==a.key/8)throw new TypeError(\"invalid key length \"+e.length);return\"stream\"===a.type?new o(a.module,e,r,!0):\"auth\"===a.type?new i(a.module,e,r,!0):new f(a.module,e,r)}r(6698)(f,a),f.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),i.push(r);return n.concat(i)},f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error(\"unable to decrypt data\");for(var r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=s[t.toLowerCase()];if(!r)throw new TypeError(\"invalid suite type\");var i=u(e,!1,r.key,r.iv);return c(t,i.key,i.iv)},e.createDecipheriv=c},5799:(t,e,r)=>{var i=r(530),n=r(2356),s=r(2861).Buffer,o=r(650),a=r(6168),h=r(462),u=r(8078);function f(t,e,r){a.call(this),this._cache=new c,this._cipher=new h.AES(e),this._prev=s.from(r),this._mode=t,this._autopadding=!0}r(6698)(f,a),f.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get();)r=this._mode.encrypt(this,e),i.push(r);return s.concat(i)};var l=s.alloc(16,16);function c(){this.cache=s.allocUnsafe(0)}function d(t,e,r){var a=i[t.toLowerCase()];if(!a)throw new TypeError(\"invalid suite type\");if(\"string\"==typeof e&&(e=s.from(e)),e.length!==a.key/8)throw new TypeError(\"invalid key length \"+e.length);if(\"string\"==typeof r&&(r=s.from(r)),\"GCM\"!==a.mode&&r.length!==a.iv)throw new TypeError(\"invalid iv length \"+r.length);return\"stream\"===a.type?new o(a.module,e,r):\"auth\"===a.type?new n(a.module,e,r):new f(a.module,e,r)}f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(l))throw this._cipher.scrub(),new Error(\"data not multiple of block length\")},f.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},c.prototype.add=function(t){this.cache=s.concat([this.cache,t])},c.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},c.prototype.flush=function(){for(var t=16-this.cache.length,e=s.allocUnsafe(t),r=-1;++r{var i=r(2861).Buffer,n=i.alloc(16,0);function s(t){var e=i.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function o(t){this.h=t,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}o.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=s(n)},o.prototype.update=function(t){var e;for(this.cache=i.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},o.prototype.final=function(t,e){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(s([0,t,0,e])),this.state},t.exports=o},5122:t=>{t.exports=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}},2884:(t,e,r)=>{var i=r(295);e.encrypt=function(t,e){var r=i(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},e.decrypt=function(t,e){var r=t._prev;t._prev=e;var n=t._cipher.decryptBlock(e);return i(n,r)}},6383:(t,e,r)=>{var i=r(2861).Buffer,n=r(295);function s(t,e,r){var s=e.length,o=n(e,t._cache);return t._cache=t._cache.slice(s),t._prev=i.concat([t._prev,r?e:o]),o}e.encrypt=function(t,e,r){for(var n,o=i.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=i.allocUnsafe(0)),!(t._cache.length<=e.length)){o=i.concat([o,s(t,e,r)]);break}n=t._cache.length,o=i.concat([o,s(t,e.slice(0,n),r)]),e=e.slice(n)}return o}},5264:(t,e,r)=>{var i=r(2861).Buffer;function n(t,e,r){for(var i,n,o=-1,a=0;++o<8;)i=e&1<<7-o?128:0,a+=(128&(n=t._cipher.encryptBlock(t._prev)[0]^i))>>o%8,t._prev=s(t._prev,r?i:n);return a}function s(t,e){var r=t.length,n=-1,s=i.allocUnsafe(t.length);for(t=i.concat([t,i.from([e])]);++n>7;return s}e.encrypt=function(t,e,r){for(var s=e.length,o=i.allocUnsafe(s),a=-1;++a{var i=r(2861).Buffer;function n(t,e,r){var n=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=i.concat([t._prev.slice(1),i.from([r?e:n])]),n}e.encrypt=function(t,e,r){for(var s=e.length,o=i.allocUnsafe(s),a=-1;++a{var i=r(295),n=r(2861).Buffer,s=r(5122);function o(t){var e=t._cipher.encryptBlockRaw(t._prev);return s(t._prev),e}e.encrypt=function(t,e){var r=Math.ceil(e.length/16),s=t._cache.length;t._cache=n.concat([t._cache,n.allocUnsafe(16*r)]);for(var a=0;a{e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},530:(t,e,r)=>{var i={ECB:r(2632),CBC:r(2884),CFB:r(6383),CFB8:r(6975),CFB1:r(5264),OFB:r(6843),CTR:r(3053),GCM:r(3053)},n=r(3219);for(var s in n)n[s].module=i[n[s].mode];t.exports=n},6843:(t,e,r)=>{var i=r(8287).Buffer,n=r(295);function s(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}e.encrypt=function(t,e){for(;t._cache.length{var i=r(462),n=r(2861).Buffer,s=r(6168);function o(t,e,r,o){s.call(this),this._cipher=new i.AES(e),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=o,this._mode=t}r(6698)(o,s),o.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},o.prototype._final=function(){this._cipher.scrub()},t.exports=o},125:(t,e,r)=>{var i=r(4050),n=r(1241),s=r(530),o=r(2438),a=r(8078);function h(t,e,r){if(t=t.toLowerCase(),s[t])return n.createCipheriv(t,e,r);if(o[t])return new i({key:e,iv:r,mode:t});throw new TypeError(\"invalid suite type\")}function u(t,e,r){if(t=t.toLowerCase(),s[t])return n.createDecipheriv(t,e,r);if(o[t])return new i({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError(\"invalid suite type\")}e.createCipher=e.Cipher=function(t,e){var r,i;if(t=t.toLowerCase(),s[t])r=s[t].key,i=s[t].iv;else{if(!o[t])throw new TypeError(\"invalid suite type\");r=8*o[t].key,i=o[t].iv}var n=a(e,!1,r,i);return h(t,n.key,n.iv)},e.createCipheriv=e.Cipheriv=h,e.createDecipher=e.Decipher=function(t,e){var r,i;if(t=t.toLowerCase(),s[t])r=s[t].key,i=s[t].iv;else{if(!o[t])throw new TypeError(\"invalid suite type\");r=8*o[t].key,i=o[t].iv}var n=a(e,!1,r,i);return u(t,n.key,n.iv)},e.createDecipheriv=e.Decipheriv=u,e.listCiphers=e.getCiphers=function(){return Object.keys(o).concat(n.getCiphers())}},4050:(t,e,r)=>{var i=r(6168),n=r(9560),s=r(6698),o=r(2861).Buffer,a={\"des-ede3-cbc\":n.CBC.instantiate(n.EDE),\"des-ede3\":n.EDE,\"des-ede-cbc\":n.CBC.instantiate(n.EDE),\"des-ede\":n.EDE,\"des-cbc\":n.CBC.instantiate(n.DES),\"des-ecb\":n.DES};function h(t){i.call(this);var e,r=t.mode.toLowerCase(),n=a[r];e=t.decrypt?\"decrypt\":\"encrypt\";var s=t.key;o.isBuffer(s)||(s=o.from(s)),\"des-ede\"!==r&&\"des-ede-cbc\"!==r||(s=o.concat([s,s.slice(0,8)]));var h=t.iv;o.isBuffer(h)||(h=o.from(h)),this._des=n.create({key:s,iv:h,type:e})}a.des=a[\"des-cbc\"],a.des3=a[\"des-ede3-cbc\"],t.exports=h,s(h,i),h.prototype._update=function(t){return o.from(this._des.update(t))},h.prototype._final=function(){return o.from(this._des.final())}},2438:(t,e)=>{e[\"des-ecb\"]={key:8,iv:0},e[\"des-cbc\"]=e.des={key:8,iv:8},e[\"des-ede3-cbc\"]=e.des3={key:24,iv:8},e[\"des-ede3\"]={key:24,iv:0},e[\"des-ede-cbc\"]={key:16,iv:8},e[\"des-ede\"]={key:16,iv:0}},7332:(t,e,r)=>{var i=r(8287).Buffer,n=r(9404),s=r(3209);function o(t){var e,r=t.modulus.byteLength();do{e=new n(s(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,e){var r=function(t){var e=o(t);return{blinder:e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),s=e.modulus.byteLength(),a=new n(t).mul(r.blinder).umod(e.modulus),h=a.toRed(n.mont(e.prime1)),u=a.toRed(n.mont(e.prime2)),f=e.coefficient,l=e.prime1,c=e.prime2,d=h.redPow(e.exponent1).fromRed(),p=u.redPow(e.exponent2).fromRed(),m=d.isub(p).imul(f).umod(l).imul(c);return p.iadd(m).imul(r.unblinder).umod(e.modulus).toArrayLike(i,\"be\",s)}a.getr=o,t.exports=a},5715:(t,e,r)=>{\"use strict\";t.exports=r(2951)},20:(t,e,r)=>{\"use strict\";var i=r(2861).Buffer,n=r(7108),s=r(8399),o=r(6698),a=r(5359),h=r(4847),u=r(2951);function f(t){s.Writable.call(this);var e=u[t];if(!e)throw new Error(\"Unknown message digest\");this._hashType=e.hash,this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function l(t){s.Writable.call(this);var e=u[t];if(!e)throw new Error(\"Unknown message digest\");this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function c(t){return new f(t)}function d(t){return new l(t)}Object.keys(u).forEach((function(t){u[t].id=i.from(u[t].id,\"hex\"),u[t.toLowerCase()]=u[t]})),o(f,s.Writable),f.prototype._write=function(t,e,r){this._hash.update(t),r()},f.prototype.update=function(t,e){return this._hash.update(\"string\"==typeof t?i.from(t,e):t),this},f.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),i=a(r,t,this._hashType,this._signType,this._tag);return e?i.toString(e):i},o(l,s.Writable),l.prototype._write=function(t,e,r){this._hash.update(t),r()},l.prototype.update=function(t,e){return this._hash.update(\"string\"==typeof t?i.from(t,e):t),this},l.prototype.verify=function(t,e,r){var n=\"string\"==typeof e?i.from(e,r):e;this.end();var s=this._hash.digest();return h(n,s,t,this._signType,this._tag)},t.exports={Sign:c,Verify:d,createSign:c,createVerify:d}},5359:(t,e,r)=>{\"use strict\";var i=r(2861).Buffer,n=r(3507),s=r(7332),o=r(6729).ec,a=r(9404),h=r(8170),u=r(4589);function f(t,e,r,s){if((t=i.from(t.toArray())).length0&&r.ishrn(i),r}function c(t,e,r){var s,o;do{for(s=i.alloc(0);8*s.length{\"use strict\";var i=r(2861).Buffer,n=r(9404),s=r(6729).ec,o=r(8170),a=r(4589);function h(t,e){if(t.cmpn(0)<=0)throw new Error(\"invalid sig\");if(t.cmp(e)>=0)throw new Error(\"invalid sig\")}t.exports=function(t,e,r,u,f){var l=o(r);if(\"ec\"===l.type){if(\"ecdsa\"!==u&&\"ecdsa/rsa\"!==u)throw new Error(\"wrong public key type\");return function(t,e,r){var i=a[r.data.algorithm.curve.join(\".\")];if(!i)throw new Error(\"unknown curve \"+r.data.algorithm.curve.join(\".\"));var n=new s(i),o=r.data.subjectPrivateKey.data;return n.verify(e,t,o)}(t,e,l)}if(\"dsa\"===l.type){if(\"dsa\"!==u)throw new Error(\"wrong public key type\");return function(t,e,r){var i=r.data.p,s=r.data.q,a=r.data.g,u=r.data.pub_key,f=o.signature.decode(t,\"der\"),l=f.s,c=f.r;h(l,s),h(c,s);var d=n.mont(i),p=l.invm(s);return 0===a.toRed(d).redPow(new n(e).mul(p).mod(s)).fromRed().mul(u.toRed(d).redPow(c.mul(p).mod(s)).fromRed()).mod(i).mod(s).cmp(c)}(t,e,l)}if(\"rsa\"!==u&&\"ecdsa/rsa\"!==u)throw new Error(\"wrong public key type\");e=i.concat([f,e]);for(var c=l.modulus.byteLength(),d=[1],p=0;e.length+d.length+2{const i=r(5364);t.exports=i(\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\")},9204:(t,e,r)=>{\"use strict\";var i=r(6763);t.exports=function(t){function e(e){var r=e.slice(0,-4),i=e.slice(-4),n=t(r);if(!(i[0]^n[0]|i[1]^n[1]|i[2]^n[2]|i[3]^n[3]))return r}return{encode:function(e){var r=Uint8Array.from(e),n=t(r),s=r.length+4,o=new Uint8Array(s);return o.set(r,0),o.set(n.subarray(0,4),r.length),i.encode(o,s)},decode:function(t){var r=e(i.decode(t));if(!r)throw new Error(\"Invalid checksum\");return r},decodeUnsafe:function(t){var r=i.decodeUnsafe(t);if(r)return e(r)}}}},1889:(t,e,r)=>{\"use strict\";var{sha256:i}=r(2623),n=r(9204);t.exports=n((function(t){return i(i(t))}))},295:(t,e,r)=>{var i=r(8287).Buffer;t.exports=function(t,e){for(var r=Math.min(t.length,e.length),n=new i(r),s=0;s{\"use strict\";const i=r(7526),n=r(251),s=\"function\"==typeof Symbol&&\"function\"==typeof Symbol.for?Symbol.for(\"nodejs.util.inspect.custom\"):null;e.Buffer=h,e.SlowBuffer=function(t){return+t!=t&&(t=0),h.alloc(+t)},e.INSPECT_MAX_BYTES=50;const o=2147483647;function a(t){if(t>o)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,h.prototype),e}function h(t,e,r){if(\"number\"==typeof t){if(\"string\"==typeof e)throw new TypeError('The \"string\" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if(\"string\"==typeof t)return function(t,e){if(\"string\"==typeof e&&\"\"!==e||(e=\"utf8\"),!h.isEncoding(e))throw new TypeError(\"Unknown encoding: \"+e);const r=0|m(t,e);let i=a(r);const n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(G(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t);if(G(t,ArrayBuffer)||t&&G(t.buffer,ArrayBuffer))return d(t,e,r);if(\"undefined\"!=typeof SharedArrayBuffer&&(G(t,SharedArrayBuffer)||t&&G(t.buffer,SharedArrayBuffer)))return d(t,e,r);if(\"number\"==typeof t)throw new TypeError('The \"value\" argument must not be of type number. Received type number');const i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return h.from(i,e,r);const n=function(t){if(h.isBuffer(t)){const e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?\"number\"!=typeof t.length||J(t.length)?a(0):c(t):\"Buffer\"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(n)return n;if(\"undefined\"!=typeof Symbol&&null!=Symbol.toPrimitive&&\"function\"==typeof t[Symbol.toPrimitive])return h.from(t[Symbol.toPrimitive](\"string\"),e,r);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t)}function f(t){if(\"number\"!=typeof t)throw new TypeError('\"size\" argument must be of type number');if(t<0)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"')}function l(t){return f(t),a(t<0?0:0|p(t))}function c(t){const e=t.length<0?0:0|p(t.length),r=a(e);for(let i=0;i=o)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+o.toString(16)+\" bytes\");return 0|t}function m(t,e){if(h.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||G(t,ArrayBuffer))return t.byteLength;if(\"string\"!=typeof t)throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":return V(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return $(t).length;default:if(n)return i?-1:V(t).length;e=(\"\"+e).toLowerCase(),n=!0}}function g(t,e,r){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return\"\";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return\"\";if((r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return T(this,e,r);case\"utf8\":case\"utf-8\":return A(this,e,r);case\"ascii\":return I(this,e,r);case\"latin1\":case\"binary\":return B(this,e,r);case\"base64\":return x(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return P(this,e,r);default:if(i)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),i=!0}}function y(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function b(t,e,r,i,n){if(0===t.length)return-1;if(\"string\"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if(\"string\"==typeof e&&(e=h.from(e,i)),h.isBuffer(e))return 0===e.length?-1:v(t,e,r,i,n);if(\"number\"==typeof e)return e&=255,\"function\"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,i,n);throw new TypeError(\"val must be string, number or Buffer\")}function v(t,e,r,i,n){let s,o=1,a=t.length,h=e.length;if(void 0!==i&&(\"ucs2\"===(i=String(i).toLowerCase())||\"ucs-2\"===i||\"utf16le\"===i||\"utf-16le\"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,h/=2,r/=2}function u(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){let i=-1;for(s=r;sa&&(r=a-h),s=r;s>=0;s--){let r=!0;for(let i=0;in&&(i=n):i=n;const s=e.length;let o;for(i>s/2&&(i=s/2),o=0;o>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function x(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);const i=[];let n=e;for(;n239?4:e>223?3:e>191?2:1;if(n+o<=r){let r,i,a,h;switch(o){case 1:e<128&&(s=e);break;case 2:r=t[n+1],128==(192&r)&&(h=(31&e)<<6|63&r,h>127&&(s=h));break;case 3:r=t[n+1],i=t[n+2],128==(192&r)&&128==(192&i)&&(h=(15&e)<<12|(63&r)<<6|63&i,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:r=t[n+1],i=t[n+2],a=t[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(h=(15&e)<<18|(63&r)<<12|(63&i)<<6|63&a,h>65535&&h<1114112&&(s=h))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=o}return function(t){const e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);let r=\"\",i=0;for(;ii.length?(h.isBuffer(e)||(e=h.from(e)),e.copy(i,n)):Uint8Array.prototype.set.call(i,e,n);else{if(!h.isBuffer(e))throw new TypeError('\"list\" argument must be an Array of Buffers');e.copy(i,n)}n+=e.length}return i},h.byteLength=m,h.prototype._isBuffer=!0,h.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError(\"Buffer size must be a multiple of 16-bits\");for(let e=0;er&&(t+=\" ... \"),\"\"},s&&(h.prototype[s]=h.prototype.inspect),h.prototype.compare=function(t,e,r,i,n){if(G(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),!h.isBuffer(t))throw new TypeError('The \"target\" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError(\"out of range index\");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;let s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0);const a=Math.min(s,o),u=this.slice(i,n),f=t.slice(e,r);for(let t=0;t>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i=\"utf8\")):(i=r,r=void 0)}const n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");i||(i=\"utf8\");let s=!1;for(;;)switch(i){case\"hex\":return w(this,t,e,r);case\"utf8\":case\"utf-8\":return _(this,t,e,r);case\"ascii\":case\"latin1\":case\"binary\":return M(this,t,e,r);case\"base64\":return k(this,t,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return S(this,t,e,r);default:if(s)throw new TypeError(\"Unknown encoding: \"+i);i=(\"\"+i).toLowerCase(),s=!0}},h.prototype.toJSON=function(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};const E=4096;function I(t,e,r){let i=\"\";r=Math.min(t.length,r);for(let n=e;ni)&&(r=i);let n=\"\";for(let i=e;ir)throw new RangeError(\"Trying to access beyond buffer length\")}function C(t,e,r,i,n,s){if(!h.isBuffer(t))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError(\"Index out of range\")}function L(t,e,r,i,n){H(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,r}function O(t,e,r,i,n){H(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s>>=8,t[r+6]=s,s>>=8,t[r+5]=s,s>>=8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o>>=8,t[r+2]=o,o>>=8,t[r+1]=o,o>>=8,t[r]=o,r+8}function j(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError(\"Index out of range\");if(r<0)throw new RangeError(\"Index out of range\")}function N(t,e,r,i,s){return e=+e,r>>>=0,s||j(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function U(t,e,r,i,s){return e=+e,r>>>=0,s||j(t,0,r,8),n.write(t,e,r,i,52,8),r+8}h.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||R(t,e,this.length);let i=this[t],n=1,s=0;for(;++s>>=0,e>>>=0,r||R(t,e,this.length);let i=this[t+--e],n=1;for(;e>0&&(n*=256);)i+=this[t+--e]*n;return i},h.prototype.readUint8=h.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readBigUInt64LE=X((function(t){z(t>>>=0,\"offset\");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const i=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,n=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(i)+(BigInt(n)<>>=0,\"offset\");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const i=e*2**24+65536*this[++t]+256*this[++t]+this[++t],n=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(i)<>>=0,e>>>=0,r||R(t,e,this.length);let i=this[t],n=1,s=0;for(;++s=n&&(i-=Math.pow(2,8*e)),i},h.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);let i=e,n=1,s=this[t+--i];for(;i>0&&(n*=256);)s+=this[t+--i]*n;return n*=128,s>=n&&(s-=Math.pow(2,8*e)),s},h.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readBigInt64LE=X((function(t){z(t>>>=0,\"offset\");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(i)<>>=0,\"offset\");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const i=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<>>=0,e||R(t,4,this.length),n.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),n.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),n.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),n.read(this,t,!1,52,8)},h.prototype.writeUintLE=h.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||C(this,t,e,r,Math.pow(2,8*r)-1,0);let n=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,i||C(this,t,e,r,Math.pow(2,8*r)-1,0);let n=r-1,s=1;for(this[e+n]=255&t;--n>=0&&(s*=256);)this[e+n]=t/s&255;return e+r},h.prototype.writeUint8=h.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},h.prototype.writeBigUInt64LE=X((function(t,e=0){return L(this,t,e,BigInt(0),BigInt(\"0xffffffffffffffff\"))})),h.prototype.writeBigUInt64BE=X((function(t,e=0){return O(this,t,e,BigInt(0),BigInt(\"0xffffffffffffffff\"))})),h.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}let n=0,s=1,o=0;for(this[e]=255&t;++n>>=0,!i){const i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}let n=r-1,s=1,o=0;for(this[e+n]=255&t;--n>=0&&(s*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/s|0)-o&255;return e+r},h.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},h.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},h.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},h.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},h.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},h.prototype.writeBigInt64LE=X((function(t,e=0){return L(this,t,e,-BigInt(\"0x8000000000000000\"),BigInt(\"0x7fffffffffffffff\"))})),h.prototype.writeBigInt64BE=X((function(t,e=0){return O(this,t,e,-BigInt(\"0x8000000000000000\"),BigInt(\"0x7fffffffffffffff\"))})),h.prototype.writeFloatLE=function(t,e,r){return N(this,t,e,!0,r)},h.prototype.writeFloatBE=function(t,e,r){return N(this,t,e,!1,r)},h.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},h.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},h.prototype.copy=function(t,e,r,i){if(!h.isBuffer(t))throw new TypeError(\"argument should be a Buffer\");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError(\"Index out of range\");if(i<0)throw new RangeError(\"sourceEnd out of bounds\");i>this.length&&(i=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),\"number\"==typeof t)for(n=e;n=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function H(t,e,r,i,n,s){if(t>r||t3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${e}${i} and <= ${r}${i}`,new q.ERR_OUT_OF_RANGE(\"value\",n,t)}!function(t,e,r){z(e,\"offset\"),void 0!==t[e]&&void 0!==t[e+r]||W(e,t.length-(r+1))}(i,n,s)}function z(t,e){if(\"number\"!=typeof t)throw new q.ERR_INVALID_ARG_TYPE(e,\"number\",t)}function W(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new q.ERR_OUT_OF_RANGE(r||\"offset\",\"an integer\",t);if(e<0)throw new q.ERR_BUFFER_OUT_OF_BOUNDS;throw new q.ERR_OUT_OF_RANGE(r||\"offset\",`>= ${r?1:0} and <= ${e}`,t)}D(\"ERR_BUFFER_OUT_OF_BOUNDS\",(function(t){return t?`${t} is outside of buffer bounds`:\"Attempt to access memory outside buffer bounds\"}),RangeError),D(\"ERR_INVALID_ARG_TYPE\",(function(t,e){return`The \"${t}\" argument must be of type number. Received type ${typeof e}`}),TypeError),D(\"ERR_OUT_OF_RANGE\",(function(t,e,r){let i=`The value of \"${t}\" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=F(String(r)):\"bigint\"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=F(n)),n+=\"n\"),i+=` It must be ${e}. Received ${n}`,i}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function V(t,e){let r;e=e||1/0;const i=t.length;let n=null;const s=[];for(let o=0;o55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error(\"Invalid code point\");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function $(t){return i.toByteArray(function(t){if((t=(t=t.split(\"=\")[0]).trim().replace(K,\"\")).length<2)return\"\";for(;t.length%4!=0;)t+=\"=\";return t}(t))}function Z(t,e,r,i){let n;for(n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function G(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const Y=function(){const t=\"0123456789abcdef\",e=new Array(256);for(let r=0;r<16;++r){const i=16*r;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function X(t){return\"undefined\"==typeof BigInt?Q:t}function Q(){throw new Error(\"BigInt not supported\")}},4497:(t,e,r)=>{const i=r(8454),n=r(9596);t.exports=class{constructor(t,e){if(this.store=t,this.chunkLength=t.chunkLength,this.inProgressGets=new Map,!this.store||!this.store.get||!this.store.put)throw new Error(\"First argument must be abstract-chunk-store compliant\");this.cache=new i(e)}put(t,e,r=(()=>{})){if(!this.cache)return n((()=>r(new Error(\"CacheStore closed\"))));this.cache.remove(t),this.store.put(t,e,r)}get(t,e,r=(()=>{})){if(\"function\"==typeof e)return this.get(t,null,e);if(!this.cache)return n((()=>r(new Error(\"CacheStore closed\"))));e||(e={});let i=this.cache.get(t);if(i){const t=e.offset||0,s=e.length||i.length-t;return 0===t&&s===i.length||(i=i.slice(t,s+t)),n((()=>r(null,i)))}let s=this.inProgressGets.get(t);const o=!!s;s||(s=[],this.inProgressGets.set(t,s)),s.push({opts:e,cb:r}),o||this.store.get(t,((e,r)=>{e||null==this.cache||this.cache.set(t,r);const i=this.inProgressGets.get(t);this.inProgressGets.delete(t);for(const{opts:t,cb:n}of i)if(e)n(e);else{const e=t.offset||0,i=t.length||r.length-e;let s=r;0===e&&i===r.length||(s=r.slice(e,i+e)),n(null,s)}}))}close(t=(()=>{})){if(!this.cache)return n((()=>t(new Error(\"CacheStore closed\"))));this.cache=null,this.store.close(t)}destroy(t=(()=>{})){if(!this.cache)return n((()=>t(new Error(\"CacheStore closed\"))));this.cache=null,this.store.destroy(t)}}},8075:(t,e,r)=>{\"use strict\";var i=r(453),n=r(487),s=n(i(\"String.prototype.indexOf\"));t.exports=function(t,e){var r=i(t,!!e);return\"function\"==typeof r&&s(t,\".prototype.\")>-1?n(r):r}},487:(t,e,r)=>{\"use strict\";var i=r(6743),n=r(453),s=r(6897),o=r(9675),a=n(\"%Function.prototype.apply%\"),h=n(\"%Function.prototype.call%\"),u=n(\"%Reflect.apply%\",!0)||i.call(h,a),f=r(655),l=n(\"%Math.max%\");t.exports=function(t){if(\"function\"!=typeof t)throw new o(\"a function is required\");var e=u(i,h,arguments);return s(e,1+l(0,t.length-(arguments.length-1)),!0)};var c=function(){return u(i,a,arguments)};f?f(t.exports,\"apply\",{value:c}):t.exports.apply=c},6168:(t,e,r)=>{var i=r(2861).Buffer,n=r(8310).Transform,s=r(3141).I;function o(t){n.call(this),this.hashMode=\"string\"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(6698)(o,n),o.prototype.update=function(t,e,r){\"string\"==typeof t&&(t=i.from(t,e));var n=this._update(t);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error(\"trying to get auth tag in unsupported state\")},o.prototype.setAuthTag=function(){throw new Error(\"trying to set auth tag in unsupported state\")},o.prototype.setAAD=function(){throw new Error(\"trying to set aad in unsupported state\")},o.prototype._transform=function(t,e,r){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{r(i)}},o.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},o.prototype._finalOrDigest=function(t){var e=this.__final()||i.alloc(0);return t&&(e=this._toString(e,t,!0)),e},o.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new s(e),this._encoding=e),this._encoding!==e)throw new Error(\"can't switch encodings\");var i=this._decoder.write(t);return r&&(i+=this._decoder.end()),i},t.exports=o},5622:(t,e,r)=>{function i(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):\"[object Array]\"===i(t)},e.isBoolean=function(t){return\"boolean\"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return\"number\"==typeof t},e.isString=function(t){return\"string\"==typeof t},e.isSymbol=function(t){return\"symbol\"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return\"[object RegExp]\"===i(t)},e.isObject=function(t){return\"object\"==typeof t&&null!==t},e.isDate=function(t){return\"[object Date]\"===i(t)},e.isError=function(t){return\"[object Error]\"===i(t)||t instanceof Error},e.isFunction=function(t){return\"function\"==typeof t},e.isPrimitive=function(t){return null===t||\"boolean\"==typeof t||\"number\"==typeof t||\"string\"==typeof t||\"symbol\"==typeof t||void 0===t},e.isBuffer=r(8287).Buffer.isBuffer},4018:t=>{t.exports=function(){for(var t=navigator.hardwareConcurrency||1,e=[],r=0;r{var i=r(8287).Buffer,n=r(6729),s=r(2801);t.exports=function(t){return new a(t)};var o={secp256k1:{name:\"secp256k1\",byteLength:32},secp224r1:{name:\"p224\",byteLength:28},prime256v1:{name:\"p256\",byteLength:32},prime192v1:{name:\"p192\",byteLength:24},ed25519:{name:\"ed25519\",byteLength:32},secp384r1:{name:\"p384\",byteLength:48},secp521r1:{name:\"p521\",byteLength:66}};function a(t){this.curveType=o[t],this.curveType||(this.curveType={name:t}),this.curve=new n.ec(this.curveType.name),this.keys=void 0}function h(t,e,r){Array.isArray(t)||(t=t.toArray());var n=new i(t);if(r&&n.length=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,s=Math.min(t.length,r),o=e;o=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(t){return t instanceof s||null!==t&&\"object\"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if(\"number\"==typeof t)return this._initNumber(t,e,r);if(\"object\"==typeof t)return this._initArray(t,e,r);\"hex\"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;\"-\"===(t=t.toString().replace(/\\s+/g,\"\"))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if(\"le\"===r)for(n=0,s=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?\"\"};var f=[\"\",\"0\",\"00\",\"000\",\"0000\",\"00000\",\"000000\",\"0000000\",\"00000000\",\"000000000\",\"0000000000\",\"00000000000\",\"000000000000\",\"0000000000000\",\"00000000000000\",\"000000000000000\",\"0000000000000000\",\"00000000000000000\",\"000000000000000000\",\"0000000000000000000\",\"00000000000000000000\",\"000000000000000000000\",\"0000000000000000000000\",\"00000000000000000000000\",\"000000000000000000000000\",\"0000000000000000000000000\"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,h=o/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(s=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||\"hex\"===t){r=\"\";for(var n=0,s=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r=\"\";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r=\"0\"+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}i(!1,\"Base should be between 2 and 36\")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,\"Number can only safely store up to 53 bits\"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,\"byte array longer than desired length\"),i(s>0,\"Requested array length <= 0\"),this.strip();var o,a,h=\"le\"===e,u=new t(s),f=this.clone();if(h){for(a=0;!f.isZero();a++)o=f.andln(255),f.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i(\"number\"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i(\"number\"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,b=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,M=0|o[4],k=8191&M,S=M>>>13,x=0|o[5],A=8191&x,E=x>>>13,I=0|o[6],B=8191&I,T=I>>>13,P=0|o[7],R=8191&P,C=P>>>13,L=0|o[8],O=8191&L,j=L>>>13,N=0|o[9],U=8191&N,q=N>>>13,D=0|a[0],F=8191&D,H=D>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,Z=V>>>13,G=0|a[3],J=8191&G,Y=G>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((s=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,s=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((s=s+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,s=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,s=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((s=s+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,s=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,s=s+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((s=s+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,s=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,s=s+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((s=s+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,H))+Math.imul(T,F)|0,s=Math.imul(T,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,Z)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,s=s+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,s=s+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,st)|0))<<13)|0;u=((s=s+Math.imul(c,ot)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(C,F)|0,s=Math.imul(C,H),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,Z)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,s=s+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,s=s+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,it)|0,i=i+Math.imul(p,st)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((s=s+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,F),n=(n=Math.imul(O,H))+Math.imul(j,F)|0,s=Math.imul(j,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(C,W)|0,s=s+Math.imul(C,K)|0,i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,Z)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,Z)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,s=s+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,it)|0,i=i+Math.imul(y,st)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,s=s+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((s=s+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,H))+Math.imul(q,F)|0,s=Math.imul(q,H),i=i+Math.imul(O,W)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(j,W)|0,s=s+Math.imul(j,K)|0,i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(C,$)|0,s=s+Math.imul(C,Z)|0,i=i+Math.imul(B,J)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,s=s+Math.imul(S,it)|0,i=i+Math.imul(w,st)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,s=s+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,s=s+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((s=s+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,W),n=(n=Math.imul(U,K))+Math.imul(q,W)|0,s=Math.imul(q,K),i=i+Math.imul(O,$)|0,n=(n=n+Math.imul(O,Z)|0)+Math.imul(j,$)|0,s=s+Math.imul(j,Z)|0,i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(C,J)|0,s=s+Math.imul(C,Y)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(S,st)|0,s=s+Math.imul(S,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,s=s+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,s=s+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((s=s+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,Z))+Math.imul(q,$)|0,s=Math.imul(q,Z),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(j,J)|0,s=s+Math.imul(j,Y)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(C,Q)|0,s=s+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(A,st)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,s=s+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,s=s+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((s=s+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,J),n=(n=Math.imul(U,Y))+Math.imul(q,J)|0,s=Math.imul(q,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(j,Q)|0,s=s+Math.imul(j,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(C,rt)|0,s=s+Math.imul(C,it)|0,i=i+Math.imul(B,st)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,s=s+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,s=s+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((s=s+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(q,Q)|0,s=Math.imul(q,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(j,rt)|0,s=s+Math.imul(j,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,ot)|0,i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(T,ht)|0,s=s+Math.imul(T,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,s=s+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((s=s+Math.imul(S,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(q,rt)|0,s=Math.imul(q,it),i=i+Math.imul(O,st)|0,n=(n=n+Math.imul(O,ot)|0)+Math.imul(j,st)|0,s=s+Math.imul(j,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(C,ht)|0,s=s+Math.imul(C,ut)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,s=s+Math.imul(T,ct)|0;var Tt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((s=s+Math.imul(E,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,st),n=(n=Math.imul(U,ot))+Math.imul(q,st)|0,s=Math.imul(q,ot),i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(j,ht)|0,s=s+Math.imul(j,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(C,lt)|0,s=s+Math.imul(C,ct)|0;var Pt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((s=s+Math.imul(T,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ht),n=(n=Math.imul(U,ut))+Math.imul(q,ht)|0,s=Math.imul(q,ut),i=i+Math.imul(O,lt)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(j,lt)|0,s=s+Math.imul(j,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((s=s+Math.imul(C,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,lt),n=(n=Math.imul(U,ct))+Math.imul(q,lt)|0,s=Math.imul(q,ct);var Ct=(u+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((s=s+Math.imul(j,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Lt=(u+(i=Math.imul(U,pt))|0)+((8191&(n=(n=Math.imul(U,mt))+Math.imul(q,pt)|0))<<13)|0;return u=((s=Math.imul(q,mt))+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Bt,h[14]=Tt,h[15]=Pt,h[16]=Rt,h[17]=Ct,h[18]=Lt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),s.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-s|l>>>s,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i(\"number\"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,\"imaskn works only with positive numbers\"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i(\"number\"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&s}for(;n>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,h=i.length-n.length;if(\"mod\"!==e){(a=new s(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),\"div\"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),\"mod\"!==e&&(n=a.div.neg()),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),\"mod\"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?\"div\"===e?{div:this.divn(t.words[0]),mod:null}:\"mod\"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,\"div\",!1).div},s.prototype.mod=function(t){return this.divmod(t,\"mod\",!1).mod},s.prototype.umod=function(t){return this.divmod(t,\"mod\",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},s.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),h=new s(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(h)):(r.isub(e),a.isub(n),h.isub(o))}return{a,b:h,gcd:r.iushln(u)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return!(1&this.words[0])},s.prototype.isOdd=function(){return!(1&~this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i(\"number\"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,\"Number is too big\");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new k(t)},s.prototype.toRed=function(t){return i(!this.red,\"Already a number in reduction context\"),i(0===this.negative,\"red works only with positives\"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,\"fromRed works only with numbers in reduction context\"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,\"Already a number in reduction context\"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,\"redAdd works only with red numbers\"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,\"redIAdd works only with red numbers\"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,\"redSub works only with red numbers\"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,\"redISub works only with red numbers\"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,\"redShl works only with red numbers\"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,\"redSqr works only with red numbers\"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,\"redISqr works only with red numbers\"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,\"redSqrt works only with red numbers\"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,\"redInvm works only with red numbers\"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,\"redNeg works only with red numbers\"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,\"redPow(normalNum)\"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,\"k256\",\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\")}function w(){b.call(this,\"p224\",\"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\")}function _(){b.call(this,\"p192\",\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\")}function M(){b.call(this,\"25519\",\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\")}function k(t){if(\"string\"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),\"modulus must be greater than 1\"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,s=o}s>>>=22,t.words[n-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(y[t])return y[t];var e;if(\"k256\"===t)e=new v;else if(\"p224\"===t)e=new w;else if(\"p192\"===t)e=new _;else{if(\"p25519\"!==t)throw new Error(\"Unknown prime \"+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,\"red works only with positives\"),i(t.red,\"red works only with red numbers\")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),\"red works only with positives\"),i(t.red&&t.red===e.red,\"red works only with red numbers\")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},7108:(t,e,r)=>{\"use strict\";var i=r(6698),n=r(8276),s=r(6011),o=r(2802),a=r(6168);function h(t){a.call(this,\"digest\"),this._hash=t}i(h,a),h.prototype._update=function(t){this._hash.update(t)},h.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return\"md5\"===(t=t.toLowerCase())?new n:\"rmd160\"===t||\"ripemd160\"===t?new s:new h(o(t))}},320:(t,e,r)=>{var i=r(8276);t.exports=function(t){return(new i).update(t).digest()}},3507:(t,e,r)=>{\"use strict\";var i=r(6698),n=r(1800),s=r(6168),o=r(2861).Buffer,a=r(320),h=r(6011),u=r(2802),f=o.alloc(128);function l(t,e){s.call(this,\"digest\"),\"string\"==typeof e&&(e=o.from(e));var r=\"sha512\"===t||\"sha384\"===t?128:64;this._alg=t,this._key=e,e.length>r?e=(\"rmd160\"===t?new h:u(t)).update(e).digest():e.length{\"use strict\";var i=r(6698),n=r(2861).Buffer,s=r(6168),o=n.alloc(128),a=64;function h(t,e){s.call(this,\"digest\"),\"string\"==typeof e&&(e=n.from(e)),this._alg=t,this._key=e,e.length>a?e=t(e):e.length{\"use strict\";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r(3209),e.createHash=e.Hash=r(7108),e.createHmac=e.Hmac=r(3507);var i=r(5715),n=Object.keys(i),s=[\"sha1\",\"sha224\",\"sha256\",\"sha384\",\"sha512\",\"md5\",\"rmd160\"].concat(n);e.getHashes=function(){return s};var o=r(8396);e.pbkdf2=o.pbkdf2,e.pbkdf2Sync=o.pbkdf2Sync;var a=r(125);e.Cipher=a.Cipher,e.createCipher=a.createCipher,e.Cipheriv=a.Cipheriv,e.createCipheriv=a.createCipheriv,e.Decipher=a.Decipher,e.createDecipher=a.createDecipher,e.Decipheriv=a.Decipheriv,e.createDecipheriv=a.createDecipheriv,e.getCiphers=a.getCiphers,e.listCiphers=a.listCiphers;var h=r(5380);e.DiffieHellmanGroup=h.DiffieHellmanGroup,e.createDiffieHellmanGroup=h.createDiffieHellmanGroup,e.getDiffieHellman=h.getDiffieHellman,e.createDiffieHellman=h.createDiffieHellman,e.DiffieHellman=h.DiffieHellman;var u=r(20);e.createSign=u.createSign,e.Sign=u.Sign,e.createVerify=u.createVerify,e.Verify=u.Verify,e.createECDH=r(1324);var f=r(7168);e.publicEncrypt=f.publicEncrypt,e.privateEncrypt=f.privateEncrypt,e.publicDecrypt=f.publicDecrypt,e.privateDecrypt=f.privateDecrypt;var l=r(6983);e.randomFill=l.randomFill,e.randomFillSync=l.randomFillSync,e.createCredentials=function(){throw new Error([\"sorry, createCredentials is not implemented yet\",\"we accept pull requests\",\"https://github.com/crypto-browserify/crypto-browserify\"].join(\"\\n\"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},7833:(t,e,r)=>{var i=r(5606);e.formatArgs=function(e){if(e[0]=(this.useColors?\"%c\":\"\")+this.namespace+(this.useColors?\" %c\":\" \")+e[0]+(this.useColors?\"%c \":\" \")+\"+\"+t.exports.humanize(this.diff),!this.useColors)return;const r=\"color: \"+this.color;e.splice(1,0,r,\"color: inherit\");let i=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(t=>{\"%%\"!==t&&(i++,\"%c\"===t&&(n=i))})),e.splice(n,0,r)},e.save=function(t){try{t?e.storage.setItem(\"debug\",t):e.storage.removeItem(\"debug\")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem(\"debug\")}catch(t){}return!t&&void 0!==i&&\"env\"in i&&(t=i.env.DEBUG),t},e.useColors=function(){return!(\"undefined\"==typeof window||!window.process||\"renderer\"!==window.process.type&&!window.process.__nwjs)||(\"undefined\"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/))&&(\"undefined\"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||\"undefined\"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||\"undefined\"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||\"undefined\"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/))},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!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`.\"))}})(),e.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\"],e.log=console.debug||console.log||(()=>{}),t.exports=r(736)(e);const{formatters:n}=t.exports;n.j=function(t){try{return JSON.stringify(t)}catch(t){return\"[UnexpectedJSONParseError]: \"+t.message}}},736:(t,e,r)=>{t.exports=function(t){function e(t){let r,n,s,o=null;function a(...t){if(!a.enabled)return;const i=a,n=Number(new Date),s=n-(r||n);i.diff=s,i.prev=r,i.curr=n,r=n,t[0]=e.coerce(t[0]),\"string\"!=typeof t[0]&&t.unshift(\"%O\");let o=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((r,n)=>{if(\"%%\"===r)return\"%\";o++;const s=e.formatters[n];if(\"function\"==typeof s){const e=t[o];r=s.call(i,e),t.splice(o,1),o--}return r})),e.formatArgs.call(i,t),(i.log||e.log).apply(i,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=i,a.destroy=e.destroy,Object.defineProperty(a,\"enabled\",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==e.namespaces&&(n=e.namespaces,s=e.enabled(t)),s),set:t=>{o=t}}),\"function\"==typeof e.init&&e.init(a),a}function i(t,r){const i=e(this.namespace+(void 0===r?\":\":r)+t);return i.log=this.log,i}function n(t){return t.toString().substring(2,t.toString().length-2).replace(/\\.\\*\\?$/,\"*\")}return e.debug=e,e.default=e,e.coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){const t=[...e.names.map(n),...e.skips.map(n).map((t=>\"-\"+t))].join(\",\");return e.enable(\"\"),t},e.enable=function(t){let r;e.save(t),e.namespaces=t,e.names=[],e.skips=[];const i=(\"string\"==typeof t?t:\"\").split(/[\\s,]+/),n=i.length;for(r=0;r{e[r]=t[r]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let r=0;for(let e=0;e{\"use strict\";var i=r(655),n=r(8068),s=r(9675),o=r(5795);t.exports=function(t,e,r){if(!t||\"object\"!=typeof t&&\"function\"!=typeof t)throw new s(\"`obj` must be an object or a function`\");if(\"string\"!=typeof e&&\"symbol\"!=typeof e)throw new s(\"`property` must be a string or a symbol`\");if(arguments.length>3&&\"boolean\"!=typeof arguments[3]&&null!==arguments[3])throw new s(\"`nonEnumerable`, if provided, must be a boolean or null\");if(arguments.length>4&&\"boolean\"!=typeof arguments[4]&&null!==arguments[4])throw new s(\"`nonWritable`, if provided, must be a boolean or null\");if(arguments.length>5&&\"boolean\"!=typeof arguments[5]&&null!==arguments[5])throw new s(\"`nonConfigurable`, if provided, must be a boolean or null\");if(arguments.length>6&&\"boolean\"!=typeof arguments[6])throw new s(\"`loose`, if provided, must be a boolean\");var a=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,f=arguments.length>6&&arguments[6],l=!!o&&o(t,e);if(i)i(t,e,{configurable:null===u&&l?l.configurable:!u,enumerable:null===a&&l?l.enumerable:!a,value:r,writable:null===h&&l?l.writable:!h});else{if(!f&&(a||h||u))throw new n(\"This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.\");t[e]=r}}},9560:(t,e,r)=>{\"use strict\";e.utils=r(7626),e.Cipher=r(2808),e.DES=r(2211),e.CBC=r(3389),e.EDE=r(5279)},3389:(t,e,r)=>{\"use strict\";var i=r(3349),n=r(6698),s={};function o(t){i.equal(t.length,8,\"Invalid IV length\"),this.iv=new Array(8);for(var e=0;e{\"use strict\";var i=r(3349);function n(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==t.padding}t.exports=n,n.prototype._init=function(){},n.prototype.update=function(t){return 0===t.length?[]:\"decrypt\"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},n.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),i=0;i0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},n.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r=\"encrypt\"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e{\"use strict\";var i=r(3349),n=r(6698),s=r(7626),o=r(2808);function a(){this.tmp=new Array(2),this.keys=null}function h(t){o.call(this,t);var e=new a;this._desState=e,this.deriveKeys(e,t.key)}n(h,o),t.exports=h,h.create=function(t){return new h(t)};var u=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];h.prototype.deriveKeys=function(t,e){t.keys=new Array(32),i.equal(e.length,this.blockSize,\"Invalid key length\");var r=s.readUInt32BE(e,0),n=s.readUInt32BE(e,4);s.pc1(r,n,t.tmp,0),r=t.tmp[0],n=t.tmp[1];for(var o=0;o>>1];r=s.r28shl(r,a),n=s.r28shl(n,a),s.pc2(r,n,t.keys,o)}},h.prototype._update=function(t,e,r,i){var n=this._desState,o=s.readUInt32BE(t,e),a=s.readUInt32BE(t,e+4);s.ip(o,a,n.tmp,0),o=n.tmp[0],a=n.tmp[1],\"encrypt\"===this.type?this._encrypt(n,o,a,n.tmp,0):this._decrypt(n,o,a,n.tmp,0),o=n.tmp[0],a=n.tmp[1],s.writeUInt32BE(r,o,i),s.writeUInt32BE(r,a,i+4)},h.prototype._pad=function(t,e){if(!1===this.padding)return!1;for(var r=t.length-e,i=e;i>>0,o=c}s.rip(a,o,i,n)},h.prototype._decrypt=function(t,e,r,i,n){for(var o=r,a=e,h=t.keys.length-2;h>=0;h-=2){var u=t.keys[h],f=t.keys[h+1];s.expand(o,t.tmp,0),u^=t.tmp[0],f^=t.tmp[1];var l=s.substitute(u,f),c=o;o=(a^s.permute(l))>>>0,a=c}s.rip(o,a,i,n)}},5279:(t,e,r)=>{\"use strict\";var i=r(3349),n=r(6698),s=r(2808),o=r(2211);function a(t,e){i.equal(e.length,24,\"Invalid key length\");var r=e.slice(0,8),n=e.slice(8,16),s=e.slice(16,24);this.ciphers=\"encrypt\"===t?[o.create({type:\"encrypt\",key:r}),o.create({type:\"decrypt\",key:n}),o.create({type:\"encrypt\",key:s})]:[o.create({type:\"decrypt\",key:s}),o.create({type:\"encrypt\",key:n}),o.create({type:\"decrypt\",key:r})]}function h(t){s.call(this,t);var e=new a(this.type,this.options.key);this._edeState=e}n(h,s),t.exports=h,h.create=function(t){return new h(t)},h.prototype._update=function(t,e,r,i){var n=this._edeState;n.ciphers[0]._update(t,e,r,i),n.ciphers[1]._update(r,i,r,i),n.ciphers[2]._update(r,i,r,i)},h.prototype._pad=o.prototype._pad,h.prototype._unpad=o.prototype._unpad},7626:(t,e)=>{\"use strict\";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,i){for(var n=0,s=0,o=6;o>=0;o-=2){for(var a=0;a<=24;a+=8)n<<=1,n|=e>>>a+o&1;for(a=0;a<=24;a+=8)n<<=1,n|=t>>>a+o&1}for(o=6;o>=0;o-=2){for(a=1;a<=25;a+=8)s<<=1,s|=e>>>a+o&1;for(a=1;a<=25;a+=8)s<<=1,s|=t>>>a+o&1}r[i+0]=n>>>0,r[i+1]=s>>>0},e.rip=function(t,e,r,i){for(var n=0,s=0,o=0;o<4;o++)for(var a=24;a>=0;a-=8)n<<=1,n|=e>>>a+o&1,n<<=1,n|=t>>>a+o&1;for(o=4;o<8;o++)for(a=24;a>=0;a-=8)s<<=1,s|=e>>>a+o&1,s<<=1,s|=t>>>a+o&1;r[i+0]=n>>>0,r[i+1]=s>>>0},e.pc1=function(t,e,r,i){for(var n=0,s=0,o=7;o>=5;o--){for(var a=0;a<=24;a+=8)n<<=1,n|=e>>a+o&1;for(a=0;a<=24;a+=8)n<<=1,n|=t>>a+o&1}for(a=0;a<=24;a+=8)n<<=1,n|=e>>a+o&1;for(o=1;o<=3;o++){for(a=0;a<=24;a+=8)s<<=1,s|=e>>a+o&1;for(a=0;a<=24;a+=8)s<<=1,s|=t>>a+o&1}for(a=0;a<=24;a+=8)s<<=1,s|=t>>a+o&1;r[i+0]=n>>>0,r[i+1]=s>>>0},e.r28shl=function(t,e){return t<>>28-e};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,i,n){for(var s=0,o=0,a=r.length>>>1,h=0;h>>r[h]&1;for(h=a;h>>r[h]&1;i[n+0]=s>>>0,i[n+1]=o>>>0},e.expand=function(t,e,r){var i=0,n=0;i=(1&t)<<5|t>>>27;for(var s=23;s>=15;s-=4)i<<=6,i|=t>>>s&63;for(s=11;s>=3;s-=4)n|=t>>>s&63,n<<=6;n|=(31&t)<<1|t>>>31,e[r+0]=i>>>0,e[r+1]=n>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var r=0,n=0;n<4;n++)r<<=4,r|=i[64*n+(t>>>18-6*n&63)];for(n=0;n<4;n++)r<<=4,r|=i[256+64*n+(e>>>18-6*n&63)];return r>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,r=0;r>>n[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var i=t.toString(2);i.length{var i=r(8287).Buffer,n=r(4934),s=r(3241),o=r(4910),a={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(t){var e=new i(s[t].prime,\"hex\"),r=new i(s[t].gen,\"hex\");return new o(e,r)},e.createDiffieHellman=e.DiffieHellman=function t(e,r,s,h){return i.isBuffer(r)||void 0===a[r]?t(e,\"binary\",r,s):(r=r||\"binary\",h=h||\"binary\",s=s||new i([2]),i.isBuffer(s)||(s=new i(s,h)),\"number\"==typeof e?new o(n(e,s),s,!0):(i.isBuffer(e)||(e=new i(e,r)),new o(e,s,!0)))}},4910:(t,e,r)=>{var i=r(8287).Buffer,n=r(6473),s=new(r(2244)),o=new n(24),a=new n(11),h=new n(10),u=new n(3),f=new n(7),l=r(4934),c=r(3209);function d(t,e){return e=e||\"utf8\",i.isBuffer(t)||(t=new i(t,e)),this._pub=new n(t),this}function p(t,e){return e=e||\"utf8\",i.isBuffer(t)||(t=new i(t,e)),this._priv=new n(t),this}t.exports=g;var m={};function g(t,e,r){this.setGenerator(e),this.__prime=new n(t),this._prime=n.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=d,this.setPrivateKey=p):this._primeCode=8}function y(t,e){var r=new i(t.toArray());return e?r.toString(e):r}Object.defineProperty(g.prototype,\"verifyError\",{enumerable:!0,get:function(){return\"number\"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString(\"hex\"),i=[r,t.toString(16)].join(\"_\");if(i in m)return m[i];var n,c=0;if(t.isEven()||!l.simpleSieve||!l.fermatTest(t)||!s.test(t))return c+=1,c+=\"02\"===r||\"05\"===r?8:4,m[i]=c,c;switch(s.test(t.shrn(1))||(c+=2),r){case\"02\":t.mod(o).cmp(a)&&(c+=8);break;case\"05\":(n=t.mod(h)).cmp(u)&&n.cmp(f)&&(c+=8);break;default:c+=4}return m[i]=c,c}(this.__prime,this.__gen)),this._primeCode}}),g.prototype.generateKeys=function(){return this._priv||(this._priv=new n(c(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},g.prototype.computeSecret=function(t){var e=(t=(t=new n(t)).toRed(this._prime)).redPow(this._priv).fromRed(),r=new i(e.toArray()),s=this.getPrime();if(r.length{var i=r(3209);t.exports=b,b.simpleSieve=g,b.fermatTest=y;var n=r(6473),s=new n(24),o=new(r(2244)),a=new n(1),h=new n(2),u=new n(5),f=(new n(16),new n(8),new n(10)),l=new n(3),c=(new n(7),new n(11)),d=new n(4),p=(new n(12),null);function m(){if(null!==p)return p;var t=[];t[0]=2;for(var e=1,r=3;r<1048576;r+=2){for(var i=Math.ceil(Math.sqrt(r)),n=0;nt;)r.ishrn(1);if(r.isEven()&&r.iadd(a),r.testn(1)||r.iadd(h),e.cmp(h)){if(!e.cmp(u))for(;r.mod(f).cmp(l);)r.iadd(d)}else for(;r.mod(s).cmp(c);)r.iadd(d);if(g(p=r.shrn(1))&&g(r)&&y(p)&&y(r)&&o.test(p)&&o.test(r))return r}}},6473:function(t,e,r){!function(t,e){\"use strict\";function i(t,e){if(!t)throw new Error(e||\"Assertion failed\")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&(\"le\"!==e&&\"be\"!==e||(r=e,e=10),this._init(t||0,e||10,r||\"be\"))}var o;\"object\"==typeof t?t.exports=s:e.BN=s,s.BN=s,s.wordSize=26;try{o=\"undefined\"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6089).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,s=Math.min(t.length,r),o=e;o=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(t){return t instanceof s||null!==t&&\"object\"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if(\"number\"==typeof t)return this._initNumber(t,e,r);if(\"object\"==typeof t)return this._initArray(t,e,r);\"hex\"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;\"-\"===(t=t.toString().replace(/\\s+/g,\"\"))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if(\"le\"===r)for(n=0,s=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?\"\"};var f=[\"\",\"0\",\"00\",\"000\",\"0000\",\"00000\",\"000000\",\"0000000\",\"00000000\",\"000000000\",\"0000000000\",\"00000000000\",\"000000000000\",\"0000000000000\",\"00000000000000\",\"000000000000000\",\"0000000000000000\",\"00000000000000000\",\"000000000000000000\",\"0000000000000000000\",\"00000000000000000000\",\"000000000000000000000\",\"0000000000000000000000\",\"00000000000000000000000\",\"000000000000000000000000\",\"0000000000000000000000000\"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,h=o/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(s=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||\"hex\"===t){r=\"\";for(var n=0,s=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r=\"\";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r=\"0\"+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}i(!1,\"Base should be between 2 and 36\")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,\"Number can only safely store up to 53 bits\"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,\"byte array longer than desired length\"),i(s>0,\"Requested array length <= 0\"),this.strip();var o,a,h=\"le\"===e,u=new t(s),f=this.clone();if(h){for(a=0;!f.isZero();a++)o=f.andln(255),f.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i(\"number\"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i(\"number\"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,b=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,M=0|o[4],k=8191&M,S=M>>>13,x=0|o[5],A=8191&x,E=x>>>13,I=0|o[6],B=8191&I,T=I>>>13,P=0|o[7],R=8191&P,C=P>>>13,L=0|o[8],O=8191&L,j=L>>>13,N=0|o[9],U=8191&N,q=N>>>13,D=0|a[0],F=8191&D,H=D>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,Z=V>>>13,G=0|a[3],J=8191&G,Y=G>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((s=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,s=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((s=s+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,s=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,s=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((s=s+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,s=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,s=s+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((s=s+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,s=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,s=s+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((s=s+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,H))+Math.imul(T,F)|0,s=Math.imul(T,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,Z)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,s=s+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,s=s+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,st)|0))<<13)|0;u=((s=s+Math.imul(c,ot)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(C,F)|0,s=Math.imul(C,H),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,Z)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,s=s+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,s=s+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,it)|0,i=i+Math.imul(p,st)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((s=s+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,F),n=(n=Math.imul(O,H))+Math.imul(j,F)|0,s=Math.imul(j,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(C,W)|0,s=s+Math.imul(C,K)|0,i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,Z)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,Z)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,s=s+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,it)|0,i=i+Math.imul(y,st)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,s=s+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((s=s+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,H))+Math.imul(q,F)|0,s=Math.imul(q,H),i=i+Math.imul(O,W)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(j,W)|0,s=s+Math.imul(j,K)|0,i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(C,$)|0,s=s+Math.imul(C,Z)|0,i=i+Math.imul(B,J)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,s=s+Math.imul(S,it)|0,i=i+Math.imul(w,st)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,s=s+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,s=s+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((s=s+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,W),n=(n=Math.imul(U,K))+Math.imul(q,W)|0,s=Math.imul(q,K),i=i+Math.imul(O,$)|0,n=(n=n+Math.imul(O,Z)|0)+Math.imul(j,$)|0,s=s+Math.imul(j,Z)|0,i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(C,J)|0,s=s+Math.imul(C,Y)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(S,st)|0,s=s+Math.imul(S,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,s=s+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,s=s+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((s=s+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,Z))+Math.imul(q,$)|0,s=Math.imul(q,Z),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(j,J)|0,s=s+Math.imul(j,Y)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(C,Q)|0,s=s+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(A,st)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,s=s+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,s=s+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((s=s+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,J),n=(n=Math.imul(U,Y))+Math.imul(q,J)|0,s=Math.imul(q,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(j,Q)|0,s=s+Math.imul(j,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(C,rt)|0,s=s+Math.imul(C,it)|0,i=i+Math.imul(B,st)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,s=s+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,s=s+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((s=s+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(q,Q)|0,s=Math.imul(q,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(j,rt)|0,s=s+Math.imul(j,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,ot)|0,i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(T,ht)|0,s=s+Math.imul(T,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,s=s+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((s=s+Math.imul(S,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(q,rt)|0,s=Math.imul(q,it),i=i+Math.imul(O,st)|0,n=(n=n+Math.imul(O,ot)|0)+Math.imul(j,st)|0,s=s+Math.imul(j,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(C,ht)|0,s=s+Math.imul(C,ut)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,s=s+Math.imul(T,ct)|0;var Tt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((s=s+Math.imul(E,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,st),n=(n=Math.imul(U,ot))+Math.imul(q,st)|0,s=Math.imul(q,ot),i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(j,ht)|0,s=s+Math.imul(j,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(C,lt)|0,s=s+Math.imul(C,ct)|0;var Pt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((s=s+Math.imul(T,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ht),n=(n=Math.imul(U,ut))+Math.imul(q,ht)|0,s=Math.imul(q,ut),i=i+Math.imul(O,lt)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(j,lt)|0,s=s+Math.imul(j,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((s=s+Math.imul(C,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,lt),n=(n=Math.imul(U,ct))+Math.imul(q,lt)|0,s=Math.imul(q,ct);var Ct=(u+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((s=s+Math.imul(j,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Lt=(u+(i=Math.imul(U,pt))|0)+((8191&(n=(n=Math.imul(U,mt))+Math.imul(q,pt)|0))<<13)|0;return u=((s=Math.imul(q,mt))+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Bt,h[14]=Tt,h[15]=Pt,h[16]=Rt,h[17]=Ct,h[18]=Lt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),s.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-s|l>>>s,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i(\"number\"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,\"imaskn works only with positive numbers\"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i(\"number\"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&s}for(;n>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,h=i.length-n.length;if(\"mod\"!==e){(a=new s(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),\"div\"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),\"mod\"!==e&&(n=a.div.neg()),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),\"mod\"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?\"div\"===e?{div:this.divn(t.words[0]),mod:null}:\"mod\"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,\"div\",!1).div},s.prototype.mod=function(t){return this.divmod(t,\"mod\",!1).mod},s.prototype.umod=function(t){return this.divmod(t,\"mod\",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},s.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),h=new s(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(h)):(r.isub(e),a.isub(n),h.isub(o))}return{a,b:h,gcd:r.iushln(u)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return!(1&this.words[0])},s.prototype.isOdd=function(){return!(1&~this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i(\"number\"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,\"Number is too big\");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new k(t)},s.prototype.toRed=function(t){return i(!this.red,\"Already a number in reduction context\"),i(0===this.negative,\"red works only with positives\"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,\"fromRed works only with numbers in reduction context\"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,\"Already a number in reduction context\"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,\"redAdd works only with red numbers\"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,\"redIAdd works only with red numbers\"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,\"redSub works only with red numbers\"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,\"redISub works only with red numbers\"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,\"redShl works only with red numbers\"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,\"redSqr works only with red numbers\"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,\"redISqr works only with red numbers\"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,\"redSqrt works only with red numbers\"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,\"redInvm works only with red numbers\"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,\"redNeg works only with red numbers\"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,\"redPow(normalNum)\"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,\"k256\",\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\")}function w(){b.call(this,\"p224\",\"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\")}function _(){b.call(this,\"p192\",\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\")}function M(){b.call(this,\"25519\",\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\")}function k(t){if(\"string\"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),\"modulus must be greater than 1\"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,s=o}s>>>=22,t.words[n-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(y[t])return y[t];var e;if(\"k256\"===t)e=new v;else if(\"p224\"===t)e=new w;else if(\"p192\"===t)e=new _;else{if(\"p25519\"!==t)throw new Error(\"Unknown prime \"+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,\"red works only with positives\"),i(t.red,\"red works only with red numbers\")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),\"red works only with positives\"),i(t.red&&t.red===e.red,\"red works only with red numbers\")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},6729:(t,e,r)=>{\"use strict\";var i=e;i.version=r(1636).rE,i.utils=r(7011),i.rand=r(5037),i.curve=r(894),i.curves=r(480),i.ec=r(7447),i.eddsa=r(8650)},6677:(t,e,r)=>{\"use strict\";var i=r(8490),n=r(7011),s=n.getNAF,o=n.getJSF,a=n.assert;function h(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=h,h.prototype.point=function(){throw new Error(\"Not implemented\")},h.prototype.validate=function(){throw new Error(\"Not implemented\")},h.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),i=s(e,1,this._bitLength),n=(1<=o;f--)h=(h<<1)+i[f];u.push(h)}for(var l=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=n;d>0;d--){for(o=0;o=0;u--){for(var f=0;u>=0&&0===o[u];u--)f++;if(u>=0&&f++,h=h.dblp(f),u<0)break;var l=o[u];a(0!==l),h=\"affine\"===t.type?l>0?h.mixedAdd(n[l-1>>1]):h.mixedAdd(n[-l-1>>1].neg()):l>0?h.add(n[l-1>>1]):h.add(n[-l-1>>1].neg())}return\"affine\"===t.type?h.toP():h},h.prototype._wnafMulAdd=function(t,e,r,i,n){var a,h,u,f=this._wnafT1,l=this._wnafT2,c=this._wnafT3,d=0;for(a=0;a=1;a-=2){var m=a-1,g=a;if(1===f[m]&&1===f[g]){var y=[e[m],null,null,e[g]];0===e[m].y.cmp(e[g].y)?(y[1]=e[m].add(e[g]),y[2]=e[m].toJ().mixedAdd(e[g].neg())):0===e[m].y.cmp(e[g].y.redNeg())?(y[1]=e[m].toJ().mixedAdd(e[g]),y[2]=e[m].add(e[g].neg())):(y[1]=e[m].toJ().mixedAdd(e[g]),y[2]=e[m].toJ().mixedAdd(e[g].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],v=o(r[m],r[g]);for(d=Math.max(v[0].length,d),c[m]=new Array(d),c[g]=new Array(d),h=0;h=0;a--){for(var S=0;a>=0;){var x=!0;for(h=0;h=0&&S++,M=M.dblp(S),a<0)break;for(h=0;h0?u=l[h][A-1>>1]:A<0&&(u=l[h][-A-1>>1].neg()),M=\"affine\"===u.type?M.mixedAdd(u):M.add(u))}}for(a=0;a=Math.ceil((t.bitLength()+1)/e.step)},u.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n{\"use strict\";var i=r(7011),n=r(8490),s=r(6698),o=r(6677),a=i.assert;function h(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,o.call(this,\"edwards\",t),this.a=new n(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function u(t,e,r,i,s){o.BasePoint.call(this,t,\"projective\"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(e,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=s&&new n(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(h,o),t.exports=h,h.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},h.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},h.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},h.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error(\"invalid point\");var h=a.fromRed().isOdd();return(e&&!h||!e&&h)&&(a=a.redNeg()),this.point(t,a)},h.prototype.pointFromY=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error(\"invalid point\");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error(\"invalid point\");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},h.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},s(u,o.BasePoint),h.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},h.prototype.point=function(t,e,r,i){return new u(this,t,e,r,i)},u.fromJSON=function(t,e){return new u(t,e[0],e[1],e[2])},u.prototype.inspect=function(){return this.isInfinity()?\"\":\"\"},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=i.redAdd(e),o=s.redSub(r),a=i.redSub(e),h=n.redMul(o),u=s.redMul(a),f=n.redMul(a),l=o.redMul(s);return this.curve.point(h,u,l,f)},u.prototype._projDbl=function(){var t,e,r,i,n,s,o=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),h=this.y.redSqr();if(this.curve.twisted){var u=(i=this.curve._mulA(a)).redAdd(h);this.zOne?(t=o.redSub(a).redSub(h).redMul(u.redSub(this.curve.two)),e=u.redMul(i.redSub(h)),r=u.redSqr().redSub(u).redSub(u)):(n=this.z.redSqr(),s=u.redSub(n).redISub(n),t=o.redSub(a).redISub(h).redMul(s),e=u.redMul(i.redSub(h)),r=u.redMul(s))}else i=a.redAdd(h),n=this.curve._mulC(this.z).redSqr(),s=i.redSub(n).redSub(n),t=this.curve._mulC(o.redISub(i)).redMul(s),e=this.curve._mulC(i).redMul(a.redISub(h)),r=i.redMul(s);return this.curve.point(t,e,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),o=n.redSub(i),a=n.redAdd(i),h=r.redAdd(e),u=s.redMul(o),f=a.redMul(h),l=s.redMul(h),c=o.redMul(a);return this.curve.point(u,f,c,l)},u.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),s=this.x.redMul(t.x),o=this.y.redMul(t.y),a=this.curve.d.redMul(s).redMul(o),h=n.redSub(a),u=n.redAdd(a),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(o),l=i.redMul(h).redMul(f);return this.curve.twisted?(e=i.redMul(u).redMul(o.redSub(this.curve._mulA(s))),r=h.redMul(u)):(e=i.redMul(u).redMul(o.redSub(s)),r=this.curve._mulC(h).redMul(u)),this.curve.point(l,e,r)},u.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},u.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},u.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},u.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},894:(t,e,r)=>{\"use strict\";var i=e;i.base=r(6677),i.short=r(9188),i.mont=r(370),i.edwards=r(1298)},370:(t,e,r)=>{\"use strict\";var i=r(8490),n=r(6698),s=r(6677),o=r(7011);function a(t){s.call(this,\"mont\",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function h(t,e,r){s.BasePoint.call(this,t,\"projective\"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(a,s),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},n(h,s.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(o.toArray(t,e),1)},a.prototype.point=function(t,e){return new h(this,t,e)},a.prototype.pointFromJSON=function(t){return h.fromJSON(this,t)},h.prototype.precompute=function(){},h.prototype._encode=function(){return this.getX().toArray(\"be\",this.curve.p.byteLength())},h.fromJSON=function(t,e){return new h(t,e[0],e[1]||t.one)},h.prototype.inspect=function(){return this.isInfinity()?\"\":\"\"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},h.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},h.prototype.add=function(){throw new Error(\"Not supported on Montgomery curve\")},h.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),s=t.x.redSub(t.z).redMul(r),o=n.redMul(i),a=e.z.redMul(s.redAdd(o).redSqr()),h=e.x.redMul(s.redISub(o).redSqr());return this.curve.point(a,h)},h.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var s=n.length-1;s>=0;s--)0===n[s]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},h.prototype.mulAdd=function(){throw new Error(\"Not supported on Montgomery curve\")},h.prototype.jumlAdd=function(){throw new Error(\"Not supported on Montgomery curve\")},h.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},h.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},h.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},9188:(t,e,r)=>{\"use strict\";var i=r(7011),n=r(8490),s=r(6698),o=r(6677),a=i.assert;function h(t){o.call(this,\"short\",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(t,e,r,i){o.BasePoint.call(this,t,\"affine\"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(e,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(t,e,r,i){o.BasePoint.call(this,t,\"jacobian\"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(e,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(h,o),t.exports=h,h.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new n(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new n(t.lambda,16);else{var s=this._getEndoRoots(this.n);0===this.g.mul(s[0]).x.cmp(this.g.x.redMul(e))?r=s[0]:(r=s[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new n(t.a,16),b:new n(t.b,16)}})):this._getEndoBasis(r)}}},h.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:n.mont(t),r=new n(2).toRed(e).redInvm(),i=r.redNeg(),s=new n(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(s).fromRed(),i.redSub(s).fromRed()]},h.prototype._getEndoBasis=function(t){for(var e,r,i,s,o,a,h,u,f,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),c=t,d=this.n.clone(),p=new n(1),m=new n(0),g=new n(0),y=new n(1),b=0;0!==c.cmpn(0);){var v=d.div(c);u=d.sub(v.mul(c)),f=g.sub(v.mul(p));var w=y.sub(v.mul(m));if(!i&&u.cmp(l)<0)e=h.neg(),r=p,i=u.neg(),s=f;else if(i&&2==++b)break;h=u,d=c,c=u,g=p,p=f,y=m,m=w}o=u.neg(),a=f;var _=i.sqr().add(s.sqr());return o.sqr().add(a.sqr()).cmp(_)>=0&&(o=e,a=r),i.negative&&(i=i.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:s},{a:o,b:a}]},h.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=n.mul(r.a),a=s.mul(i.a),h=n.mul(r.b),u=s.mul(i.b);return{k1:t.sub(o).sub(a),k2:h.add(u).neg()}},h.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error(\"invalid point\");var s=i.fromRed().isOdd();return(e&&!s||!e&&s)&&(i=i.redNeg()),this.point(t,i)},h.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},h.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s\":\"\"},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},u.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(t){return t=new n(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},u.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},u.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},u.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(f,o.BasePoint),h.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),h=s.redSub(o);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),l=i.redMul(u),c=h.redSqr().redIAdd(f).redISub(l).redISub(l),d=h.redMul(l.redISub(c)).redISub(s.redMul(f)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(c,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(i),a=n.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=o.redSqr(),u=h.redMul(o),f=r.redMul(h),l=a.redSqr().redIAdd(u).redISub(f).redISub(f),c=a.redMul(f.redISub(l)).redISub(n.redMul(u)),d=this.z.redMul(o);return this.curve.jpoint(l,c,d)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?\"\":\"\"},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},480:(t,e,r)=>{\"use strict\";var i,n=e,s=r(7952),o=r(894),a=r(7011).assert;function h(t){\"short\"===t.type?this.curve=new o.short(t):\"edwards\"===t.type?this.curve=new o.edwards(t):this.curve=new o.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),\"Invalid curve\"),a(this.g.mul(this.n).isInfinity(),\"Invalid curve, G*N != O\")}function u(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new h(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=h,u(\"p192\",{type:\"short\",prime:\"p192\",p:\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\",a:\"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc\",b:\"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1\",n:\"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831\",hash:s.sha256,gRed:!1,g:[\"188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012\",\"07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811\"]}),u(\"p224\",{type:\"short\",prime:\"p224\",p:\"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\",a:\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe\",b:\"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4\",n:\"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d\",hash:s.sha256,gRed:!1,g:[\"b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21\",\"bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34\"]}),u(\"p256\",{type:\"short\",prime:null,p:\"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff\",a:\"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc\",b:\"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b\",n:\"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551\",hash:s.sha256,gRed:!1,g:[\"6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296\",\"4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5\"]}),u(\"p384\",{type:\"short\",prime:null,p:\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff\",a:\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc\",b:\"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef\",n:\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973\",hash:s.sha384,gRed:!1,g:[\"aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7\",\"3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f\"]}),u(\"p521\",{type:\"short\",prime:null,p:\"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff\",a:\"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc\",b:\"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00\",n:\"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409\",hash:s.sha512,gRed:!1,g:[\"000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66\",\"00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650\"]}),u(\"curve25519\",{type:\"mont\",prime:\"p25519\",p:\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\",a:\"76d06\",b:\"1\",n:\"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed\",hash:s.sha256,gRed:!1,g:[\"9\"]}),u(\"ed25519\",{type:\"edwards\",prime:\"p25519\",p:\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\",a:\"-1\",c:\"1\",d:\"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3\",n:\"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed\",hash:s.sha256,gRed:!1,g:[\"216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a\",\"6666666666666666666666666666666666666666666666666666666666666658\"]});try{i=r(4011)}catch(t){i=void 0}u(\"secp256k1\",{type:\"short\",prime:\"k256\",p:\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\",a:\"0\",b:\"7\",n:\"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141\",h:\"1\",hash:s.sha256,beta:\"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee\",lambda:\"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72\",basis:[{a:\"3086d221a7d46bcde86c90e49284eb15\",b:\"-e4437ed6010e88286f547fa90abfe4c3\"},{a:\"114ca50f7a8e2f3f657c1108d9d44cfd8\",b:\"3086d221a7d46bcde86c90e49284eb15\"}],gRed:!1,g:[\"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\",\"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8\",i]})},7447:(t,e,r)=>{\"use strict\";var i=r(8490),n=r(2723),s=r(7011),o=r(480),a=r(5037),h=s.assert,u=r(1200),f=r(8545);function l(t){if(!(this instanceof l))return new l(t);\"string\"==typeof t&&(h(Object.prototype.hasOwnProperty.call(o,t),\"Unknown curve \"+t),t=o[t]),t instanceof o.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=l,l.prototype.keyPair=function(t){return new u(this,t)},l.prototype.keyFromPrivate=function(t,e){return u.fromPrivate(this,t,e)},l.prototype.keyFromPublic=function(t,e){return u.fromPublic(this,t,e)},l.prototype.genKeyPair=function(t){t||(t={});for(var e=new n({hash:this.hash,pers:t.pers,persEnc:t.persEnc||\"utf8\",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||\"utf8\",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new i(2));;){var o=new i(e.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},l.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},l.prototype.sign=function(t,e,r,s){\"object\"==typeof r&&(s=r,r=null),s||(s={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new i(t,16));for(var o=this.n.byteLength(),a=e.getPrivate().toArray(\"be\",o),h=t.toArray(\"be\",o),u=new n({hash:this.hash,entropy:a,nonce:h,pers:s.pers,persEnc:s.persEnc||\"utf8\"}),l=this.n.sub(new i(1)),c=0;;c++){var d=s.k?s.k(c):new i(u.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(l)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var y=d.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return s.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),b^=1),new f({r:g,s:y,recoveryParam:b})}}}}}},l.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n);var s=(e=new f(e,\"hex\")).r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,h=o.invm(this.n),u=h.mul(t).umod(this.n),l=h.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},l.prototype.recoverPubKey=function(t,e,r,n){h((3&r)===r,\"The recovery param is more than two bits\"),e=new f(e,n);var s=this.n,o=new i(t),a=e.r,u=e.s,l=1&r,c=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error(\"Unable to find sencond key candinate\");a=c?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var d=e.r.invm(s),p=s.sub(o).mul(d).umod(s),m=u.mul(d).umod(s);return this.g.mulAdd(p,a,m)},l.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new f(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch(t){continue}if(s.eq(r))return n}throw new Error(\"Unable to find valid recovery factor\")}},1200:(t,e,r)=>{\"use strict\";var i=r(8490),n=r(7011).assert;function s(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=s,s.fromPublic=function(t,e,r){return e instanceof s?e:new s(t,{pub:e,pubEnc:r})},s.fromPrivate=function(t,e,r){return e instanceof s?e:new s(t,{priv:e,privEnc:r})},s.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:\"Invalid public key\"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:\"Public key * N != O\"}:{result:!1,reason:\"Public key is not a point\"}},s.prototype.getPublic=function(t,e){return\"string\"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},s.prototype.getPrivate=function(t){return\"hex\"===t?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(t,e){this.priv=new i(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(t,e){if(t.x||t.y)return\"mont\"===this.ec.curve.type?n(t.x,\"Need x coordinate\"):\"short\"!==this.ec.curve.type&&\"edwards\"!==this.ec.curve.type||n(t.x&&t.y,\"Need both x and y coordinate\"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},s.prototype.derive=function(t){return t.validate()||n(t.validate(),\"public point not validated\"),t.mul(this.priv).getX()},s.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},s.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},s.prototype.inspect=function(){return\"\"}},8545:(t,e,r)=>{\"use strict\";var i=r(8490),n=r(7011),s=n.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(s(t.r&&t.s,\"Signature without r or s\"),this.r=new i(t.r,16),this.s=new i(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function h(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,s=0,o=e.place;s>>=0;return!(n<=127)&&(e.place=o,n)}function u(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=o,o.prototype._importDER=function(t,e){t=n.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var s=h(t,r);if(!1===s)return!1;if(s+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=h(t,r);if(!1===o)return!1;var u=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var f=h(t,r);if(!1===f)return!1;if(t.length!==f+r.place)return!1;var l=t.slice(r.place,f+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new i(u),this.s=new i(l),this.recoveryParam=null,!0},o.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=u(e),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];f(i,e.length),(i=i.concat(e)).push(2),f(i,r.length);var s=i.concat(r),o=[48];return f(o,s.length),o=o.concat(s),n.encode(o,t)}},8650:(t,e,r)=>{\"use strict\";var i=r(7952),n=r(480),s=r(7011),o=s.assert,a=s.parseBytes,h=r(6661),u=r(220);function f(t){if(o(\"ed25519\"===t,\"only tested with ed25519 so far\"),!(this instanceof f))return new f(t);t=n[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}t.exports=f,f.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),s=this.encodePoint(n),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),h=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:h,Rencoded:s})},f.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(s)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e{\"use strict\";var i=r(7011),n=i.assert,s=i.parseBytes,o=i.cachedProperty;function a(t,e){this.eddsa=t,this._secret=s(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=s(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},o(a,\"pubBytes\",(function(){return this.eddsa.encodePoint(this.pub())})),o(a,\"pub\",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),o(a,\"privBytes\",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),o(a,\"priv\",(function(){return this.eddsa.decodeInt(this.privBytes())})),o(a,\"hash\",(function(){return this.eddsa.hash().update(this.secret()).digest()})),o(a,\"messagePrefix\",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return n(this._secret,\"KeyPair can only verify\"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return n(this._secret,\"KeyPair is public only\"),i.encode(this.secret(),t)},a.prototype.getPublic=function(t){return i.encode(this.pubBytes(),t)},t.exports=a},220:(t,e,r)=>{\"use strict\";var i=r(8490),n=r(7011),s=n.assert,o=n.cachedProperty,a=n.parseBytes;function h(t,e){this.eddsa=t,\"object\"!=typeof e&&(e=a(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),s(e.R&&e.S,\"Signature without R or S\"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof i&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}o(h,\"S\",(function(){return this.eddsa.decodeInt(this.Sencoded())})),o(h,\"R\",(function(){return this.eddsa.decodePoint(this.Rencoded())})),o(h,\"Rencoded\",(function(){return this.eddsa.encodePoint(this.R())})),o(h,\"Sencoded\",(function(){return this.eddsa.encodeInt(this.S())})),h.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},h.prototype.toHex=function(){return n.encode(this.toBytes(),\"hex\").toUpperCase()},t.exports=h},4011:t=>{t.exports={doubles:{step:4,points:[[\"e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a\",\"f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821\"],[\"8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508\",\"11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf\"],[\"175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739\",\"d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695\"],[\"363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640\",\"4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9\"],[\"8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c\",\"4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36\"],[\"723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda\",\"96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f\"],[\"eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa\",\"5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999\"],[\"100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0\",\"cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09\"],[\"e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d\",\"9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d\"],[\"feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d\",\"e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088\"],[\"da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1\",\"9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d\"],[\"53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0\",\"5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8\"],[\"8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047\",\"10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a\"],[\"385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862\",\"283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453\"],[\"6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7\",\"7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160\"],[\"3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd\",\"56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0\"],[\"85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83\",\"7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6\"],[\"948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a\",\"53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589\"],[\"6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8\",\"bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17\"],[\"e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d\",\"4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda\"],[\"e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725\",\"7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd\"],[\"213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754\",\"4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2\"],[\"4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c\",\"17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6\"],[\"fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6\",\"6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f\"],[\"76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39\",\"c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01\"],[\"c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891\",\"893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3\"],[\"d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b\",\"febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f\"],[\"b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03\",\"2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7\"],[\"e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d\",\"eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78\"],[\"a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070\",\"7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1\"],[\"90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4\",\"e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150\"],[\"8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da\",\"662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82\"],[\"e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11\",\"1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc\"],[\"8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e\",\"efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b\"],[\"e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41\",\"2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51\"],[\"b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef\",\"67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45\"],[\"d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8\",\"db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120\"],[\"324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d\",\"648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84\"],[\"4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96\",\"35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d\"],[\"9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd\",\"ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d\"],[\"6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5\",\"9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8\"],[\"a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266\",\"40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8\"],[\"7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71\",\"34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac\"],[\"928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac\",\"c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f\"],[\"85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751\",\"1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962\"],[\"ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e\",\"493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907\"],[\"827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241\",\"c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec\"],[\"eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3\",\"be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d\"],[\"e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f\",\"4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414\"],[\"1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19\",\"aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd\"],[\"146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be\",\"b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0\"],[\"fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9\",\"6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811\"],[\"da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2\",\"8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1\"],[\"a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13\",\"7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c\"],[\"174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c\",\"ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73\"],[\"959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba\",\"2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd\"],[\"d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151\",\"e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405\"],[\"64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073\",\"d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589\"],[\"8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458\",\"38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e\"],[\"13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b\",\"69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27\"],[\"bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366\",\"d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1\"],[\"8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa\",\"40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482\"],[\"8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0\",\"620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945\"],[\"dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787\",\"7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573\"],[\"f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e\",\"ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82\"]]},naf:{wnd:7,points:[[\"f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9\",\"388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672\"],[\"2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4\",\"d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6\"],[\"5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc\",\"6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da\"],[\"acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe\",\"cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37\"],[\"774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb\",\"d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b\"],[\"f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8\",\"ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81\"],[\"d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e\",\"581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58\"],[\"defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34\",\"4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77\"],[\"2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c\",\"85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a\"],[\"352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5\",\"321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c\"],[\"2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f\",\"2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67\"],[\"9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714\",\"73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402\"],[\"daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729\",\"a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55\"],[\"c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db\",\"2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482\"],[\"6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4\",\"e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82\"],[\"1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5\",\"b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396\"],[\"605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479\",\"2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49\"],[\"62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d\",\"80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf\"],[\"80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f\",\"1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a\"],[\"7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb\",\"d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7\"],[\"d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9\",\"eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933\"],[\"49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963\",\"758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a\"],[\"77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74\",\"958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6\"],[\"f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530\",\"e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37\"],[\"463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b\",\"5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e\"],[\"f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247\",\"cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6\"],[\"caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1\",\"cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476\"],[\"2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120\",\"4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40\"],[\"7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435\",\"91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61\"],[\"754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18\",\"673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683\"],[\"e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8\",\"59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5\"],[\"186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb\",\"3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b\"],[\"df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f\",\"55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417\"],[\"5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143\",\"efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868\"],[\"290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba\",\"e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a\"],[\"af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45\",\"f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6\"],[\"766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a\",\"744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996\"],[\"59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e\",\"c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e\"],[\"f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8\",\"e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d\"],[\"7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c\",\"30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2\"],[\"948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519\",\"e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e\"],[\"7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab\",\"100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437\"],[\"3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca\",\"ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311\"],[\"d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf\",\"8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4\"],[\"1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610\",\"68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575\"],[\"733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4\",\"f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d\"],[\"15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c\",\"d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d\"],[\"a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940\",\"edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629\"],[\"e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980\",\"a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06\"],[\"311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3\",\"66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374\"],[\"34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf\",\"9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee\"],[\"f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63\",\"4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1\"],[\"d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448\",\"fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b\"],[\"32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf\",\"5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661\"],[\"7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5\",\"8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6\"],[\"ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6\",\"8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e\"],[\"16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5\",\"5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d\"],[\"eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99\",\"f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc\"],[\"78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51\",\"f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4\"],[\"494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5\",\"42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c\"],[\"a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5\",\"204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b\"],[\"c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997\",\"4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913\"],[\"841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881\",\"73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154\"],[\"5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5\",\"39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865\"],[\"36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66\",\"d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc\"],[\"336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726\",\"ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224\"],[\"8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede\",\"6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e\"],[\"1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94\",\"60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6\"],[\"85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31\",\"3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511\"],[\"29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51\",\"b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b\"],[\"a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252\",\"ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2\"],[\"4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5\",\"cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c\"],[\"d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b\",\"6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3\"],[\"ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4\",\"322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d\"],[\"af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f\",\"6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700\"],[\"e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889\",\"2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4\"],[\"591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246\",\"b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196\"],[\"11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984\",\"998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4\"],[\"3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a\",\"b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257\"],[\"cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030\",\"bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13\"],[\"c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197\",\"6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096\"],[\"c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593\",\"c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38\"],[\"a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef\",\"21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f\"],[\"347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38\",\"60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448\"],[\"da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a\",\"49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a\"],[\"c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111\",\"5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4\"],[\"4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502\",\"7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437\"],[\"3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea\",\"be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7\"],[\"cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26\",\"8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d\"],[\"b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986\",\"39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a\"],[\"d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e\",\"62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54\"],[\"48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4\",\"25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77\"],[\"dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda\",\"ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517\"],[\"6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859\",\"cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10\"],[\"e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f\",\"f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125\"],[\"eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c\",\"6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e\"],[\"13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942\",\"fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1\"],[\"ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a\",\"1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2\"],[\"b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80\",\"5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423\"],[\"ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d\",\"438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8\"],[\"8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1\",\"cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758\"],[\"52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63\",\"c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375\"],[\"e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352\",\"6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d\"],[\"7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193\",\"ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec\"],[\"5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00\",\"9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0\"],[\"32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58\",\"ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c\"],[\"e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7\",\"d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4\"],[\"8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8\",\"c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f\"],[\"4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e\",\"67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649\"],[\"3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d\",\"cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826\"],[\"674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b\",\"299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5\"],[\"d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f\",\"f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87\"],[\"30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6\",\"462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b\"],[\"be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297\",\"62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc\"],[\"93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a\",\"7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c\"],[\"b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c\",\"ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f\"],[\"d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52\",\"4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a\"],[\"d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb\",\"bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46\"],[\"463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065\",\"bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f\"],[\"7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917\",\"603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03\"],[\"74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9\",\"cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08\"],[\"30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3\",\"553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8\"],[\"9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57\",\"712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373\"],[\"176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66\",\"ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3\"],[\"75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8\",\"9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8\"],[\"809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721\",\"9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1\"],[\"1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180\",\"4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9\"]]}}},7011:(t,e,r)=>{\"use strict\";var i=e,n=r(8490),s=r(3349),o=r(4367);i.assert=s,i.toArray=o.toArray,i.zero2=o.zero2,i.toHex=o.toHex,i.encode=o.encode,i.getNAF=function(t,e,r){var i,n=new Array(Math.max(t.bitLength(),r)+1);for(i=0;i(s>>1)-1?(s>>1)-h:h,o.isubn(a)):a=0,n[i]=a,o.iushrn(1)}return n},i.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,s=0;t.cmpn(-n)>0||e.cmpn(-s)>0;){var o,a,h=t.andln(3)+n&3,u=e.andln(3)+s&3;3===h&&(h=-1),3===u&&(u=-1),o=1&h?3!=(i=t.andln(7)+n&7)&&5!==i||2!==u?h:-h:0,r[0].push(o),a=1&u?3!=(i=e.andln(7)+s&7)&&5!==i||2!==h?u:-u:0,r[1].push(a),2*n===o+1&&(n=1-n),2*s===a+1&&(s=1-s),t.iushrn(1),e.iushrn(1)}return r},i.cachedProperty=function(t,e,r){var i=\"_\"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(t){return\"string\"==typeof t?i.toArray(t,\"hex\"):t},i.intFromLE=function(t){return new n(t,\"hex\",\"le\")}},8490:function(t,e,r){!function(t,e){\"use strict\";function i(t,e){if(!t)throw new Error(e||\"Assertion failed\")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&(\"le\"!==e&&\"be\"!==e||(r=e,e=10),this._init(t||0,e||10,r||\"be\"))}var o;\"object\"==typeof t?t.exports=s:e.BN=s,s.BN=s,s.wordSize=26;try{o=\"undefined\"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(9368).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,s=Math.min(t.length,r),o=e;o=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(t){return t instanceof s||null!==t&&\"object\"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if(\"number\"==typeof t)return this._initNumber(t,e,r);if(\"object\"==typeof t)return this._initArray(t,e,r);\"hex\"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;\"-\"===(t=t.toString().replace(/\\s+/g,\"\"))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if(\"le\"===r)for(n=0,s=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?\"\"};var f=[\"\",\"0\",\"00\",\"000\",\"0000\",\"00000\",\"000000\",\"0000000\",\"00000000\",\"000000000\",\"0000000000\",\"00000000000\",\"000000000000\",\"0000000000000\",\"00000000000000\",\"000000000000000\",\"0000000000000000\",\"00000000000000000\",\"000000000000000000\",\"0000000000000000000\",\"00000000000000000000\",\"000000000000000000000\",\"0000000000000000000000\",\"00000000000000000000000\",\"000000000000000000000000\",\"0000000000000000000000000\"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,h=o/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(s=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||\"hex\"===t){r=\"\";for(var n=0,s=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r=\"\";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r=\"0\"+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}i(!1,\"Base should be between 2 and 36\")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,\"Number can only safely store up to 53 bits\"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,\"byte array longer than desired length\"),i(s>0,\"Requested array length <= 0\"),this.strip();var o,a,h=\"le\"===e,u=new t(s),f=this.clone();if(h){for(a=0;!f.isZero();a++)o=f.andln(255),f.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i(\"number\"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i(\"number\"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,b=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,M=0|o[4],k=8191&M,S=M>>>13,x=0|o[5],A=8191&x,E=x>>>13,I=0|o[6],B=8191&I,T=I>>>13,P=0|o[7],R=8191&P,C=P>>>13,L=0|o[8],O=8191&L,j=L>>>13,N=0|o[9],U=8191&N,q=N>>>13,D=0|a[0],F=8191&D,H=D>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,Z=V>>>13,G=0|a[3],J=8191&G,Y=G>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((s=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,s=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((s=s+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,s=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,s=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((s=s+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,s=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,s=s+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((s=s+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,s=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,s=s+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((s=s+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,H))+Math.imul(T,F)|0,s=Math.imul(T,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,Z)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,s=s+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,s=s+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,st)|0))<<13)|0;u=((s=s+Math.imul(c,ot)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(C,F)|0,s=Math.imul(C,H),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,Z)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,s=s+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,s=s+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,it)|0,i=i+Math.imul(p,st)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((s=s+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,F),n=(n=Math.imul(O,H))+Math.imul(j,F)|0,s=Math.imul(j,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(C,W)|0,s=s+Math.imul(C,K)|0,i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,Z)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,Z)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,s=s+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,it)|0,i=i+Math.imul(y,st)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,s=s+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((s=s+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,H))+Math.imul(q,F)|0,s=Math.imul(q,H),i=i+Math.imul(O,W)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(j,W)|0,s=s+Math.imul(j,K)|0,i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(C,$)|0,s=s+Math.imul(C,Z)|0,i=i+Math.imul(B,J)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,s=s+Math.imul(S,it)|0,i=i+Math.imul(w,st)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,s=s+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,s=s+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((s=s+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,W),n=(n=Math.imul(U,K))+Math.imul(q,W)|0,s=Math.imul(q,K),i=i+Math.imul(O,$)|0,n=(n=n+Math.imul(O,Z)|0)+Math.imul(j,$)|0,s=s+Math.imul(j,Z)|0,i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(C,J)|0,s=s+Math.imul(C,Y)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(S,st)|0,s=s+Math.imul(S,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,s=s+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,s=s+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((s=s+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,Z))+Math.imul(q,$)|0,s=Math.imul(q,Z),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(j,J)|0,s=s+Math.imul(j,Y)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(C,Q)|0,s=s+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(A,st)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,s=s+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,s=s+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((s=s+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,J),n=(n=Math.imul(U,Y))+Math.imul(q,J)|0,s=Math.imul(q,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(j,Q)|0,s=s+Math.imul(j,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(C,rt)|0,s=s+Math.imul(C,it)|0,i=i+Math.imul(B,st)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,s=s+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,s=s+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((s=s+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(q,Q)|0,s=Math.imul(q,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(j,rt)|0,s=s+Math.imul(j,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,ot)|0,i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(T,ht)|0,s=s+Math.imul(T,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,s=s+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((s=s+Math.imul(S,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(q,rt)|0,s=Math.imul(q,it),i=i+Math.imul(O,st)|0,n=(n=n+Math.imul(O,ot)|0)+Math.imul(j,st)|0,s=s+Math.imul(j,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(C,ht)|0,s=s+Math.imul(C,ut)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,s=s+Math.imul(T,ct)|0;var Tt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((s=s+Math.imul(E,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,st),n=(n=Math.imul(U,ot))+Math.imul(q,st)|0,s=Math.imul(q,ot),i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(j,ht)|0,s=s+Math.imul(j,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(C,lt)|0,s=s+Math.imul(C,ct)|0;var Pt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((s=s+Math.imul(T,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ht),n=(n=Math.imul(U,ut))+Math.imul(q,ht)|0,s=Math.imul(q,ut),i=i+Math.imul(O,lt)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(j,lt)|0,s=s+Math.imul(j,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((s=s+Math.imul(C,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,lt),n=(n=Math.imul(U,ct))+Math.imul(q,lt)|0,s=Math.imul(q,ct);var Ct=(u+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((s=s+Math.imul(j,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Lt=(u+(i=Math.imul(U,pt))|0)+((8191&(n=(n=Math.imul(U,mt))+Math.imul(q,pt)|0))<<13)|0;return u=((s=Math.imul(q,mt))+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Bt,h[14]=Tt,h[15]=Pt,h[16]=Rt,h[17]=Ct,h[18]=Lt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),s.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-s|l>>>s,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i(\"number\"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,\"imaskn works only with positive numbers\"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i(\"number\"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&s}for(;n>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,h=i.length-n.length;if(\"mod\"!==e){(a=new s(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),\"div\"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),\"mod\"!==e&&(n=a.div.neg()),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),\"mod\"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?\"div\"===e?{div:this.divn(t.words[0]),mod:null}:\"mod\"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,\"div\",!1).div},s.prototype.mod=function(t){return this.divmod(t,\"mod\",!1).mod},s.prototype.umod=function(t){return this.divmod(t,\"mod\",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},s.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),h=new s(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(h)):(r.isub(e),a.isub(n),h.isub(o))}return{a,b:h,gcd:r.iushln(u)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return!(1&this.words[0])},s.prototype.isOdd=function(){return!(1&~this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i(\"number\"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,\"Number is too big\");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new k(t)},s.prototype.toRed=function(t){return i(!this.red,\"Already a number in reduction context\"),i(0===this.negative,\"red works only with positives\"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,\"fromRed works only with numbers in reduction context\"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,\"Already a number in reduction context\"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,\"redAdd works only with red numbers\"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,\"redIAdd works only with red numbers\"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,\"redSub works only with red numbers\"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,\"redISub works only with red numbers\"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,\"redShl works only with red numbers\"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,\"redSqr works only with red numbers\"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,\"redISqr works only with red numbers\"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,\"redSqrt works only with red numbers\"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,\"redInvm works only with red numbers\"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,\"redNeg works only with red numbers\"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,\"redPow(normalNum)\"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,\"k256\",\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\")}function w(){b.call(this,\"p224\",\"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\")}function _(){b.call(this,\"p192\",\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\")}function M(){b.call(this,\"25519\",\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\")}function k(t){if(\"string\"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),\"modulus must be greater than 1\"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,s=o}s>>>=22,t.words[n-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(y[t])return y[t];var e;if(\"k256\"===t)e=new v;else if(\"p224\"===t)e=new w;else if(\"p192\"===t)e=new _;else{if(\"p25519\"!==t)throw new Error(\"Unknown prime \"+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,\"red works only with positives\"),i(t.red,\"red works only with red numbers\")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),\"red works only with positives\"),i(t.red&&t.red===e.red,\"red works only with red numbers\")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},6611:(t,e,r)=>{var i=r(5606),n=r(3519),s=function(){},o=function(t,e,r){if(\"function\"==typeof e)return o(t,null,e);e||(e={}),r=n(r||s);var a=t._writableState,h=t._readableState,u=e.readable||!1!==e.readable&&t.readable,f=e.writable||!1!==e.writable&&t.writable,l=!1,c=function(){t.writable||d()},d=function(){f=!1,u||r.call(t)},p=function(){u=!1,f||r.call(t)},m=function(e){r.call(t,e?new Error(\"exited with error code: \"+e):null)},g=function(e){r.call(t,e)},y=function(){i.nextTick(b)},b=function(){if(!l)return(!u||h&&h.ended&&!h.destroyed)&&(!f||a&&a.ended&&!a.destroyed)?void 0:r.call(t,new Error(\"premature close\"))},v=function(){t.req.on(\"finish\",d)};return function(t){return t.setHeader&&\"function\"==typeof t.abort}(t)?(t.on(\"complete\",d),t.on(\"abort\",y),t.req?v():t.on(\"request\",v)):f&&!a&&(t.on(\"end\",c),t.on(\"close\",c)),function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length}(t)&&t.on(\"exit\",m),t.on(\"end\",p),t.on(\"finish\",d),!1!==e.error&&t.on(\"error\",g),t.on(\"close\",y),function(){l=!0,t.removeListener(\"complete\",d),t.removeListener(\"abort\",y),t.removeListener(\"request\",v),t.req&&t.req.removeListener(\"finish\",d),t.removeListener(\"end\",c),t.removeListener(\"close\",c),t.removeListener(\"finish\",d),t.removeListener(\"exit\",m),t.removeListener(\"end\",p),t.removeListener(\"error\",g),t.removeListener(\"close\",y)}};t.exports=o},6310:t=>{\"use strict\";function e(t,e){for(const r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}t.exports=function(t,r,i){if(!t||\"string\"==typeof t)throw new TypeError(\"Please pass an Error to err-code\");i||(i={}),\"object\"==typeof r&&(i=r,r=\"\"),r&&(i.code=r);try{return e(t,i)}catch(r){i.message=t.message,i.stack=t.stack;const n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),e(new n,i)}}},655:(t,e,r)=>{\"use strict\";var i=r(453)(\"%Object.defineProperty%\",!0)||!1;if(i)try{i({},\"a\",{value:1})}catch(t){i=!1}t.exports=i},1237:t=>{\"use strict\";t.exports=EvalError},9383:t=>{\"use strict\";t.exports=Error},9290:t=>{\"use strict\";t.exports=RangeError},9538:t=>{\"use strict\";t.exports=ReferenceError},8068:t=>{\"use strict\";t.exports=SyntaxError},9675:t=>{\"use strict\";t.exports=TypeError},5345:t=>{\"use strict\";t.exports=URIError},580:t=>{\"use strict\";var e=/[\"'&<>]/;t.exports=function(t){var r,i=\"\"+t,n=e.exec(i);if(!n)return i;var s=\"\",o=0,a=0;for(o=n.index;o{\"use strict\";var e,r=\"object\"==typeof Reflect?Reflect:null,i=r&&\"function\"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&\"function\"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var n=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(r,i){function n(r){t.removeListener(e,s),i(r)}function s(){\"function\"==typeof t.removeListener&&t.removeListener(\"error\",n),r([].slice.call(arguments))}m(t,e,s,{once:!0}),\"error\"!==e&&function(t,e,r){\"function\"==typeof t.on&&m(t,\"error\",e,{once:!0})}(t,n)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(t){if(\"function\"!=typeof t)throw new TypeError('The \"listener\" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function u(t,e,r,i){var n,s,o,u;if(a(r),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit(\"newListener\",e,r.listener?r.listener:r),s=t._events),o=s[e]),void 0===o)o=s[e]=r,++t._eventsCount;else if(\"function\"==typeof o?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=h(t))>0&&o.length>n&&!o.warned){o.warned=!0;var f=new Error(\"Possible EventEmitter memory leak detected. \"+o.length+\" \"+String(e)+\" listeners added. Use emitter.setMaxListeners() to increase limit\");f.name=\"MaxListenersExceededWarning\",f.emitter=t,f.type=e,f.count=o.length,u=f,console&&console.warn&&console.warn(u)}return t}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=f.bind(i);return n.listener=r,i.wrapFn=n,n}function c(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:\"function\"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var a=new Error(\"Unhandled error.\"+(o?\" (\"+o.message+\")\":\"\"));throw a.context=o,a}var h=s[t];if(void 0===h)return!1;if(\"function\"==typeof h)i(h,this,e);else{var u=h.length,f=p(h,u);for(r=0;r=0;s--)if(r[s]===e||r[s].listener===e){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return c(this,t,!0)},s.prototype.rawListeners=function(t){return c(this,t,!1)},s.listenerCount=function(t,e){return\"function\"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},s.prototype.listenerCount=d,s.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},8078:(t,e,r)=>{var i=r(2861).Buffer,n=r(8276);t.exports=function(t,e,r,s){if(i.isBuffer(t)||(t=i.from(t,\"binary\")),e&&(i.isBuffer(e)||(e=i.from(e,\"binary\")),8!==e.length))throw new RangeError(\"salt should be Buffer with 8 byte length\");for(var o=r/8,a=i.alloc(o),h=i.alloc(s||0),u=i.alloc(0);o>0||s>0;){var f=new n;f.update(u),f.update(t),e&&f.update(e),u=f.digest();var l=0;if(o>0){var c=a.length-o;l=Math.min(o,u.length),u.copy(a,c,0,l),o-=l}if(l0){var d=h.length-s,p=Math.min(s,u.length-l);u.copy(h,d,l,l+p),s-=p}}return u.fill(0),{key:a,iv:h}}},5809:t=>{t.exports=class{constructor(t){if(!(t>0)||t-1&t)throw new Error(\"Max size for a FixedFIFO should be a power of two\");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}clear(){this.top=this.btm=0,this.next=null,this.buffer.fill(void 0)}push(t){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){const t=this.buffer[this.btm];if(void 0!==t)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},6080:(t,e,r)=>{const i=r(5809);t.exports=class{constructor(t){this.hwm=t||16,this.head=new i(this.hwm),this.tail=this.head,this.length=0}clear(){this.head=this.tail,this.head.clear(),this.length=0}push(t){if(this.length++,!this.head.push(t)){const e=this.head;this.head=e.next=new i(2*this.head.buffer.length),this.head.push(t)}}shift(){0!==this.length&&this.length--;const t=this.tail.shift();if(void 0===t&&this.tail.next){const t=this.tail.next;return this.tail.next=null,this.tail=t,this.tail.shift()}return t}peek(){const t=this.tail.peek();return void 0===t&&this.tail.next?this.tail.next.peek():t}isEmpty(){return 0===this.length}}},3468:()=>{\"undefined\"!=typeof ReadableStream&&(ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=function({preventCancel:t}={}){const e=this.getReader(),r=this;let i=e.read();return{next(){const t=i;return i=e.read(),t},return:async n=>(await i,e.releaseLock(),t||r.cancel(),{done:!0,value:n}),async throw(t){throw await this.return(),t},[Symbol.asyncIterator](){return this}}}),ReadableStream.prototype.getIterator||(ReadableStream.prototype.getIterator=function({preventCancel:t}={}){return this[Symbol.asyncIterator]({preventCancel:t})}))},2682:(t,e,r)=>{\"use strict\";var i=r(9600),n=Object.prototype.toString,s=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){if(!i(e))throw new TypeError(\"iterator must be a function\");var o;arguments.length>=3&&(o=r),\"[object Array]\"===n.call(t)?function(t,e,r){for(var i=0,n=t.length;i{\"use strict\";var e=Object.prototype.toString,r=Math.max,i=function(t,e){for(var r=[],i=0;i{\"use strict\";var i=r(9353);t.exports=Function.prototype.bind||i},5064:t=>{t.exports=function(){if(\"undefined\"==typeof globalThis)return null;var t={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return t.RTCPeerConnection?t:null}},453:(t,e,r)=>{\"use strict\";var i,n=r(9383),s=r(1237),o=r(9290),a=r(9538),h=r(8068),u=r(9675),f=r(5345),l=Function,c=function(t){try{return l('\"use strict\"; return ('+t+\").constructor;\")()}catch(t){}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},\"\")}catch(t){d=null}var p=function(){throw new u},m=d?function(){try{return p}catch(t){try{return d(arguments,\"callee\").get}catch(t){return p}}}():p,g=r(4039)(),y=r(24)(),b=Object.getPrototypeOf||(y?function(t){return t.__proto__}:null),v={},w=\"undefined\"!=typeof Uint8Array&&b?b(Uint8Array):i,_={__proto__:null,\"%AggregateError%\":\"undefined\"==typeof AggregateError?i:AggregateError,\"%Array%\":Array,\"%ArrayBuffer%\":\"undefined\"==typeof ArrayBuffer?i:ArrayBuffer,\"%ArrayIteratorPrototype%\":g&&b?b([][Symbol.iterator]()):i,\"%AsyncFromSyncIteratorPrototype%\":i,\"%AsyncFunction%\":v,\"%AsyncGenerator%\":v,\"%AsyncGeneratorFunction%\":v,\"%AsyncIteratorPrototype%\":v,\"%Atomics%\":\"undefined\"==typeof Atomics?i:Atomics,\"%BigInt%\":\"undefined\"==typeof BigInt?i:BigInt,\"%BigInt64Array%\":\"undefined\"==typeof BigInt64Array?i:BigInt64Array,\"%BigUint64Array%\":\"undefined\"==typeof BigUint64Array?i:BigUint64Array,\"%Boolean%\":Boolean,\"%DataView%\":\"undefined\"==typeof DataView?i:DataView,\"%Date%\":Date,\"%decodeURI%\":decodeURI,\"%decodeURIComponent%\":decodeURIComponent,\"%encodeURI%\":encodeURI,\"%encodeURIComponent%\":encodeURIComponent,\"%Error%\":n,\"%eval%\":eval,\"%EvalError%\":s,\"%Float32Array%\":\"undefined\"==typeof Float32Array?i:Float32Array,\"%Float64Array%\":\"undefined\"==typeof Float64Array?i:Float64Array,\"%FinalizationRegistry%\":\"undefined\"==typeof FinalizationRegistry?i:FinalizationRegistry,\"%Function%\":l,\"%GeneratorFunction%\":v,\"%Int8Array%\":\"undefined\"==typeof Int8Array?i:Int8Array,\"%Int16Array%\":\"undefined\"==typeof Int16Array?i:Int16Array,\"%Int32Array%\":\"undefined\"==typeof Int32Array?i:Int32Array,\"%isFinite%\":isFinite,\"%isNaN%\":isNaN,\"%IteratorPrototype%\":g&&b?b(b([][Symbol.iterator]())):i,\"%JSON%\":\"object\"==typeof JSON?JSON:i,\"%Map%\":\"undefined\"==typeof Map?i:Map,\"%MapIteratorPrototype%\":\"undefined\"!=typeof Map&&g&&b?b((new Map)[Symbol.iterator]()):i,\"%Math%\":Math,\"%Number%\":Number,\"%Object%\":Object,\"%parseFloat%\":parseFloat,\"%parseInt%\":parseInt,\"%Promise%\":\"undefined\"==typeof Promise?i:Promise,\"%Proxy%\":\"undefined\"==typeof Proxy?i:Proxy,\"%RangeError%\":o,\"%ReferenceError%\":a,\"%Reflect%\":\"undefined\"==typeof Reflect?i:Reflect,\"%RegExp%\":RegExp,\"%Set%\":\"undefined\"==typeof Set?i:Set,\"%SetIteratorPrototype%\":\"undefined\"!=typeof Set&&g&&b?b((new Set)[Symbol.iterator]()):i,\"%SharedArrayBuffer%\":\"undefined\"==typeof SharedArrayBuffer?i:SharedArrayBuffer,\"%String%\":String,\"%StringIteratorPrototype%\":g&&b?b(\"\"[Symbol.iterator]()):i,\"%Symbol%\":g?Symbol:i,\"%SyntaxError%\":h,\"%ThrowTypeError%\":m,\"%TypedArray%\":w,\"%TypeError%\":u,\"%Uint8Array%\":\"undefined\"==typeof Uint8Array?i:Uint8Array,\"%Uint8ClampedArray%\":\"undefined\"==typeof Uint8ClampedArray?i:Uint8ClampedArray,\"%Uint16Array%\":\"undefined\"==typeof Uint16Array?i:Uint16Array,\"%Uint32Array%\":\"undefined\"==typeof Uint32Array?i:Uint32Array,\"%URIError%\":f,\"%WeakMap%\":\"undefined\"==typeof WeakMap?i:WeakMap,\"%WeakRef%\":\"undefined\"==typeof WeakRef?i:WeakRef,\"%WeakSet%\":\"undefined\"==typeof WeakSet?i:WeakSet};if(b)try{null.error}catch(t){var M=b(b(t));_[\"%Error.prototype%\"]=M}var k=function t(e){var r;if(\"%AsyncFunction%\"===e)r=c(\"async function () {}\");else if(\"%GeneratorFunction%\"===e)r=c(\"function* () {}\");else if(\"%AsyncGeneratorFunction%\"===e)r=c(\"async function* () {}\");else if(\"%AsyncGenerator%\"===e){var i=t(\"%AsyncGeneratorFunction%\");i&&(r=i.prototype)}else if(\"%AsyncIteratorPrototype%\"===e){var n=t(\"%AsyncGenerator%\");n&&b&&(r=b(n.prototype))}return _[e]=r,r},S={__proto__:null,\"%ArrayBufferPrototype%\":[\"ArrayBuffer\",\"prototype\"],\"%ArrayPrototype%\":[\"Array\",\"prototype\"],\"%ArrayProto_entries%\":[\"Array\",\"prototype\",\"entries\"],\"%ArrayProto_forEach%\":[\"Array\",\"prototype\",\"forEach\"],\"%ArrayProto_keys%\":[\"Array\",\"prototype\",\"keys\"],\"%ArrayProto_values%\":[\"Array\",\"prototype\",\"values\"],\"%AsyncFunctionPrototype%\":[\"AsyncFunction\",\"prototype\"],\"%AsyncGenerator%\":[\"AsyncGeneratorFunction\",\"prototype\"],\"%AsyncGeneratorPrototype%\":[\"AsyncGeneratorFunction\",\"prototype\",\"prototype\"],\"%BooleanPrototype%\":[\"Boolean\",\"prototype\"],\"%DataViewPrototype%\":[\"DataView\",\"prototype\"],\"%DatePrototype%\":[\"Date\",\"prototype\"],\"%ErrorPrototype%\":[\"Error\",\"prototype\"],\"%EvalErrorPrototype%\":[\"EvalError\",\"prototype\"],\"%Float32ArrayPrototype%\":[\"Float32Array\",\"prototype\"],\"%Float64ArrayPrototype%\":[\"Float64Array\",\"prototype\"],\"%FunctionPrototype%\":[\"Function\",\"prototype\"],\"%Generator%\":[\"GeneratorFunction\",\"prototype\"],\"%GeneratorPrototype%\":[\"GeneratorFunction\",\"prototype\",\"prototype\"],\"%Int8ArrayPrototype%\":[\"Int8Array\",\"prototype\"],\"%Int16ArrayPrototype%\":[\"Int16Array\",\"prototype\"],\"%Int32ArrayPrototype%\":[\"Int32Array\",\"prototype\"],\"%JSONParse%\":[\"JSON\",\"parse\"],\"%JSONStringify%\":[\"JSON\",\"stringify\"],\"%MapPrototype%\":[\"Map\",\"prototype\"],\"%NumberPrototype%\":[\"Number\",\"prototype\"],\"%ObjectPrototype%\":[\"Object\",\"prototype\"],\"%ObjProto_toString%\":[\"Object\",\"prototype\",\"toString\"],\"%ObjProto_valueOf%\":[\"Object\",\"prototype\",\"valueOf\"],\"%PromisePrototype%\":[\"Promise\",\"prototype\"],\"%PromiseProto_then%\":[\"Promise\",\"prototype\",\"then\"],\"%Promise_all%\":[\"Promise\",\"all\"],\"%Promise_reject%\":[\"Promise\",\"reject\"],\"%Promise_resolve%\":[\"Promise\",\"resolve\"],\"%RangeErrorPrototype%\":[\"RangeError\",\"prototype\"],\"%ReferenceErrorPrototype%\":[\"ReferenceError\",\"prototype\"],\"%RegExpPrototype%\":[\"RegExp\",\"prototype\"],\"%SetPrototype%\":[\"Set\",\"prototype\"],\"%SharedArrayBufferPrototype%\":[\"SharedArrayBuffer\",\"prototype\"],\"%StringPrototype%\":[\"String\",\"prototype\"],\"%SymbolPrototype%\":[\"Symbol\",\"prototype\"],\"%SyntaxErrorPrototype%\":[\"SyntaxError\",\"prototype\"],\"%TypedArrayPrototype%\":[\"TypedArray\",\"prototype\"],\"%TypeErrorPrototype%\":[\"TypeError\",\"prototype\"],\"%Uint8ArrayPrototype%\":[\"Uint8Array\",\"prototype\"],\"%Uint8ClampedArrayPrototype%\":[\"Uint8ClampedArray\",\"prototype\"],\"%Uint16ArrayPrototype%\":[\"Uint16Array\",\"prototype\"],\"%Uint32ArrayPrototype%\":[\"Uint32Array\",\"prototype\"],\"%URIErrorPrototype%\":[\"URIError\",\"prototype\"],\"%WeakMapPrototype%\":[\"WeakMap\",\"prototype\"],\"%WeakSetPrototype%\":[\"WeakSet\",\"prototype\"]},x=r(6743),A=r(9957),E=x.call(Function.call,Array.prototype.concat),I=x.call(Function.apply,Array.prototype.splice),B=x.call(Function.call,String.prototype.replace),T=x.call(Function.call,String.prototype.slice),P=x.call(Function.call,RegExp.prototype.exec),R=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,C=/\\\\(\\\\)?/g,L=function(t,e){var r,i=t;if(A(S,i)&&(i=\"%\"+(r=S[i])[0]+\"%\"),A(_,i)){var n=_[i];if(n===v&&(n=k(i)),void 0===n&&!e)throw new u(\"intrinsic \"+t+\" exists, but is not available. Please file an issue!\");return{alias:r,name:i,value:n}}throw new h(\"intrinsic \"+t+\" does not exist!\")};t.exports=function(t,e){if(\"string\"!=typeof t||0===t.length)throw new u(\"intrinsic name must be a non-empty string\");if(arguments.length>1&&\"boolean\"!=typeof e)throw new u('\"allowMissing\" argument must be a boolean');if(null===P(/^%?[^%]*%?$/,t))throw new h(\"`%` may not be present anywhere but at the beginning and end of the intrinsic name\");var r=function(t){var e=T(t,0,1),r=T(t,-1);if(\"%\"===e&&\"%\"!==r)throw new h(\"invalid intrinsic syntax, expected closing `%`\");if(\"%\"===r&&\"%\"!==e)throw new h(\"invalid intrinsic syntax, expected opening `%`\");var i=[];return B(t,R,(function(t,e,r,n){i[i.length]=r?B(n,C,\"$1\"):e||t})),i}(t),i=r.length>0?r[0]:\"\",n=L(\"%\"+i+\"%\",e),s=n.name,o=n.value,a=!1,f=n.alias;f&&(i=f[0],I(r,E([0,1],f)));for(var l=1,c=!0;l=r.length){var y=d(o,p);o=(c=!!y)&&\"get\"in y&&!(\"originalValue\"in y.get)?y.get:o[p]}else c=A(o,p),o=o[p];c&&!a&&(_[s]=o)}}return o}},5795:(t,e,r)=>{\"use strict\";var i=r(453)(\"%Object.getOwnPropertyDescriptor%\",!0);if(i)try{i([],\"length\")}catch(t){i=null}t.exports=i},592:(t,e,r)=>{\"use strict\";var i=r(655),n=function(){return!!i};n.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],\"length\",{value:1}).length}catch(t){return!0}},t.exports=n},24:t=>{\"use strict\";var e={__proto__:null,foo:{}},r=Object;t.exports=function(){return{__proto__:e}.foo===e.foo&&!(e instanceof r)}},4039:(t,e,r)=>{\"use strict\";var i=\"undefined\"!=typeof Symbol&&Symbol,n=r(1333);t.exports=function(){return\"function\"==typeof i&&\"function\"==typeof Symbol&&\"symbol\"==typeof i(\"foo\")&&\"symbol\"==typeof Symbol(\"bar\")&&n()}},1333:t=>{\"use strict\";t.exports=function(){if(\"function\"!=typeof Symbol||\"function\"!=typeof Object.getOwnPropertySymbols)return!1;if(\"symbol\"==typeof Symbol.iterator)return!0;var t={},e=Symbol(\"test\"),r=Object(e);if(\"string\"==typeof e)return!1;if(\"[object Symbol]\"!==Object.prototype.toString.call(e))return!1;if(\"[object Symbol]\"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if(\"function\"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if(\"function\"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var i=Object.getOwnPropertySymbols(t);if(1!==i.length||i[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(\"function\"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},9092:(t,e,r)=>{\"use strict\";var i=r(1333);t.exports=function(){return i()&&!!Symbol.toStringTag}},4729:(t,e,r)=>{\"use strict\";var i=r(2861).Buffer,n=r(8310).Transform;function s(t){n.call(this),this._block=i.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(6698)(s,n),s.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(t){i=t}r(i)},s.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},s.prototype.update=function(t,e){if(function(t,e){if(!i.isBuffer(t)&&\"string\"!=typeof t)throw new TypeError(\"Data must be a string or a buffer\")}(t),this._finalized)throw new Error(\"Digest already called\");i.isBuffer(t)||(t=i.from(t,e));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var s=this._blockOffset;s0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},s.prototype._update=function(){throw new Error(\"_update is not implemented\")},s.prototype.digest=function(t){if(this._finalized)throw new Error(\"Digest already called\");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},s.prototype._digest=function(){throw new Error(\"_digest is not implemented\")},t.exports=s},7952:(t,e,r)=>{var i=e;i.utils=r(7426),i.common=r(6166),i.sha=r(6229),i.ripemd=r(6784),i.hmac=r(8948),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},6166:(t,e,r)=>{\"use strict\";var i=r(7426),n=r(3349);function s(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian=\"big\",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=s,s.prototype.update=function(t,e){if(t=i.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,s=8;s{\"use strict\";var i=r(7426),n=r(3349);function s(t,e,r){if(!(this instanceof s))return new s(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(e,r))}t.exports=s,s.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),n(t.length<=this.blockSize);for(var e=t.length;e{\"use strict\";var i=r(7426),n=r(6166),s=i.rotl32,o=i.sum32,a=i.sum32_3,h=i.sum32_4,u=n.BlockHash;function f(){if(!(this instanceof f))return new f;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian=\"little\"}function l(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function c(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}i.inherits(f,u),e.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],u=this.h[3],f=this.h[4],b=r,v=i,w=n,_=u,M=f,k=0;k<80;k++){var S=o(s(h(r,l(k,i,n,u),t[p[k]+e],c(k)),g[k]),f);r=f,f=u,u=s(n,10),n=i,i=S,S=o(s(h(b,l(79-k,v,w,_),t[m[k]+e],d(k)),y[k]),M),b=M,M=_,_=s(w,10),w=v,v=S}S=a(this.h[1],n,_),this.h[1]=a(this.h[2],u,M),this.h[2]=a(this.h[3],f,b),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],i,w),this.h[0]=S},f.prototype._digest=function(t){return\"hex\"===t?i.toHex32(this.h,\"little\"):i.split32(this.h,\"little\")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},6229:(t,e,r)=>{\"use strict\";e.sha1=r(3917),e.sha224=r(7714),e.sha256=r(2287),e.sha384=r(1911),e.sha512=r(7766)},3917:(t,e,r)=>{\"use strict\";var i=r(7426),n=r(6166),s=r(6225),o=i.rotl32,a=i.sum32,h=i.sum32_5,u=s.ft_1,f=n.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function c(){if(!(this instanceof c))return new c;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(c,f),t.exports=c,c.blockSize=512,c.outSize=160,c.hmacStrength=80,c.padLength=64,c.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i{\"use strict\";var i=r(7426),n=r(2287);function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(s,n),t.exports=s,s.blockSize=512,s.outSize=224,s.hmacStrength=192,s.padLength=64,s.prototype._digest=function(t){return\"hex\"===t?i.toHex32(this.h.slice(0,7),\"big\"):i.split32(this.h.slice(0,7),\"big\")}},2287:(t,e,r)=>{\"use strict\";var i=r(7426),n=r(6166),s=r(6225),o=r(3349),a=i.sum32,h=i.sum32_4,u=i.sum32_5,f=s.ch32,l=s.maj32,c=s.s0_256,d=s.s1_256,p=s.g0_256,m=s.g1_256,g=n.BlockHash,y=[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];function b(){if(!(this instanceof b))return new b;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}i.inherits(b,g),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i{\"use strict\";var i=r(7426),n=r(7766);function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(s,n),t.exports=s,s.blockSize=1024,s.outSize=384,s.hmacStrength=192,s.padLength=128,s.prototype._digest=function(t){return\"hex\"===t?i.toHex32(this.h.slice(0,12),\"big\"):i.split32(this.h.slice(0,12),\"big\")}},7766:(t,e,r)=>{\"use strict\";var i=r(7426),n=r(6166),s=r(3349),o=i.rotr64_hi,a=i.rotr64_lo,h=i.shr64_hi,u=i.shr64_lo,f=i.sum64,l=i.sum64_hi,c=i.sum64_lo,d=i.sum64_4_hi,p=i.sum64_4_lo,m=i.sum64_5_hi,g=i.sum64_5_lo,y=n.BlockHash,b=[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];function v(){if(!(this instanceof v))return new v;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function w(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function _(t,e,r,i,n,s){var o=e&i^~e&s;return o<0&&(o+=4294967296),o}function M(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function k(t,e,r,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function S(t,e){var r=o(t,e,28)^o(e,t,2)^o(e,t,7);return r<0&&(r+=4294967296),r}function x(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function A(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function E(t,e){var r=o(t,e,1)^o(t,e,8)^h(t,e,7);return r<0&&(r+=4294967296),r}function I(t,e){var r=a(t,e,1)^a(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function B(t,e){var r=a(t,e,19)^a(e,t,29)^u(t,e,6);return r<0&&(r+=4294967296),r}i.inherits(v,y),t.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i{\"use strict\";var i=r(7426).rotr32;function n(t,e,r){return t&e^~t&r}function s(t,e,r){return t&e^t&r^e&r}function o(t,e,r){return t^e^r}e.ft_1=function(t,e,r,i){return 0===t?n(e,r,i):1===t||3===t?o(e,r,i):2===t?s(e,r,i):void 0},e.ch32=n,e.maj32=s,e.p32=o,e.s0_256=function(t){return i(t,2)^i(t,13)^i(t,22)},e.s1_256=function(t){return i(t,6)^i(t,11)^i(t,25)},e.g0_256=function(t){return i(t,7)^i(t,18)^t>>>3},e.g1_256=function(t){return i(t,17)^i(t,19)^t>>>10}},7426:(t,e,r)=>{\"use strict\";var i=r(3349),n=r(6698);function s(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?\"0\"+t:t}function h(t){return 7===t.length?\"0\"+t:6===t.length?\"00\"+t:5===t.length?\"000\"+t:4===t.length?\"0000\"+t:3===t.length?\"00000\"+t:2===t.length?\"000000\"+t:1===t.length?\"0000000\"+t:t}e.inherits=n,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(\"string\"==typeof t)if(e){if(\"hex\"===e)for((t=t.replace(/[^a-z0-9]+/gi,\"\")).length%2!=0&&(t=\"0\"+t),n=0;n>6|192,r[i++]=63&o|128):s(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n>>0}return o},e.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=255&s):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=255&s)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},e.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},e.sum64=function(t,e,r,i){var n=t[e],s=i+t[e+1]>>>0,o=(s>>0,t[e+1]=s},e.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,r,i){return e+i>>>0},e.sum64_4_hi=function(t,e,r,i,n,s,o,a){var h=0,u=e;return h+=(u=u+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,i,n,s,o,a){return e+i+s+a>>>0},e.sum64_5_hi=function(t,e,r,i,n,s,o,a,h,u){var f=0,l=e;return f+=(l=l+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,i,n,s,o,a,h,u){return e+i+s+a+u>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},9957:(t,e,r)=>{\"use strict\";var i=Function.prototype.call,n=Object.prototype.hasOwnProperty,s=r(6743);t.exports=s.call(i,n)},2723:(t,e,r)=>{\"use strict\";var i=r(7952),n=r(4367),s=r(3349);function o(t){if(!(this instanceof o))return new o(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=n.toArray(t.entropy,t.entropyEnc||\"hex\"),r=n.toArray(t.nonce,t.nonceEnc||\"hex\"),i=n.toArray(t.pers,t.persEnc||\"hex\");s(e.length>=this.minEntropy/8,\"Not enough entropy. Minimum is: \"+this.minEntropy+\" bits\"),this._init(e,r,i)}t.exports=o,o.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,\"Not enough entropy. Minimum is: \"+this.minEntropy+\" bits\"),this._update(t.concat(r||[])),this._reseed=1},o.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error(\"Reseed is required\");\"string\"!=typeof e&&(i=r,r=e,e=null),r&&(r=n.toArray(r,i||\"hex\"),this._update(r));for(var s=[];s.length{\"use strict\";r.r(e),r.d(e,{deleteDB:()=>g,openDB:()=>m,unwrap:()=>p,wrap:()=>d});const i=(t,e)=>e.some((e=>t instanceof e));let n,s;const o=new WeakMap,a=new WeakMap,h=new WeakMap,u=new WeakMap,f=new WeakMap;let l={get(t,e,r){if(t instanceof IDBTransaction){if(\"done\"===e)return a.get(t);if(\"objectStoreNames\"===e)return t.objectStoreNames||h.get(t);if(\"store\"===e)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return d(t[e])},set:(t,e,r)=>(t[e]=r,!0),has:(t,e)=>t instanceof IDBTransaction&&(\"done\"===e||\"store\"===e)||e in t};function c(t){return\"function\"==typeof t?(e=t)!==IDBDatabase.prototype.transaction||\"objectStoreNames\"in IDBTransaction.prototype?(s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(p(this),t),d(o.get(this))}:function(...t){return d(e.apply(p(this),t))}:function(t,...r){const i=e.call(p(this),t,...r);return h.set(i,t.sort?t.sort():[t]),d(i)}:(t instanceof IDBTransaction&&function(t){if(a.has(t))return;const e=new Promise(((e,r)=>{const i=()=>{t.removeEventListener(\"complete\",n),t.removeEventListener(\"error\",s),t.removeEventListener(\"abort\",s)},n=()=>{e(),i()},s=()=>{r(t.error||new DOMException(\"AbortError\",\"AbortError\")),i()};t.addEventListener(\"complete\",n),t.addEventListener(\"error\",s),t.addEventListener(\"abort\",s)}));a.set(t,e)}(t),i(t,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,l):t);var e}function d(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,r)=>{const i=()=>{t.removeEventListener(\"success\",n),t.removeEventListener(\"error\",s)},n=()=>{e(d(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener(\"success\",n),t.addEventListener(\"error\",s)}));return e.then((e=>{e instanceof IDBCursor&&o.set(e,t)})).catch((()=>{})),f.set(e,t),e}(t);if(u.has(t))return u.get(t);const e=c(t);return e!==t&&(u.set(t,e),f.set(e,t)),e}const p=t=>f.get(t);function m(t,e,{blocked:r,upgrade:i,blocking:n,terminated:s}={}){const o=indexedDB.open(t,e),a=d(o);return i&&o.addEventListener(\"upgradeneeded\",(t=>{i(d(o.result),t.oldVersion,t.newVersion,d(o.transaction))})),r&&o.addEventListener(\"blocked\",(()=>r())),a.then((t=>{s&&t.addEventListener(\"close\",(()=>s())),n&&t.addEventListener(\"versionchange\",(()=>n()))})).catch((()=>{})),a}function g(t,{blocked:e}={}){const r=indexedDB.deleteDatabase(t);return e&&r.addEventListener(\"blocked\",(()=>e())),d(r).then((()=>{}))}const y=[\"get\",\"getKey\",\"getAll\",\"getAllKeys\",\"count\"],b=[\"put\",\"add\",\"delete\",\"clear\"],v=new Map;function w(t,e){if(!(t instanceof IDBDatabase)||e in t||\"string\"!=typeof e)return;if(v.get(e))return v.get(e);const r=e.replace(/FromIndex$/,\"\"),i=e!==r,n=b.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!n&&!y.includes(r))return;const s=async function(t,...e){const s=this.transaction(t,n?\"readwrite\":\"readonly\");let o=s.store;return i&&(o=o.index(e.shift())),(await Promise.all([o[r](...e),n&&s.done]))[0]};return v.set(e,s),s}var _;_=l,l={..._,get:(t,e,r)=>w(t,e)||_.get(t,e,r),has:(t,e)=>!!w(t,e)||_.has(t,e)}},251:(t,e)=>{e.read=function(t,e,r,i,n){var s,o,a=8*n-i-1,h=(1<>1,f=-7,l=r?n-1:0,c=r?-1:1,d=t[e+l];for(l+=c,s=d&(1<<-f)-1,d>>=-f,f+=a;f>0;s=256*s+t[e+l],l+=c,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=i;f>0;o=256*o+t[e+l],l+=c,f-=8);if(0===s)s=1-u;else{if(s===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),s-=u}return(d?-1:1)*o*Math.pow(2,s-i)},e.write=function(t,e,r,i,n,s){var o,a,h,u=8*s-n-1,f=(1<>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:s-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+l>=1?c/h:c*Math.pow(2,1-l))*h>=2&&(o++,h/=2),o+l>=f?(a=0,o=f):o+l>=1?(a=(e*h-1)*Math.pow(2,n),o+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=255&a,d+=p,a/=256,n-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*m}},3714:(t,e,r)=>{const i=r(9596);t.exports=class{constructor(t){if(this.store=t,this.chunkLength=t.chunkLength,!this.store||!this.store.get||!this.store.put)throw new Error(\"First argument must be abstract-chunk-store compliant\");this.mem=[]}put(t,e,r=(()=>{})){this.mem[t]=e,this.store.put(t,e,(e=>{this.mem[t]=null,r(e)}))}get(t,e,r=(()=>{})){if(\"function\"==typeof e)return this.get(t,null,e);let n=this.mem[t];if(!n)return this.store.get(t,e,r);e||(e={});const s=e.offset||0,o=e.length||n.length-s;0===s&&o===n.length||(n=n.slice(s,o+s)),i((()=>r(null,n)))}close(t=(()=>{})){this.store.close(t)}destroy(t=(()=>{})){this.store.destroy(t)}}},6698:t=>{\"function\"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},7244:(t,e,r)=>{\"use strict\";var i=r(9092)(),n=r(8075)(\"Object.prototype.toString\"),s=function(t){return!(i&&t&&\"object\"==typeof t&&Symbol.toStringTag in t)&&\"[object Arguments]\"===n(t)},o=function(t){return!!s(t)||null!==t&&\"object\"==typeof t&&\"number\"==typeof t.length&&t.length>=0&&\"[object Array]\"!==n(t)&&\"[object Function]\"===n(t.callee)},a=function(){return s(arguments)}();s.isLegacyArguments=o,t.exports=a?s:o},9600:t=>{\"use strict\";var e,r,i=Function.prototype.toString,n=\"object\"==typeof Reflect&&null!==Reflect&&Reflect.apply;if(\"function\"==typeof n&&\"function\"==typeof Object.defineProperty)try{e=Object.defineProperty({},\"length\",{get:function(){throw r}}),r={},n((function(){throw 42}),null,e)}catch(t){t!==r&&(n=null)}else n=null;var s=/^\\s*class\\b/,o=function(t){try{var e=i.call(t);return s.test(e)}catch(t){return!1}},a=function(t){try{return!o(t)&&(i.call(t),!0)}catch(t){return!1}},h=Object.prototype.toString,u=\"function\"==typeof Symbol&&!!Symbol.toStringTag,f=!(0 in[,]),l=function(){return!1};if(\"object\"==typeof document){var c=document.all;h.call(c)===h.call(document.all)&&(l=function(t){if((f||!t)&&(void 0===t||\"object\"==typeof t))try{var e=h.call(t);return(\"[object HTMLAllCollection]\"===e||\"[object HTML document.all class]\"===e||\"[object HTMLCollection]\"===e||\"[object Object]\"===e)&&null==t(\"\")}catch(t){}return!1})}t.exports=n?function(t){if(l(t))return!0;if(!t)return!1;if(\"function\"!=typeof t&&\"object\"!=typeof t)return!1;try{n(t,null,e)}catch(t){if(t!==r)return!1}return!o(t)&&a(t)}:function(t){if(l(t))return!0;if(!t)return!1;if(\"function\"!=typeof t&&\"object\"!=typeof t)return!1;if(u)return a(t);if(o(t))return!1;var e=h.call(t);return!(\"[object Function]\"!==e&&\"[object GeneratorFunction]\"!==e&&!/^\\[object HTML/.test(e))&&a(t)}},8184:(t,e,r)=>{\"use strict\";var i,n=Object.prototype.toString,s=Function.prototype.toString,o=/^\\s*(?:function)?\\*/,a=r(9092)(),h=Object.getPrototypeOf;t.exports=function(t){if(\"function\"!=typeof t)return!1;if(o.test(s.call(t)))return!0;if(!a)return\"[object GeneratorFunction]\"===n.call(t);if(!h)return!1;if(void 0===i){var e=function(){if(!a)return!1;try{return Function(\"return function*() {}\")()}catch(t){}}();i=!!e&&h(e)}return h(t)===i}},5680:(t,e,r)=>{\"use strict\";var i=r(5767);t.exports=function(t){return!!i(t)}},4634:t=>{var e={}.toString;t.exports=Array.isArray||function(t){return\"[object Array]\"==e.call(t)}},405:t=>{t.exports=async function*(t){for(let e of t)\"function\"==typeof e&&(e=e()),yield*e}},9971:(t,e,r)=>{\"use strict\";const i=r(3209),{EventEmitter:n}=r(7007);function s(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0,i=t.length;re.vectorClock?t:e}static distance(t,e){let r=0,i=0;const n=Math.min(t.length,e.length),s=Math.max(t.length,e.length);for(;i=0?(this._update(r,i,t),this):r.contacts.length0&&r.length[this.distance(e.id,t),e])).sort(((t,e)=>t[0]-e[0])).slice(0,e).map((t=>t[1]))}count(){let t=0;for(const e=[this.root];e.length>0;){const r=e.pop();null===r.contacts?e.push(r.right,r.left):t+=r.contacts.length}return t}_determineNode(t,e,r){const i=r>>3,n=r%8;return e.length<=i&&0!==n?t.left:e[i]&1<<7-n?t.right:t.left}get(t){o(\"id\",t);let e=0,r=this.root;for(;null===r.contacts;)r=this._determineNode(r,t,e++);const i=this._indexOf(r,t);return i>=0?r.contacts[i]:null}_indexOf(t,e){for(let r=0;r=0){const t=r.contacts.splice(i,1)[0];this.emit(\"removed\",t)}return this}_split(t,e){t.left={contacts:[],dontSplit:!1,left:null,right:null},t.right={contacts:[],dontSplit:!1,left:null,right:null};for(const r of t.contacts)this._determineNode(t,r.id,e).contacts.push(r);t.contacts=null;const r=this._determineNode(t,this.localNodeId,e);(t.left===r?t.right:t.left).dontSplit=!0}toArray(){let t=[];for(const e=[this.root];e.length>0;){const r=e.pop();null===r.contacts?e.push(r.right,r.left):t=t.concat(r.contacts)}return t}*toIterable(){for(const t=[this.root];t.length>0;){const e=t.pop();null===e.contacts?t.push(e.right,e.left):yield*e.contacts}}_update(t,e,r){if(!s(t.contacts[e].id,r.id))throw new Error(\"wrong index for _update\");const i=t.contacts[e],n=this.arbiter(i,r);n===i&&i!==r||(t.contacts.splice(e,1),t.contacts.push(n),this.emit(\"updated\",i,n))}}t.exports=a},7558:(t,e,r)=>{var i=r(8287).Buffer,n=r(2205),s=r(8394),o=r(8849).isIP,a=r(8173),h=r(537),u=r(7007),f=new Error(\"Query timed out\");f.code=\"ETIMEDOUT\";var l=new Error(\"Unexpected node id\");function c(t){if(!(this instanceof c))return new c(t);t||(t={});var e=this;this.timeout=t.timeout||2e3,this.inflight=0,this.destroyed=!1,this.isIP=t.isIP||o,this.socket=t.socket||n.createSocket(\"udp4\"),this.socket.on(\"message\",(function(t,r){if(!e.destroyed&&r.port){try{var n=s.decode(t)}catch(t){return e.emit(\"warning\",t)}var o=n&&n.y&&n.y.toString();if(\"r\"===o||\"e\"===o){if(!i.isBuffer(n.t))return;try{var a=n.t.readUInt16BE(0)}catch(c){return e.emit(\"warning\",c)}var h=e._ids.indexOf(a);if(-1===h||0===a)return e.emit(\"response\",n,r),void e.emit(\"warning\",new Error(\"Unexpected transaction id: \"+a));var u=e._reqs[h];if(u.peer.host!==r.address)return e.emit(\"response\",n,r),void e.emit(\"warning\",new Error(\"Out of order response\"));if(e._ids[h]=0,e._reqs[h]=null,e.inflight--,\"e\"===o){var f=Array.isArray(n.e),c=new Error(f?n.e.join(\" \"):\"Unknown error\");return c.code=f&&n.e.length&&\"number\"==typeof n.e[0]?n.e[0]:0,u.callback(c,n,r,u.message),e.emit(\"update\"),void e.emit(\"postupdate\")}var d=n.r&&n.r.id;if(u.peer&&u.peer.id&&d&&!u.peer.id.equals(d))return u.callback(l,null,r),e.emit(\"update\"),void e.emit(\"postupdate\");u.callback(null,n,r,u.message),e.emit(\"update\"),e.emit(\"postupdate\"),e.emit(\"response\",n,r)}else\"q\"===o?e.emit(\"query\",n,r):e.emit(\"warning\",new Error(\"Unknown type: \"+o))}})),this.socket.on(\"error\",(function(t){\"EACCES\"===t.code||\"EADDRINUSE\"===t.code?e.emit(\"error\",t):e.emit(\"warning\",t)})),this.socket.on(\"listening\",(function(){e.emit(\"listening\")})),this._tick=0,this._ids=[],this._reqs=[],this._timer=setInterval((function(){var t=e.inflight;if(t)for(var r=0;r-1&&this._cancel(r,e)},c.prototype._cancel=function(t,e){var r=this._reqs[t];this._ids[t]=0,this._reqs[t]=null,r&&(this.inflight--,r.callback(e||new Error(\"Query was cancelled\"),null,r.peer),this.emit(\"update\"),this.emit(\"postupdate\"))},c.prototype._resolveAndQuery=function(t,e,r){var i=this;a.lookup(t.host,(function(n,s){return n?r(n):i.destroyed?r(new Error(\"k-rpc-socket is destroyed\")):void i.query({host:s,port:t.port},e,r)}))}},4662:(t,e,r)=>{var i=r(8287).Buffer;function n(t,e,r){let i=0,n=1;for(let s=e;s=48)i=10*i+(r-48);else if(s!==e||43!==r){if(s!==e||45!==r){if(46===r)break;throw new Error(\"not a number: buffer[\"+s+\"] = \"+r)}n=-1}}return i*n}function s(t,e,r,n){return null==t||0===t.length?null:(\"number\"!=typeof e&&null==n&&(n=e,e=void 0),\"number\"!=typeof r&&null==n&&(n=r,r=void 0),s.position=0,s.encoding=n||null,s.data=i.isBuffer(t)?t.slice(e,r):i.from(t),s.bytes=s.data.length,s.next())}s.bytes=0,s.position=0,s.data=null,s.encoding=null,s.next=function(){switch(s.data[s.position]){case 100:return s.dictionary();case 108:return s.list();case 105:return s.integer();default:return s.buffer()}},s.find=function(t){let e=s.position;const r=s.data.length,i=s.data;for(;e{var i=r(8287).Buffer;const{getType:n}=r(7972);function s(t,e,r){const n=[];let o=null;return s._encode(n,t),o=i.concat(n),s.bytes=o.length,i.isBuffer(e)?(o.copy(e,r),e):o}s.bytes=-1,s._floatConversionDetected=!1,s._encode=function(t,e){if(null!=e)switch(n(e)){case\"buffer\":s.buffer(t,e);break;case\"object\":s.dict(t,e);break;case\"map\":s.dictMap(t,e);break;case\"array\":s.list(t,e);break;case\"set\":s.listSet(t,e);break;case\"string\":s.string(t,e);break;case\"number\":case\"boolean\":s.number(t,e);break;case\"arraybufferview\":s.buffer(t,i.from(e.buffer,e.byteOffset,e.byteLength));break;case\"arraybuffer\":s.buffer(t,i.from(e))}};const o=i.from(\"e\"),a=i.from(\"d\"),h=i.from(\"l\");s.buffer=function(t,e){t.push(i.from(e.length+\":\"),e)},s.string=function(t,e){t.push(i.from(i.byteLength(e)+\":\"+e))},s.number=function(t,e){const r=2147483648,n=(e/r|0)*r+(e%r|0);t.push(i.from(\"i\"+n+\"e\")),n===e||s._floatConversionDetected||(s._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value \"'+e+'\":','Bencoding only defines support for integers, value was converted to \"'+n+'\"'),console.trace())},s.dict=function(t,e){t.push(a);let r,i=0;const n=Object.keys(e).sort(),h=n.length;for(;i{var i=r(8287).Buffer;const{digitCount:n,getType:s}=r(7972);t.exports=function t(e){if(null==e)return 0;const r=s(e);switch(r){case\"buffer\":return n(e.length)+1+e.length;case\"arraybufferview\":return function(t){const e=t.byteLength-t.byteOffset;return n(e)+1+e}(e);case\"string\":return function(t){const e=i.byteLength(t);return n(e)+1+e}(e);case\"array\":case\"set\":return function(e){let r=2;for(const i of e)r+=t(i);return r}(e);case\"number\":return 1+n(Math.floor(e))+1;case\"bigint\":return 1+e.toString().length+1;case\"object\":return function(e){let r=2;const s=Object.keys(e);for(let o=0;o{const i=t.exports;i.encode=r(8746),i.decode=r(4662),i.byteLength=i.encodingLength=r(6814)},7972:(t,e,r)=>{var i=r(8287).Buffer;const n=t.exports;n.digitCount=function(t){const e=t<0?1:0;return t=Math.abs(Number(t||1)),Math.floor(Math.log10(t))+1+e},n.getType=function(t){return i.isBuffer(t)?\"buffer\":ArrayBuffer.isView(t)?\"arraybufferview\":Array.isArray(t)?\"array\":t instanceof Number?\"number\":t instanceof Boolean?\"boolean\":t instanceof Set?\"set\":t instanceof Map?\"map\":t instanceof String?\"string\":t instanceof ArrayBuffer?\"arraybuffer\":typeof t}},4988:(t,e,r)=>{var i=r(5606),n=r(8287).Buffer,s=r(7558),o=r(9971),a=r(7007),h=r(3209),u=r(537),f=[{host:\"router.bittorrent.com\",port:6881},{host:\"router.utorrent.com\",port:6881},{host:\"dht.transmissionbt.com\",port:6881}];function l(t){if(!(this instanceof l))return new l(t);t||(t={});var e,r=this;function i(t,e){if(t&&c(t.id,r._idLength)&&!t.id.equals(r.id)){var i=r.nodes.get(t.id);if(i)return void(i.seen=Date.now());r._addNode({id:t.id,host:e.address||e.host,port:e.port,distance:0,seen:Date.now()})}}this._idLength=t.idLength||20,this.id=function(t){if(n.isBuffer(t))return t;if(ArrayBuffer.isView(t))return n.from(t.buffer,t.byteOffset,t.byteLength);if(\"string\"==typeof t)return n.from(t,\"hex\");throw new Error(\"Pass a buffer or a string\")}(t.id||t.nodeId||h(this._idLength)),this.socket=t.krpcSocket||s(t),this.bootstrap=!1===(e=t.nodes||t.bootstrap)?[]:!0===e?f:[].concat(e||f).map(p),this.concurrency=t.concurrency||16,this.backgroundConcurrency=t.backgroundConcurrency||this.concurrency/4|0,this.k=t.k||20,this.destroyed=!1,this.pending=[],this.nodes=null,this.socket.setMaxListeners(0),this.socket.on(\"query\",(function(t,e){i(t.a,e),r.emit(\"query\",t,e)})),this.socket.on(\"response\",(function(t,e){i(t.r,e)})),this.socket.on(\"warning\",(function(t){r.emit(\"warning\",t)})),this.socket.on(\"error\",(function(t){r.emit(\"error\",t)})),this.socket.on(\"update\",(function(){for(;r.pending.length&&r.socket.inflight=300&&t.code<400&&(a=t):o++,t||n||r&&!1===r(e,h)&&(n=!0),--s||i(o?null:a||new Error(\"All queries failed\"),o)}},l.prototype.query=function(t,e,r){this.socket.inflight>=this.concurrency?this.pending.push([t,e,r]):(e.a||(e.a={}),e.a.id||(e.a.id=this.id),t.token&&(e.a.token=t.token),this.socket.query(t,e,r))},l.prototype.destroy=function(t){this.destroyed=!0,this.socket.destroy(t)},l.prototype.clear=function(){var t=this;this.nodes=new o({localNodeId:this.id,numberOfNodesPerKBucket:this.k,numberOfNodesToPing:this.concurrency}),this.nodes.on(\"ping\",(function(e,r){t.emit(\"ping\",e,(function(e){e&&(e.id&&t.nodes.remove(e.id),t._addNode(r))}))}))},l.prototype.populate=function(t,e,r){this._closest(t,e,!0,null,r)},l.prototype.closest=function(t,e,r,i){this._closest(t,e,!1,r,i)},l.prototype._addNode=function(t){var e=this.nodes.get(t.id);this.nodes.add(t),e||this.emit(\"node\",t)},l.prototype._closest=function(t,e,r,n,s){s||(s=m);var a=this,h=0,u={},f=0,l=!0,p=!1;e.a||(e.a={}),e.a.id||(e.a.id=this.id);var g=new o({localNodeId:t,numberOfNodesPerKBucket:this.k,numberOfNodesToPing:this.concurrency}),y=r?\"postupdate\":\"update\";function b(){if(!(a.destroyed||a.socket.inflight>=a.concurrency)){var n=a.pending.length+a.socket.inflight-f;if(!(r&&a.socket.inflight>=a.backgroundConcurrency&&n)){var s=g.closest(t,a.k);(!s.length||s.length=a.concurrency)return;var h=s[o],c=h.host+\":\"+h.port;u[c]||(u[c]=!0,f++,a.socket.query(h,e,w))}f||(a.socket.removeListener(y,b),i.nextTick(v))}}}function v(){s(null,h)}function w(t,e,r){f--,r&&(u[(r.address||r.host)+\":\"+r.port]=!0),r&&r.id&&a.nodes.get(r.id)&&(!t||\"EUNEXPECTEDNODE\"!==t.code&&\"ETIMEDOUT\"!==t.code||a.nodes.remove(r.id));var i=e&&e.r;if(!i)return b();!t&&c(i.id,a._idLength)&&(h++,_({id:i.id,port:r.port,host:r.host||r.address,distance:0}));for(var s=i.nodes?function(t,e){var r=[];try{for(var i=0;i{function e(t){}t.exports=function(t){var r=null,i=null,n=null,s=null;return function(t,r){s=t,o(r||e)};function o(e){if(i)return r||(r=[]),void r.push(e);var n=s;s=null,i=e,t(n,a)}function a(t){var s=i,a=n;if(n=null,i=null,r&&(n=r,r=null,o(e)),a)for(var h=0;h{e.RateLimiter=r(3065),e.TokenBucket=r(5472)},3085:(t,e,r)=>{var i=r(5606);t.exports=function(){if(void 0!==i&&i.hrtime){var t=i.hrtime(),e=t[0],r=t[1];return 1e3*e+Math.floor(r/1e6)}return(new Date).getTime()}},3065:(t,e,r)=>{var i=r(5606),n=r(5472),s=r(3085),o=function(t,e,r){this.tokenBucket=new n(t,t,e,null),this.tokenBucket.content=t,this.curIntervalStart=s(),this.tokensThisInterval=0,this.fireImmediately=r};o.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(t,e){if(t>this.tokenBucket.bucketSize)return i.nextTick(e.bind(null,\"Requested tokens \"+t+\" exceeds maximum tokens per interval \"+this.tokenBucket.bucketSize,null)),!1;var r=this,n=s();if((n=this.tokenBucket.interval)&&(this.curIntervalStart=n,this.tokensThisInterval=0),t>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)i.nextTick(e.bind(null,null,-1));else{var o=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-n);setTimeout((function(){r.tokenBucket.removeTokens(t,a)}),o)}return!1}return this.tokenBucket.removeTokens(t,a);function a(i,n){if(i)return e(i,null);r.tokensThisInterval+=t,e(null,n)}},tryRemoveTokens:function(t){if(t>this.tokenBucket.bucketSize)return!1;var e=s();if((e=this.tokenBucket.interval)&&(this.curIntervalStart=e,this.tokensThisInterval=0),t>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var r=this.tokenBucket.tryRemoveTokens(t);return r&&(this.tokensThisInterval+=t),r},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},t.exports=o},5472:(t,e,r)=>{var i=r(5606),n=function(t,e,r,i){if(this.bucketSize=t,this.tokensPerInterval=e,\"string\"==typeof r)switch(r){case\"sec\":case\"second\":this.interval=1e3;break;case\"min\":case\"minute\":this.interval=6e4;break;case\"hr\":case\"hour\":this.interval=36e5;break;case\"day\":this.interval=864e5;break;default:throw new Error(\"Invaid interval \"+r)}else this.interval=r;this.parentBucket=i,this.content=0,this.lastDrip=+new Date};n.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(t,e){var r=this;return this.bucketSize?t>this.bucketSize?(i.nextTick(e.bind(null,\"Requested tokens \"+t+\" exceeds bucket size \"+this.bucketSize,null)),!1):(this.drip(),t>this.content?n():this.parentBucket?this.parentBucket.removeTokens(t,(function(i,s){return i?e(i,null):t>r.content?n():(r.content-=t,void e(null,Math.min(s,r.content)))})):(this.content-=t,i.nextTick(e.bind(null,null,this.content)),!0)):(i.nextTick(e.bind(null,null,t,Number.POSITIVE_INFINITY)),!0);function n(){var i=Math.ceil((t-r.content)*(r.interval/r.tokensPerInterval));return setTimeout((function(){r.removeTokens(t,e)}),i),!1}},tryRemoveTokens:function(t){return!(this.bucketSize&&(t>this.bucketSize||(this.drip(),t>this.content||this.parentBucket&&!this.parentBucket.tryRemoveTokens(t)||(this.content-=t,0))))},drip:function(){if(this.tokensPerInterval){var t=+new Date,e=Math.max(t-this.lastDrip,0);this.lastDrip=t;var r=e*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+r,this.bucketSize)}else this.content=this.bucketSize}},t.exports=n},8454:(t,e,r)=>{var i=r(7007),n=r(6698);function s(t){if(!(this instanceof s))return new s(t);\"number\"==typeof t&&(t={max:t}),t||(t={}),i.EventEmitter.call(this),this.cache={},this.head=this.tail=null,this.length=0,this.max=t.max||1e3,this.maxAge=t.maxAge||0}t.exports=s,n(s,i.EventEmitter),Object.defineProperty(s.prototype,\"keys\",{get:function(){return Object.keys(this.cache)}}),s.prototype.clear=function(){this.cache={},this.head=this.tail=null,this.length=0},s.prototype.remove=function(t){if(\"string\"!=typeof t&&(t=\"\"+t),this.cache.hasOwnProperty(t)){var e=this.cache[t];return delete this.cache[t],this._unlink(t,e.prev,e.next),e.value}},s.prototype._unlink=function(t,e,r){this.length--,0===this.length?this.head=this.tail=null:this.head===t?(this.head=e,this.cache[this.head].next=null):this.tail===t?(this.tail=r,this.cache[this.tail].prev=null):(this.cache[e].next=r,this.cache[r].prev=e)},s.prototype.peek=function(t){if(this.cache.hasOwnProperty(t)){var e=this.cache[t];if(this._checkAge(t,e))return e.value}},s.prototype.set=function(t,e){var r;if(\"string\"!=typeof t&&(t=\"\"+t),this.cache.hasOwnProperty(t)){if((r=this.cache[t]).value=e,this.maxAge&&(r.modified=Date.now()),t===this.head)return e;this._unlink(t,r.prev,r.next)}else r={value:e,modified:0,next:null,prev:null},this.maxAge&&(r.modified=Date.now()),this.cache[t]=r,this.length===this.max&&this.evict();return this.length++,r.next=null,r.prev=this.head,this.head&&(this.cache[this.head].next=t),this.head=t,this.tail||(this.tail=t),e},s.prototype._checkAge=function(t,e){return!(this.maxAge&&Date.now()-e.modified>this.maxAge&&(this.remove(t),this.emit(\"evict\",{key:t,value:e.value}),1))},s.prototype.get=function(t){if(\"string\"!=typeof t&&(t=\"\"+t),this.cache.hasOwnProperty(t)){var e=this.cache[t];if(this._checkAge(t,e))return this.head!==t&&(t===this.tail?(this.tail=e.next,this.cache[this.tail].prev=null):this.cache[e.prev].next=e.next,this.cache[e.next].prev=e.prev,this.cache[this.head].next=t,e.prev=this.head,e.next=null,this.head=t),e.value}},s.prototype.evict=function(){if(this.tail){var t=this.tail,e=this.remove(this.tail);this.emit(\"evict\",{key:t,value:e})}}},8276:(t,e,r)=>{\"use strict\";var i=r(6698),n=r(4729),s=r(2861).Buffer,o=new Array(16);function a(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function h(t,e){return t<>>32-e}function u(t,e,r,i,n,s,o){return h(t+(e&r|~e&i)+n+s|0,o)+e|0}function f(t,e,r,i,n,s,o){return h(t+(e&i|r&~i)+n+s|0,o)+e|0}function l(t,e,r,i,n,s,o){return h(t+(e^r^i)+n+s|0,o)+e|0}function c(t,e,r,i,n,s,o){return h(t+(r^(e|~i))+n+s|0,o)+e|0}i(a,n),a.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,s=this._d;r=u(r,i,n,s,t[0],3614090360,7),s=u(s,r,i,n,t[1],3905402710,12),n=u(n,s,r,i,t[2],606105819,17),i=u(i,n,s,r,t[3],3250441966,22),r=u(r,i,n,s,t[4],4118548399,7),s=u(s,r,i,n,t[5],1200080426,12),n=u(n,s,r,i,t[6],2821735955,17),i=u(i,n,s,r,t[7],4249261313,22),r=u(r,i,n,s,t[8],1770035416,7),s=u(s,r,i,n,t[9],2336552879,12),n=u(n,s,r,i,t[10],4294925233,17),i=u(i,n,s,r,t[11],2304563134,22),r=u(r,i,n,s,t[12],1804603682,7),s=u(s,r,i,n,t[13],4254626195,12),n=u(n,s,r,i,t[14],2792965006,17),r=f(r,i=u(i,n,s,r,t[15],1236535329,22),n,s,t[1],4129170786,5),s=f(s,r,i,n,t[6],3225465664,9),n=f(n,s,r,i,t[11],643717713,14),i=f(i,n,s,r,t[0],3921069994,20),r=f(r,i,n,s,t[5],3593408605,5),s=f(s,r,i,n,t[10],38016083,9),n=f(n,s,r,i,t[15],3634488961,14),i=f(i,n,s,r,t[4],3889429448,20),r=f(r,i,n,s,t[9],568446438,5),s=f(s,r,i,n,t[14],3275163606,9),n=f(n,s,r,i,t[3],4107603335,14),i=f(i,n,s,r,t[8],1163531501,20),r=f(r,i,n,s,t[13],2850285829,5),s=f(s,r,i,n,t[2],4243563512,9),n=f(n,s,r,i,t[7],1735328473,14),r=l(r,i=f(i,n,s,r,t[12],2368359562,20),n,s,t[5],4294588738,4),s=l(s,r,i,n,t[8],2272392833,11),n=l(n,s,r,i,t[11],1839030562,16),i=l(i,n,s,r,t[14],4259657740,23),r=l(r,i,n,s,t[1],2763975236,4),s=l(s,r,i,n,t[4],1272893353,11),n=l(n,s,r,i,t[7],4139469664,16),i=l(i,n,s,r,t[10],3200236656,23),r=l(r,i,n,s,t[13],681279174,4),s=l(s,r,i,n,t[0],3936430074,11),n=l(n,s,r,i,t[3],3572445317,16),i=l(i,n,s,r,t[6],76029189,23),r=l(r,i,n,s,t[9],3654602809,4),s=l(s,r,i,n,t[12],3873151461,11),n=l(n,s,r,i,t[15],530742520,16),r=c(r,i=l(i,n,s,r,t[2],3299628645,23),n,s,t[0],4096336452,6),s=c(s,r,i,n,t[7],1126891415,10),n=c(n,s,r,i,t[14],2878612391,15),i=c(i,n,s,r,t[5],4237533241,21),r=c(r,i,n,s,t[12],1700485571,6),s=c(s,r,i,n,t[3],2399980690,10),n=c(n,s,r,i,t[10],4293915773,15),i=c(i,n,s,r,t[1],2240044497,21),r=c(r,i,n,s,t[8],1873313359,6),s=c(s,r,i,n,t[15],4264355552,10),n=c(n,s,r,i,t[6],2734768916,15),i=c(i,n,s,r,t[13],1309151649,21),r=c(r,i,n,s,t[4],4149444226,6),s=c(s,r,i,n,t[11],3174756917,10),n=c(n,s,r,i,t[2],718787259,15),i=c(i,n,s,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+s|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=s.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},4862:(t,e,r)=>{t.exports=n;const i=r(9596);function n(t,e){if(!(this instanceof n))return new n(t,e);if(e||(e={}),this.chunkLength=Number(t),!this.chunkLength)throw new Error(\"First argument must be a chunk length\");this.chunks=[],this.closed=!1,this.length=Number(e.length)||1/0,this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=Math.ceil(this.length/this.chunkLength)-1)}n.prototype.put=function(t,e,r=(()=>{})){if(this.closed)return i((()=>r(new Error(\"Storage is closed\"))));const n=t===this.lastChunkIndex;return n&&e.length!==this.lastChunkLength?i((()=>r(new Error(\"Last chunk length must be \"+this.lastChunkLength)))):n||e.length===this.chunkLength?(this.chunks[t]=e,void i((()=>r(null)))):i((()=>r(new Error(\"Chunk length must be \"+this.chunkLength))))},n.prototype.get=function(t,e,r=(()=>{})){if(\"function\"==typeof e)return this.get(t,null,e);if(this.closed)return i((()=>r(new Error(\"Storage is closed\"))));let n=this.chunks[t];if(!n){const t=new Error(\"Chunk not found\");return t.notFound=!0,i((()=>r(t)))}e||(e={});const s=e.offset||0,o=e.length||n.length-s;0===s&&o===n.length||(n=n.slice(s,o+s)),i((()=>r(null,n)))},n.prototype.close=n.prototype.destroy=function(t=(()=>{})){if(this.closed)return i((()=>t(new Error(\"Storage is closed\"))));this.closed=!0,this.chunks=null,i((()=>t(null)))}},2244:(t,e,r)=>{var i=r(1158),n=r(5037);function s(t){this.rand=t||new n.Rand}t.exports=s,s.create=function(t){return new s(t)},s.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(t)>=0);return n},s.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},s.prototype.test=function(t,e,r){var n=t.bitLength(),s=i.mont(t),o=new i(1).toRed(s);e||(e=Math.max(1,n/48|0));for(var a=t.subn(1),h=0;!a.testn(h);h++);for(var u=t.shrn(h),f=a.toRed(s);e>0;e--){var l=this._randrange(new i(2),a);r&&r(l);var c=l.toRed(s).redPow(u);if(0!==c.cmp(o)&&0!==c.cmp(f)){for(var d=1;d0;e--){var f=this._randrange(new i(2),o),l=t.gcd(f);if(0!==l.cmpn(1))return l;var c=f.toRed(n).redPow(h);if(0!==c.cmp(s)&&0!==c.cmp(u)){for(var d=1;d=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,s=Math.min(t.length,r),o=e;o=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(t){return t instanceof s||null!==t&&\"object\"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if(\"number\"==typeof t)return this._initNumber(t,e,r);if(\"object\"==typeof t)return this._initArray(t,e,r);\"hex\"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;\"-\"===(t=t.toString().replace(/\\s+/g,\"\"))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if(\"le\"===r)for(n=0,s=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?\"\"};var f=[\"\",\"0\",\"00\",\"000\",\"0000\",\"00000\",\"000000\",\"0000000\",\"00000000\",\"000000000\",\"0000000000\",\"00000000000\",\"000000000000\",\"0000000000000\",\"00000000000000\",\"000000000000000\",\"0000000000000000\",\"00000000000000000\",\"000000000000000000\",\"0000000000000000000\",\"00000000000000000000\",\"000000000000000000000\",\"0000000000000000000000\",\"00000000000000000000000\",\"000000000000000000000000\",\"0000000000000000000000000\"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,h=o/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(s=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||\"hex\"===t){r=\"\";for(var n=0,s=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r=\"\";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r=\"0\"+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}i(!1,\"Base should be between 2 and 36\")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,\"Number can only safely store up to 53 bits\"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,\"byte array longer than desired length\"),i(s>0,\"Requested array length <= 0\"),this.strip();var o,a,h=\"le\"===e,u=new t(s),f=this.clone();if(h){for(a=0;!f.isZero();a++)o=f.andln(255),f.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i(\"number\"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i(\"number\"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,b=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,M=0|o[4],k=8191&M,S=M>>>13,x=0|o[5],A=8191&x,E=x>>>13,I=0|o[6],B=8191&I,T=I>>>13,P=0|o[7],R=8191&P,C=P>>>13,L=0|o[8],O=8191&L,j=L>>>13,N=0|o[9],U=8191&N,q=N>>>13,D=0|a[0],F=8191&D,H=D>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,Z=V>>>13,G=0|a[3],J=8191&G,Y=G>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((s=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,s=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((s=s+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,s=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,s=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((s=s+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,s=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,s=s+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((s=s+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,s=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,s=s+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((s=s+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,H))+Math.imul(T,F)|0,s=Math.imul(T,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,Z)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,s=s+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,s=s+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,st)|0))<<13)|0;u=((s=s+Math.imul(c,ot)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(C,F)|0,s=Math.imul(C,H),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,Z)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,s=s+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,s=s+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,it)|0,i=i+Math.imul(p,st)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((s=s+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,F),n=(n=Math.imul(O,H))+Math.imul(j,F)|0,s=Math.imul(j,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(C,W)|0,s=s+Math.imul(C,K)|0,i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,Z)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,Z)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,s=s+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,it)|0,i=i+Math.imul(y,st)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,s=s+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((s=s+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,H))+Math.imul(q,F)|0,s=Math.imul(q,H),i=i+Math.imul(O,W)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(j,W)|0,s=s+Math.imul(j,K)|0,i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(C,$)|0,s=s+Math.imul(C,Z)|0,i=i+Math.imul(B,J)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,s=s+Math.imul(S,it)|0,i=i+Math.imul(w,st)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,s=s+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,s=s+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((s=s+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,W),n=(n=Math.imul(U,K))+Math.imul(q,W)|0,s=Math.imul(q,K),i=i+Math.imul(O,$)|0,n=(n=n+Math.imul(O,Z)|0)+Math.imul(j,$)|0,s=s+Math.imul(j,Z)|0,i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(C,J)|0,s=s+Math.imul(C,Y)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(S,st)|0,s=s+Math.imul(S,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,s=s+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,s=s+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((s=s+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,Z))+Math.imul(q,$)|0,s=Math.imul(q,Z),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(j,J)|0,s=s+Math.imul(j,Y)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(C,Q)|0,s=s+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(A,st)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,s=s+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,s=s+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((s=s+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,J),n=(n=Math.imul(U,Y))+Math.imul(q,J)|0,s=Math.imul(q,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(j,Q)|0,s=s+Math.imul(j,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(C,rt)|0,s=s+Math.imul(C,it)|0,i=i+Math.imul(B,st)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,s=s+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,s=s+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((s=s+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(q,Q)|0,s=Math.imul(q,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(j,rt)|0,s=s+Math.imul(j,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,ot)|0,i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(T,ht)|0,s=s+Math.imul(T,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,s=s+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((s=s+Math.imul(S,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(q,rt)|0,s=Math.imul(q,it),i=i+Math.imul(O,st)|0,n=(n=n+Math.imul(O,ot)|0)+Math.imul(j,st)|0,s=s+Math.imul(j,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(C,ht)|0,s=s+Math.imul(C,ut)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,s=s+Math.imul(T,ct)|0;var Tt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((s=s+Math.imul(E,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,st),n=(n=Math.imul(U,ot))+Math.imul(q,st)|0,s=Math.imul(q,ot),i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(j,ht)|0,s=s+Math.imul(j,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(C,lt)|0,s=s+Math.imul(C,ct)|0;var Pt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((s=s+Math.imul(T,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ht),n=(n=Math.imul(U,ut))+Math.imul(q,ht)|0,s=Math.imul(q,ut),i=i+Math.imul(O,lt)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(j,lt)|0,s=s+Math.imul(j,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((s=s+Math.imul(C,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,lt),n=(n=Math.imul(U,ct))+Math.imul(q,lt)|0,s=Math.imul(q,ct);var Ct=(u+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((s=s+Math.imul(j,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Lt=(u+(i=Math.imul(U,pt))|0)+((8191&(n=(n=Math.imul(U,mt))+Math.imul(q,pt)|0))<<13)|0;return u=((s=Math.imul(q,mt))+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Bt,h[14]=Tt,h[15]=Pt,h[16]=Rt,h[17]=Ct,h[18]=Lt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),s.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-s|l>>>s,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i(\"number\"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,\"imaskn works only with positive numbers\"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i(\"number\"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&s}for(;n>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,h=i.length-n.length;if(\"mod\"!==e){(a=new s(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),\"div\"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),\"mod\"!==e&&(n=a.div.neg()),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),\"mod\"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?\"div\"===e?{div:this.divn(t.words[0]),mod:null}:\"mod\"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,\"div\",!1).div},s.prototype.mod=function(t){return this.divmod(t,\"mod\",!1).mod},s.prototype.umod=function(t){return this.divmod(t,\"mod\",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},s.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),h=new s(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(h)):(r.isub(e),a.isub(n),h.isub(o))}return{a,b:h,gcd:r.iushln(u)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return!(1&this.words[0])},s.prototype.isOdd=function(){return!(1&~this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i(\"number\"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,\"Number is too big\");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new k(t)},s.prototype.toRed=function(t){return i(!this.red,\"Already a number in reduction context\"),i(0===this.negative,\"red works only with positives\"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,\"fromRed works only with numbers in reduction context\"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,\"Already a number in reduction context\"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,\"redAdd works only with red numbers\"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,\"redIAdd works only with red numbers\"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,\"redSub works only with red numbers\"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,\"redISub works only with red numbers\"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,\"redShl works only with red numbers\"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,\"redSqr works only with red numbers\"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,\"redISqr works only with red numbers\"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,\"redSqrt works only with red numbers\"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,\"redInvm works only with red numbers\"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,\"redNeg works only with red numbers\"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,\"redPow(normalNum)\"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,\"k256\",\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\")}function w(){b.call(this,\"p224\",\"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\")}function _(){b.call(this,\"p192\",\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\")}function M(){b.call(this,\"25519\",\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\")}function k(t){if(\"string\"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),\"modulus must be greater than 1\"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,s=o}s>>>=22,t.words[n-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(y[t])return y[t];var e;if(\"k256\"===t)e=new v;else if(\"p224\"===t)e=new w;else if(\"p192\"===t)e=new _;else{if(\"p25519\"!==t)throw new Error(\"Unknown prime \"+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,\"red works only with positives\"),i(t.red,\"red works only with red numbers\")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),\"red works only with positives\"),i(t.red&&t.red===e.red,\"red works only with red numbers\")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},8673:t=>{\"use strict\";function e(){this._types=Object.create(null),this._extensions=Object.create(null);for(let t=0;t{\"use strict\";let i=r(8673);t.exports=new i(r(8446))},8446:t=>{t.exports={\"application/andrew-inset\":[\"ez\"],\"application/applixware\":[\"aw\"],\"application/atom+xml\":[\"atom\"],\"application/atomcat+xml\":[\"atomcat\"],\"application/atomdeleted+xml\":[\"atomdeleted\"],\"application/atomsvc+xml\":[\"atomsvc\"],\"application/atsc-dwd+xml\":[\"dwd\"],\"application/atsc-held+xml\":[\"held\"],\"application/atsc-rsat+xml\":[\"rsat\"],\"application/bdoc\":[\"bdoc\"],\"application/calendar+xml\":[\"xcs\"],\"application/ccxml+xml\":[\"ccxml\"],\"application/cdfx+xml\":[\"cdfx\"],\"application/cdmi-capability\":[\"cdmia\"],\"application/cdmi-container\":[\"cdmic\"],\"application/cdmi-domain\":[\"cdmid\"],\"application/cdmi-object\":[\"cdmio\"],\"application/cdmi-queue\":[\"cdmiq\"],\"application/cu-seeme\":[\"cu\"],\"application/dash+xml\":[\"mpd\"],\"application/davmount+xml\":[\"davmount\"],\"application/docbook+xml\":[\"dbk\"],\"application/dssc+der\":[\"dssc\"],\"application/dssc+xml\":[\"xdssc\"],\"application/ecmascript\":[\"es\",\"ecma\"],\"application/emma+xml\":[\"emma\"],\"application/emotionml+xml\":[\"emotionml\"],\"application/epub+zip\":[\"epub\"],\"application/exi\":[\"exi\"],\"application/express\":[\"exp\"],\"application/fdt+xml\":[\"fdt\"],\"application/font-tdpfr\":[\"pfr\"],\"application/geo+json\":[\"geojson\"],\"application/gml+xml\":[\"gml\"],\"application/gpx+xml\":[\"gpx\"],\"application/gxf\":[\"gxf\"],\"application/gzip\":[\"gz\"],\"application/hjson\":[\"hjson\"],\"application/hyperstudio\":[\"stk\"],\"application/inkml+xml\":[\"ink\",\"inkml\"],\"application/ipfix\":[\"ipfix\"],\"application/its+xml\":[\"its\"],\"application/java-archive\":[\"jar\",\"war\",\"ear\"],\"application/java-serialized-object\":[\"ser\"],\"application/java-vm\":[\"class\"],\"application/javascript\":[\"js\",\"mjs\"],\"application/json\":[\"json\",\"map\"],\"application/json5\":[\"json5\"],\"application/jsonml+json\":[\"jsonml\"],\"application/ld+json\":[\"jsonld\"],\"application/lgr+xml\":[\"lgr\"],\"application/lost+xml\":[\"lostxml\"],\"application/mac-binhex40\":[\"hqx\"],\"application/mac-compactpro\":[\"cpt\"],\"application/mads+xml\":[\"mads\"],\"application/manifest+json\":[\"webmanifest\"],\"application/marc\":[\"mrc\"],\"application/marcxml+xml\":[\"mrcx\"],\"application/mathematica\":[\"ma\",\"nb\",\"mb\"],\"application/mathml+xml\":[\"mathml\"],\"application/mbox\":[\"mbox\"],\"application/mediaservercontrol+xml\":[\"mscml\"],\"application/metalink+xml\":[\"metalink\"],\"application/metalink4+xml\":[\"meta4\"],\"application/mets+xml\":[\"mets\"],\"application/mmt-aei+xml\":[\"maei\"],\"application/mmt-usd+xml\":[\"musd\"],\"application/mods+xml\":[\"mods\"],\"application/mp21\":[\"m21\",\"mp21\"],\"application/mp4\":[\"mp4s\",\"m4p\"],\"application/msword\":[\"doc\",\"dot\"],\"application/mxf\":[\"mxf\"],\"application/n-quads\":[\"nq\"],\"application/n-triples\":[\"nt\"],\"application/node\":[\"cjs\"],\"application/octet-stream\":[\"bin\",\"dms\",\"lrf\",\"mar\",\"so\",\"dist\",\"distz\",\"pkg\",\"bpk\",\"dump\",\"elc\",\"deploy\",\"exe\",\"dll\",\"deb\",\"dmg\",\"iso\",\"img\",\"msi\",\"msp\",\"msm\",\"buffer\"],\"application/oda\":[\"oda\"],\"application/oebps-package+xml\":[\"opf\"],\"application/ogg\":[\"ogx\"],\"application/omdoc+xml\":[\"omdoc\"],\"application/onenote\":[\"onetoc\",\"onetoc2\",\"onetmp\",\"onepkg\"],\"application/oxps\":[\"oxps\"],\"application/p2p-overlay+xml\":[\"relo\"],\"application/patch-ops-error+xml\":[\"xer\"],\"application/pdf\":[\"pdf\"],\"application/pgp-encrypted\":[\"pgp\"],\"application/pgp-signature\":[\"asc\",\"sig\"],\"application/pics-rules\":[\"prf\"],\"application/pkcs10\":[\"p10\"],\"application/pkcs7-mime\":[\"p7m\",\"p7c\"],\"application/pkcs7-signature\":[\"p7s\"],\"application/pkcs8\":[\"p8\"],\"application/pkix-attr-cert\":[\"ac\"],\"application/pkix-cert\":[\"cer\"],\"application/pkix-crl\":[\"crl\"],\"application/pkix-pkipath\":[\"pkipath\"],\"application/pkixcmp\":[\"pki\"],\"application/pls+xml\":[\"pls\"],\"application/postscript\":[\"ai\",\"eps\",\"ps\"],\"application/provenance+xml\":[\"provx\"],\"application/pskc+xml\":[\"pskcxml\"],\"application/raml+yaml\":[\"raml\"],\"application/rdf+xml\":[\"rdf\",\"owl\"],\"application/reginfo+xml\":[\"rif\"],\"application/relax-ng-compact-syntax\":[\"rnc\"],\"application/resource-lists+xml\":[\"rl\"],\"application/resource-lists-diff+xml\":[\"rld\"],\"application/rls-services+xml\":[\"rs\"],\"application/route-apd+xml\":[\"rapd\"],\"application/route-s-tsid+xml\":[\"sls\"],\"application/route-usd+xml\":[\"rusd\"],\"application/rpki-ghostbusters\":[\"gbr\"],\"application/rpki-manifest\":[\"mft\"],\"application/rpki-roa\":[\"roa\"],\"application/rsd+xml\":[\"rsd\"],\"application/rss+xml\":[\"rss\"],\"application/rtf\":[\"rtf\"],\"application/sbml+xml\":[\"sbml\"],\"application/scvp-cv-request\":[\"scq\"],\"application/scvp-cv-response\":[\"scs\"],\"application/scvp-vp-request\":[\"spq\"],\"application/scvp-vp-response\":[\"spp\"],\"application/sdp\":[\"sdp\"],\"application/senml+xml\":[\"senmlx\"],\"application/sensml+xml\":[\"sensmlx\"],\"application/set-payment-initiation\":[\"setpay\"],\"application/set-registration-initiation\":[\"setreg\"],\"application/shf+xml\":[\"shf\"],\"application/sieve\":[\"siv\",\"sieve\"],\"application/smil+xml\":[\"smi\",\"smil\"],\"application/sparql-query\":[\"rq\"],\"application/sparql-results+xml\":[\"srx\"],\"application/srgs\":[\"gram\"],\"application/srgs+xml\":[\"grxml\"],\"application/sru+xml\":[\"sru\"],\"application/ssdl+xml\":[\"ssdl\"],\"application/ssml+xml\":[\"ssml\"],\"application/swid+xml\":[\"swidtag\"],\"application/tei+xml\":[\"tei\",\"teicorpus\"],\"application/thraud+xml\":[\"tfi\"],\"application/timestamped-data\":[\"tsd\"],\"application/toml\":[\"toml\"],\"application/trig\":[\"trig\"],\"application/ttml+xml\":[\"ttml\"],\"application/ubjson\":[\"ubj\"],\"application/urc-ressheet+xml\":[\"rsheet\"],\"application/urc-targetdesc+xml\":[\"td\"],\"application/voicexml+xml\":[\"vxml\"],\"application/wasm\":[\"wasm\"],\"application/widget\":[\"wgt\"],\"application/winhlp\":[\"hlp\"],\"application/wsdl+xml\":[\"wsdl\"],\"application/wspolicy+xml\":[\"wspolicy\"],\"application/xaml+xml\":[\"xaml\"],\"application/xcap-att+xml\":[\"xav\"],\"application/xcap-caps+xml\":[\"xca\"],\"application/xcap-diff+xml\":[\"xdf\"],\"application/xcap-el+xml\":[\"xel\"],\"application/xcap-ns+xml\":[\"xns\"],\"application/xenc+xml\":[\"xenc\"],\"application/xhtml+xml\":[\"xhtml\",\"xht\"],\"application/xliff+xml\":[\"xlf\"],\"application/xml\":[\"xml\",\"xsl\",\"xsd\",\"rng\"],\"application/xml-dtd\":[\"dtd\"],\"application/xop+xml\":[\"xop\"],\"application/xproc+xml\":[\"xpl\"],\"application/xslt+xml\":[\"*xsl\",\"xslt\"],\"application/xspf+xml\":[\"xspf\"],\"application/xv+xml\":[\"mxml\",\"xhvml\",\"xvml\",\"xvm\"],\"application/yang\":[\"yang\"],\"application/yin+xml\":[\"yin\"],\"application/zip\":[\"zip\"],\"audio/3gpp\":[\"*3gpp\"],\"audio/adpcm\":[\"adp\"],\"audio/amr\":[\"amr\"],\"audio/basic\":[\"au\",\"snd\"],\"audio/midi\":[\"mid\",\"midi\",\"kar\",\"rmi\"],\"audio/mobile-xmf\":[\"mxmf\"],\"audio/mp3\":[\"*mp3\"],\"audio/mp4\":[\"m4a\",\"mp4a\"],\"audio/mpeg\":[\"mpga\",\"mp2\",\"mp2a\",\"mp3\",\"m2a\",\"m3a\"],\"audio/ogg\":[\"oga\",\"ogg\",\"spx\",\"opus\"],\"audio/s3m\":[\"s3m\"],\"audio/silk\":[\"sil\"],\"audio/wav\":[\"wav\"],\"audio/wave\":[\"*wav\"],\"audio/webm\":[\"weba\"],\"audio/xm\":[\"xm\"],\"font/collection\":[\"ttc\"],\"font/otf\":[\"otf\"],\"font/ttf\":[\"ttf\"],\"font/woff\":[\"woff\"],\"font/woff2\":[\"woff2\"],\"image/aces\":[\"exr\"],\"image/apng\":[\"apng\"],\"image/avif\":[\"avif\"],\"image/bmp\":[\"bmp\"],\"image/cgm\":[\"cgm\"],\"image/dicom-rle\":[\"drle\"],\"image/emf\":[\"emf\"],\"image/fits\":[\"fits\"],\"image/g3fax\":[\"g3\"],\"image/gif\":[\"gif\"],\"image/heic\":[\"heic\"],\"image/heic-sequence\":[\"heics\"],\"image/heif\":[\"heif\"],\"image/heif-sequence\":[\"heifs\"],\"image/hej2k\":[\"hej2\"],\"image/hsj2\":[\"hsj2\"],\"image/ief\":[\"ief\"],\"image/jls\":[\"jls\"],\"image/jp2\":[\"jp2\",\"jpg2\"],\"image/jpeg\":[\"jpeg\",\"jpg\",\"jpe\"],\"image/jph\":[\"jph\"],\"image/jphc\":[\"jhc\"],\"image/jpm\":[\"jpm\"],\"image/jpx\":[\"jpx\",\"jpf\"],\"image/jxr\":[\"jxr\"],\"image/jxra\":[\"jxra\"],\"image/jxrs\":[\"jxrs\"],\"image/jxs\":[\"jxs\"],\"image/jxsc\":[\"jxsc\"],\"image/jxsi\":[\"jxsi\"],\"image/jxss\":[\"jxss\"],\"image/ktx\":[\"ktx\"],\"image/ktx2\":[\"ktx2\"],\"image/png\":[\"png\"],\"image/sgi\":[\"sgi\"],\"image/svg+xml\":[\"svg\",\"svgz\"],\"image/t38\":[\"t38\"],\"image/tiff\":[\"tif\",\"tiff\"],\"image/tiff-fx\":[\"tfx\"],\"image/webp\":[\"webp\"],\"image/wmf\":[\"wmf\"],\"message/disposition-notification\":[\"disposition-notification\"],\"message/global\":[\"u8msg\"],\"message/global-delivery-status\":[\"u8dsn\"],\"message/global-disposition-notification\":[\"u8mdn\"],\"message/global-headers\":[\"u8hdr\"],\"message/rfc822\":[\"eml\",\"mime\"],\"model/3mf\":[\"3mf\"],\"model/gltf+json\":[\"gltf\"],\"model/gltf-binary\":[\"glb\"],\"model/iges\":[\"igs\",\"iges\"],\"model/mesh\":[\"msh\",\"mesh\",\"silo\"],\"model/mtl\":[\"mtl\"],\"model/obj\":[\"obj\"],\"model/step+xml\":[\"stpx\"],\"model/step+zip\":[\"stpz\"],\"model/step-xml+zip\":[\"stpxz\"],\"model/stl\":[\"stl\"],\"model/vrml\":[\"wrl\",\"vrml\"],\"model/x3d+binary\":[\"*x3db\",\"x3dbz\"],\"model/x3d+fastinfoset\":[\"x3db\"],\"model/x3d+vrml\":[\"*x3dv\",\"x3dvz\"],\"model/x3d+xml\":[\"x3d\",\"x3dz\"],\"model/x3d-vrml\":[\"x3dv\"],\"text/cache-manifest\":[\"appcache\",\"manifest\"],\"text/calendar\":[\"ics\",\"ifb\"],\"text/coffeescript\":[\"coffee\",\"litcoffee\"],\"text/css\":[\"css\"],\"text/csv\":[\"csv\"],\"text/html\":[\"html\",\"htm\",\"shtml\"],\"text/jade\":[\"jade\"],\"text/jsx\":[\"jsx\"],\"text/less\":[\"less\"],\"text/markdown\":[\"markdown\",\"md\"],\"text/mathml\":[\"mml\"],\"text/mdx\":[\"mdx\"],\"text/n3\":[\"n3\"],\"text/plain\":[\"txt\",\"text\",\"conf\",\"def\",\"list\",\"log\",\"in\",\"ini\"],\"text/richtext\":[\"rtx\"],\"text/rtf\":[\"*rtf\"],\"text/sgml\":[\"sgml\",\"sgm\"],\"text/shex\":[\"shex\"],\"text/slim\":[\"slim\",\"slm\"],\"text/spdx\":[\"spdx\"],\"text/stylus\":[\"stylus\",\"styl\"],\"text/tab-separated-values\":[\"tsv\"],\"text/troff\":[\"t\",\"tr\",\"roff\",\"man\",\"me\",\"ms\"],\"text/turtle\":[\"ttl\"],\"text/uri-list\":[\"uri\",\"uris\",\"urls\"],\"text/vcard\":[\"vcard\"],\"text/vtt\":[\"vtt\"],\"text/xml\":[\"*xml\"],\"text/yaml\":[\"yaml\",\"yml\"],\"video/3gpp\":[\"3gp\",\"3gpp\"],\"video/3gpp2\":[\"3g2\"],\"video/h261\":[\"h261\"],\"video/h263\":[\"h263\"],\"video/h264\":[\"h264\"],\"video/iso.segment\":[\"m4s\"],\"video/jpeg\":[\"jpgv\"],\"video/jpm\":[\"*jpm\",\"jpgm\"],\"video/mj2\":[\"mj2\",\"mjp2\"],\"video/mp2t\":[\"ts\"],\"video/mp4\":[\"mp4\",\"mp4v\",\"mpg4\"],\"video/mpeg\":[\"mpeg\",\"mpg\",\"mpe\",\"m1v\",\"m2v\"],\"video/ogg\":[\"ogv\"],\"video/quicktime\":[\"qt\",\"mov\"],\"video/webm\":[\"webm\"]}},3349:t=>{function e(t,e){if(!t)throw new Error(e||\"Assertion failed\")}t.exports=e,e.equal=function(t,e,r){if(t!=e)throw new Error(r||\"Assertion failed: \"+t+\" != \"+e)}},4367:(t,e)=>{\"use strict\";var r=e;function i(t){return 1===t.length?\"0\"+t:t}function n(t){for(var e=\"\",r=0;r>8,o=255&n;s?r.push(s,o):r.push(o)}return r},r.zero2=i,r.toHex=n,r.encode=function(t,e){return\"hex\"===e?n(t):t}},6585:t=>{var e=1e3,r=60*e,i=60*r,n=24*i;function s(t,e,r,i){var n=e>=1.5*r;return Math.round(t/r)+\" \"+i+(n?\"s\":\"\")}t.exports=function(t,o){o=o||{};var a,h,u=typeof t;if(\"string\"===u&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var s=/^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(s){var o=parseFloat(s[1]);switch((s[2]||\"ms\").toLowerCase()){case\"years\":case\"year\":case\"yrs\":case\"yr\":case\"y\":return 315576e5*o;case\"weeks\":case\"week\":case\"w\":return 6048e5*o;case\"days\":case\"day\":case\"d\":return o*n;case\"hours\":case\"hour\":case\"hrs\":case\"hr\":case\"h\":return o*i;case\"minutes\":case\"minute\":case\"mins\":case\"min\":case\"m\":return o*r;case\"seconds\":case\"second\":case\"secs\":case\"sec\":case\"s\":return o*e;case\"milliseconds\":case\"millisecond\":case\"msecs\":case\"msec\":case\"ms\":return o;default:return}}}}(t);if(\"number\"===u&&isFinite(t))return o.long?(a=t,(h=Math.abs(a))>=n?s(a,h,n,\"day\"):h>=i?s(a,h,i,\"hour\"):h>=r?s(a,h,r,\"minute\"):h>=e?s(a,h,e,\"second\"):a+\" ms\"):function(t){var s=Math.abs(t);return s>=n?Math.round(t/n)+\"d\":s>=i?Math.round(t/i)+\"h\":s>=r?Math.round(t/r)+\"m\":s>=e?Math.round(t/e)+\"s\":t+\"ms\"}(t);throw new Error(\"val is not a non-empty string or a valid number. val=\"+JSON.stringify(t))}},3519:(t,e,r)=>{var i=r(6587);function n(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function s(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||\"Function wrapped with `once`\";return e.onceError=r+\" shouldn't be called more than once\",e.called=!1,e}t.exports=i(n),t.exports.strict=i(s),n.proto=n((function(){Object.defineProperty(Function.prototype,\"once\",{value:function(){return n(this)},configurable:!0}),Object.defineProperty(Function.prototype,\"onceStrict\",{value:function(){return s(this)},configurable:!0})}))},1137:(t,e,r)=>{\"use strict\";var i=r(7568);e.certificate=r(6413);var n=i.define(\"RSAPrivateKey\",(function(){this.seq().obj(this.key(\"version\").int(),this.key(\"modulus\").int(),this.key(\"publicExponent\").int(),this.key(\"privateExponent\").int(),this.key(\"prime1\").int(),this.key(\"prime2\").int(),this.key(\"exponent1\").int(),this.key(\"exponent2\").int(),this.key(\"coefficient\").int())}));e.RSAPrivateKey=n;var s=i.define(\"RSAPublicKey\",(function(){this.seq().obj(this.key(\"modulus\").int(),this.key(\"publicExponent\").int())}));e.RSAPublicKey=s;var o=i.define(\"AlgorithmIdentifier\",(function(){this.seq().obj(this.key(\"algorithm\").objid(),this.key(\"none\").null_().optional(),this.key(\"curve\").objid().optional(),this.key(\"params\").seq().obj(this.key(\"p\").int(),this.key(\"q\").int(),this.key(\"g\").int()).optional())})),a=i.define(\"SubjectPublicKeyInfo\",(function(){this.seq().obj(this.key(\"algorithm\").use(o),this.key(\"subjectPublicKey\").bitstr())}));e.PublicKey=a;var h=i.define(\"PrivateKeyInfo\",(function(){this.seq().obj(this.key(\"version\").int(),this.key(\"algorithm\").use(o),this.key(\"subjectPrivateKey\").octstr())}));e.PrivateKey=h;var u=i.define(\"EncryptedPrivateKeyInfo\",(function(){this.seq().obj(this.key(\"algorithm\").seq().obj(this.key(\"id\").objid(),this.key(\"decrypt\").seq().obj(this.key(\"kde\").seq().obj(this.key(\"id\").objid(),this.key(\"kdeparams\").seq().obj(this.key(\"salt\").octstr(),this.key(\"iters\").int())),this.key(\"cipher\").seq().obj(this.key(\"algo\").objid(),this.key(\"iv\").octstr()))),this.key(\"subjectPrivateKey\").octstr())}));e.EncryptedPrivateKey=u;var f=i.define(\"DSAPrivateKey\",(function(){this.seq().obj(this.key(\"version\").int(),this.key(\"p\").int(),this.key(\"q\").int(),this.key(\"g\").int(),this.key(\"pub_key\").int(),this.key(\"priv_key\").int())}));e.DSAPrivateKey=f,e.DSAparam=i.define(\"DSAparam\",(function(){this.int()}));var l=i.define(\"ECParameters\",(function(){this.choice({namedCurve:this.objid()})})),c=i.define(\"ECPrivateKey\",(function(){this.seq().obj(this.key(\"version\").int(),this.key(\"privateKey\").octstr(),this.key(\"parameters\").optional().explicit(0).use(l),this.key(\"publicKey\").optional().explicit(1).bitstr())}));e.ECPrivateKey=c,e.signature=i.define(\"signature\",(function(){this.seq().obj(this.key(\"r\").int(),this.key(\"s\").int())}))},6413:(t,e,r)=>{\"use strict\";var i=r(7568),n=i.define(\"Time\",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),s=i.define(\"AttributeTypeValue\",(function(){this.seq().obj(this.key(\"type\").objid(),this.key(\"value\").any())})),o=i.define(\"AlgorithmIdentifier\",(function(){this.seq().obj(this.key(\"algorithm\").objid(),this.key(\"parameters\").optional(),this.key(\"curve\").objid().optional())})),a=i.define(\"SubjectPublicKeyInfo\",(function(){this.seq().obj(this.key(\"algorithm\").use(o),this.key(\"subjectPublicKey\").bitstr())})),h=i.define(\"RelativeDistinguishedName\",(function(){this.setof(s)})),u=i.define(\"RDNSequence\",(function(){this.seqof(h)})),f=i.define(\"Name\",(function(){this.choice({rdnSequence:this.use(u)})})),l=i.define(\"Validity\",(function(){this.seq().obj(this.key(\"notBefore\").use(n),this.key(\"notAfter\").use(n))})),c=i.define(\"Extension\",(function(){this.seq().obj(this.key(\"extnID\").objid(),this.key(\"critical\").bool().def(!1),this.key(\"extnValue\").octstr())})),d=i.define(\"TBSCertificate\",(function(){this.seq().obj(this.key(\"version\").explicit(0).int().optional(),this.key(\"serialNumber\").int(),this.key(\"signature\").use(o),this.key(\"issuer\").use(f),this.key(\"validity\").use(l),this.key(\"subject\").use(f),this.key(\"subjectPublicKeyInfo\").use(a),this.key(\"issuerUniqueID\").implicit(1).bitstr().optional(),this.key(\"subjectUniqueID\").implicit(2).bitstr().optional(),this.key(\"extensions\").explicit(3).seqof(c).optional())})),p=i.define(\"X509Certificate\",(function(){this.seq().obj(this.key(\"tbsCertificate\").use(d),this.key(\"signatureAlgorithm\").use(o),this.key(\"signatureValue\").bitstr())}));t.exports=p},4101:(t,e,r)=>{\"use strict\";var i=/Proc-Type: 4,ENCRYPTED[\\n\\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\\n\\r]+([0-9A-z\\n\\r+/=]+)[\\n\\r]+/m,n=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,s=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\\n\\r+/=]+)-----END \\1-----$/m,o=r(8078),a=r(1241),h=r(2861).Buffer;t.exports=function(t,e){var r,u=t.toString(),f=u.match(i);if(f){var l=\"aes\"+f[1],c=h.from(f[2],\"hex\"),d=h.from(f[3].replace(/[\\r\\n]/g,\"\"),\"base64\"),p=o(e,c.slice(0,8),parseInt(f[1],10)).key,m=[],g=a.createDecipheriv(l,p,c);m.push(g.update(d)),m.push(g.final()),r=h.concat(m)}else{var y=u.match(s);r=h.from(y[2].replace(/[\\r\\n]/g,\"\"),\"base64\")}return{tag:u.match(n)[1],data:r}}},8170:(t,e,r)=>{\"use strict\";var i=r(1137),n=r(5579),s=r(4101),o=r(1241),a=r(8396),h=r(2861).Buffer;function u(t){var e;\"object\"!=typeof t||h.isBuffer(t)||(e=t.passphrase,t=t.key),\"string\"==typeof t&&(t=h.from(t));var r,u,f=s(t,e),l=f.tag,c=f.data;switch(l){case\"CERTIFICATE\":u=i.certificate.decode(c,\"der\").tbsCertificate.subjectPublicKeyInfo;case\"PUBLIC KEY\":switch(u||(u=i.PublicKey.decode(c,\"der\")),r=u.algorithm.algorithm.join(\".\")){case\"1.2.840.113549.1.1.1\":return i.RSAPublicKey.decode(u.subjectPublicKey.data,\"der\");case\"1.2.840.10045.2.1\":return u.subjectPrivateKey=u.subjectPublicKey,{type:\"ec\",data:u};case\"1.2.840.10040.4.1\":return u.algorithm.params.pub_key=i.DSAparam.decode(u.subjectPublicKey.data,\"der\"),{type:\"dsa\",data:u.algorithm.params};default:throw new Error(\"unknown key id \"+r)}case\"ENCRYPTED PRIVATE KEY\":c=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),s=n[t.algorithm.decrypt.cipher.algo.join(\".\")],u=t.algorithm.decrypt.cipher.iv,f=t.subjectPrivateKey,l=parseInt(s.split(\"-\")[1],10)/8,c=a.pbkdf2Sync(e,r,i,l,\"sha1\"),d=o.createDecipheriv(s,c,u),p=[];return p.push(d.update(f)),p.push(d.final()),h.concat(p)}(c=i.EncryptedPrivateKey.decode(c,\"der\"),e);case\"PRIVATE KEY\":switch(r=(u=i.PrivateKey.decode(c,\"der\")).algorithm.algorithm.join(\".\")){case\"1.2.840.113549.1.1.1\":return i.RSAPrivateKey.decode(u.subjectPrivateKey,\"der\");case\"1.2.840.10045.2.1\":return{curve:u.algorithm.curve,privateKey:i.ECPrivateKey.decode(u.subjectPrivateKey,\"der\").privateKey};case\"1.2.840.10040.4.1\":return u.algorithm.params.priv_key=i.DSAparam.decode(u.subjectPrivateKey,\"der\"),{type:\"dsa\",params:u.algorithm.params};default:throw new Error(\"unknown key id \"+r)}case\"RSA PUBLIC KEY\":return i.RSAPublicKey.decode(c,\"der\");case\"RSA PRIVATE KEY\":return i.RSAPrivateKey.decode(c,\"der\");case\"DSA PRIVATE KEY\":return{type:\"dsa\",params:i.DSAPrivateKey.decode(c,\"der\")};case\"EC PRIVATE KEY\":return{curve:(c=i.ECPrivateKey.decode(c,\"der\")).parameters.value,privateKey:c.privateKey};default:throw new Error(\"unknown key type \"+l)}}u.signature=i.signature,t.exports=u},7975:(t,e,r)=>{\"use strict\";var i=r(5606);function n(t){if(\"string\"!=typeof t)throw new TypeError(\"Path must be a string. Received \"+JSON.stringify(t))}function s(t,e){for(var r,i=\"\",n=0,s=-1,o=0,a=0;a<=t.length;++a){if(a2){var h=i.lastIndexOf(\"/\");if(h!==i.length-1){-1===h?(i=\"\",n=0):n=(i=i.slice(0,h)).length-1-i.lastIndexOf(\"/\"),s=a,o=0;continue}}else if(2===i.length||1===i.length){i=\"\",n=0,s=a,o=0;continue}e&&(i.length>0?i+=\"/..\":i=\"..\",n=2)}else i.length>0?i+=\"/\"+t.slice(s+1,a):i=t.slice(s+1,a),n=a-s-1;s=a,o=0}else 46===r&&-1!==o?++o:o=-1}return i}var o={resolve:function(){for(var t,e=\"\",r=!1,o=arguments.length-1;o>=-1&&!r;o--){var a;o>=0?a=arguments[o]:(void 0===t&&(t=i.cwd()),a=t),n(a),0!==a.length&&(e=a+\"/\"+e,r=47===a.charCodeAt(0))}return e=s(e,!r),r?e.length>0?\"/\"+e:\"/\":e.length>0?e:\".\"},normalize:function(t){if(n(t),0===t.length)return\".\";var e=47===t.charCodeAt(0),r=47===t.charCodeAt(t.length-1);return 0!==(t=s(t,!e)).length||e||(t=\".\"),t.length>0&&r&&(t+=\"/\"),e?\"/\"+t:t},isAbsolute:function(t){return n(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return\".\";for(var t,e=0;e0&&(void 0===t?t=r:t+=\"/\"+r)}return void 0===t?\".\":o.normalize(t)},relative:function(t,e){if(n(t),n(e),t===e)return\"\";if((t=o.resolve(t))===(e=o.resolve(e)))return\"\";for(var r=1;ru){if(47===e.charCodeAt(a+l))return e.slice(a+l+1);if(0===l)return e.slice(a+l)}else s>u&&(47===t.charCodeAt(r+l)?f=l:0===l&&(f=0));break}var c=t.charCodeAt(r+l);if(c!==e.charCodeAt(a+l))break;47===c&&(f=l)}var d=\"\";for(l=r+f+1;l<=i;++l)l!==i&&47!==t.charCodeAt(l)||(0===d.length?d+=\"..\":d+=\"/..\");return d.length>0?d+e.slice(a+f):(a+=f,47===e.charCodeAt(a)&&++a,e.slice(a))},_makeLong:function(t){return t},dirname:function(t){if(n(t),0===t.length)return\".\";for(var e=t.charCodeAt(0),r=47===e,i=-1,s=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!s){i=o;break}}else s=!1;return-1===i?r?\"/\":\".\":r&&1===i?\"//\":t.slice(0,i)},basename:function(t,e){if(void 0!==e&&\"string\"!=typeof e)throw new TypeError('\"ext\" argument must be a string');n(t);var r,i=0,s=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return\"\";var a=e.length-1,h=-1;for(r=t.length-1;r>=0;--r){var u=t.charCodeAt(r);if(47===u){if(!o){i=r+1;break}}else-1===h&&(o=!1,h=r+1),a>=0&&(u===e.charCodeAt(a)?-1==--a&&(s=r):(a=-1,s=h))}return i===s?s=h:-1===s&&(s=t.length),t.slice(i,s)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!o){i=r+1;break}}else-1===s&&(o=!1,s=r+1);return-1===s?\"\":t.slice(i,s)},extname:function(t){n(t);for(var e=-1,r=0,i=-1,s=!0,o=0,a=t.length-1;a>=0;--a){var h=t.charCodeAt(a);if(47!==h)-1===i&&(s=!1,i=a+1),46===h?-1===e?e=a:1!==o&&(o=1):-1!==e&&(o=-1);else if(!s){r=a+1;break}}return-1===e||-1===i||0===o||1===o&&e===i-1&&e===r+1?\"\":t.slice(e,i)},format:function(t){if(null===t||\"object\"!=typeof t)throw new TypeError('The \"pathObject\" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,i=e.base||(e.name||\"\")+(e.ext||\"\");return r?r===e.root?r+i:r+\"/\"+i:i}(0,t)},parse:function(t){n(t);var e={root:\"\",dir:\"\",base:\"\",ext:\"\",name:\"\"};if(0===t.length)return e;var r,i=t.charCodeAt(0),s=47===i;s?(e.root=\"/\",r=1):r=0;for(var o=-1,a=0,h=-1,u=!0,f=t.length-1,l=0;f>=r;--f)if(47!==(i=t.charCodeAt(f)))-1===h&&(u=!1,h=f+1),46===i?-1===o?o=f:1!==l&&(l=1):-1!==o&&(l=-1);else if(!u){a=f+1;break}return-1===o||-1===h||0===l||1===l&&o===h-1&&o===a+1?-1!==h&&(e.base=e.name=0===a&&s?t.slice(1,h):t.slice(a,h)):(0===a&&s?(e.name=t.slice(1,o),e.base=t.slice(1,h)):(e.name=t.slice(a,o),e.base=t.slice(a,h)),e.ext=t.slice(o,h)),a>0?e.dir=t.slice(0,a-1):s&&(e.dir=\"/\"),e},sep:\"/\",delimiter:\":\",win32:null,posix:null};o.posix=o,t.exports=o},8396:(t,e,r)=>{e.pbkdf2=r(3832),e.pbkdf2Sync=r(1352)},3832:(t,e,r)=>{var i,n,s=r(2861).Buffer,o=r(4196),a=r(2455),h=r(1352),u=r(3382),f=globalThis.crypto&&globalThis.crypto.subtle,l={sha:\"SHA-1\",\"sha-1\":\"SHA-1\",sha1:\"SHA-1\",sha256:\"SHA-256\",\"sha-256\":\"SHA-256\",sha384:\"SHA-384\",\"sha-384\":\"SHA-384\",\"sha-512\":\"SHA-512\",sha512:\"SHA-512\"},c=[];function d(){return n||(n=globalThis.process&&globalThis.process.nextTick?globalThis.process.nextTick:globalThis.queueMicrotask?globalThis.queueMicrotask:globalThis.setImmediate?globalThis.setImmediate:globalThis.setTimeout)}function p(t,e,r,i,n){return f.importKey(\"raw\",t,{name:\"PBKDF2\"},!1,[\"deriveBits\"]).then((function(t){return f.deriveBits({name:\"PBKDF2\",salt:e,iterations:r,hash:{name:n}},t,i<<3)})).then((function(t){return s.from(t)}))}t.exports=function(t,e,r,n,m,g){\"function\"==typeof m&&(g=m,m=void 0);var y=l[(m=m||\"sha1\").toLowerCase()];if(y&&\"function\"==typeof globalThis.Promise){if(o(r,n),t=u(t,a,\"Password\"),e=u(e,a,\"Salt\"),\"function\"!=typeof g)throw new Error(\"No callback provided to pbkdf2\");!function(t,e){t.then((function(t){d()((function(){e(null,t)}))}),(function(t){d()((function(){e(t)}))}))}(function(t){if(globalThis.process&&!globalThis.process.browser)return Promise.resolve(!1);if(!f||!f.importKey||!f.deriveBits)return Promise.resolve(!1);if(void 0!==c[t])return c[t];var e=p(i=i||s.alloc(8),i,10,128,t).then((function(){return!0})).catch((function(){return!1}));return c[t]=e,e}(y).then((function(i){return i?p(t,e,r,n,y):h(t,e,r,n,m)})),g)}else d()((function(){var i;try{i=h(t,e,r,n,m)}catch(t){return g(t)}g(null,i)}))}},2455:(t,e,r)=>{var i,n=r(5606);i=globalThis.process&&globalThis.process.browser?\"utf-8\":globalThis.process&&globalThis.process.version?parseInt(n.version.split(\".\")[0].slice(1),10)>=6?\"utf-8\":\"binary\":\"utf-8\",t.exports=i},4196:t=>{var e=Math.pow(2,30)-1;t.exports=function(t,r){if(\"number\"!=typeof t)throw new TypeError(\"Iterations not a number\");if(t<0)throw new TypeError(\"Bad iterations\");if(\"number\"!=typeof r)throw new TypeError(\"Key length not a number\");if(r<0||r>e||r!=r)throw new TypeError(\"Bad key length\")}},1352:(t,e,r)=>{var i=r(320),n=r(6011),s=r(2802),o=r(2861).Buffer,a=r(4196),h=r(2455),u=r(3382),f=o.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function c(t,e,r){var a=function(t){return\"rmd160\"===t||\"ripemd160\"===t?function(t){return(new n).update(t).digest()}:\"md5\"===t?i:function(e){return s(t).update(e).digest()}}(t),h=\"sha512\"===t||\"sha384\"===t?128:64;e.length>h?e=a(e):e.length{var i=r(2861).Buffer;t.exports=function(t,e,r){if(i.isBuffer(t))return t;if(\"string\"==typeof t)return i.from(t,e);if(ArrayBuffer.isView(t))return i.from(t.buffer);throw new TypeError(r+\" must be a string, a Buffer, a typed array or a DataView\")}},8444:t=>{t.exports=function(t){return Math.max(16384,1<{\"use strict\";t.exports=[\"Float32Array\",\"Float64Array\",\"Int8Array\",\"Int16Array\",\"Int32Array\",\"Uint8Array\",\"Uint8ClampedArray\",\"Uint16Array\",\"Uint32Array\",\"BigInt64Array\",\"BigUint64Array\"]},3225:(t,e,r)=>{\"use strict\";var i=r(5606);void 0===i||!i.version||0===i.version.indexOf(\"v0.\")||0===i.version.indexOf(\"v1.\")&&0!==i.version.indexOf(\"v1.8.\")?t.exports={nextTick:function(t,e,r,n){if(\"function\"!=typeof t)throw new TypeError('\"callback\" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return i.nextTick(t);case 2:return i.nextTick((function(){t.call(null,e)}));case 3:return i.nextTick((function(){t.call(null,e,r)}));case 4:return i.nextTick((function(){t.call(null,e,r,n)}));default:for(s=new Array(a-1),o=0;o{var e,r,i=t.exports={};function n(){throw new Error(\"setTimeout has not been defined\")}function s(){throw new Error(\"clearTimeout has not been defined\")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e=\"function\"==typeof setTimeout?setTimeout:n}catch(t){e=n}try{r=\"function\"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var a,h=[],u=!1,f=-1;function l(){u&&a&&(u=!1,a.length?h=a.concat(h):f=-1,h.length&&c())}function c(){if(!u){var t=o(l);u=!0;for(var e=h.length;e;){for(a=h,h=[];++f1)for(var r=1;r{e.publicEncrypt=r(8902),e.privateDecrypt=r(7362),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}},8206:(t,e,r)=>{var i=r(7108),n=r(2861).Buffer;function s(t){var e=n.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var r,o=n.alloc(0),a=0;o.length=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,s=Math.min(t.length,r),o=e;o=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(t){return t instanceof s||null!==t&&\"object\"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if(\"number\"==typeof t)return this._initNumber(t,e,r);if(\"object\"==typeof t)return this._initArray(t,e,r);\"hex\"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;\"-\"===(t=t.toString().replace(/\\s+/g,\"\"))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if(\"le\"===r)for(n=0,s=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?\"\"};var f=[\"\",\"0\",\"00\",\"000\",\"0000\",\"00000\",\"000000\",\"0000000\",\"00000000\",\"000000000\",\"0000000000\",\"00000000000\",\"000000000000\",\"0000000000000\",\"00000000000000\",\"000000000000000\",\"0000000000000000\",\"00000000000000000\",\"000000000000000000\",\"0000000000000000000\",\"00000000000000000000\",\"000000000000000000000\",\"0000000000000000000000\",\"00000000000000000000000\",\"000000000000000000000000\",\"0000000000000000000000000\"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,h=o/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(s=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||\"hex\"===t){r=\"\";for(var n=0,s=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r=\"\";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r=\"0\"+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}i(!1,\"Base should be between 2 and 36\")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,\"Number can only safely store up to 53 bits\"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,\"byte array longer than desired length\"),i(s>0,\"Requested array length <= 0\"),this.strip();var o,a,h=\"le\"===e,u=new t(s),f=this.clone();if(h){for(a=0;!f.isZero();a++)o=f.andln(255),f.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i(\"number\"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i(\"number\"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,b=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,M=0|o[4],k=8191&M,S=M>>>13,x=0|o[5],A=8191&x,E=x>>>13,I=0|o[6],B=8191&I,T=I>>>13,P=0|o[7],R=8191&P,C=P>>>13,L=0|o[8],O=8191&L,j=L>>>13,N=0|o[9],U=8191&N,q=N>>>13,D=0|a[0],F=8191&D,H=D>>>13,z=0|a[1],W=8191&z,K=z>>>13,V=0|a[2],$=8191&V,Z=V>>>13,G=0|a[3],J=8191&G,Y=G>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,H))+Math.imul(c,F)|0))<<13)|0;u=((s=Math.imul(c,H))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,H))+Math.imul(m,F)|0,s=Math.imul(m,H);var yt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,K)|0)+Math.imul(c,W)|0))<<13)|0;u=((s=s+Math.imul(c,K)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,H))+Math.imul(b,F)|0,s=Math.imul(b,H),i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,K)|0;var bt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,H))+Math.imul(_,F)|0,s=Math.imul(_,H),i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,K)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,J)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((s=s+Math.imul(c,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(k,F),n=(n=Math.imul(k,H))+Math.imul(S,F)|0,s=Math.imul(S,H),i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,K)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,J)|0,s=s+Math.imul(m,Y)|0;var wt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((s=s+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,H))+Math.imul(E,F)|0,s=Math.imul(E,H),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,K)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,s=s+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((s=s+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,H))+Math.imul(T,F)|0,s=Math.imul(T,H),i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,K)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,K)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,Z)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,s=s+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,s=s+Math.imul(m,it)|0;var Mt=(u+(i=i+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,st)|0))<<13)|0;u=((s=s+Math.imul(c,ot)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,H))+Math.imul(C,F)|0,s=Math.imul(C,H),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,K)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,Z)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(S,J)|0,s=s+Math.imul(S,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,s=s+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,it)|0,i=i+Math.imul(p,st)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0;var kt=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((s=s+Math.imul(c,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,F),n=(n=Math.imul(O,H))+Math.imul(j,F)|0,s=Math.imul(j,H),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(C,W)|0,s=s+Math.imul(C,K)|0,i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,Z)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,Z)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,Y)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,s=s+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,it)|0,i=i+Math.imul(y,st)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,s=s+Math.imul(m,ut)|0;var St=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((s=s+Math.imul(c,ct)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,H))+Math.imul(q,F)|0,s=Math.imul(q,H),i=i+Math.imul(O,W)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(j,W)|0,s=s+Math.imul(j,K)|0,i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(C,$)|0,s=s+Math.imul(C,Z)|0,i=i+Math.imul(B,J)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(S,rt)|0,s=s+Math.imul(S,it)|0,i=i+Math.imul(w,st)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,s=s+Math.imul(b,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,s=s+Math.imul(m,ct)|0;var xt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((s=s+Math.imul(c,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,W),n=(n=Math.imul(U,K))+Math.imul(q,W)|0,s=Math.imul(q,K),i=i+Math.imul(O,$)|0,n=(n=n+Math.imul(O,Z)|0)+Math.imul(j,$)|0,s=s+Math.imul(j,Z)|0,i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(C,J)|0,s=s+Math.imul(C,Y)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(S,st)|0,s=s+Math.imul(S,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,s=s+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,s=s+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((s=s+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,Z))+Math.imul(q,$)|0,s=Math.imul(q,Z),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(j,J)|0,s=s+Math.imul(j,Y)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(C,Q)|0,s=s+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(A,st)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,ht)|0,s=s+Math.imul(S,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,s=s+Math.imul(_,ct)|0;var Et=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((s=s+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,J),n=(n=Math.imul(U,Y))+Math.imul(q,J)|0,s=Math.imul(q,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(j,Q)|0,s=s+Math.imul(j,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(C,rt)|0,s=s+Math.imul(C,it)|0,i=i+Math.imul(B,st)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,ht)|0,s=s+Math.imul(E,ut)|0,i=i+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,ct)|0)+Math.imul(S,lt)|0,s=s+Math.imul(S,ct)|0;var It=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((s=s+Math.imul(_,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(q,Q)|0,s=Math.imul(q,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(j,rt)|0,s=s+Math.imul(j,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,ot)|0,i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(T,ht)|0,s=s+Math.imul(T,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(E,lt)|0,s=s+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((s=s+Math.imul(S,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(q,rt)|0,s=Math.imul(q,it),i=i+Math.imul(O,st)|0,n=(n=n+Math.imul(O,ot)|0)+Math.imul(j,st)|0,s=s+Math.imul(j,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(C,ht)|0,s=s+Math.imul(C,ut)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,s=s+Math.imul(T,ct)|0;var Tt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((s=s+Math.imul(E,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,st),n=(n=Math.imul(U,ot))+Math.imul(q,st)|0,s=Math.imul(q,ot),i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(j,ht)|0,s=s+Math.imul(j,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(C,lt)|0,s=s+Math.imul(C,ct)|0;var Pt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((s=s+Math.imul(T,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ht),n=(n=Math.imul(U,ut))+Math.imul(q,ht)|0,s=Math.imul(q,ut),i=i+Math.imul(O,lt)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(j,lt)|0,s=s+Math.imul(j,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((s=s+Math.imul(C,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,lt),n=(n=Math.imul(U,ct))+Math.imul(q,lt)|0,s=Math.imul(q,ct);var Ct=(u+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((s=s+Math.imul(j,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Lt=(u+(i=Math.imul(U,pt))|0)+((8191&(n=(n=Math.imul(U,mt))+Math.imul(q,pt)|0))<<13)|0;return u=((s=Math.imul(q,mt))+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=kt,h[8]=St,h[9]=xt,h[10]=At,h[11]=Et,h[12]=It,h[13]=Bt,h[14]=Tt,h[15]=Pt,h[16]=Rt,h[17]=Ct,h[18]=Lt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),s.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?d(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-s|l>>>s,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i(\"number\"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,\"imaskn works only with positive numbers\"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i(\"number\"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&s}for(;n>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,h=i.length-n.length;if(\"mod\"!==e){(a=new s(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),\"div\"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),\"mod\"!==e&&(n=a.div.neg()),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),\"mod\"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),\"div\"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?\"div\"===e?{div:this.divn(t.words[0]),mod:null}:\"mod\"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,\"div\",!1).div},s.prototype.mod=function(t){return this.divmod(t,\"mod\",!1).mod},s.prototype.umod=function(t){return this.divmod(t,\"mod\",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},s.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),h=new s(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;!(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(h)):(r.isub(e),a.isub(n),h.isub(o))}return{a,b:h,gcd:r.iushln(u)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;!(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;!(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return!(1&this.words[0])},s.prototype.isOdd=function(){return!(1&~this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i(\"number\"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,\"Number is too big\");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new k(t)},s.prototype.toRed=function(t){return i(!this.red,\"Already a number in reduction context\"),i(0===this.negative,\"red works only with positives\"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,\"fromRed works only with numbers in reduction context\"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,\"Already a number in reduction context\"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,\"redAdd works only with red numbers\"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,\"redIAdd works only with red numbers\"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,\"redSub works only with red numbers\"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,\"redISub works only with red numbers\"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,\"redShl works only with red numbers\"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,\"redSqr works only with red numbers\"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,\"redISqr works only with red numbers\"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,\"redSqrt works only with red numbers\"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,\"redInvm works only with red numbers\"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,\"redNeg works only with red numbers\"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,\"redPow(normalNum)\"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,\"k256\",\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\")}function w(){b.call(this,\"p224\",\"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\")}function _(){b.call(this,\"p192\",\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\")}function M(){b.call(this,\"25519\",\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\")}function k(t){if(\"string\"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),\"modulus must be greater than 1\"),this.m=t,this.prime=null}function S(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(v,b),v.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n>>22,s=o}s>>>=22,t.words[n-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(y[t])return y[t];var e;if(\"k256\"===t)e=new v;else if(\"p224\"===t)e=new w;else if(\"p192\"===t)e=new _;else{if(\"p25519\"!==t)throw new Error(\"Unknown prime \"+t);e=new M}return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,\"red works only with positives\"),i(t.red,\"red works only with red numbers\")},k.prototype._verify2=function(t,e){i(!(t.negative|e.negative),\"red works only with positives\"),i(t.red&&t.red===e.red,\"red works only with red numbers\")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4==++a||0===i&&0===f)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}h=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new S(t)},n(S,k),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},7362:(t,e,r)=>{var i=r(8170),n=r(8206),s=r(2061),o=r(2509),a=r(7332),h=r(7108),u=r(9247),f=r(2861).Buffer;t.exports=function(t,e,r){var l;l=t.padding?t.padding:r?1:4;var c,d=i(t),p=d.modulus.byteLength();if(e.length>p||new o(e).cmp(d.modulus)>=0)throw new Error(\"decryption error\");c=r?u(new o(e),d):a(e,d);var m=f.alloc(p-c.length);if(c=f.concat([m,c],p),4===l)return function(t,e){var r=t.modulus.byteLength(),i=h(\"sha1\").update(f.alloc(0)).digest(),o=i.length;if(0!==e[0])throw new Error(\"decryption error\");var a=e.slice(1,o+1),u=e.slice(o+1),l=s(a,n(u,o)),c=s(u,n(l,r-o-1));if(function(t,e){t=f.from(t),e=f.from(e);var r=0,i=t.length;t.length!==e.length&&(r++,i=Math.min(t.length,e.length));for(var n=-1;++n=e.length){s++;break}var o=e.slice(2,n-1);if((\"0002\"!==i.toString(\"hex\")&&!r||\"0001\"!==i.toString(\"hex\")&&r)&&s++,o.length<8&&s++,s)throw new Error(\"decryption error\");return e.slice(n)}(0,c,r);if(3===l)return c;throw new Error(\"unknown padding\")}},8902:(t,e,r)=>{var i=r(8170),n=r(3209),s=r(7108),o=r(8206),a=r(2061),h=r(2509),u=r(9247),f=r(7332),l=r(2861).Buffer;t.exports=function(t,e,r){var c;c=t.padding?t.padding:r?1:4;var d,p=i(t);if(4===c)d=function(t,e){var r=t.modulus.byteLength(),i=e.length,u=s(\"sha1\").update(l.alloc(0)).digest(),f=u.length,c=2*f;if(i>r-c-2)throw new Error(\"message too long\");var d=l.alloc(r-i-c-2),p=r-f-1,m=n(f),g=a(l.concat([u,d,l.alloc(1,1),e],p),o(m,p)),y=a(m,o(g,f));return new h(l.concat([l.alloc(1),y,g],r))}(p,e);else if(1===c)d=function(t,e,r){var i,s=e.length,o=t.modulus.byteLength();if(s>o-11)throw new Error(\"message too long\");return i=r?l.alloc(o-s-3,255):function(t){for(var e,r=l.allocUnsafe(t),i=0,s=n(2*t),o=0;i=0)throw new Error(\"data too long for modulus\")}return r?f(d,p):u(d,p)}},9247:(t,e,r)=>{var i=r(2509),n=r(2861).Buffer;t.exports=function(t,e){return n.from(t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed().toArray())}},2061:t=>{t.exports=function(t,e){for(var r=t.length,i=-1;++i{var i=r(5606),n=r(3519),s=r(6611),o=r(2376),a=function(){},h=/^v?\\.0/.test(i.version),u=function(t){return\"function\"==typeof t},f=function(t){t()},l=function(t,e){return t.pipe(e)};t.exports=function(){var t,e=Array.prototype.slice.call(arguments),r=u(e[e.length-1]||a)&&e.pop()||a;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error(\"pump requires two streams per minimum\");var i=e.map((function(l,c){var d=c0,(function(e){t||(t=e),e&&i.forEach(f),d||(i.forEach(f),r(t))}))}));return e.reduce(l)}},9596:t=>{let e;t.exports=\"function\"==typeof queueMicrotask?queueMicrotask.bind(\"undefined\"!=typeof window?window:globalThis):t=>(e||(e=Promise.resolve())).then(t).catch((t=>setTimeout((()=>{throw t}),0)))},2133:t=>{t.exports=\"function\"==typeof queueMicrotask?queueMicrotask:t=>Promise.resolve().then(t)},7373:t=>{t.exports=function(t){var e=0;return function(){if(e===t.length)return null;var r=t.length-e,i=Math.random()*r|0,n=t[e+i],s=t[e];return t[e]=n,t[e+i]=s,e++,n}}},3209:(t,e,r)=>{\"use strict\";var i=r(5606),n=65536,s=r(2861).Buffer,o=globalThis.crypto||globalThis.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError(\"requested too many random bytes\");var r=s.allocUnsafe(t);if(t>0)if(t>n)for(var a=0;a{\"use strict\";var i=r(5606);function n(){throw new Error(\"secure random number generation not supported by this browser\\nuse chrome, FireFox or Internet Explorer 11\")}var s=r(2861),o=r(3209),a=s.Buffer,h=s.kMaxLength,u=globalThis.crypto||globalThis.msCrypto,f=Math.pow(2,32)-1;function l(t,e){if(\"number\"!=typeof t||t!=t)throw new TypeError(\"offset must be a number\");if(t>f||t<0)throw new TypeError(\"offset must be a uint32\");if(t>h||t>e)throw new RangeError(\"offset out of range\")}function c(t,e,r){if(\"number\"!=typeof t||t!=t)throw new TypeError(\"size must be a number\");if(t>f||t<0)throw new TypeError(\"size must be a uint32\");if(t+e>r||t>h)throw new RangeError(\"buffer too small\")}function d(t,e,r,n){if(i.browser){var s=t.buffer,a=new Uint8Array(s,e,r);return u.getRandomValues(a),n?void i.nextTick((function(){n(null,t)})):t}if(!n)return o(r).copy(t,e),t;o(r,(function(r,i){if(r)return n(r);i.copy(t,e),n(null,t)}))}u&&u.getRandomValues||!i.browser?(e.randomFill=function(t,e,r,i){if(!(a.isBuffer(t)||t instanceof globalThis.Uint8Array))throw new TypeError('\"buf\" argument must be a Buffer or Uint8Array');if(\"function\"==typeof e)i=e,e=0,r=t.length;else if(\"function\"==typeof r)i=r,r=t.length-e;else if(\"function\"!=typeof i)throw new TypeError('\"cb\" argument must be a function');return l(e,t.length),c(r,e,t.length),d(t,e,r,i)},e.randomFillSync=function(t,e,r){if(void 0===e&&(e=0),!(a.isBuffer(t)||t instanceof globalThis.Uint8Array))throw new TypeError('\"buf\" argument must be a Buffer or Uint8Array');return l(e,t.length),void 0===r&&(r=t.length-e),c(r,e,t.length),d(t,e,r)}):(e.randomFill=n,e.randomFillSync=n)},2878:t=>{\"use strict\";function e(t,e){return{start:t.start,end:t.end,index:e}}function r(t){return{start:t.start,end:t.end}}function i(t,e){return t.index-e.index}function n(t,e){return t.start-e.start}t.exports=function(t,s,o){if(\"string\"!=typeof s)throw new TypeError(\"argument str must be a string\");var a=s.indexOf(\"=\");if(-1===a)return-2;var h=s.slice(a+1).split(\",\"),u=[];u.type=s.slice(0,a);for(var f=0;ft-1&&(d=t-1),isNaN(c)||isNaN(d)||c>d||c<0||u.push({start:c,end:d})}return u.length<1?-1:o&&o.combine?function(t){for(var s=t.map(e).sort(n),o=0,a=1;au.end+1?s[++o]=h:h.end>u.end&&(u.end=h.end,u.index=Math.min(u.index,h.index))}s.length=o+1;var f=s.sort(i).map(r);return f.type=t.type,f}(u):u}},8727:t=>{\"use strict\";function e(t){return parseInt(t,10)===t}function r(t){function r(e){this.s=function(e){if(void 0===e){e=new Array(t);for(var r=0;r{\"use strict\";var i=r(3225),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=l;var s=Object.create(r(5622));s.inherits=r(6698);var o=r(5412),a=r(6708);s.inherits(l,o);for(var h=n(a.prototype),u=0;u{\"use strict\";t.exports=s;var i=r(4610),n=Object.create(r(5622));function s(t){if(!(this instanceof s))return new s(t);i.call(this,t)}n.inherits=r(6698),n.inherits(s,i),s.prototype._transform=function(t,e,r){r(null,t)}},5412:(t,e,r)=>{\"use strict\";var i=r(5606),n=r(3225);t.exports=v;var s,o=r(4634);v.ReadableState=b,r(7007).EventEmitter;var a=function(t,e){return t.listeners(e).length},h=r(345),u=r(4106).Buffer,f=(\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof window?window:\"undefined\"!=typeof self?self:{}).Uint8Array||function(){},l=Object.create(r(5622));l.inherits=r(6698);var c=r(9838),d=void 0;d=c&&c.debuglog?c.debuglog(\"stream\"):function(){};var p,m=r(3222),g=r(5896);l.inherits(v,h);var y=[\"error\",\"close\",\"destroy\",\"pause\",\"resume\"];function b(t,e){t=t||{};var i=e instanceof(s=s||r(5382));this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||\"utf8\",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(3141).I),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function v(t){if(s=s||r(5382),!(this instanceof v))return new v(t);this._readableState=new b(t,this),this.readable=!0,t&&(\"function\"==typeof t.read&&(this._read=t.read),\"function\"==typeof t.destroy&&(this._destroy=t.destroy)),h.call(this)}function w(t,e,r,i,n){var s,o=t._readableState;return null===e?(o.reading=!1,function(t,e){if(!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}}(t,o)):(n||(s=function(t,e){var r,i;return i=e,u.isBuffer(i)||i instanceof f||\"string\"==typeof e||void 0===e||t.objectMode||(r=new TypeError(\"Invalid non-string/buffer chunk\")),r}(o,e)),s?t.emit(\"error\",s):o.objectMode||e&&e.length>0?(\"string\"==typeof e||o.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),i?o.endEmitted?t.emit(\"error\",new Error(\"stream.unshift() after end event\")):_(t,o,e,!0):o.ended?t.emit(\"error\",new Error(\"stream.push() after EOF\")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?_(t,o,e,!1):A(t,o)):_(t,o,e,!1))):i||(o.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=M?t=M:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d(\"emitReadable\",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(x,t):x(t))}function x(t){d(\"emit readable\"),t.emit(\"readable\"),T(t)}function A(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(E,t,e))}function E(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(\"\"):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;return ts.length?s.length:t;if(o===s.length?n+=s:n+=s.slice(0,t),0==(t-=o)){o===s.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=u.allocUnsafe(t),i=e.head,n=1;for(i.data.copy(r),t-=i.data.length;i=i.next;){var s=i.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0==(t-=o)){o===s.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=s.slice(o));break}++n}return e.length-=n,r}(t,e),i}(t,e.buffer,e.decoder),r);var r}function R(t){var e=t._readableState;if(e.length>0)throw new Error('\"endReadable()\" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(C,e,t))}function C(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit(\"end\"))}function L(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return d(\"read: emitReadable\",e.length,e.ended),0===e.length&&e.ended?R(this):S(this),null;if(0===(t=k(t,e))&&e.ended)return 0===e.length&&R(this),null;var i,n=e.needReadable;return d(\"need readable\",n),(0===e.length||e.length-t0?P(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&R(this)),null!==i&&this.emit(\"data\",i),i},v.prototype._read=function(t){this.emit(\"error\",new Error(\"_read() is not implemented\"))},v.prototype.pipe=function(t,e){var r=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,d(\"pipe count=%d opts=%j\",s.pipesCount,e);var h=e&&!1===e.end||t===i.stdout||t===i.stderr?b:u;function u(){d(\"onend\"),t.end()}s.endEmitted?n.nextTick(h):r.once(\"end\",h),t.on(\"unpipe\",(function e(i,n){d(\"onunpipe\"),i===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,d(\"cleanup\"),t.removeListener(\"close\",g),t.removeListener(\"finish\",y),t.removeListener(\"drain\",f),t.removeListener(\"error\",m),t.removeListener(\"unpipe\",e),r.removeListener(\"end\",u),r.removeListener(\"end\",b),r.removeListener(\"data\",p),l=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}));var f=function(t){return function(){var e=t._readableState;d(\"pipeOnDrain\",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,\"data\")&&(e.flowing=!0,T(t))}}(r);t.on(\"drain\",f);var l=!1,c=!1;function p(e){d(\"ondata\"),c=!1,!1!==t.write(e)||c||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==L(s.pipes,t))&&!l&&(d(\"false write response, pause\",s.awaitDrain),s.awaitDrain++,c=!0),r.pause())}function m(e){d(\"onerror\",e),b(),t.removeListener(\"error\",m),0===a(t,\"error\")&&t.emit(\"error\",e)}function g(){t.removeListener(\"finish\",y),b()}function y(){d(\"onfinish\"),t.removeListener(\"close\",g),b()}function b(){d(\"unpipe\"),r.unpipe(t)}return r.on(\"data\",p),function(t,e,r){if(\"function\"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,\"error\",m),t.once(\"close\",g),t.once(\"finish\",y),t.emit(\"pipe\",r),s.flowing||(d(\"pipe resume\"),r.resume()),t},v.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit(\"unpipe\",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s{\"use strict\";t.exports=o;var i=r(5382),n=Object.create(r(5622));function s(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit(\"error\",new Error(\"write callback called multiple times\"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{\"use strict\";var i=r(5606),n=r(3225);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(undefined),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=y;var o,a=!i.browser&&[\"v0.10\",\"v0.9.\"].indexOf(i.version.slice(0,5))>-1?setImmediate:n.nextTick;y.WritableState=g;var h=Object.create(r(5622));h.inherits=r(6698);var u,f={deprecate:r(4643)},l=r(345),c=r(4106).Buffer,d=(\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof window?window:\"undefined\"!=typeof self?self:{}).Uint8Array||function(){},p=r(5896);function m(){}function g(t,e){o=o||r(5382),t=t||{};var i=e instanceof o;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var h=t.highWaterMark,u=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=h||0===h?h:i&&(u||0===u)?u:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||\"utf8\",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,s=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,s){--e.pendingcb,r?(n.nextTick(s,i),n.nextTick(k,t,e),t._writableState.errorEmitted=!0,t.emit(\"error\",i)):(s(i),t._writableState.errorEmitted=!0,t.emit(\"error\",i),k(t,e))}(t,r,i,e,s);else{var o=_(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||w(t,r),i?a(v,t,r,o,s):v(t,r,o,s)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function y(t){if(o=o||r(5382),!(u.call(y,this)||this instanceof o))return new y(t);this._writableState=new g(t,this),this.writable=!0,t&&(\"function\"==typeof t.write&&(this._write=t.write),\"function\"==typeof t.writev&&(this._writev=t.writev),\"function\"==typeof t.destroy&&(this._destroy=t.destroy),\"function\"==typeof t.final&&(this._final=t.final)),l.call(this)}function b(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function v(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit(\"drain\"))}(t,e),e.pendingcb--,i(),k(t,e)}function w(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),o=e.corkedRequestsFree;o.entry=r;for(var a=0,h=!0;r;)n[a]=r,r.isBuf||(h=!1),r=r.next,a+=1;n.allBuffers=h,b(t,e,!0,e.length,n,\"\",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,f=r.encoding,l=r.callback;if(b(t,e,!1,e.objectMode?1:u.length,u,f,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function M(t,e){t._final((function(r){e.pendingcb--,r&&t.emit(\"error\",r),e.prefinished=!0,t.emit(\"prefinish\"),k(t,e)}))}function k(t,e){var r=_(e);return r&&(function(t,e){e.prefinished||e.finalCalled||(\"function\"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,n.nextTick(M,t,e)):(e.prefinished=!0,t.emit(\"prefinish\")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit(\"finish\"))),r}h.inherits(y,l),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,\"buffer\",{get:f.deprecate((function(){return this.getBuffer()}),\"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.\",\"DEP0003\")})}catch(t){}}(),\"function\"==typeof Symbol&&Symbol.hasInstance&&\"function\"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!u.call(this,t)||this===y&&t&&t._writableState instanceof g}})):u=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit(\"error\",new Error(\"Cannot pipe, not readable\"))},y.prototype.write=function(t,e,r){var i,s=this._writableState,o=!1,a=!s.objectMode&&(i=t,c.isBuffer(i)||i instanceof d);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),\"function\"==typeof e&&(r=e,e=null),a?e=\"buffer\":e||(e=s.defaultEncoding),\"function\"!=typeof r&&(r=m),s.ended?function(t,e){var r=new Error(\"write after end\");t.emit(\"error\",r),n.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var s=!0,o=!1;return null===r?o=new TypeError(\"May not write null values to stream\"):\"string\"==typeof r||void 0===r||e.objectMode||(o=new TypeError(\"Invalid non-string/buffer chunk\")),o&&(t.emit(\"error\",o),n.nextTick(i,o),s=!1),s}(this,s,t,r))&&(s.pendingcb++,o=function(t,e,r,i,n,s){if(!r){var o=function(t,e,r){return t.objectMode||!1===t.decodeStrings||\"string\"!=typeof e||(e=c.from(e,r)),e}(e,i,n);i!==o&&(r=!0,n=\"buffer\",i=o)}var a=e.objectMode?1:i.length;e.length+=a;var h=e.length-1))throw new TypeError(\"Unknown encoding: \"+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,\"writableHighWaterMark\",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error(\"_write() is not implemented\"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var i=this._writableState;\"function\"==typeof t?(r=t,t=null,e=null):\"function\"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,k(t,e),r&&(e.finished?n.nextTick(r):t.once(\"finish\",r)),e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,\"destroyed\",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=p.destroy,y.prototype._undestroy=p.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}},3222:(t,e,r)=>{\"use strict\";var i=r(4106).Buffer,n=r(5340);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return\"\";for(var e=this.head,r=\"\"+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return i.alloc(0);for(var e,r,n=i.allocUnsafe(t>>>0),s=this.head,o=0;s;)e=n,r=o,s.data.copy(e,r),o+=s.data.length,s=s.next;return n},t}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var t=n.inspect({length:this.length});return this.constructor.name+\" \"+t})},5896:(t,e,r)=>{\"use strict\";var i=r(3225);function n(t,e){t.emit(\"error\",e)}t.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(n,this,t)):i.nextTick(n,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,i.nextTick(n,r,t)):i.nextTick(n,r,t):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},345:(t,e,r)=>{t.exports=r(7007).EventEmitter},4106:(t,e,r)=>{var i=r(8287),n=i.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(s(i,e),e.Buffer=o),s(n,o),o.from=function(t,e,r){if(\"number\"==typeof t)throw new TypeError(\"Argument must not be a number\");return n(t,e,r)},o.alloc=function(t,e,r){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");var i=n(t);return void 0!==e?\"string\"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");return n(t)},o.allocUnsafeSlow=function(t){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");return i.SlowBuffer(t)}},8399:(t,e,r)=>{(e=t.exports=r(5412)).Stream=e,e.Readable=e,e.Writable=r(6708),e.Duplex=r(5382),e.Transform=r(4610),e.PassThrough=r(3600)},5307:(t,e,r)=>{const i=r(5682);var n=[];function s(){this.list=[],this.map=new Map}function o(){this.records=new Map,this.size=0}function a(t){if(!(this instanceof a))return new a(t);if(t||(t={}),this.maxSize=t.maxSize||1/0,this.maxAge=t.maxAge||0,this._onstale=t.onStale||t.onstale||null,this._fresh=new o,this._stale=new o,this._interval=null,this._gced=!1,this.maxAge&&this.maxAge<1/0){var e=Math.ceil(2/3*this.maxAge);this._interval=setInterval(this._gcAuto.bind(this),e),this._interval.unref&&this._interval.unref()}}function h(t){return i.isBuffer(t)?i.toString(t,\"hex\"):t}function u(t,e,r){var i=t[e];i.index=r,t[r].index=e,t[e]=t[r],t[r]=i}t.exports=a,s.prototype.add=function(t,e){var r=h(t),i=this.map.get(r);return!i&&(i={index:this.list.length,record:e||t},this.list.push(i),this.map.set(r,i),!0)},s.prototype.remove=function(t){var e=h(t),r=this.map.get(e);return!!r&&(u(this.list,r.index,this.list.length-1),this.list.pop(),this.map.delete(e),!0)},o.prototype.add=function(t,e,r){var i=this.records.get(t);return i||(i=new s,this.records.set(t,i)),!!i.add(e,r)&&(this.size++,!0)},o.prototype.remove=function(t,e,r){var i=this.records.get(t);return!!i&&!!i.remove(e,r)&&(this.size--,i.map.size||this.records.delete(t),!0)},o.prototype.get=function(t){var e=this.records.get(t);return e?e.list:n},Object.defineProperty(a.prototype,\"size\",{get:function(){return this._fresh.size+this._stale.size}}),a.prototype.add=function(t,e,r){this._stale.remove(t,e,r),this._fresh.add(t,e,r)&&this._fresh.size>this.maxSize&&this._gc()},a.prototype.remove=function(t,e,r){this._fresh.remove(t,e,r),this._stale.remove(t,e,r)},a.prototype.get=function(t,e){var r=this._fresh.get(t),i=this._stale.get(t),n=r.length,s=i.length,o=n+s;(e>o||!e)&&(e=o);for(var a=new Array(e),h=0;h0&&this._onstale(this._stale),this._stale=this._fresh,this._fresh=new o,this._gced=!0},a.prototype.clear=function(){this._gc(),this._gc()},a.prototype.destroy=function(){this.clear(),clearInterval(this._interval),this._interval=null}},6011:(t,e,r)=>{\"use strict\";var i=r(8287).Buffer,n=r(6698),s=r(4729),o=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],u=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],f=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],l=[0,1518500249,1859775393,2400959708,2840853838],c=[1352829926,1548603684,1836072691,2053994217,0];function d(){s.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function m(t,e,r,i,n,s,o,a){return p(t+(e^r^i)+s+o|0,a)+n|0}function g(t,e,r,i,n,s,o,a){return p(t+(e&r|~e&i)+s+o|0,a)+n|0}function y(t,e,r,i,n,s,o,a){return p(t+((e|~r)^i)+s+o|0,a)+n|0}function b(t,e,r,i,n,s,o,a){return p(t+(e&i|r&~i)+s+o|0,a)+n|0}function v(t,e,r,i,n,s,o,a){return p(t+(e^(r|~i))+s+o|0,a)+n|0}n(d,s),d.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,s=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,M=0|this._c,k=0|this._d,S=0|this._e,x=0;x<80;x+=1){var A,E;x<16?(A=m(r,i,n,s,d,t[a[x]],l[0],u[x]),E=v(w,_,M,k,S,t[h[x]],c[0],f[x])):x<32?(A=g(r,i,n,s,d,t[a[x]],l[1],u[x]),E=b(w,_,M,k,S,t[h[x]],c[1],f[x])):x<48?(A=y(r,i,n,s,d,t[a[x]],l[2],u[x]),E=y(w,_,M,k,S,t[h[x]],c[2],f[x])):x<64?(A=b(r,i,n,s,d,t[a[x]],l[3],u[x]),E=g(w,_,M,k,S,t[h[x]],c[3],f[x])):(A=v(r,i,n,s,d,t[a[x]],l[4],u[x]),E=m(w,_,M,k,S,t[h[x]],c[4],f[x])),r=d,d=s,s=p(n,10),n=i,i=A,w=S,S=k,k=p(M,10),M=_,_=E}var I=this._b+n+k|0;this._b=this._c+s+S|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+i+M|0,this._a=I},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.alloc?i.alloc(20):new i(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},5372:(t,e,r)=>{t.exports=function(t,e,r){if(\"number\"!=typeof e)throw new Error(\"second argument must be a Number\");let n,s,o,a,h,u,f=!0;function l(t){function e(){r&&r(t,n),r=null}f?i(e):e()}function c(e,r,i){if(n[e]=i,r&&(h=!0),0==--o||r)l(r);else if(!h&&u{t.exports=function(t,e){let r,n,s,o=!0;function a(t){function n(){e&&e(t,r),e=null}o?i(n):n()}function h(t,e,i){r[t]=i,(0==--n||e)&&a(e)}Array.isArray(t)?(r=[],n=t.length):(s=Object.keys(t),r={},n=s.length),n?s?s.forEach((function(e){t[e]((function(t,r){h(e,t,r)}))})):t.forEach((function(t,e){t((function(t,r){h(e,t,r)}))})):a(null),o=!1};const i=r(9596)},2861:(t,e,r)=>{var i=r(8287),n=i.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(s(i,e),e.Buffer=o),o.prototype=Object.create(n.prototype),s(n,o),o.from=function(t,e,r){if(\"number\"==typeof t)throw new TypeError(\"Argument must not be a number\");return n(t,e,r)},o.alloc=function(t,e,r){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");var i=n(t);return void 0!==e?\"string\"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");return n(t)},o.allocUnsafeSlow=function(t){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");return i.SlowBuffer(t)}},6897:(t,e,r)=>{\"use strict\";var i=r(453),n=r(41),s=r(592)(),o=r(5795),a=r(9675),h=i(\"%Math.floor%\");t.exports=function(t,e){if(\"function\"!=typeof t)throw new a(\"`fn` is not a function\");if(\"number\"!=typeof e||e<0||e>4294967295||h(e)!==e)throw new a(\"`length` must be a positive 32-bit integer\");var r=arguments.length>2&&!!arguments[2],i=!0,u=!0;if(\"length\"in t&&o){var f=o(t,\"length\");f&&!f.configurable&&(i=!1),f&&!f.writable&&(u=!1)}return(i||u||!r)&&(s?n(t,\"length\",e,!0,!0):n(t,\"length\",e)),t}},392:(t,e,r)=>{var i=r(2861).Buffer;function n(t,e){this._block=i.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}n.prototype.update=function(t,e){\"string\"==typeof t&&(e=e||\"utf8\",t=i.from(t,e));for(var r=this._block,n=this._blockSize,s=t.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s},n.prototype._update=function(){throw new Error(\"_update must be implemented by subclass\")},t.exports=n},2802:(t,e,r)=>{var i=t.exports=function(t){t=t.toLowerCase();var e=i[t];if(!e)throw new Error(t+\" is not supported (we accept pull requests)\");return new e};i.sha=r(7816),i.sha1=r(3737),i.sha224=r(6710),i.sha256=r(4107),i.sha384=r(2827),i.sha512=r(2890)},7816:(t,e,r)=>{var i=r(6698),n=r(392),s=r(2861).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function h(){this.init(),this._w=a,n.call(this,64,56)}function u(t){return t<<30|t>>>2}function f(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(h,n),h.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},h.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,s=0|this._c,a=0|this._d,h=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=r[l-3]^r[l-8]^r[l-14]^r[l-16];for(var c=0;c<80;++c){var d=~~(c/20),p=0|((e=i)<<5|e>>>27)+f(d,n,s,a)+h+r[c]+o[d];h=a,a=s,s=u(n),n=i,i=p}this._a=i+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=h+this._e|0},h.prototype._hash=function(){var t=s.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=h},3737:(t,e,r)=>{var i=r(6698),n=r(392),s=r(2861).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function h(){this.init(),this._w=a,n.call(this,64,56)}function u(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function l(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(h,n),h.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},h.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,s=0|this._c,a=0|this._d,h=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=(e=r[c-3]^r[c-8]^r[c-14]^r[c-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=u(i)+l(p,n,s,a)+h+r[d]+o[p]|0;h=a,a=s,s=f(n),n=i,i=m}this._a=i+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=h+this._e|0},h.prototype._hash=function(){var t=s.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=h},6710:(t,e,r)=>{var i=r(6698),n=r(4107),s=r(392),o=r(2861).Buffer,a=new Array(64);function h(){this.init(),this._w=a,s.call(this,64,56)}i(h,n),h.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},h.prototype._hash=function(){var t=o.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=h},4107:(t,e,r)=>{var i=r(6698),n=r(392),s=r(2861).Buffer,o=[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],a=new Array(64);function h(){this.init(),this._w=a,n.call(this,64,56)}function u(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function l(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function c(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}i(h,n),h.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},h.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,s=0|this._c,a=0|this._d,h=0|this._e,p=0|this._f,m=0|this._g,g=0|this._h,y=0;y<16;++y)r[y]=t.readInt32BE(4*y);for(;y<64;++y)r[y]=0|(((e=r[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[y-7]+d(r[y-15])+r[y-16];for(var b=0;b<64;++b){var v=g+c(h)+u(h,p,m)+o[b]+r[b]|0,w=l(i)+f(i,n,s)|0;g=m,m=p,p=h,h=a+v|0,a=s,s=n,n=i,i=v+w|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=h+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},h.prototype._hash=function(){var t=s.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=h},2827:(t,e,r)=>{var i=r(6698),n=r(2890),s=r(392),o=r(2861).Buffer,a=new Array(160);function h(){this.init(),this._w=a,s.call(this,128,112)}i(h,n),h.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},h.prototype._hash=function(){var t=o.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=h},2890:(t,e,r)=>{var i=r(6698),n=r(392),s=r(2861).Buffer,o=[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],a=new Array(160);function h(){this.init(),this._w=a,n.call(this,128,112)}function u(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function l(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function c(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0>>0?1:0}i(h,n),h.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},h.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,s=0|this._dh,a=0|this._eh,h=0|this._fh,b=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,M=0|this._cl,k=0|this._dl,S=0|this._el,x=0|this._fl,A=0|this._gl,E=0|this._hl,I=0;I<32;I+=2)e[I]=t.readInt32BE(4*I),e[I+1]=t.readInt32BE(4*I+4);for(;I<160;I+=2){var B=e[I-30],T=e[I-30+1],P=d(B,T),R=p(T,B),C=m(B=e[I-4],T=e[I-4+1]),L=g(T,B),O=e[I-14],j=e[I-14+1],N=e[I-32],U=e[I-32+1],q=R+j|0,D=P+O+y(q,R)|0;D=(D=D+C+y(q=q+L|0,L)|0)+N+y(q=q+U|0,U)|0,e[I]=D,e[I+1]=q}for(var F=0;F<160;F+=2){D=e[F],q=e[F+1];var H=f(r,i,n),z=f(w,_,M),W=l(r,w),K=l(w,r),V=c(a,S),$=c(S,a),Z=o[F],G=o[F+1],J=u(a,h,b),Y=u(S,x,A),X=E+$|0,Q=v+V+y(X,E)|0;Q=(Q=(Q=Q+J+y(X=X+Y|0,Y)|0)+Z+y(X=X+G|0,G)|0)+D+y(X=X+q|0,q)|0;var tt=K+z|0,et=W+H+y(tt,K)|0;v=b,E=A,b=h,A=x,h=a,x=S,a=s+Q+y(S=k+X|0,k)|0,s=n,k=M,n=i,M=_,i=r,_=w,r=Q+et+y(w=X+tt|0,X)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+M|0,this._dl=this._dl+k|0,this._el=this._el+S|0,this._fl=this._fl+x|0,this._gl=this._gl+A|0,this._hl=this._hl+E|0,this._ah=this._ah+r+y(this._al,w)|0,this._bh=this._bh+i+y(this._bl,_)|0,this._ch=this._ch+n+y(this._cl,M)|0,this._dh=this._dh+s+y(this._dl,k)|0,this._eh=this._eh+a+y(this._el,S)|0,this._fh=this._fh+h+y(this._fl,x)|0,this._gh=this._gh+b+y(this._gl,A)|0,this._hh=this._hh+v+y(this._hl,E)|0},h.prototype._hash=function(){var t=s.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=h},7541:(t,e,r)=>{const i=r(8765),n=r(8499);t.exports={Throttle:i,ThrottleGroup:n}},8499:(t,e,r)=>{const{TokenBucket:i}=r(9439),n=r(8765);t.exports=class{constructor(t={}){if(\"object\"!=typeof t)throw new Error(\"Options must be an object\");this.throttles=[],this.setEnabled(t.enabled),this.setRate(t.rate,t.chunksize)}getEnabled(){return this._enabled}getRate(){return this.bucket.tokensPerInterval}getChunksize(){return this.chunksize}setEnabled(t=!0){if(\"boolean\"!=typeof t)throw new Error(\"Enabled must be a boolean\");this._enabled=t;for(const e of this.throttles)e.setEnabled(t)}setRate(t,e=null){if(!Number.isInteger(t)||t<0)throw new Error(\"Rate must be an integer bigger than zero\");if(t=parseInt(t),e&&(\"number\"!=typeof e||e<=0))throw new Error(\"Chunksize must be bigger than zero\");if(e=e||Math.max(parseInt(t/10),1),e=parseInt(e),t>0&&e>t)throw new Error(\"Chunk size must be smaller than rate\");this.bucket||(this.bucket=new i(t,t,\"second\",null)),this.bucket.bucketSize=t,this.bucket.tokensPerInterval=t,this.chunksize=e}setChunksize(t){if(!Number.isInteger(t)||t<=0)throw new Error(\"Chunk size must be an integer bigger than zero\");const e=this.getRate();if(t=parseInt(t),e>0&&t>e)throw new Error(\"Chunk size must be smaller than rate\");this.chunksize=t}throttle(t={}){if(\"object\"!=typeof t)throw new Error(\"Options must be an object\");return new n({...t,group:this})}destroy(){for(const t of this.throttles)t.destroy();this.throttles=[]}_addThrottle(t){if(!(t instanceof n))throw new Error(\"Throttle must be an instance of Throttle\");this.throttles.push(t)}_removeThrottle(t){const e=this.throttles.indexOf(t);e>-1&&this.throttles.splice(e,1)}}},8765:(t,e,r)=>{const{EventEmitter:i}=r(7007),{Transform:n}=r(8179),{wait:s}=r(2072);t.exports=class extends n{constructor(t={}){if(super(),\"object\"!=typeof t)throw new Error(\"Options must be an object\");const e=Object.assign({},t);if(e.group&&!(e.group instanceof o))throw new Error(\"Group must be an instanece of ThrottleGroup\");e.group||(e.group=new o(e)),this._setEnabled(e.enabled||e.group.enabled),this._group=e.group,this._emitter=new i,this._destroyed=!1,this._group._addThrottle(this)}getEnabled(){return this._enabled}getGroup(){return this._group}_setEnabled(t=!0){if(\"boolean\"!=typeof t)throw new Error(\"Enabled must be a boolean\");this._enabled=t}setEnabled(t){this._setEnabled(t),this._enabled?this._emitter.emit(\"enabled\"):this._emitter.emit(\"disabled\")}_transform(t,e){this._processChunk(t,e)}async _waitForTokens(t){return new Promise(((e,r)=>{let i=!1;const n=this;function s(t){if(n._emitter.removeListener(\"disabled\",s),n._emitter.removeListener(\"destroyed\",s),!i){if(i=!0,t)return r(t);e()}}this._emitter.once(\"disabled\",s),this._emitter.once(\"destroyed\",s),this._group.bucket.removeTokens(t,s)}))}_areBothEnabled(){return this._enabled&&this._group.getEnabled()}async _processChunk(t,e){if(!this._areBothEnabled())return e(null,t);let r=0,i=this._group.getChunksize(),n=t.slice(r,r+i);for(;n.length>0;){if(this._areBothEnabled())try{for(;0===this._group.getRate()&&!this._destroyed&&this._areBothEnabled();)if(await s(1e3),this._destroyed)return;if(this._areBothEnabled()&&!this._group.bucket.tryRemoveTokens(n.length)&&(await this._waitForTokens(n.length),this._destroyed))return}catch(t){return e(t)}this.push(n),r+=i,i=this._areBothEnabled()?this._group.getChunksize():t.length-r,n=t.slice(r,r+i)}return e()}destroy(...t){this._group._removeThrottle(this),this._destroyed=!0,this._emitter.emit(\"destroyed\"),super.destroy(...t)}};const o=r(8499)},2072:t=>{t.exports={wait:function(t){return new Promise((e=>setTimeout(e,t)))}}},8310:(t,e,r)=>{t.exports=n;var i=r(7007).EventEmitter;function n(){i.call(this)}r(6698)(n,i),n.Readable=r(6891),n.Writable=r(1999),n.Duplex=r(8101),n.Transform=r(9083),n.PassThrough=r(3681),n.finished=r(4257),n.pipeline=r(5267),n.Stream=n,n.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on(\"data\",n),t.on(\"drain\",s),t._isStdio||e&&!1===e.end||(r.on(\"end\",a),r.on(\"close\",h));var o=!1;function a(){o||(o=!0,t.end())}function h(){o||(o=!0,\"function\"==typeof t.destroy&&t.destroy())}function u(t){if(f(),0===i.listenerCount(this,\"error\"))throw t}function f(){r.removeListener(\"data\",n),t.removeListener(\"drain\",s),r.removeListener(\"end\",a),r.removeListener(\"close\",h),r.removeListener(\"error\",u),t.removeListener(\"error\",u),r.removeListener(\"end\",f),r.removeListener(\"close\",f),t.removeListener(\"close\",f)}return r.on(\"error\",u),t.on(\"error\",u),r.on(\"end\",f),r.on(\"close\",f),t.on(\"close\",f),t.emit(\"pipe\",r),t}},2463:t=>{\"use strict\";var e={};function r(t,r,i){i||(i=Error);var n=function(t){var e,i;function n(e,i,n){return t.call(this,function(t,e,i){return\"string\"==typeof r?r:r(t,e,i)}(e,i,n))||this}return i=t,(e=n).prototype=Object.create(i.prototype),e.prototype.constructor=e,e.__proto__=i,n}(i);n.prototype.name=i.name,n.prototype.code=t,e[t]=n}function i(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?\"one of \".concat(e,\" \").concat(t.slice(0,r-1).join(\", \"),\", or \")+t[r-1]:2===r?\"one of \".concat(e,\" \").concat(t[0],\" or \").concat(t[1]):\"of \".concat(e,\" \").concat(t[0])}return\"of \".concat(e,\" \").concat(String(t))}r(\"ERR_INVALID_OPT_VALUE\",(function(t,e){return'The value \"'+e+'\" is invalid for option \"'+t+'\"'}),TypeError),r(\"ERR_INVALID_ARG_TYPE\",(function(t,e,r){var n,s,o,a,h;if(\"string\"==typeof e&&(s=\"not \",e.substr(0,4)===s)?(n=\"must not be\",e=e.replace(/^not /,\"\")):n=\"must be\",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-9,r)===e}(t,\" argument\"))o=\"The \".concat(t,\" \").concat(n,\" \").concat(i(e,\"type\"));else{var u=(\"number\"!=typeof h&&(h=0),h+1>(a=t).length||-1===a.indexOf(\".\",h)?\"argument\":\"property\");o='The \"'.concat(t,'\" ').concat(u,\" \").concat(n,\" \").concat(i(e,\"type\"))}return o+\". Received type \".concat(typeof r)}),TypeError),r(\"ERR_STREAM_PUSH_AFTER_EOF\",\"stream.push() after EOF\"),r(\"ERR_METHOD_NOT_IMPLEMENTED\",(function(t){return\"The \"+t+\" method is not implemented\"})),r(\"ERR_STREAM_PREMATURE_CLOSE\",\"Premature close\"),r(\"ERR_STREAM_DESTROYED\",(function(t){return\"Cannot call \"+t+\" after a stream was destroyed\"})),r(\"ERR_MULTIPLE_CALLBACK\",\"Callback called multiple times\"),r(\"ERR_STREAM_CANNOT_PIPE\",\"Cannot pipe, not readable\"),r(\"ERR_STREAM_WRITE_AFTER_END\",\"write after end\"),r(\"ERR_STREAM_NULL_VALUES\",\"May not write null values to stream\",TypeError),r(\"ERR_UNKNOWN_ENCODING\",(function(t){return\"Unknown encoding: \"+t}),TypeError),r(\"ERR_STREAM_UNSHIFT_AFTER_END_EVENT\",\"stream.unshift() after end event\"),t.exports.F=e},8101:(t,e,r)=>{\"use strict\";var i=r(5606),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=f;var s=r(6891),o=r(1999);r(6698)(f,s);for(var a=n(o.prototype),h=0;h{\"use strict\";t.exports=n;var i=r(9083);function n(t){if(!(this instanceof n))return new n(t);i.call(this,t)}r(6698)(n,i),n.prototype._transform=function(t,e,r){r(null,t)}},6891:(t,e,r)=>{\"use strict\";var i,n=r(5606);t.exports=x,x.ReadableState=S,r(7007).EventEmitter;var s,o=function(t,e){return t.listeners(e).length},a=r(1396),h=r(8287).Buffer,u=(\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof window?window:\"undefined\"!=typeof self?self:{}).Uint8Array||function(){},f=r(7199);s=f&&f.debuglog?f.debuglog(\"stream\"):function(){};var l,c,d,p=r(1766),m=r(4347),g=r(6644).getHighWaterMark,y=r(2463).F,b=y.ERR_INVALID_ARG_TYPE,v=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,_=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(6698)(x,a);var M=m.errorOrDestroy,k=[\"error\",\"close\",\"destroy\",\"pause\",\"resume\"];function S(t,e,n){i=i||r(8101),t=t||{},\"boolean\"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,\"readableHighWaterMark\",n),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||\"utf8\",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=r(3141).I),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function x(t){if(i=i||r(8101),!(this instanceof x))return new x(t);var e=this instanceof i;this._readableState=new S(t,this,e),this.readable=!0,t&&(\"function\"==typeof t.read&&(this._read=t.read),\"function\"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,r,i,n){s(\"readableAddChunk\",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(s(\"onEofChunk\"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?T(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,P(t)))}}(t,a);else if(n||(o=function(t,e){var r,i;return i=e,h.isBuffer(i)||i instanceof u||\"string\"==typeof e||void 0===e||t.objectMode||(r=new b(\"chunk\",[\"string\",\"Buffer\",\"Uint8Array\"],e)),r}(a,e)),o)M(t,o);else if(a.objectMode||e&&e.length>0)if(\"string\"==typeof e||a.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),i)a.endEmitted?M(t,new _):E(t,a,e,!0);else if(a.ended)M(t,new v);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?E(t,a,e,!1):R(t,a)):E(t,a,e,!1)}else i||(a.reading=!1,R(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=I?t=I:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function T(t){var e=t._readableState;s(\"emitReadable\",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(s(\"emitReadable\",e.flowing),e.emittedReadable=!0,n.nextTick(P,t))}function P(t){var e=t._readableState;s(\"emitReadable_\",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit(\"readable\"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function R(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(C,t,e))}function C(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount(\"data\")>0&&t.resume()}function O(t){s(\"readable nexttick read 0\"),t.read(0)}function j(t,e){s(\"resume\",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit(\"resume\"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(s(\"flow\",e.flowing);e.flowing&&null!==t.read(););}function U(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(\"\"):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function q(t){var e=t._readableState;s(\"endReadable\",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(D,e,t))}function D(t,e){if(s(\"endReadableNT\",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit(\"end\"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function F(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return s(\"read: emitReadable\",e.length,e.ended),0===e.length&&e.ended?q(this):T(this),null;if(0===(t=B(t,e))&&e.ended)return 0===e.length&&q(this),null;var i,n=e.needReadable;return s(\"need readable\",n),(0===e.length||e.length-t0?U(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&q(this)),null!==i&&this.emit(\"data\",i),i},x.prototype._read=function(t){M(this,new w(\"_read()\"))},x.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,s(\"pipe count=%d opts=%j\",i.pipesCount,e);var a=e&&!1===e.end||t===n.stdout||t===n.stderr?m:h;function h(){s(\"onend\"),t.end()}i.endEmitted?n.nextTick(a):r.once(\"end\",a),t.on(\"unpipe\",(function e(n,o){s(\"onunpipe\"),n===r&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,s(\"cleanup\"),t.removeListener(\"close\",d),t.removeListener(\"finish\",p),t.removeListener(\"drain\",u),t.removeListener(\"error\",c),t.removeListener(\"unpipe\",e),r.removeListener(\"end\",h),r.removeListener(\"end\",m),r.removeListener(\"data\",l),f=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||u())}));var u=function(t){return function(){var e=t._readableState;s(\"pipeOnDrain\",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,\"data\")&&(e.flowing=!0,N(t))}}(r);t.on(\"drain\",u);var f=!1;function l(e){s(\"ondata\");var n=t.write(e);s(\"dest.write\",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==F(i.pipes,t))&&!f&&(s(\"false write response, pause\",i.awaitDrain),i.awaitDrain++),r.pause())}function c(e){s(\"onerror\",e),m(),t.removeListener(\"error\",c),0===o(t,\"error\")&&M(t,e)}function d(){t.removeListener(\"finish\",p),m()}function p(){s(\"onfinish\"),t.removeListener(\"close\",d),m()}function m(){s(\"unpipe\"),r.unpipe(t)}return r.on(\"data\",l),function(t,e,r){if(\"function\"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,\"error\",c),t.once(\"close\",d),t.once(\"finish\",p),t.emit(\"pipe\",r),i.flowing||(s(\"pipe resume\"),r.resume()),t},x.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit(\"unpipe\",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,!1!==i.flowing&&this.resume()):\"readable\"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,s(\"on readable\",i.length,i.reading),i.length?T(this):i.reading||n.nextTick(O,this))),r},x.prototype.addListener=x.prototype.on,x.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return\"readable\"===t&&n.nextTick(L,this),r},x.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return\"readable\"!==t&&void 0!==t||n.nextTick(L,this),e},x.prototype.resume=function(){var t=this._readableState;return t.flowing||(s(\"resume\"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(j,t,e))}(this,t)),t.paused=!1,this},x.prototype.pause=function(){return s(\"call pause flowing=%j\",this._readableState.flowing),!1!==this._readableState.flowing&&(s(\"pause\"),this._readableState.flowing=!1,this.emit(\"pause\")),this._readableState.paused=!0,this},x.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on(\"end\",(function(){if(s(\"wrapped end\"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on(\"data\",(function(n){s(\"wrapped data\"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&\"function\"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var o=0;o{\"use strict\";t.exports=f;var i=r(2463).F,n=i.ERR_METHOD_NOT_IMPLEMENTED,s=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=i.ERR_TRANSFORM_WITH_LENGTH_0,h=r(8101);function u(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit(\"error\",new s);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{\"use strict\";var i,n=r(5606);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(undefined),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=x,x.WritableState=S;var o,a={deprecate:r(4643)},h=r(1396),u=r(8287).Buffer,f=(\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof window?window:\"undefined\"!=typeof self?self:{}).Uint8Array||function(){},l=r(4347),c=r(6644).getHighWaterMark,d=r(2463).F,p=d.ERR_INVALID_ARG_TYPE,m=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_STREAM_CANNOT_PIPE,b=d.ERR_STREAM_DESTROYED,v=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,M=l.errorOrDestroy;function k(){}function S(t,e,o){i=i||r(8101),t=t||{},\"boolean\"!=typeof o&&(o=e instanceof i),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=c(this,t,\"writableHighWaterMark\",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||\"utf8\",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,s=r.writecb;if(\"function\"!=typeof s)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,s){--e.pendingcb,r?(n.nextTick(s,i),n.nextTick(P,t,e),t._writableState.errorEmitted=!0,M(t,i)):(s(i),t._writableState.errorEmitted=!0,M(t,i),P(t,e))}(t,r,i,e,s);else{var o=B(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),i?n.nextTick(E,t,r,o,s):E(t,r,o,s)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function x(t){var e=this instanceof(i=i||r(8101));if(!e&&!o.call(x,this))return new x(t);this._writableState=new S(t,this,e),this.writable=!0,t&&(\"function\"==typeof t.write&&(this._write=t.write),\"function\"==typeof t.writev&&(this._writev=t.writev),\"function\"==typeof t.destroy&&(this._destroy=t.destroy),\"function\"==typeof t.final&&(this._final=t.final)),h.call(this)}function A(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b(\"write\")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function E(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit(\"drain\"))}(t,e),e.pendingcb--,i(),P(t,e)}function I(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),o=e.corkedRequestsFree;o.entry=r;for(var a=0,h=!0;r;)n[a]=r,r.isBuf||(h=!1),r=r.next,a+=1;n.allBuffers=h,A(t,e,!0,e.length,n,\"\",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,f=r.encoding,l=r.callback;if(A(t,e,!1,e.objectMode?1:u.length,u,f,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function B(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function T(t,e){t._final((function(r){e.pendingcb--,r&&M(t,r),e.prefinished=!0,t.emit(\"prefinish\"),P(t,e)}))}function P(t,e){var r=B(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||(\"function\"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit(\"prefinish\")):(e.pendingcb++,e.finalCalled=!0,n.nextTick(T,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit(\"finish\"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}r(6698)(x,h),S.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(S.prototype,\"buffer\",{get:a.deprecate((function(){return this.getBuffer()}),\"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.\",\"DEP0003\")})}catch(t){}}(),\"function\"==typeof Symbol&&Symbol.hasInstance&&\"function\"==typeof Function.prototype[Symbol.hasInstance]?(o=Function.prototype[Symbol.hasInstance],Object.defineProperty(x,Symbol.hasInstance,{value:function(t){return!!o.call(this,t)||this===x&&t&&t._writableState instanceof S}})):o=function(t){return t instanceof this},x.prototype.pipe=function(){M(this,new y)},x.prototype.write=function(t,e,r){var i,s=this._writableState,o=!1,a=!s.objectMode&&(i=t,u.isBuffer(i)||i instanceof f);return a&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),\"function\"==typeof e&&(r=e,e=null),a?e=\"buffer\":e||(e=s.defaultEncoding),\"function\"!=typeof r&&(r=k),s.ending?function(t,e){var r=new w;M(t,r),n.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var s;return null===r?s=new v:\"string\"==typeof r||e.objectMode||(s=new p(\"chunk\",[\"string\",\"Buffer\"],r)),!s||(M(t,s),n.nextTick(i,s),!1)}(this,s,t,r))&&(s.pendingcb++,o=function(t,e,r,i,n,s){if(!r){var o=function(t,e,r){return t.objectMode||!1===t.decodeStrings||\"string\"!=typeof e||(e=u.from(e,r)),e}(e,i,n);i!==o&&(r=!0,n=\"buffer\",i=o)}var a=e.objectMode?1:i.length;e.length+=a;var h=e.length-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(x.prototype,\"writableBuffer\",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(x.prototype,\"writableHighWaterMark\",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),x.prototype._write=function(t,e,r){r(new m(\"_write()\"))},x.prototype._writev=null,x.prototype.end=function(t,e,r){var i=this._writableState;return\"function\"==typeof t?(r=t,t=null,e=null):\"function\"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,P(t,e),r&&(e.finished?n.nextTick(r):t.once(\"finish\",r)),e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(x.prototype,\"writableLength\",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(x.prototype,\"destroyed\",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),x.prototype.destroy=l.destroy,x.prototype._undestroy=l.undestroy,x.prototype._destroy=function(t,e){e(t)}},5034:(t,e,r)=>{\"use strict\";var i,n=r(5606);function s(t,e,r){return(e=function(t){var e=function(t,e){if(\"object\"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,\"string\");if(\"object\"!=typeof i)return i;throw new TypeError(\"@@toPrimitive must return a primitive value.\")}return String(t)}(t);return\"symbol\"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=r(4257),a=Symbol(\"lastResolve\"),h=Symbol(\"lastReject\"),u=Symbol(\"error\"),f=Symbol(\"ended\"),l=Symbol(\"lastPromise\"),c=Symbol(\"handlePromise\"),d=Symbol(\"stream\");function p(t,e){return{value:t,done:e}}function m(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[l]=null,t[a]=null,t[h]=null,e(p(r,!1)))}}function g(t){n.nextTick(m,t)}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((s(i={get stream(){return this[d]},next:function(){var t=this,e=this[u];if(null!==e)return Promise.reject(e);if(this[f])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(e,r){n.nextTick((function(){t[u]?r(t[u]):e(p(void 0,!0))}))}));var r,i=this[l];if(i)r=new Promise(function(t,e){return function(r,i){t.then((function(){e[f]?r(p(void 0,!0)):e[c](r,i)}),i)}}(i,this));else{var s=this[d].read();if(null!==s)return Promise.resolve(p(s,!1));r=new Promise(this[c])}return this[l]=r,r}},Symbol.asyncIterator,(function(){return this})),s(i,\"return\",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(p(void 0,!0))}))}))})),i),y);t.exports=function(t){var e,r=Object.create(b,(s(e={},d,{value:t,writable:!0}),s(e,a,{value:null,writable:!0}),s(e,h,{value:null,writable:!0}),s(e,u,{value:null,writable:!0}),s(e,f,{value:t._readableState.endEmitted,writable:!0}),s(e,c,{value:function(t,e){var i=r[d].read();i?(r[l]=null,r[a]=null,r[h]=null,t(p(i,!1))):(r[a]=t,r[h]=e)},writable:!0}),e));return r[l]=null,o(t,(function(t){if(t&&\"ERR_STREAM_PREMATURE_CLOSE\"!==t.code){var e=r[h];return null!==e&&(r[l]=null,r[a]=null,r[h]=null,e(t)),void(r[u]=t)}var i=r[a];null!==i&&(r[l]=null,r[a]=null,r[h]=null,i(p(void 0,!0))),r[f]=!0})),t.on(\"readable\",g.bind(null,r)),r}},1766:(t,e,r)=>{\"use strict\";function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function n(t){for(var e=1;e0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:\"unshift\",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:\"shift\",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:\"clear\",value:function(){this.head=this.tail=null,this.length=0}},{key:\"join\",value:function(t){if(0===this.length)return\"\";for(var e=this.head,r=\"\"+e.data;e=e.next;)r+=t+e.data;return r}},{key:\"concat\",value:function(t){if(0===this.length)return h.alloc(0);for(var e,r,i,n=h.allocUnsafe(t>>>0),s=this.head,o=0;s;)e=s.data,r=n,i=o,h.prototype.copy.call(e,r,i),o+=s.data.length,s=s.next;return n}},{key:\"consume\",value:function(t,e){var r;return tn.length?n.length:t;if(s===n.length?i+=n:i+=n.slice(0,t),0==(t-=s)){s===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(s));break}++r}return this.length-=r,i}},{key:\"_getBuffer\",value:function(t){var e=h.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,s=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,s),0==(t-=s)){s===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(s));break}++i}return this.length-=i,e}},{key:f,value:function(t,e){return u(this,n(n({},e),{},{depth:0,customInspect:!1}))}}])&&o(e.prototype,r),Object.defineProperty(e,\"prototype\",{writable:!1}),t}()},4347:(t,e,r)=>{\"use strict\";var i=r(5606);function n(t,e){o(t,e),s(t)}function s(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit(\"close\")}function o(t,e){t.emit(\"error\",e)}t.exports={destroy:function(t,e){var r=this,a=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return a||h?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(o,this,t)):i.nextTick(o,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted?i.nextTick(s,r):(r._writableState.errorEmitted=!0,i.nextTick(n,r,t)):i.nextTick(n,r,t):e?(i.nextTick(s,r),e(t)):i.nextTick(s,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit(\"error\",e)}}},4257:(t,e,r)=>{\"use strict\";var i=r(2463).F.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function t(e,r,s){if(\"function\"==typeof r)return t(e,null,r);r||(r={}),s=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n{t.exports=function(){throw new Error(\"Readable.from is not available in the browser\")}},5267:(t,e,r)=>{\"use strict\";var i,n=r(2463).F,s=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function h(t){t()}function u(t,e){return t.pipe(e)}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n0,(function(t){f||(f=t),t&&c.forEach(h),s||(c.forEach(h),l(f))}))}));return e.reduce(u)}},6644:(t,e,r)=>{\"use strict\";var i=r(2463).F.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,n){var s=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,n,r);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new i(n?r:\"highWaterMark\",s);return Math.floor(s)}return t.objectMode?16:16384}}},1396:(t,e,r)=>{t.exports=r(7007).EventEmitter},8179:(t,e,r)=>{const{EventEmitter:i}=r(7007),n=new Error(\"Stream was destroyed\"),s=new Error(\"Premature close\"),o=r(2133),a=r(6080),h=268435455,u=1^h,f=16384,l=32768,c=131072,d=768^h,p=268402687,m=268304383,g=2<<18,y=4<<18,b=8<<18,v=32<<18,w=64<<18,_=128<<18,M=512<<18,k=201064447,S=234881023,x=262160,A=8404992,E=8405006,I=33587200,B=33587215,T=2359311,P=Symbol.asyncIterator||Symbol(\"asyncIterator\");class R{constructor(t,{highWaterMark:e=16384,map:r=null,mapWritable:i,byteLength:n,byteLengthWritable:s}={}){this.stream=t,this.queue=new a,this.highWaterMark=e,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=s||n||et,this.map=i||r,this.afterWrite=q.bind(this),this.afterUpdateNextTick=H.bind(this)}get ended(){return!!(this.stream._duplexState&v)}push(t){return null!==this.map&&(t=this.map(t)),this.buffered+=this.byteLength(t),this.queue.push(t),this.buffered0,this.error=null,this.pipeline=null,this.byteLength=s||n||et,this.map=i||r,this.pipeTo=null,this.afterRead=D.bind(this),this.afterUpdateNextTick=F.bind(this)}get ended(){return!!(this.stream._duplexState&f)}pipe(t,e){if(null!==this.pipeTo)throw new Error(\"Can only pipe to one destination\");if(\"function\"!=typeof e&&(e=null),this.stream._duplexState|=512,this.pipeTo=t,this.pipeline=new O(this.stream,t,e),e&&this.stream.on(\"error\",rt),tt(t))t._writableState.pipeline=this.pipeline,e&&t.on(\"error\",rt),t.on(\"finish\",this.pipeline.finished.bind(this.pipeline));else{const e=this.pipeline.done.bind(this.pipeline,t),r=this.pipeline.done.bind(this.pipeline,t,null);t.on(\"error\",e),t.on(\"close\",r),t.on(\"finish\",this.pipeline.finished.bind(this.pipeline))}t.on(\"drain\",j.bind(this)),this.stream.emit(\"piping\",t),t.emit(\"pipe\",this.stream)}push(t){const e=this.stream;return null===t?(this.highWaterMark=0,e._duplexState=268369855&e._duplexState|1024,!1):(null!==this.map&&(t=this.map(t)),this.buffered+=this.byteLength(t),this.queue.push(t),e._duplexState=268369919&e._duplexState|128,this.buffered0;)e.push(this.shift());for(let t=0;t0;)i.drains.shift().resolve(!1);null!==i.pipeline&&i.pipeline.done(e,t)}}function q(t){const e=this.stream;t&&e.destroy(t),e._duplexState&=k,null!==this.drains&&function(t){for(let e=0;e=t._readableState.highWaterMark}static isPaused(t){return!(256&t._duplexState)}[P](){const t=this;let e=null,r=null,i=null;return this.on(\"error\",(t=>{e=t})),this.on(\"readable\",(function(){null!==r&&s(t.read())})),this.on(\"close\",(function(){null!==r&&s(null)})),{[P](){return this},next:()=>new Promise((function(e,n){r=e,i=n;const o=t.read();null!==o?s(o):8&t._duplexState&&s(null)})),return:()=>o(null),throw:t=>o(t)};function s(s){null!==i&&(e?i(e):null!==s||t._duplexState&f?r({value:s,done:null===s}):i(n),i=r=null)}function o(e){return t.destroy(e),new Promise(((r,i)=>{if(8&t._duplexState)return r({value:void 0,done:!0});t.once(\"close\",(function(){e?i(e):r({value:void 0,done:!0})}))}))}}}class Z extends V{constructor(t){super(t),this._duplexState|=16385,this._writableState=new R(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final),t.eagerOpen&&this._writableState.updateNextTick())}_writev(t,e){e(null)}_write(t,e){this._writableState.autoBatch(t,e)}_final(t){t(null)}static isBackpressured(t){return!!(146800654&t._duplexState)}static drained(t){if(t.destroyed)return Promise.resolve(!1);const e=t._writableState;var r;const i=((r=t)._writev!==Z.prototype._writev&&r._writev!==G.prototype._writev?Math.min(1,e.queue.length):e.queue.length)+(67108864&t._duplexState?1:0);return 0===i?Promise.resolve(!0):(null===e.drains&&(e.drains=[]),new Promise((t=>{e.drains.push({writes:i,resolve:t})})))}write(t){return this._writableState.updateNextTick(),this._writableState.push(t)}end(t){return this._writableState.updateNextTick(),this._writableState.end(t),this}}class G extends ${constructor(t){super(t),this._duplexState=1|this._duplexState&c,this._writableState=new R(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final))}_writev(t,e){e(null)}_write(t,e){this._writableState.autoBatch(t,e)}_final(t){t(null)}write(t){return this._writableState.updateNextTick(),this._writableState.push(t)}end(t){return this._writableState.updateNextTick(),this._writableState.end(t),this}}class J extends G{constructor(t){super(t),this._transformState=new L(this),t&&(t.transform&&(this._transform=t.transform),t.flush&&(this._flush=t.flush))}_write(t,e){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=t:this._transform(t,this._transformState.afterTransform)}_read(t){if(null!==this._transformState.data){const e=this._transformState.data;this._transformState.data=null,t(null),this._transform(e,this._transformState.afterTransform)}else t(null)}destroy(t){super.destroy(t),null!==this._transformState.data&&(this._transformState.data=null,this._transformState.afterTransform())}_transform(t,e){e(null,t)}_flush(t){t(null)}_final(t){this._transformState.afterFinal=t,this._flush(Y.bind(this))}}function Y(t,e){const r=this._transformState.afterFinal;if(t)return r(t);null!=e&&this.push(e),this.push(null),r(null)}function X(t,...e){const r=Array.isArray(t)?[...t,...e]:[t,...e],i=r.length&&\"function\"==typeof r[r.length-1]?r.pop():null;if(r.length<2)throw new Error(\"Pipeline requires at least 2 streams\");let n=r[0],o=null,a=null;for(let t=1;t1,u),n.pipe(o)),n=o;if(i){let t=!1;const e=tt(o)||!(!o._writableState||!o._writableState.autoDestroy);o.on(\"error\",(t=>{null===a&&(a=t)})),o.on(\"finish\",(()=>{t=!0,e||i(a)})),e&&o.on(\"close\",(()=>i(a||(t?null:s))))}return o;function h(t,e,r,i){t.on(\"error\",i),t.on(\"close\",(function(){return e&&t._readableState&&!t._readableState.ended||r&&t._writableState&&!t._writableState.ended?i(s):void 0}))}function u(t){if(t&&!a){a=t;for(const e of r)e.destroy(t)}}}function Q(t){return!!t._readableState||!!t._writableState}function tt(t){return\"number\"==typeof t._duplexState&&Q(t)}function et(t){return function(t){return\"object\"==typeof t&&null!==t&&\"number\"==typeof t.byteLength}(t)?t.byteLength:1024}function rt(){}function it(){this.destroy(new Error(\"Stream aborted.\"))}t.exports={pipeline:X,pipelinePromise:function(...t){return new Promise(((e,r)=>X(...t,(t=>{if(t)return r(t);e()}))))},isStream:Q,isStreamx:tt,getStreamError:function(t){const e=t._readableState&&t._readableState.error||t._writableState&&t._writableState.error;return e===n?null:e},Stream:V,Writable:Z,Readable:$,Duplex:G,Transform:J,PassThrough:class extends J{}}},3141:(t,e,r)=>{\"use strict\";var i=r(5003).Buffer,n=i.isEncoding||function(t){switch((t=\"\"+t)&&t.toLowerCase()){case\"hex\":case\"utf8\":case\"utf-8\":case\"ascii\":case\"binary\":case\"base64\":case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":case\"raw\":return!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return\"utf8\";for(var e;;)switch(t){case\"utf8\":case\"utf-8\":return\"utf8\";case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return\"utf16le\";case\"latin1\":case\"binary\":return\"latin1\";case\"base64\":case\"ascii\":case\"hex\":return t;default:if(e)return;t=(\"\"+t).toLowerCase(),e=!0}}(t);if(\"string\"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error(\"Unknown encoding: \"+t);return e||t}(t),this.encoding){case\"utf16le\":this.text=h,this.end=u,e=4;break;case\"utf8\":this.fillLast=a,e=4;break;case\"base64\":this.text=f,this.end=l,e=3;break;default:return this.write=c,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,\"�\";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,\"�\";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,\"�\"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function h(t,e){if((t.length-e)%2==0){var r=t.toString(\"utf16le\",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString(\"utf16le\",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):\"\";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString(\"utf16le\",0,r)}return e}function f(t,e){var r=(t.length-e)%3;return 0===r?t.toString(\"base64\",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString(\"base64\",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):\"\";return this.lastNeed?e+this.lastChar.toString(\"base64\",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):\"\"}e.I=s,s.prototype.write=function(t){if(0===t.length)return\"\";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return\"\";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString(\"utf8\",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString(\"utf8\",e,i)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},5003:(t,e,r)=>{var i=r(8287),n=i.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(s(i,e),e.Buffer=o),s(n,o),o.from=function(t,e,r){if(\"number\"==typeof t)throw new TypeError(\"Argument must not be a number\");return n(t,e,r)},o.alloc=function(t,e,r){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");var i=n(t);return void 0!==e?\"string\"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");return n(t)},o.allocUnsafeSlow=function(t){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");return i.SlowBuffer(t)}},1035:t=>{function e(t){return(+Date.now()-t)/100&65535}t.exports=function(t){const r=+Date.now(),i=10*(t||5),n=[0];let s=1,o=e(r)-1&65535;return function(t){const a=e(r);let h=a-o&65535;for(h>i&&(h=i),o=a;h--;)s===i&&(s=0),n[s]=n[0===s?i-1:s-1],s++;t&&(n[s-1]+=t);const u=n[s-1],f=n.length{!function(t){\"use strict\";var e=function(t){var e,r=new Float64Array(16);if(t)for(e=0;e>24&255,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r,t[e+4]=i>>24&255,t[e+5]=i>>16&255,t[e+6]=i>>8&255,t[e+7]=255&i}function m(t,e,r,i,n){var s,o=0;for(s=0;s>>8)-1}function g(t,e,r,i){return m(t,e,r,i,16)}function y(t,e,r,i){return m(t,e,r,i,32)}function b(t,e,r,i){!function(t,e,r,i){for(var n,s=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,h=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,f=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,c=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,d=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,m=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,y=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,_=s,M=o,k=a,S=h,x=u,A=f,E=l,I=c,B=d,T=p,P=m,R=g,C=y,L=b,O=v,j=w,N=0;N<20;N+=2)_^=(n=(C^=(n=(B^=(n=(x^=(n=_+C|0)<<7|n>>>25)+_|0)<<9|n>>>23)+x|0)<<13|n>>>19)+B|0)<<18|n>>>14,A^=(n=(M^=(n=(L^=(n=(T^=(n=A+M|0)<<7|n>>>25)+A|0)<<9|n>>>23)+T|0)<<13|n>>>19)+L|0)<<18|n>>>14,P^=(n=(E^=(n=(k^=(n=(O^=(n=P+E|0)<<7|n>>>25)+P|0)<<9|n>>>23)+O|0)<<13|n>>>19)+k|0)<<18|n>>>14,j^=(n=(R^=(n=(I^=(n=(S^=(n=j+R|0)<<7|n>>>25)+j|0)<<9|n>>>23)+S|0)<<13|n>>>19)+I|0)<<18|n>>>14,_^=(n=(S^=(n=(k^=(n=(M^=(n=_+S|0)<<7|n>>>25)+_|0)<<9|n>>>23)+M|0)<<13|n>>>19)+k|0)<<18|n>>>14,A^=(n=(x^=(n=(I^=(n=(E^=(n=A+x|0)<<7|n>>>25)+A|0)<<9|n>>>23)+E|0)<<13|n>>>19)+I|0)<<18|n>>>14,P^=(n=(T^=(n=(B^=(n=(R^=(n=P+T|0)<<7|n>>>25)+P|0)<<9|n>>>23)+R|0)<<13|n>>>19)+B|0)<<18|n>>>14,j^=(n=(O^=(n=(L^=(n=(C^=(n=j+O|0)<<7|n>>>25)+j|0)<<9|n>>>23)+C|0)<<13|n>>>19)+L|0)<<18|n>>>14;_=_+s|0,M=M+o|0,k=k+a|0,S=S+h|0,x=x+u|0,A=A+f|0,E=E+l|0,I=I+c|0,B=B+d|0,T=T+p|0,P=P+m|0,R=R+g|0,C=C+y|0,L=L+b|0,O=O+v|0,j=j+w|0,t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=M>>>0&255,t[5]=M>>>8&255,t[6]=M>>>16&255,t[7]=M>>>24&255,t[8]=k>>>0&255,t[9]=k>>>8&255,t[10]=k>>>16&255,t[11]=k>>>24&255,t[12]=S>>>0&255,t[13]=S>>>8&255,t[14]=S>>>16&255,t[15]=S>>>24&255,t[16]=x>>>0&255,t[17]=x>>>8&255,t[18]=x>>>16&255,t[19]=x>>>24&255,t[20]=A>>>0&255,t[21]=A>>>8&255,t[22]=A>>>16&255,t[23]=A>>>24&255,t[24]=E>>>0&255,t[25]=E>>>8&255,t[26]=E>>>16&255,t[27]=E>>>24&255,t[28]=I>>>0&255,t[29]=I>>>8&255,t[30]=I>>>16&255,t[31]=I>>>24&255,t[32]=B>>>0&255,t[33]=B>>>8&255,t[34]=B>>>16&255,t[35]=B>>>24&255,t[36]=T>>>0&255,t[37]=T>>>8&255,t[38]=T>>>16&255,t[39]=T>>>24&255,t[40]=P>>>0&255,t[41]=P>>>8&255,t[42]=P>>>16&255,t[43]=P>>>24&255,t[44]=R>>>0&255,t[45]=R>>>8&255,t[46]=R>>>16&255,t[47]=R>>>24&255,t[48]=C>>>0&255,t[49]=C>>>8&255,t[50]=C>>>16&255,t[51]=C>>>24&255,t[52]=L>>>0&255,t[53]=L>>>8&255,t[54]=L>>>16&255,t[55]=L>>>24&255,t[56]=O>>>0&255,t[57]=O>>>8&255,t[58]=O>>>16&255,t[59]=O>>>24&255,t[60]=j>>>0&255,t[61]=j>>>8&255,t[62]=j>>>16&255,t[63]=j>>>24&255}(t,e,r,i)}function v(t,e,r,i){!function(t,e,r,i){for(var n,s=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,h=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,f=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,c=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,d=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,m=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,y=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,_=0;_<20;_+=2)s^=(n=(y^=(n=(d^=(n=(u^=(n=s+y|0)<<7|n>>>25)+s|0)<<9|n>>>23)+u|0)<<13|n>>>19)+d|0)<<18|n>>>14,f^=(n=(o^=(n=(b^=(n=(p^=(n=f+o|0)<<7|n>>>25)+f|0)<<9|n>>>23)+p|0)<<13|n>>>19)+b|0)<<18|n>>>14,m^=(n=(l^=(n=(a^=(n=(v^=(n=m+l|0)<<7|n>>>25)+m|0)<<9|n>>>23)+v|0)<<13|n>>>19)+a|0)<<18|n>>>14,w^=(n=(g^=(n=(c^=(n=(h^=(n=w+g|0)<<7|n>>>25)+w|0)<<9|n>>>23)+h|0)<<13|n>>>19)+c|0)<<18|n>>>14,s^=(n=(h^=(n=(a^=(n=(o^=(n=s+h|0)<<7|n>>>25)+s|0)<<9|n>>>23)+o|0)<<13|n>>>19)+a|0)<<18|n>>>14,f^=(n=(u^=(n=(c^=(n=(l^=(n=f+u|0)<<7|n>>>25)+f|0)<<9|n>>>23)+l|0)<<13|n>>>19)+c|0)<<18|n>>>14,m^=(n=(p^=(n=(d^=(n=(g^=(n=m+p|0)<<7|n>>>25)+m|0)<<9|n>>>23)+g|0)<<13|n>>>19)+d|0)<<18|n>>>14,w^=(n=(v^=(n=(b^=(n=(y^=(n=w+v|0)<<7|n>>>25)+w|0)<<9|n>>>23)+y|0)<<13|n>>>19)+b|0)<<18|n>>>14;t[0]=s>>>0&255,t[1]=s>>>8&255,t[2]=s>>>16&255,t[3]=s>>>24&255,t[4]=f>>>0&255,t[5]=f>>>8&255,t[6]=f>>>16&255,t[7]=f>>>24&255,t[8]=m>>>0&255,t[9]=m>>>8&255,t[10]=m>>>16&255,t[11]=m>>>24&255,t[12]=w>>>0&255,t[13]=w>>>8&255,t[14]=w>>>16&255,t[15]=w>>>24&255,t[16]=l>>>0&255,t[17]=l>>>8&255,t[18]=l>>>16&255,t[19]=l>>>24&255,t[20]=c>>>0&255,t[21]=c>>>8&255,t[22]=c>>>16&255,t[23]=c>>>24&255,t[24]=d>>>0&255,t[25]=d>>>8&255,t[26]=d>>>16&255,t[27]=d>>>24&255,t[28]=p>>>0&255,t[29]=p>>>8&255,t[30]=p>>>16&255,t[31]=p>>>24&255}(t,e,r,i)}var w=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function _(t,e,r,i,n,s,o){var a,h,u=new Uint8Array(16),f=new Uint8Array(64);for(h=0;h<16;h++)u[h]=0;for(h=0;h<8;h++)u[h]=s[h];for(;n>=64;){for(b(f,u,o,w),h=0;h<64;h++)t[e+h]=r[i+h]^f[h];for(a=1,h=8;h<16;h++)a=a+(255&u[h])|0,u[h]=255&a,a>>>=8;n-=64,e+=64,i+=64}if(n>0)for(b(f,u,o,w),h=0;h=64;){for(b(h,a,n,w),o=0;o<64;o++)t[e+o]=h[o];for(s=1,o=8;o<16;o++)s=s+(255&a[o])|0,a[o]=255&s,s>>>=8;r-=64,e+=64}if(r>0)for(b(h,a,n,w),o=0;o>>13|r<<3),i=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(r>>>10|i<<6),n=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(i>>>7|n<<9),s=255&t[8]|(255&t[9])<<8,this.r[4]=255&(n>>>4|s<<12),this.r[5]=s>>>1&8190,o=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(s>>>14|o<<2),a=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(o>>>11|a<<5),h=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(a>>>8|h<<8),this.r[9]=h>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function A(t,e,r,i,n,s){var o=new x(s);return o.update(r,i,n),o.finish(t,e),0}function E(t,e,r,i,n,s){var o=new Uint8Array(16);return A(o,0,r,i,n,s),g(t,e,o,0)}function I(t,e,r,i,n){var s;if(r<32)return-1;for(S(t,0,e,0,r,i,n),A(t,16,t,32,r-32,t),s=0;s<16;s++)t[s]=0;return 0}function B(t,e,r,i,n){var s,o=new Uint8Array(32);if(r<32)return-1;if(k(o,0,32,i,n),0!==E(e,16,e,32,r-32,o))return-1;for(S(t,0,e,0,r,i,n),s=0;s<32;s++)t[s]=0;return 0}function T(t,e){var r;for(r=0;r<16;r++)t[r]=0|e[r]}function P(t){var e,r,i=1;for(e=0;e<16;e++)r=t[e]+i+65535,i=Math.floor(r/65536),t[e]=r-65536*i;t[0]+=i-1+37*(i-1)}function R(t,e,r){for(var i,n=~(r-1),s=0;s<16;s++)i=n&(t[s]^e[s]),t[s]^=i,e[s]^=i}function C(t,r){var i,n,s,o=e(),a=e();for(i=0;i<16;i++)a[i]=r[i];for(P(a),P(a),P(a),n=0;n<2;n++){for(o[0]=a[0]-65517,i=1;i<15;i++)o[i]=a[i]-65535-(o[i-1]>>16&1),o[i-1]&=65535;o[15]=a[15]-32767-(o[14]>>16&1),s=o[15]>>16&1,o[14]&=65535,R(a,o,1-s)}for(i=0;i<16;i++)t[2*i]=255&a[i],t[2*i+1]=a[i]>>8}function L(t,e){var r=new Uint8Array(32),i=new Uint8Array(32);return C(r,t),C(i,e),y(r,0,i,0)}function O(t){var e=new Uint8Array(32);return C(e,t),1&e[0]}function j(t,e){var r;for(r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function N(t,e,r){for(var i=0;i<16;i++)t[i]=e[i]+r[i]}function U(t,e,r){for(var i=0;i<16;i++)t[i]=e[i]-r[i]}function q(t,e,r){var i,n,s=0,o=0,a=0,h=0,u=0,f=0,l=0,c=0,d=0,p=0,m=0,g=0,y=0,b=0,v=0,w=0,_=0,M=0,k=0,S=0,x=0,A=0,E=0,I=0,B=0,T=0,P=0,R=0,C=0,L=0,O=0,j=r[0],N=r[1],U=r[2],q=r[3],D=r[4],F=r[5],H=r[6],z=r[7],W=r[8],K=r[9],V=r[10],$=r[11],Z=r[12],G=r[13],J=r[14],Y=r[15];s+=(i=e[0])*j,o+=i*N,a+=i*U,h+=i*q,u+=i*D,f+=i*F,l+=i*H,c+=i*z,d+=i*W,p+=i*K,m+=i*V,g+=i*$,y+=i*Z,b+=i*G,v+=i*J,w+=i*Y,o+=(i=e[1])*j,a+=i*N,h+=i*U,u+=i*q,f+=i*D,l+=i*F,c+=i*H,d+=i*z,p+=i*W,m+=i*K,g+=i*V,y+=i*$,b+=i*Z,v+=i*G,w+=i*J,_+=i*Y,a+=(i=e[2])*j,h+=i*N,u+=i*U,f+=i*q,l+=i*D,c+=i*F,d+=i*H,p+=i*z,m+=i*W,g+=i*K,y+=i*V,b+=i*$,v+=i*Z,w+=i*G,_+=i*J,M+=i*Y,h+=(i=e[3])*j,u+=i*N,f+=i*U,l+=i*q,c+=i*D,d+=i*F,p+=i*H,m+=i*z,g+=i*W,y+=i*K,b+=i*V,v+=i*$,w+=i*Z,_+=i*G,M+=i*J,k+=i*Y,u+=(i=e[4])*j,f+=i*N,l+=i*U,c+=i*q,d+=i*D,p+=i*F,m+=i*H,g+=i*z,y+=i*W,b+=i*K,v+=i*V,w+=i*$,_+=i*Z,M+=i*G,k+=i*J,S+=i*Y,f+=(i=e[5])*j,l+=i*N,c+=i*U,d+=i*q,p+=i*D,m+=i*F,g+=i*H,y+=i*z,b+=i*W,v+=i*K,w+=i*V,_+=i*$,M+=i*Z,k+=i*G,S+=i*J,x+=i*Y,l+=(i=e[6])*j,c+=i*N,d+=i*U,p+=i*q,m+=i*D,g+=i*F,y+=i*H,b+=i*z,v+=i*W,w+=i*K,_+=i*V,M+=i*$,k+=i*Z,S+=i*G,x+=i*J,A+=i*Y,c+=(i=e[7])*j,d+=i*N,p+=i*U,m+=i*q,g+=i*D,y+=i*F,b+=i*H,v+=i*z,w+=i*W,_+=i*K,M+=i*V,k+=i*$,S+=i*Z,x+=i*G,A+=i*J,E+=i*Y,d+=(i=e[8])*j,p+=i*N,m+=i*U,g+=i*q,y+=i*D,b+=i*F,v+=i*H,w+=i*z,_+=i*W,M+=i*K,k+=i*V,S+=i*$,x+=i*Z,A+=i*G,E+=i*J,I+=i*Y,p+=(i=e[9])*j,m+=i*N,g+=i*U,y+=i*q,b+=i*D,v+=i*F,w+=i*H,_+=i*z,M+=i*W,k+=i*K,S+=i*V,x+=i*$,A+=i*Z,E+=i*G,I+=i*J,B+=i*Y,m+=(i=e[10])*j,g+=i*N,y+=i*U,b+=i*q,v+=i*D,w+=i*F,_+=i*H,M+=i*z,k+=i*W,S+=i*K,x+=i*V,A+=i*$,E+=i*Z,I+=i*G,B+=i*J,T+=i*Y,g+=(i=e[11])*j,y+=i*N,b+=i*U,v+=i*q,w+=i*D,_+=i*F,M+=i*H,k+=i*z,S+=i*W,x+=i*K,A+=i*V,E+=i*$,I+=i*Z,B+=i*G,T+=i*J,P+=i*Y,y+=(i=e[12])*j,b+=i*N,v+=i*U,w+=i*q,_+=i*D,M+=i*F,k+=i*H,S+=i*z,x+=i*W,A+=i*K,E+=i*V,I+=i*$,B+=i*Z,T+=i*G,P+=i*J,R+=i*Y,b+=(i=e[13])*j,v+=i*N,w+=i*U,_+=i*q,M+=i*D,k+=i*F,S+=i*H,x+=i*z,A+=i*W,E+=i*K,I+=i*V,B+=i*$,T+=i*Z,P+=i*G,R+=i*J,C+=i*Y,v+=(i=e[14])*j,w+=i*N,_+=i*U,M+=i*q,k+=i*D,S+=i*F,x+=i*H,A+=i*z,E+=i*W,I+=i*K,B+=i*V,T+=i*$,P+=i*Z,R+=i*G,C+=i*J,L+=i*Y,w+=(i=e[15])*j,o+=38*(M+=i*U),a+=38*(k+=i*q),h+=38*(S+=i*D),u+=38*(x+=i*F),f+=38*(A+=i*H),l+=38*(E+=i*z),c+=38*(I+=i*W),d+=38*(B+=i*K),p+=38*(T+=i*V),m+=38*(P+=i*$),g+=38*(R+=i*Z),y+=38*(C+=i*G),b+=38*(L+=i*J),v+=38*(O+=i*Y),s=(i=(s+=38*(_+=i*N))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),o=(i=o+n+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),b=(i=b+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),w=(i=w+n+65535)-65536*(n=Math.floor(i/65536)),s=(i=(s+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),o=(i=o+n+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),b=(i=b+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),w=(i=w+n+65535)-65536*(n=Math.floor(i/65536)),s+=n-1+37*(n-1),t[0]=s,t[1]=o,t[2]=a,t[3]=h,t[4]=u,t[5]=f,t[6]=l,t[7]=c,t[8]=d,t[9]=p,t[10]=m,t[11]=g,t[12]=y,t[13]=b,t[14]=v,t[15]=w}function D(t,e){q(t,e,e)}function F(t,r){var i,n=e();for(i=0;i<16;i++)n[i]=r[i];for(i=253;i>=0;i--)D(n,n),2!==i&&4!==i&&q(n,n,r);for(i=0;i<16;i++)t[i]=n[i]}function H(t,r){var i,n=e();for(i=0;i<16;i++)n[i]=r[i];for(i=250;i>=0;i--)D(n,n),1!==i&&q(n,n,r);for(i=0;i<16;i++)t[i]=n[i]}function z(t,r,i){var n,s,o=new Uint8Array(32),a=new Float64Array(80),u=e(),f=e(),l=e(),c=e(),d=e(),p=e();for(s=0;s<31;s++)o[s]=r[s];for(o[31]=127&r[31]|64,o[0]&=248,j(a,i),s=0;s<16;s++)f[s]=a[s],c[s]=u[s]=l[s]=0;for(u[0]=c[0]=1,s=254;s>=0;--s)R(u,f,n=o[s>>>3]>>>(7&s)&1),R(l,c,n),N(d,u,l),U(u,u,l),N(l,f,c),U(f,f,c),D(c,d),D(p,u),q(u,l,u),q(l,f,d),N(d,u,l),U(u,u,l),D(f,u),U(l,c,p),q(u,l,h),N(u,u,c),q(l,l,u),q(u,c,p),q(c,f,a),D(f,d),R(u,f,n),R(l,c,n);for(s=0;s<16;s++)a[s+16]=u[s],a[s+32]=l[s],a[s+48]=f[s],a[s+64]=c[s];var m=a.subarray(32),g=a.subarray(16);return F(m,m),q(g,g,m),C(t,g),0}function W(t,e){return z(t,e,s)}function K(t,e){return i(e,32),W(t,e)}function V(t,e,r){var i=new Uint8Array(32);return z(i,r,e),v(t,n,i,w)}x.prototype.blocks=function(t,e,r){for(var i,n,s,o,a,h,u,f,l,c,d,p,m,g,y,b,v,w,_,M=this.fin?0:2048,k=this.h[0],S=this.h[1],x=this.h[2],A=this.h[3],E=this.h[4],I=this.h[5],B=this.h[6],T=this.h[7],P=this.h[8],R=this.h[9],C=this.r[0],L=this.r[1],O=this.r[2],j=this.r[3],N=this.r[4],U=this.r[5],q=this.r[6],D=this.r[7],F=this.r[8],H=this.r[9];r>=16;)c=l=0,c+=(k+=8191&(i=255&t[e+0]|(255&t[e+1])<<8))*C,c+=(S+=8191&(i>>>13|(n=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*H),c+=(x+=8191&(n>>>10|(s=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*F),c+=(A+=8191&(s>>>7|(o=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*D),l=(c+=(E+=8191&(o>>>4|(a=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*q))>>>13,c&=8191,c+=(I+=a>>>1&8191)*(5*U),c+=(B+=8191&(a>>>14|(h=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*N),c+=(T+=8191&(h>>>11|(u=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*j),c+=(P+=8191&(u>>>8|(f=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*O),d=l+=(c+=(R+=f>>>5|M)*(5*L))>>>13,d+=k*L,d+=S*C,d+=x*(5*H),d+=A*(5*F),l=(d+=E*(5*D))>>>13,d&=8191,d+=I*(5*q),d+=B*(5*U),d+=T*(5*N),d+=P*(5*j),l+=(d+=R*(5*O))>>>13,d&=8191,p=l,p+=k*O,p+=S*L,p+=x*C,p+=A*(5*H),l=(p+=E*(5*F))>>>13,p&=8191,p+=I*(5*D),p+=B*(5*q),p+=T*(5*U),p+=P*(5*N),m=l+=(p+=R*(5*j))>>>13,m+=k*j,m+=S*O,m+=x*L,m+=A*C,l=(m+=E*(5*H))>>>13,m&=8191,m+=I*(5*F),m+=B*(5*D),m+=T*(5*q),m+=P*(5*U),g=l+=(m+=R*(5*N))>>>13,g+=k*N,g+=S*j,g+=x*O,g+=A*L,l=(g+=E*C)>>>13,g&=8191,g+=I*(5*H),g+=B*(5*F),g+=T*(5*D),g+=P*(5*q),y=l+=(g+=R*(5*U))>>>13,y+=k*U,y+=S*N,y+=x*j,y+=A*O,l=(y+=E*L)>>>13,y&=8191,y+=I*C,y+=B*(5*H),y+=T*(5*F),y+=P*(5*D),b=l+=(y+=R*(5*q))>>>13,b+=k*q,b+=S*U,b+=x*N,b+=A*j,l=(b+=E*O)>>>13,b&=8191,b+=I*L,b+=B*C,b+=T*(5*H),b+=P*(5*F),v=l+=(b+=R*(5*D))>>>13,v+=k*D,v+=S*q,v+=x*U,v+=A*N,l=(v+=E*j)>>>13,v&=8191,v+=I*O,v+=B*L,v+=T*C,v+=P*(5*H),w=l+=(v+=R*(5*F))>>>13,w+=k*F,w+=S*D,w+=x*q,w+=A*U,l=(w+=E*N)>>>13,w&=8191,w+=I*j,w+=B*O,w+=T*L,w+=P*C,_=l+=(w+=R*(5*H))>>>13,_+=k*H,_+=S*F,_+=x*D,_+=A*q,l=(_+=E*U)>>>13,_&=8191,_+=I*N,_+=B*j,_+=T*O,_+=P*L,k=c=8191&(l=(l=((l+=(_+=R*C)>>>13)<<2)+l|0)+(c&=8191)|0),S=d+=l>>>=13,x=p&=8191,A=m&=8191,E=g&=8191,I=y&=8191,B=b&=8191,T=v&=8191,P=w&=8191,R=_&=8191,e+=16,r-=16;this.h[0]=k,this.h[1]=S,this.h[2]=x,this.h[3]=A,this.h[4]=E,this.h[5]=I,this.h[6]=B,this.h[7]=T,this.h[8]=P,this.h[9]=R},x.prototype.finish=function(t,e){var r,i,n,s,o=new Uint16Array(10);if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,o[0]=this.h[0]+5,r=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this.h[s]+r,r=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,i=(1^r)-1,s=0;s<10;s++)o[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|o[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),n=this.h[0]+this.pad[0],this.h[0]=65535&n,s=1;s<8;s++)n=(this.h[s]+this.pad[s]|0)+(n>>>16)|0,this.h[s]=65535&n;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},x.prototype.update=function(t,e,r){var i,n;if(this.leftover){for((n=16-this.leftover)>r&&(n=r),i=0;i=16&&(n=r-r%16,this.blocks(t,e,n),e+=n,r-=n),r){for(i=0;i=128;){for(M=0;M<16;M++)k=8*M+Z,T[M]=r[k+0]<<24|r[k+1]<<16|r[k+2]<<8|r[k+3],P[M]=r[k+4]<<24|r[k+5]<<16|r[k+6]<<8|r[k+7];for(M=0;M<80;M++)if(n=R,s=C,o=L,a=O,h=j,u=N,f=U,c=D,d=F,p=H,m=z,g=W,y=K,b=V,A=65535&(x=$),E=x>>>16,I=65535&(S=q),B=S>>>16,A+=65535&(x=(W>>>14|j<<18)^(W>>>18|j<<14)^(j>>>9|W<<23)),E+=x>>>16,I+=65535&(S=(j>>>14|W<<18)^(j>>>18|W<<14)^(W>>>9|j<<23)),B+=S>>>16,A+=65535&(x=W&K^~W&V),E+=x>>>16,I+=65535&(S=j&N^~j&U),B+=S>>>16,S=G[2*M],A+=65535&(x=G[2*M+1]),E+=x>>>16,I+=65535&S,B+=S>>>16,S=T[M%16],E+=(x=P[M%16])>>>16,I+=65535&S,B+=S>>>16,I+=(E+=(A+=65535&x)>>>16)>>>16,A=65535&(x=_=65535&A|E<<16),E=x>>>16,I=65535&(S=w=65535&I|(B+=I>>>16)<<16),B=S>>>16,A+=65535&(x=(D>>>28|R<<4)^(R>>>2|D<<30)^(R>>>7|D<<25)),E+=x>>>16,I+=65535&(S=(R>>>28|D<<4)^(D>>>2|R<<30)^(D>>>7|R<<25)),B+=S>>>16,E+=(x=D&F^D&H^F&H)>>>16,I+=65535&(S=R&C^R&L^C&L),B+=S>>>16,l=65535&(I+=(E+=(A+=65535&x)>>>16)>>>16)|(B+=I>>>16)<<16,v=65535&A|E<<16,A=65535&(x=m),E=x>>>16,I=65535&(S=a),B=S>>>16,E+=(x=_)>>>16,I+=65535&(S=w),B+=S>>>16,C=n,L=s,O=o,j=a=65535&(I+=(E+=(A+=65535&x)>>>16)>>>16)|(B+=I>>>16)<<16,N=h,U=u,q=f,R=l,F=c,H=d,z=p,W=m=65535&A|E<<16,K=g,V=y,$=b,D=v,M%16==15)for(k=0;k<16;k++)S=T[k],A=65535&(x=P[k]),E=x>>>16,I=65535&S,B=S>>>16,S=T[(k+9)%16],A+=65535&(x=P[(k+9)%16]),E+=x>>>16,I+=65535&S,B+=S>>>16,w=T[(k+1)%16],A+=65535&(x=((_=P[(k+1)%16])>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25)),E+=x>>>16,I+=65535&(S=(w>>>1|_<<31)^(w>>>8|_<<24)^w>>>7),B+=S>>>16,w=T[(k+14)%16],E+=(x=((_=P[(k+14)%16])>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26))>>>16,I+=65535&(S=(w>>>19|_<<13)^(_>>>29|w<<3)^w>>>6),B+=S>>>16,B+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,T[k]=65535&I|B<<16,P[k]=65535&A|E<<16;A=65535&(x=D),E=x>>>16,I=65535&(S=R),B=S>>>16,S=t[0],E+=(x=e[0])>>>16,I+=65535&S,B+=S>>>16,B+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[0]=R=65535&I|B<<16,e[0]=D=65535&A|E<<16,A=65535&(x=F),E=x>>>16,I=65535&(S=C),B=S>>>16,S=t[1],E+=(x=e[1])>>>16,I+=65535&S,B+=S>>>16,B+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[1]=C=65535&I|B<<16,e[1]=F=65535&A|E<<16,A=65535&(x=H),E=x>>>16,I=65535&(S=L),B=S>>>16,S=t[2],E+=(x=e[2])>>>16,I+=65535&S,B+=S>>>16,B+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[2]=L=65535&I|B<<16,e[2]=H=65535&A|E<<16,A=65535&(x=z),E=x>>>16,I=65535&(S=O),B=S>>>16,S=t[3],E+=(x=e[3])>>>16,I+=65535&S,B+=S>>>16,B+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[3]=O=65535&I|B<<16,e[3]=z=65535&A|E<<16,A=65535&(x=W),E=x>>>16,I=65535&(S=j),B=S>>>16,S=t[4],E+=(x=e[4])>>>16,I+=65535&S,B+=S>>>16,B+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[4]=j=65535&I|B<<16,e[4]=W=65535&A|E<<16,A=65535&(x=K),E=x>>>16,I=65535&(S=N),B=S>>>16,S=t[5],E+=(x=e[5])>>>16,I+=65535&S,B+=S>>>16,B+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[5]=N=65535&I|B<<16,e[5]=K=65535&A|E<<16,A=65535&(x=V),E=x>>>16,I=65535&(S=U),B=S>>>16,S=t[6],E+=(x=e[6])>>>16,I+=65535&S,B+=S>>>16,B+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[6]=U=65535&I|B<<16,e[6]=V=65535&A|E<<16,A=65535&(x=$),E=x>>>16,I=65535&(S=q),B=S>>>16,S=t[7],E+=(x=e[7])>>>16,I+=65535&S,B+=S>>>16,B+=(I+=(E+=(A+=65535&x)>>>16)>>>16)>>>16,t[7]=q=65535&I|B<<16,e[7]=$=65535&A|E<<16,Z+=128,i-=128}return i}function Y(t,e,r){var i,n=new Int32Array(8),s=new Int32Array(8),o=new Uint8Array(256),a=r;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,s[0]=4089235720,s[1]=2227873595,s[2]=4271175723,s[3]=1595750129,s[4]=2917565137,s[5]=725511199,s[6]=4215389547,s[7]=327033209,J(n,s,e,r),r%=128,i=0;i=0;--n)Q(t,e,i=r[n/8|0]>>(7&n)&1),X(e,t),X(t,t),Q(t,e,i)}function rt(t,r){var i=[e(),e(),e(),e()];T(i[0],l),T(i[1],c),T(i[2],a),q(i[3],l,c),et(t,i,r)}function it(t,r,n){var s,o=new Uint8Array(64),a=[e(),e(),e(),e()];for(n||i(r,32),Y(o,r,32),o[0]&=248,o[31]&=127,o[31]|=64,rt(a,o),tt(t,a),s=0;s<32;s++)r[s+32]=t[s];return 0}var nt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function st(t,e){var r,i,n,s;for(i=63;i>=32;--i){for(r=0,n=i-32,s=i-12;n>4)*nt[n],r=e[n]>>8,e[n]&=255;for(n=0;n<32;n++)e[n]-=r*nt[n];for(i=0;i<32;i++)e[i+1]+=e[i]>>8,t[i]=255&e[i]}function ot(t){var e,r=new Float64Array(64);for(e=0;e<64;e++)r[e]=t[e];for(e=0;e<64;e++)t[e]=0;st(t,r)}function at(t,r,i,n){var s,o,a=new Uint8Array(64),h=new Uint8Array(64),u=new Uint8Array(64),f=new Float64Array(64),l=[e(),e(),e(),e()];Y(a,n,32),a[0]&=248,a[31]&=127,a[31]|=64;var c=i+64;for(s=0;s>7&&U(t[0],o,t[0]),q(t[3],t[0],t[1]),0)}(c,n))return-1;for(s=0;s=0},t.sign.keyPair=function(){var t=new Uint8Array(ft),e=new Uint8Array(lt);return it(t,e),{publicKey:t,secretKey:e}},t.sign.keyPair.fromSecretKey=function(t){if(dt(t),t.length!==lt)throw new Error(\"bad secret key size\");for(var e=new Uint8Array(ft),r=0;r{t.exports=function(t,e){if(!(e>=t.length||e<0)){var r=t.pop();if(e{function e(t){try{if(!globalThis.localStorage)return!1}catch(t){return!1}var e=globalThis.localStorage[t];return null!=e&&\"true\"===String(e).toLowerCase()}t.exports=function(t,r){if(e(\"noDeprecation\"))return t;var i=!1;return function(){if(!i){if(e(\"throwDeprecation\"))throw new Error(r);e(\"traceDeprecation\")?console.trace(r):console.warn(r),i=!0}return t.apply(this,arguments)}}},1135:t=>{t.exports=function(t){return t&&\"object\"==typeof t&&\"function\"==typeof t.copy&&\"function\"==typeof t.fill&&\"function\"==typeof t.readUInt8}},9032:(t,e,r)=>{\"use strict\";var i=r(7244),n=r(8184),s=r(5767),o=r(5680);function a(t){return t.call.bind(t)}var h=\"undefined\"!=typeof BigInt,u=\"undefined\"!=typeof Symbol,f=a(Object.prototype.toString),l=a(Number.prototype.valueOf),c=a(String.prototype.valueOf),d=a(Boolean.prototype.valueOf);if(h)var p=a(BigInt.prototype.valueOf);if(u)var m=a(Symbol.prototype.valueOf);function g(t,e){if(\"object\"!=typeof t)return!1;try{return e(t),!0}catch(t){return!1}}function y(t){return\"[object Map]\"===f(t)}function b(t){return\"[object Set]\"===f(t)}function v(t){return\"[object WeakMap]\"===f(t)}function w(t){return\"[object WeakSet]\"===f(t)}function _(t){return\"[object ArrayBuffer]\"===f(t)}function M(t){return\"undefined\"!=typeof ArrayBuffer&&(_.working?_(t):t instanceof ArrayBuffer)}function k(t){return\"[object DataView]\"===f(t)}function S(t){return\"undefined\"!=typeof DataView&&(k.working?k(t):t instanceof DataView)}e.isArgumentsObject=i,e.isGeneratorFunction=n,e.isTypedArray=o,e.isPromise=function(t){return\"undefined\"!=typeof Promise&&t instanceof Promise||null!==t&&\"object\"==typeof t&&\"function\"==typeof t.then&&\"function\"==typeof t.catch},e.isArrayBufferView=function(t){return\"undefined\"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):o(t)||S(t)},e.isUint8Array=function(t){return\"Uint8Array\"===s(t)},e.isUint8ClampedArray=function(t){return\"Uint8ClampedArray\"===s(t)},e.isUint16Array=function(t){return\"Uint16Array\"===s(t)},e.isUint32Array=function(t){return\"Uint32Array\"===s(t)},e.isInt8Array=function(t){return\"Int8Array\"===s(t)},e.isInt16Array=function(t){return\"Int16Array\"===s(t)},e.isInt32Array=function(t){return\"Int32Array\"===s(t)},e.isFloat32Array=function(t){return\"Float32Array\"===s(t)},e.isFloat64Array=function(t){return\"Float64Array\"===s(t)},e.isBigInt64Array=function(t){return\"BigInt64Array\"===s(t)},e.isBigUint64Array=function(t){return\"BigUint64Array\"===s(t)},y.working=\"undefined\"!=typeof Map&&y(new Map),e.isMap=function(t){return\"undefined\"!=typeof Map&&(y.working?y(t):t instanceof Map)},b.working=\"undefined\"!=typeof Set&&b(new Set),e.isSet=function(t){return\"undefined\"!=typeof Set&&(b.working?b(t):t instanceof Set)},v.working=\"undefined\"!=typeof WeakMap&&v(new WeakMap),e.isWeakMap=function(t){return\"undefined\"!=typeof WeakMap&&(v.working?v(t):t instanceof WeakMap)},w.working=\"undefined\"!=typeof WeakSet&&w(new WeakSet),e.isWeakSet=function(t){return w(t)},_.working=\"undefined\"!=typeof ArrayBuffer&&_(new ArrayBuffer),e.isArrayBuffer=M,k.working=\"undefined\"!=typeof ArrayBuffer&&\"undefined\"!=typeof DataView&&k(new DataView(new ArrayBuffer(1),0,1)),e.isDataView=S;var x=\"undefined\"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function A(t){return\"[object SharedArrayBuffer]\"===f(t)}function E(t){return void 0!==x&&(void 0===A.working&&(A.working=A(new x)),A.working?A(t):t instanceof x)}function I(t){return g(t,l)}function B(t){return g(t,c)}function T(t){return g(t,d)}function P(t){return h&&g(t,p)}function R(t){return u&&g(t,m)}e.isSharedArrayBuffer=E,e.isAsyncFunction=function(t){return\"[object AsyncFunction]\"===f(t)},e.isMapIterator=function(t){return\"[object Map Iterator]\"===f(t)},e.isSetIterator=function(t){return\"[object Set Iterator]\"===f(t)},e.isGeneratorObject=function(t){return\"[object Generator]\"===f(t)},e.isWebAssemblyCompiledModule=function(t){return\"[object WebAssembly.Module]\"===f(t)},e.isNumberObject=I,e.isStringObject=B,e.isBooleanObject=T,e.isBigIntObject=P,e.isSymbolObject=R,e.isBoxedPrimitive=function(t){return I(t)||B(t)||T(t)||P(t)||R(t)},e.isAnyArrayBuffer=function(t){return\"undefined\"!=typeof Uint8Array&&(M(t)||E(t))},[\"isProxy\",\"isExternal\",\"isModuleNamespaceObject\"].forEach((function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw new Error(t+\" is not supported in userland\")}})}))},537:(t,e,r)=>{var i=r(5606),n=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=n)return t;switch(t){case\"%s\":return String(i[r++]);case\"%d\":return Number(i[r++]);case\"%j\":try{return JSON.stringify(i[r++])}catch(t){return\"[Circular]\"}default:return t}})),a=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),g(r)?i.showHidden=r:r&&e._extend(i,r),w(i.showHidden)&&(i.showHidden=!1),w(i.depth)&&(i.depth=2),w(i.colors)&&(i.colors=!1),w(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=f),c(i,t,i.depth)}function f(t,e){var r=u.styles[e];return r?\"\u001b[\"+u.colors[r][0]+\"m\"+t+\"\u001b[\"+u.colors[r][1]+\"m\":t}function l(t,e){return t}function c(t,r,i){if(t.customInspect&&r&&x(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return v(n)||(n=c(t,n,i)),n}var s=function(t,e){if(w(e))return t.stylize(\"undefined\",\"undefined\");if(v(e)){var r=\"'\"+JSON.stringify(e).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return t.stylize(r,\"string\")}return b(e)?t.stylize(\"\"+e,\"number\"):g(e)?t.stylize(\"\"+e,\"boolean\"):y(e)?t.stylize(\"null\",\"null\"):void 0}(t,r);if(s)return s;var o=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(r)),S(r)&&(o.indexOf(\"message\")>=0||o.indexOf(\"description\")>=0))return d(r);if(0===o.length){if(x(r)){var h=r.name?\": \"+r.name:\"\";return t.stylize(\"[Function\"+h+\"]\",\"special\")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),\"regexp\");if(k(r))return t.stylize(Date.prototype.toString.call(r),\"date\");if(S(r))return d(r)}var u,f=\"\",l=!1,M=[\"{\",\"}\"];return m(r)&&(l=!0,M=[\"[\",\"]\"]),x(r)&&(f=\" [Function\"+(r.name?\": \"+r.name:\"\")+\"]\"),_(r)&&(f=\" \"+RegExp.prototype.toString.call(r)),k(r)&&(f=\" \"+Date.prototype.toUTCString.call(r)),S(r)&&(f=\" \"+d(r)),0!==o.length||l&&0!=r.length?i<0?_(r)?t.stylize(RegExp.prototype.toString.call(r),\"regexp\"):t.stylize(\"[Object]\",\"special\"):(t.seen.push(r),u=l?function(t,e,r,i,n){for(var s=[],o=0,a=e.length;o60?r[0]+(\"\"===e?\"\":e+\"\\n \")+\" \"+t.join(\",\\n \")+\" \"+r[1]:r[0]+e+\" \"+t.join(\", \")+\" \"+r[1]}(u,f,M)):M[0]+f+M[1]}function d(t){return\"[\"+Error.prototype.toString.call(t)+\"]\"}function p(t,e,r,i,n,s){var o,a,h;if((h=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?a=h.set?t.stylize(\"[Getter/Setter]\",\"special\"):t.stylize(\"[Getter]\",\"special\"):h.set&&(a=t.stylize(\"[Setter]\",\"special\")),B(i,n)||(o=\"[\"+n+\"]\"),a||(t.seen.indexOf(h.value)<0?(a=y(r)?c(t,h.value,null):c(t,h.value,r-1)).indexOf(\"\\n\")>-1&&(a=s?a.split(\"\\n\").map((function(t){return\" \"+t})).join(\"\\n\").slice(2):\"\\n\"+a.split(\"\\n\").map((function(t){return\" \"+t})).join(\"\\n\")):a=t.stylize(\"[Circular]\",\"special\")),w(o)){if(s&&n.match(/^\\d+$/))return a;(o=JSON.stringify(\"\"+n)).match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)?(o=o.slice(1,-1),o=t.stylize(o,\"name\")):(o=o.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),o=t.stylize(o,\"string\"))}return o+\": \"+a}function m(t){return Array.isArray(t)}function g(t){return\"boolean\"==typeof t}function y(t){return null===t}function b(t){return\"number\"==typeof t}function v(t){return\"string\"==typeof t}function w(t){return void 0===t}function _(t){return M(t)&&\"[object RegExp]\"===A(t)}function M(t){return\"object\"==typeof t&&null!==t}function k(t){return M(t)&&\"[object Date]\"===A(t)}function S(t){return M(t)&&(\"[object Error]\"===A(t)||t instanceof Error)}function x(t){return\"function\"==typeof t}function A(t){return Object.prototype.toString.call(t)}function E(t){return t<10?\"0\"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(t=t.toUpperCase(),!o[t])if(a.test(t)){var r=i.pid;o[t]=function(){var i=e.format.apply(e,arguments);console.error(\"%s %d: %s\",t,r,i)}}else o[t]=function(){};return o[t]},e.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:\"cyan\",number:\"yellow\",boolean:\"yellow\",undefined:\"grey\",null:\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"},e.types=r(9032),e.isArray=m,e.isBoolean=g,e.isNull=y,e.isNullOrUndefined=function(t){return null==t},e.isNumber=b,e.isString=v,e.isSymbol=function(t){return\"symbol\"==typeof t},e.isUndefined=w,e.isRegExp=_,e.types.isRegExp=_,e.isObject=M,e.isDate=k,e.types.isDate=k,e.isError=S,e.types.isNativeError=S,e.isFunction=x,e.isPrimitive=function(t){return null===t||\"boolean\"==typeof t||\"number\"==typeof t||\"string\"==typeof t||\"symbol\"==typeof t||void 0===t},e.isBuffer=r(1135);var I=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];function B(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){var t,r;console.log(\"%s - %s\",(r=[E((t=new Date).getHours()),E(t.getMinutes()),E(t.getSeconds())].join(\":\"),[t.getDate(),I[t.getMonth()],r].join(\" \")),e.format.apply(e,arguments))},e.inherits=r(6698),e._extend=function(t,e){if(!e||!M(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var T=\"undefined\"!=typeof Symbol?Symbol(\"util.promisify.custom\"):void 0;function P(t,e){if(!t){var r=new Error(\"Promise was rejected with a falsy value\");r.reason=t,t=r}return e(t)}e.promisify=function(t){if(\"function\"!=typeof t)throw new TypeError('The \"original\" argument must be of type Function');if(T&&t[T]){var e;if(\"function\"!=typeof(e=t[T]))throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');return Object.defineProperty(e,T,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],s=0;s{\"use strict\";var i=r(2682),n=r(9209),s=r(487),o=r(8075),a=r(5795),h=o(\"Object.prototype.toString\"),u=r(9092)(),f=globalThis,l=n(),c=o(\"String.prototype.slice\"),d=Object.getPrototypeOf,p=o(\"Array.prototype.indexOf\",!0)||function(t,e){for(var r=0;r-1?e:\"Object\"===e&&function(t){var e=!1;return i(m,(function(r,i){if(!e)try{r(t),e=c(i,1)}catch(t){}})),e}(t)}return a?function(t){var e=!1;return i(m,(function(r,i){if(!e)try{\"$\"+r(t)===i&&(e=c(i,1))}catch(t){}})),e}(t):null}},6587:t=>{t.exports=function t(e,r){if(e&&r)return t(e)(r);if(\"function\"!=typeof e)throw new TypeError(\"need wrapper function\");return Object.keys(e).forEach((function(t){i[t]=e[t]})),i;function i(){for(var t=new Array(arguments.length),r=0;r{},8982:()=>{},1551:()=>{},826:()=>{},61:()=>{},7936:()=>{},7790:()=>{},3776:()=>{},7965:()=>{},2532:()=>{},2123:()=>{},6089:()=>{},9368:()=>{},2205:()=>{},8173:()=>{},8849:()=>{},4688:()=>{},3208:()=>{},1069:()=>{},2376:()=>{},5340:()=>{},9838:()=>{},3779:()=>{},7199:()=>{},2799:()=>{},1281:()=>{},3095:()=>{},1438:()=>{},3643:()=>{},9748:()=>{},8585:()=>{},4206:()=>{},9334:()=>{},5725:()=>{},7237:()=>{},6636:()=>{},9209:(t,e,r)=>{\"use strict\";var i=r(6578),n=globalThis;t.exports=function(){for(var t=[],e=0;e{\"use strict\";r.d(e,{A:()=>p});var i=r(9639);function n(t){const e=t<0?1:0;return t=Math.abs(Number(t||1)),Math.floor(Math.log10(t))+1+e}function s(t){return ArrayBuffer.isView(t)?\"arraybufferview\":Array.isArray(t)?\"array\":t instanceof Number?\"number\":t instanceof Boolean?\"boolean\":t instanceof Set?\"set\":t instanceof Map?\"map\":t instanceof String?\"string\":t instanceof ArrayBuffer?\"arraybuffer\":typeof t}function o(t,e,r){const n=[];let s=null;return o._encode(n,t),s=(0,i.xW)(n),o.bytes=s.length,ArrayBuffer.isView(e)?(e.set(s,r),e):s}o.bytes=-1,o._floatConversionDetected=!1,o._encode=function(t,e){if(null!=e)switch(s(e)){case\"object\":o.dict(t,e);break;case\"map\":o.dictMap(t,e);break;case\"array\":o.list(t,e);break;case\"set\":o.listSet(t,e);break;case\"string\":o.string(t,e);break;case\"number\":case\"boolean\":o.number(t,e);break;case\"arraybufferview\":o.buffer(t,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));break;case\"arraybuffer\":o.buffer(t,new Uint8Array(e))}};const a=new Uint8Array([101]),h=new Uint8Array([100]),u=new Uint8Array([108]);o.buffer=function(t,e){t.push((0,i.L0)(e.length+\":\"),e)},o.string=function(t,e){t.push((0,i.L0)((0,i.L0)(e).byteLength+\":\"+e))},o.number=function(t,e){if(Number.isInteger(e))return t.push((0,i.L0)(\"i\"+BigInt(e)+\"e\"));const r=2147483648,n=(e/r|0)*r+(e%r|0);t.push((0,i.L0)(\"i\"+n+\"e\")),n===e||o._floatConversionDetected||(o._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value \"'+e+'\":','Bencoding only defines support for integers, value was converted to \"'+n+'\"'),console.trace())},o.dict=function(t,e){t.push(h);let r,i=0;const n=Object.keys(e).sort(),s=n.length;for(;i=48)i=10*i+(r-48);else if(s!==e||43!==r){if(s!==e||45!==r){if(46===r)break;throw new Error(\"not a number: buffer[\"+s+\"] = \"+r)}n=-1}}return i*n}function c(t,e,r,n){return null==t||0===t.length?null:(\"number\"!=typeof e&&null==n&&(n=e,e=void 0),\"number\"!=typeof r&&null==n&&(n=r,r=void 0),c.position=0,c.encoding=n||null,c.data=ArrayBuffer.isView(t)?new Uint8Array(t.slice(e,r)):(0,i.L0)(t),c.bytes=c.data.length,c.next())}function d(t){if(null==t)return 0;const e=s(t);switch(e){case\"arraybufferview\":return function(t){const e=t.byteLength-t.byteOffset;return n(e)+1+e}(t);case\"string\":return function(t){const e=(0,i.L0)(t).byteLength;return n(e)+1+e}(t);case\"array\":case\"set\":return function(t){let e=2;for(const r of t)e+=d(r);return e}(t);case\"number\":return 1+n(Math.floor(t))+1;case\"bigint\":return 1+t.toString().length+1;case\"object\":return function(t){let e=2;const r=Object.keys(t);for(let s=0;s{\"use strict\";function i(t){return(t>>3)+Number(t%8!=0)}r.d(e,{A:()=>n});class n{get length(){return this.buffer.length<<3}constructor(t=0,e){const r=null==e?void 0:e.grow;this.grow=r?Number.isFinite(r)?i(r):r:0,this.buffer=\"number\"==typeof t?new Uint8Array(i(t)):t}get(t){const e=t>>3;return e>t%8)}set(t,e=!0){const r=t>>3;if(e){if(r>=this.buffer.length){const t=Math.max(r+1,Math.min(2*this.buffer.length,this.grow));if(t<=this.grow){const e=new Uint8Array(t);e.set(this.buffer),this.buffer=e}}this.buffer[r]|=128>>t%8}else r>t%8))}setAll(t,e=0){const r=Math.min(i(e+t.length),this.grow);if(this.buffer.length>3,s=128>>e%8;for(let e=0;e=this.buffer.length)break;s=128}else s>>=1}forEach(t,e=0,r=8*this.buffer.length){let i=e>>3,n=128>>e%8;for(let s=e;s>=1}isEmpty(){for(let t=0;t{\"use strict\";r.d(e,{A:()=>T});var i=r(988),n=r(3033),s=r(1565),o=r(7833),a=r(8727),h=r(8179),u=r(9639),f=r(1035),l=r(1314);const c=o(\"bittorrent-protocol\"),d=(0,u.L0)(\"\u0013BitTorrent protocol\"),p=new Uint8Array([0,0,0,0]),m=new Uint8Array([0,0,0,1,0]),g=new Uint8Array([0,0,0,1,1]),y=new Uint8Array([0,0,0,1,2]),b=new Uint8Array([0,0,0,1,3]),v=[0,0,0,0,0,0,0,0],w=[0,0,0,3,9,0,0],_=new Uint8Array([0,0,0,1,14]),M=new Uint8Array([0,0,0,1,15]),k=new Uint8Array([0,0,0,0,0,0,0,0]),S=new Uint8Array([0,0,1,2]),x=new Uint8Array([0,0,0,2]);function A(t,e){for(let r=t.length;r--;)t[r]^=e[r];return t}class E{constructor(t,e,r,i){this.piece=t,this.offset=e,this.length=r,this.callback=i}}class I{constructor(){this.buffer=new Uint8Array}get(t){return!0}set(t){}}class B extends h.Duplex{constructor(t=null,e=0,r=!1){super(),this._debugId=(0,u.V5)((0,u.po)(4)),this._debug(\"new wire\"),this.peerId=null,this.peerIdBuffer=null,this.type=t,this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new n.A(0,{grow:4e5}),this.extensions={},this.peerExtensions={},this.requests=[],this.peerRequests=[],this.extendedMapping={},this.peerExtendedMapping={},this.extendedHandshake={},this.peerExtendedHandshake={},this.hasFast=!1,this.allowedFastSet=[],this.peerAllowedFastSet=[],this._ext={},this._nextExt=1,this.uploaded=0,this.downloaded=0,this.uploadSpeed=f(),this.downloadSpeed=f(),this._keepAliveInterval=null,this._timeout=null,this._timeoutMs=0,this._timeoutExpiresAt=null,this._finished=!1,this._parserSize=0,this._parser=null,this._buffer=[],this._bufferSize=0,this._peEnabled=r,r?(this._dh=s.createDiffieHellman(\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a36210000000000090563\",\"hex\",2),this._myPubKey=this._dh.generateKeys(\"hex\")):this._myPubKey=null,this._peerPubKey=null,this._sharedSecret=null,this._peerCryptoProvide=[],this._cryptoHandshakeDone=!1,this._cryptoSyncPattern=null,this._waitMaxBytes=null,this._encryptionMethod=null,this._encryptGenerator=null,this._decryptGenerator=null,this._setGenerators=!1,this.once(\"finish\",(()=>this._onFinish())),this.on(\"finish\",this._onFinish),this._debug(\"type:\",this.type),\"tcpIncoming\"===this.type&&this._peEnabled?this._determineHandshakeType():\"tcpOutgoing\"===this.type&&this._peEnabled&&0===e?this._parsePe2():this._parseHandshake(null)}setKeepAlive(t){this._debug(\"setKeepAlive %s\",t),clearInterval(this._keepAliveInterval),!1!==t&&(this._keepAliveInterval=setInterval((()=>{this.keepAlive()}),55e3))}setTimeout(t,e){this._debug(\"setTimeout ms=%d unref=%s\",t,e),this._timeoutMs=t,this._timeoutUnref=!!e,this._resetTimeout(!0)}destroy(){if(!this.destroyed)return this._debug(\"destroy\"),this.end(),this}end(t){if(!this.destroyed&&!this.destroying)return this._debug(\"end\"),this._onUninterested(),this._onChoke(),super.end(t)}use(t){const e=t.prototype.name;if(!e)throw new Error('Extension class requires a \"name\" property on the prototype');this._debug(\"use extension.name=%s\",e);const r=this._nextExt,i=new t(this);function n(){}\"function\"!=typeof i.onHandshake&&(i.onHandshake=n),\"function\"!=typeof i.onExtendedHandshake&&(i.onExtendedHandshake=n),\"function\"!=typeof i.onMessage&&(i.onMessage=n),this.extendedMapping[r]=e,this._ext[e]=i,this[e]=i,this._nextExt+=1}keepAlive(){this._debug(\"keep-alive\"),this._push(p)}sendPe1(){if(this._peEnabled){const t=Math.floor(513*Math.random()),e=(0,u.po)(t);this._push((0,u.xW)([(0,u.fk)(this._myPubKey),e]))}}sendPe2(){const t=Math.floor(513*Math.random()),e=(0,u.po)(t);this._push((0,u.xW)([(0,u.fk)(this._myPubKey),e]))}async sendPe3(t){await this.setEncrypt(this._sharedSecret,t);const e=await(0,u.tW)((0,u.fk)(this._utfToHex(\"req1\")+this._sharedSecret)),r=A(await(0,u.tW)((0,u.fk)(this._utfToHex(\"req2\")+t)),await(0,u.tW)((0,u.fk)(this._utfToHex(\"req3\")+this._sharedSecret))),i=new DataView((0,u.po)(2).buffer).getUint16(0)%512,n=(0,u.po)(i);let s=new Uint8Array(14+i+2);s.set(k),s.set(S,8);const o=new DataView(s.buffer);o.setInt16(12,i),n.copy(s,14),o.setInt16(14+i,0),s=this._encryptHandshake(s),this._push((0,u.xW)([e,r,s]))}async sendPe4(t){await this.setEncrypt(this._sharedSecret,t);const e=new DataView((0,u.po)(2).buffer).getUint16(0)%512,r=(0,u.po)(e);let i=new Uint8Array(14+e);const n=new DataView(i.buffer);i.set(k),i.set(x,8),n.setInt16(12,e),i.set(r,14),i=this._encryptHandshake(i),this._push(i),this._cryptoHandshakeDone=!0,this._debug(\"completed crypto handshake\")}handshake(t,e,r){let i,n;if(\"string\"==typeof t?(t=t.toLowerCase(),i=(0,u.fk)(t)):(i=t,t=(0,u.V5)(i)),\"string\"==typeof e?n=(0,u.fk)(e):(n=e,e=(0,u.V5)(n)),this._infoHash=i,20!==i.length||20!==n.length)throw new Error(\"infoHash and peerId MUST have length 20\");this._debug(\"handshake i=%s p=%s exts=%o\",t,e,r);const s=new Uint8Array(v);this.extensions={extended:!0,dht:!(!r||!r.dht),fast:!(!r||!r.fast)},s[5]|=16,this.extensions.dht&&(s[7]|=1),this.extensions.fast&&(s[7]|=4),this.extensions.fast&&this.peerExtensions.fast&&(this._debug(\"fast extension is enabled\"),this.hasFast=!0),this._push((0,u.xW)([d,s,i,n])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const t=Object.assign({},this.extendedHandshake);t.m={};for(const e in this.extendedMapping){const r=this.extendedMapping[e];t.m[r]=Number(e)}this.extended(0,i.A.encode(t)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking)if(this.amChoking=!0,this._debug(\"choke\"),this._push(m),this.hasFast){let t=0;for(;this.peerRequests.length>t;){const e=this.peerRequests[t];this.allowedFastSet.includes(e.piece)?++t:this.reject(e.piece,e.offset,e.length)}}else for(;this.peerRequests.length;)this.peerRequests.pop()}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug(\"unchoke\"),this._push(g))}interested(){this.amInterested||(this.amInterested=!0,this._debug(\"interested\"),this._push(y))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug(\"uninterested\"),this._push(b))}have(t){this._debug(\"have %d\",t),this._message(4,[t],null)}bitfield(t){this._debug(\"bitfield\"),ArrayBuffer.isView(t)||(t=t.buffer),this._message(5,[],t)}request(t,e,r,i){return i||(i=()=>{}),this._finished?i(new Error(\"wire is closed\")):!this.peerChoking||this.hasFast&&this.peerAllowedFastSet.includes(t)?(this._debug(\"request index=%d offset=%d length=%d\",t,e,r),this.requests.push(new E(t,e,r,i)),this._timeout||this._resetTimeout(!0),void this._message(6,[t,e,r],null)):i(new Error(\"peer is choking\"))}piece(t,e,r){this._debug(\"piece index=%d offset=%d\",t,e),this._message(7,[t,e],r),this.uploaded+=r.length,this.uploadSpeed(r.length),this.emit(\"upload\",r.length)}cancel(t,e,r){this._debug(\"cancel index=%d offset=%d length=%d\",t,e,r),this._callback(this._pull(this.requests,t,e,r),new Error(\"request was cancelled\"),null),this._message(8,[t,e,r],null)}port(t){this._debug(\"port %d\",t);const e=new Uint8Array(w);new DataView(e.buffer).setUint16(5,t),this._push(e)}suggest(t){if(!this.hasFast)throw Error(\"fast extension is disabled\");this._debug(\"suggest %d\",t),this._message(13,[t],null)}haveAll(){if(!this.hasFast)throw Error(\"fast extension is disabled\");this._debug(\"have-all\"),this._push(_)}haveNone(){if(!this.hasFast)throw Error(\"fast extension is disabled\");this._debug(\"have-none\"),this._push(M)}reject(t,e,r){if(!this.hasFast)throw Error(\"fast extension is disabled\");this._debug(\"reject index=%d offset=%d length=%d\",t,e,r),this._pull(this.peerRequests,t,e,r),this._message(16,[t,e,r],null)}allowedFast(t){if(!this.hasFast)throw Error(\"fast extension is disabled\");this._debug(\"allowed-fast %d\",t),this.allowedFastSet.includes(t)||this.allowedFastSet.push(t),this._message(17,[t],null)}extended(t,e){if(this._debug(\"extended ext=%s\",t),\"string\"==typeof t&&this.peerExtendedMapping[t]&&(t=this.peerExtendedMapping[t]),\"number\"!=typeof t)throw new Error(`Unrecognized extension: ${t}`);{const r=new Uint8Array([t]),n=ArrayBuffer.isView(e)?e:i.A.encode(e);this._message(20,[],(0,u.xW)([r,n]))}}async setEncrypt(t,e){let r,i,n,s;switch(this.type){case\"tcpIncoming\":r=await(0,u.tW)((0,u.fk)(this._utfToHex(\"keyB\")+t+e)),n=await(0,u.tW)((0,u.fk)(this._utfToHex(\"keyA\")+t+e)),i=[];for(const t of r.values())i.push(t);s=[];for(const t of n.values())s.push(t);this._encryptGenerator=new a(i),this._decryptGenerator=new a(s);break;case\"tcpOutgoing\":r=await(0,u.tW)((0,u.fk)(this._utfToHex(\"keyA\")+t+e)),n=await(0,u.tW)((0,u.fk)(this._utfToHex(\"keyB\")+t+e)),i=[];for(const t of r.values())i.push(t);s=[];for(const t of n.values())s.push(t);this._encryptGenerator=new a(i),this._decryptGenerator=new a(s);break;default:return!1}for(let t=0;t<1024;t++)this._encryptGenerator.randomByte(),this._decryptGenerator.randomByte();return this._setGenerators=!0,!0}_message(t,e,r){const i=r?r.length:0,n=new Uint8Array(5+4*e.length),s=new DataView(n.buffer);s.setUint32(0,n.length+i-4),n[4]=t;for(let t=0;t{if(n===this._pull(this.peerRequests,t,e,r))return i?(this._debug(\"error satisfying request index=%d offset=%d length=%d (%s)\",t,e,r,i.message),void(this.hasFast&&this.reject(t,e,r))):void this.piece(t,e,s)},n=new E(t,e,r,i);this.peerRequests.push(n),this.emit(\"request\",t,e,r,i)}_onPiece(t,e,r){this._debug(\"got piece index=%d offset=%d\",t,e),this._callback(this._pull(this.requests,t,e,r.length),null,r),this.downloaded+=r.length,this.downloadSpeed(r.length),this.emit(\"download\",r.length),this.emit(\"piece\",t,e,r)}_onCancel(t,e,r){this._debug(\"got cancel index=%d offset=%d length=%d\",t,e,r),this._pull(this.peerRequests,t,e,r),this.emit(\"cancel\",t,e,r)}_onPort(t){this._debug(\"got port %d\",t),this.emit(\"port\",t)}_onSuggest(t){if(!this.hasFast)return this._debug(\"Error: got suggest whereas fast extension is disabled\"),void this.destroy();this._debug(\"got suggest %d\",t),this.emit(\"suggest\",t)}_onHaveAll(){if(!this.hasFast)return this._debug(\"Error: got have-all whereas fast extension is disabled\"),void this.destroy();this._debug(\"got have-all\"),this.peerPieces=new I,this.emit(\"have-all\")}_onHaveNone(){if(!this.hasFast)return this._debug(\"Error: got have-none whereas fast extension is disabled\"),void this.destroy();this._debug(\"got have-none\"),this.emit(\"have-none\")}_onReject(t,e,r){if(!this.hasFast)return this._debug(\"Error: got reject whereas fast extension is disabled\"),void this.destroy();this._debug(\"got reject index=%d offset=%d length=%d\",t,e,r),this._callback(this._pull(this.requests,t,e,r),new Error(\"request was rejected\"),null),this.emit(\"reject\",t,e,r)}_onAllowedFast(t){if(!this.hasFast)return this._debug(\"Error: got allowed-fast whereas fast extension is disabled\"),void this.destroy();this._debug(\"got allowed-fast %d\",t),this.peerAllowedFastSet.includes(t)||this.peerAllowedFastSet.push(t),this.peerAllowedFastSet.length>100&&this.peerAllowedFastSet.shift(),this.emit(\"allowed-fast\",t)}_onExtended(t,e){if(0===t){let t;try{t=i.A.decode(e)}catch(t){this._debug(\"ignoring invalid extended handshake: %s\",t.message||t)}if(!t)return;if(this.peerExtendedHandshake=t,\"object\"==typeof t.m)for(const e in t.m)this.peerExtendedMapping[e]=Number(t.m[e].toString());for(const t in this._ext)this.peerExtendedMapping[t]&&this._ext[t].onExtendedHandshake(this.peerExtendedHandshake);this._debug(\"got extended handshake\"),this.emit(\"extended\",\"handshake\",this.peerExtendedHandshake)}else this.extendedMapping[t]&&(t=this.extendedMapping[t],this._ext[t]&&this._ext[t].onMessage(e)),this._debug(\"got extended message ext=%s\",t),this.emit(\"extended\",t,e)}_onTimeout(){this._debug(\"request timed out\"),this._callback(this.requests.shift(),new Error(\"request has timed out\"),null),this.emit(\"timeout\")}_write(t,e){if(2===this._encryptionMethod&&this._cryptoHandshakeDone&&(t=this._decrypt(t)),this._bufferSize+=t.length,this._buffer.push(t),this._buffer.length>1&&(this._buffer=[(0,u.xW)(this._buffer,this._bufferSize)]),this._cryptoSyncPattern){const e=this._buffer[0].indexOf(this._cryptoSyncPattern);if(-1!==e)this._buffer[0]=this._buffer[0].slice(e+this._cryptoSyncPattern.length),this._bufferSize-=e+this._cryptoSyncPattern.length,this._cryptoSyncPattern=null;else if(this._bufferSize+t.length>this._waitMaxBytes+this._cryptoSyncPattern.length)return this._debug(\"Error: could not resynchronize\"),void this.destroy()}for(;this._bufferSize>=this._parserSize&&!this._cryptoSyncPattern;)if(0===this._parserSize)this._parser(new Uint8Array);else{const t=this._buffer[0];this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[t.slice(this._parserSize)]:[],this._parser(t.slice(0,this._parserSize))}e(null)}_callback(t,e,r){t&&(this._resetTimeout(!this.peerChoking&&!this._finished),t.callback(e,r))}_resetTimeout(t){if(!t||!this._timeoutMs||!this.requests.length)return clearTimeout(this._timeout),this._timeout=null,void(this._timeoutExpiresAt=null);const e=Date.now()+this._timeoutMs;if(this._timeout){if(e-this._timeoutExpiresAt<.05*this._timeoutMs)return;clearTimeout(this._timeout)}this._timeoutExpiresAt=e,this._timeout=setTimeout((()=>this._onTimeout()),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref()}_parse(t,e){this._parserSize=t,this._parser=e}_parseUntil(t,e){this._cryptoSyncPattern=t,this._waitMaxBytes=e}_onMessageLength(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(0);e>0?this._parse(e,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))}_onMessage(t){this._parse(4,this._onMessageLength);const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.getUint32(1));case 5:return this._onBitField(t.slice(1));case 6:return this._onRequest(e.getUint32(1),e.getUint32(5),e.getUint32(9));case 7:return this._onPiece(e.getUint32(1),e.getUint32(5),t.slice(9));case 8:return this._onCancel(e.getUint32(1),e.getUint32(5),e.getUint32(9));case 9:return this._onPort(e.getUint16(1));case 13:return this._onSuggest(e.getUint32(1));case 14:return this._onHaveAll();case 15:return this._onHaveNone();case 16:return this._onReject(e.getUint32(1),e.getUint32(5),e.getUint32(9));case 17:return this._onAllowedFast(e.getUint32(1));case 20:return this._onExtended(t[1],t.slice(2));default:return this._debug(\"got unknown message\"),this.emit(\"unknownmessage\",t)}}_determineHandshakeType(){this._parse(1,(t=>{const e=t[0];19===e?this._parse(e+48,this._onHandshakeBuffer):this._parsePe1(t)}))}_parsePe1(t){this._parse(95,(e=>{this._onPe1((0,u.xW)([t,e])),this._parsePe3()}))}_parsePe2(){this._parse(96,(t=>{for(this._onPe2(t);!this._setGenerators;);this._parsePe4()}))}async _parsePe3(){const t=await(0,u.tW)((0,u.fk)(this._utfToHex(\"req1\")+this._sharedSecret));this._parseUntil(t,512),this._parse(20,(t=>{for(this._onPe3(t);!this._setGenerators;);this._parsePe3Encrypted()}))}_parsePe3Encrypted(){this._parse(14,(t=>{const e=this._decryptHandshake(t.slice(0,8)),r=this._decryptHandshake(t.slice(8,12)),i=new DataView(this._decryptHandshake(t.slice(12,14)).buffer).getUint16(0);this._parse(i,(t=>{t=this._decryptHandshake(t),this._parse(2,(i=>{const n=new DataView(this._decryptHandshake(i).buffer).getUint16(0);this._parse(n,(i=>{i=this._decryptHandshake(i),this._onPe3Encrypted(e,r,t,i);const s=n?i[0]:null,o=n?i.slice(1,20):null;19===s&&\"BitTorrent protocol\"===(0,u.dU)(o)?this._onHandshakeBuffer(i.slice(1)):this._parseHandshake()}))}))}))}))}_parsePe4(){const t=this._decryptHandshake(k);this._parseUntil(t,512),this._parse(6,(t=>{const e=this._decryptHandshake(t.slice(0,4)),r=new DataView(this._decryptHandshake(t.slice(4,6)).buffer).getUint16(0);this._parse(r,(t=>{this._decryptHandshake(t),this._onPe4(e),this._parseHandshake(null)}))}))}_parseHandshake(){this._parse(1,(t=>{const e=t[0];if(19!==e)return this._debug(\"Error: wire not speaking BitTorrent protocol (%s)\",e.toString()),void this.end();this._parse(e+48,this._onHandshakeBuffer)}))}_onHandshakeBuffer(t){const e=t.slice(0,19);if(\"BitTorrent protocol\"!==(0,u.dU)(e))return this._debug(\"Error: wire not speaking BitTorrent protocol (%s)\",(0,u.dU)(e)),void this.end();t=t.slice(19),this._onHandshake(t.slice(8,28),t.slice(28,48),{dht:!!(1&t[7]),fast:!!(4&t[7]),extended:!!(16&t[5])}),this._parse(4,this._onMessageLength)}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,(()=>{}));this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error(\"wire was closed\"),null)}_debug(...t){t[0]=`[${this._debugId}] ${t[0]}`,c(...t)}_pull(t,e,r,i){for(let n=0;n{\"use strict\";r.d(e,{NJ:()=>y,V5:()=>o,dU:()=>p,HB:()=>b,xW:()=>h,LC:()=>u,tW:()=>S,fk:()=>a,Ht:()=>v,po:()=>x,L0:()=>g});const i=\"0123456789abcdef\",n=[],s=[];for(let t=0;t<256;t++)n[t]=i[t>>4&15]+i[15&t],t<16&&(t<10?s[48+t]=t:s[87+t]=t);const o=t=>{const e=t.length;let r=\"\",i=0;for(;i{const e=t.length>>1,r=e<<1,i=new Uint8Array(e);let n=0,o=0;for(;o{const r=t.length||0;if(!e){let i=r;for(;i--;)e+=t[i].length}const i=new Uint8Array(e);let n=e,s=r;for(;s--;)n-=t[s].length,i.set(t[s],n);return i},u=(t,e)=>{if(t.length!==e.length)return!1;for(let r=t.length;r>-1;r-=1)if(t[r]!==e[r])return!1;return!0};for(var f=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",l=\"undefined\"==typeof Uint8Array?[]:new Uint8Array(256),c=0;c<64;c++)l[f.charCodeAt(c)]=c;const d=new TextDecoder,p=(t,e)=>e?new TextDecoder(e).decode(t):d.decode(t),m=new TextEncoder,g=t=>m.encode(t),y=t=>function(t){var e,r=new Uint8Array(t),i=r.length,n=\"\";for(e=0;e>2],n+=f[(3&r[e])<<4|r[e+1]>>4],n+=f[(15&r[e+1])<<2|r[e+2]>>6],n+=f[63&r[e+2]];return i%3==2?n=n.substring(0,n.length-1)+\"=\":i%3==1&&(n=n.substring(0,n.length-2)+\"==\"),n}(t),b=t=>{let e,r=\"\",n=0;const s=t.length;for(;n>4]+i[15&e];return r},v=t=>{const e=a(t);if(e.length<=65536)return String.fromCharCode(...e);let r=\"\",i=0;for(;i{if(!M)throw new Error(\"no web crypto support\");\"string\"==typeof t&&(t=g(t));const i=new Uint8Array(await M.digest(r,t));return e?k[e](i):i},x=t=>{const e=new Uint8Array(t);return _.getRandomValues(e)}},5310:(t,e,r)=>{\"use strict\";r.r(e),r.d(e,{default:()=>g,enableSecure:()=>m});var i=r(7007),n=r(8179),s=r(1314),o=r(7833),a=r(6458);const h=\"tcpIncoming\",u=\"tcpOutgoing\",f=\"utpIncoming\",l=\"utpOutgoing\",c=\"webSeed\",d=o(\"webtorrent:peer\");let p=!1;const m=()=>{p=!0};class g extends i{constructor(t,e){super(),this.id=t,this.type=e,d(\"new %s Peer %s\",e,t),this.addr=null,this.conn=null,this.swarm=null,this.wire=null,this.source=null,this.connected=!1,this.destroyed=!1,this.timeout=null,this.retries=0,this.sentPe1=!1,this.sentPe2=!1,this.sentPe3=!1,this.sentPe4=!1,this.sentHandshake=!1}onConnect(){if(this.destroyed)return;this.connected=!0,d(\"Peer %s connected\",this.id),clearTimeout(this.connectTimeout);const t=this.conn;t.once(\"end\",(()=>{this.destroy()})),t.once(\"close\",(()=>{this.destroy()})),t.once(\"finish\",(()=>{this.destroy()})),t.once(\"error\",(t=>{this.destroy(t)}));const e=this.wire=new a.A(this.type,this.retries,p);e.once(\"end\",(()=>{this.destroy()})),e.once(\"close\",(()=>{this.destroy()})),e.once(\"finish\",(()=>{this.destroy()})),e.once(\"error\",(t=>{this.destroy(t)})),e.once(\"pe1\",(()=>{this.onPe1()})),e.once(\"pe2\",(()=>{this.onPe2()})),e.once(\"pe3\",(()=>{this.onPe3()})),e.once(\"pe4\",(()=>{this.onPe4()})),e.once(\"handshake\",((t,e)=>{this.onHandshake(t,e)})),this.startHandshakeTimeout(),this.setThrottlePipes(),this.swarm&&(\"tcpOutgoing\"===this.type?p&&0===this.retries&&!this.sentPe1?this.sendPe1():this.sentHandshake||this.handshake():\"tcpIncoming\"===this.type||this.sentHandshake||this.handshake())}sendPe1(){this.wire.sendPe1(),this.sentPe1=!0}onPe1(){this.sendPe2()}sendPe2(){this.wire.sendPe2(),this.sentPe2=!0}onPe2(){this.sendPe3()}sendPe3(){this.wire.sendPe3(this.swarm.infoHash),this.sentPe3=!0}onPe3(t){this.swarm&&(this.swarm.infoHashHash!==t&&this.destroy(new Error(\"unexpected crypto handshake info hash for this swarm\")),this.sendPe4())}sendPe4(){this.wire.sendPe4(this.swarm.infoHash),this.sentPe4=!0}onPe4(){this.sentHandshake||this.handshake()}clearPipes(){this.conn.unpipe(),this.wire.unpipe()}setThrottlePipes(){const t=this;(0,n.pipeline)(this.conn,this.throttleGroups.down.throttle(),new n.Transform({transform(e,r){t.emit(\"download\",e.length),t.destroyed||r(null,e)}}),this.wire,this.throttleGroups.up.throttle(),new n.Transform({transform(e,r){t.emit(\"upload\",e.length),t.destroyed||r(null,e)}}),this.conn)}onHandshake(t,e){if(!this.swarm)return;if(this.destroyed)return;if(this.swarm.destroyed)return this.destroy(new Error(\"swarm already destroyed\"));if(t!==this.swarm.infoHash)return this.destroy(new Error(\"unexpected handshake info hash for this swarm\"));if(e===this.swarm.peerId)return this.destroy(new Error(\"refusing to connect to ourselves\"));d(\"Peer %s got handshake %s\",this.id,t),clearTimeout(this.handshakeTimeout),this.retries=0;let r=this.addr;!r&&this.conn.remoteAddress&&this.conn.remotePort&&(r=`${this.conn.remoteAddress}:${this.conn.remotePort}`),this.swarm._onWire(this.wire,r),this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}handshake(){const t={dht:!this.swarm.private&&!!this.swarm.client.dht,fast:!0};this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,t),this.sentHandshake=!0}startConnectTimeout(){clearTimeout(this.connectTimeout);this.connectTimeout=setTimeout((()=>{this.destroy(new Error(\"connect timeout\"))}),{webrtc:25e3,tcpOutgoing:5e3,utpOutgoing:5e3}[this.type]),this.connectTimeout.unref&&this.connectTimeout.unref()}startHandshakeTimeout(){clearTimeout(this.handshakeTimeout),this.handshakeTimeout=setTimeout((()=>{this.destroy(new Error(\"handshake timeout\"))}),25e3),this.handshakeTimeout.unref&&this.handshakeTimeout.unref()}destroy(t){if(this.destroyed)return;this.destroyed=!0,this.connected=!1,d(\"destroy %s %s (error: %s)\",this.type,this.id,t&&(t.message||t)),clearTimeout(this.connectTimeout),clearTimeout(this.handshakeTimeout);const e=this.swarm,r=this.conn,i=this.wire;this.swarm=null,this.conn=null,this.wire=null,e&&i&&s(e.wires,e.wires.indexOf(i)),r&&(r.on(\"error\",(()=>{})),r.destroy()),i&&i.destroy(),e&&e.removePeer(this.id)}}g.TYPE_TCP_INCOMING=h,g.TYPE_TCP_OUTGOING=u,g.TYPE_UTP_INCOMING=f,g.TYPE_UTP_OUTGOING=l,g.TYPE_WEBRTC=\"webrtc\",g.TYPE_WEBSEED=c,g.SOURCE_MANUAL=\"manual\",g.SOURCE_TRACKER=\"tracker\",g.SOURCE_DHT=\"dht\",g.SOURCE_LSD=\"lsd\",g.SOURCE_UT_PEX=\"ut_pex\",g.createWebRTCPeer=(t,e,r)=>{const i=new g(t.id,\"webrtc\");if(i.conn=t,i.swarm=e,i.throttleGroups=r,i.conn.connected)i.onConnect();else{const t=()=>{i.conn.removeListener(\"connect\",e),i.conn.removeListener(\"error\",r)},e=()=>{t(),i.onConnect()},r=e=>{t(),i.destroy(e)};i.conn.once(\"connect\",e),i.conn.once(\"error\",r),i.startConnectTimeout()}return i},g.createTCPIncomingPeer=(t,e)=>g._createIncomingPeer(t,h,e),g.createUTPIncomingPeer=(t,e)=>g._createIncomingPeer(t,f,e),g.createTCPOutgoingPeer=(t,e,r)=>g._createOutgoingPeer(t,e,u,r),g.createUTPOutgoingPeer=(t,e,r)=>g._createOutgoingPeer(t,e,l,r),g._createIncomingPeer=(t,e,r)=>{const i=`${t.remoteAddress}:${t.remotePort}`,n=new g(i,e);return n.conn=t,n.addr=i,n.throttleGroups=r,n.onConnect(),n},g._createOutgoingPeer=(t,e,r,i)=>{const n=new g(t,r);return n.addr=t,n.swarm=e,n.throttleGroups=i,n},g.createWebSeedPeer=(t,e,r,i)=>{const n=new g(e,c);return n.swarm=r,n.conn=t,n.throttleGroups=i,n.onConnect(),n}},3219:t=>{\"use strict\";t.exports=JSON.parse('{\"aes-128-ecb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-192-ecb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-256-ecb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-128-cbc\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-192-cbc\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-256-cbc\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes128\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes192\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes256\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-128-cfb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-192-cfb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-256-cfb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-128-cfb8\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-192-cfb8\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-256-cfb8\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-128-cfb1\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-192-cfb1\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-256-cfb1\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-128-ofb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-192-ofb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-256-ofb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-128-ctr\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-192-ctr\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-256-ctr\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-128-gcm\":{\"cipher\":\"AES\",\"key\":128,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"},\"aes-192-gcm\":{\"cipher\":\"AES\",\"key\":192,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"},\"aes-256-gcm\":{\"cipher\":\"AES\",\"key\":256,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"}}')},2951:t=>{\"use strict\";t.exports=JSON.parse('{\"sha224WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha224\",\"id\":\"302d300d06096086480165030402040500041c\"},\"RSA-SHA224\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha224\",\"id\":\"302d300d06096086480165030402040500041c\"},\"sha256WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha256\",\"id\":\"3031300d060960864801650304020105000420\"},\"RSA-SHA256\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha256\",\"id\":\"3031300d060960864801650304020105000420\"},\"sha384WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha384\",\"id\":\"3041300d060960864801650304020205000430\"},\"RSA-SHA384\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha384\",\"id\":\"3041300d060960864801650304020205000430\"},\"sha512WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha512\",\"id\":\"3051300d060960864801650304020305000440\"},\"RSA-SHA512\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha512\",\"id\":\"3051300d060960864801650304020305000440\"},\"RSA-SHA1\":{\"sign\":\"rsa\",\"hash\":\"sha1\",\"id\":\"3021300906052b0e03021a05000414\"},\"ecdsa-with-SHA1\":{\"sign\":\"ecdsa\",\"hash\":\"sha1\",\"id\":\"\"},\"sha256\":{\"sign\":\"ecdsa\",\"hash\":\"sha256\",\"id\":\"\"},\"sha224\":{\"sign\":\"ecdsa\",\"hash\":\"sha224\",\"id\":\"\"},\"sha384\":{\"sign\":\"ecdsa\",\"hash\":\"sha384\",\"id\":\"\"},\"sha512\":{\"sign\":\"ecdsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-SHA\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA-SHA1\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA-WITH-SHA224\":{\"sign\":\"dsa\",\"hash\":\"sha224\",\"id\":\"\"},\"DSA-SHA224\":{\"sign\":\"dsa\",\"hash\":\"sha224\",\"id\":\"\"},\"DSA-WITH-SHA256\":{\"sign\":\"dsa\",\"hash\":\"sha256\",\"id\":\"\"},\"DSA-SHA256\":{\"sign\":\"dsa\",\"hash\":\"sha256\",\"id\":\"\"},\"DSA-WITH-SHA384\":{\"sign\":\"dsa\",\"hash\":\"sha384\",\"id\":\"\"},\"DSA-SHA384\":{\"sign\":\"dsa\",\"hash\":\"sha384\",\"id\":\"\"},\"DSA-WITH-SHA512\":{\"sign\":\"dsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-SHA512\":{\"sign\":\"dsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-RIPEMD160\":{\"sign\":\"dsa\",\"hash\":\"rmd160\",\"id\":\"\"},\"ripemd160WithRSA\":{\"sign\":\"rsa\",\"hash\":\"rmd160\",\"id\":\"3021300906052b2403020105000414\"},\"RSA-RIPEMD160\":{\"sign\":\"rsa\",\"hash\":\"rmd160\",\"id\":\"3021300906052b2403020105000414\"},\"md5WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"md5\",\"id\":\"3020300c06082a864886f70d020505000410\"},\"RSA-MD5\":{\"sign\":\"rsa\",\"hash\":\"md5\",\"id\":\"3020300c06082a864886f70d020505000410\"}}')},4589:t=>{\"use strict\";t.exports=JSON.parse('{\"1.3.132.0.10\":\"secp256k1\",\"1.3.132.0.33\":\"p224\",\"1.2.840.10045.3.1.1\":\"p192\",\"1.2.840.10045.3.1.7\":\"p256\",\"1.3.132.0.34\":\"p384\",\"1.3.132.0.35\":\"p521\"}')},3241:t=>{\"use strict\";t.exports=JSON.parse('{\"modp1\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"},\"modp2\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"},\"modp5\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"},\"modp14\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"},\"modp15\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"},\"modp16\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"},\"modp17\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"},\"modp18\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"}}')},1636:t=>{\"use strict\";t.exports={rE:\"6.5.5\"}},5579:t=>{\"use strict\";t.exports=JSON.parse('{\"2.16.840.1.101.3.4.1.1\":\"aes-128-ecb\",\"2.16.840.1.101.3.4.1.2\":\"aes-128-cbc\",\"2.16.840.1.101.3.4.1.3\":\"aes-128-ofb\",\"2.16.840.1.101.3.4.1.4\":\"aes-128-cfb\",\"2.16.840.1.101.3.4.1.21\":\"aes-192-ecb\",\"2.16.840.1.101.3.4.1.22\":\"aes-192-cbc\",\"2.16.840.1.101.3.4.1.23\":\"aes-192-ofb\",\"2.16.840.1.101.3.4.1.24\":\"aes-192-cfb\",\"2.16.840.1.101.3.4.1.41\":\"aes-256-ecb\",\"2.16.840.1.101.3.4.1.42\":\"aes-256-cbc\",\"2.16.840.1.101.3.4.1.43\":\"aes-256-ofb\",\"2.16.840.1.101.3.4.1.44\":\"aes-256-cfb\"}')}},i={};function n(t){var e=i[t];if(void 0!==e)return e.exports;var s=i[t]={id:t,loaded:!1,exports:{}};return r[t].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,n.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if(\"object\"==typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&\"function\"==typeof r.then)return r}var s=Object.create(null);n.r(s);var o={};t=t||[null,e({}),e([]),e(e)];for(var a=2&i&&r;\"object\"==typeof a&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach((t=>o[t]=()=>r[t]));return o.default=()=>r,n.d(s,o),s},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var s={};return(()=>{\"use strict\";n.d(s,{default:()=>Lr});var t=n(8947),e=n.n(t),r=n(1889),i=n.n(r),o=n(8287),a=n(7007),h=n.n(a),u=n(7975),f=n(988),l=n(1467),c=n(8444),d=n(2123);const p=new RegExp([\"^npm-debug\\\\.log$\",\"^\\\\..*\\\\.swp$\",\"^\\\\.DS_Store$\",\"^\\\\.AppleDouble$\",\"^\\\\.LSOverride$\",\"^Icon\\\\r$\",\"^\\\\._.*\",\"^\\\\.Spotlight-V100(?:$|\\\\/)\",\"\\\\.Trashes\",\"^__MACOSX$\",\"~$\",\"^Thumbs\\\\.db$\",\"^ehthumbs\\\\.db$\",\"^[Dd]esktop\\\\.ini$\",\"@eaDir$\"].join(\"|\"));var m=n(405),g=n(8190),y=n(9596),b=n(9639),v=(n(3468),n(2532));const w=[[\"udp://tracker.leechers-paradise.org:6969\"],[\"udp://tracker.coppersurfer.tk:6969\"],[\"udp://tracker.opentrackr.org:1337\"],[\"udp://explodie.org:6969\"],[\"udp://tracker.empire-js.us:1337\"],[\"wss://tracker.btorrent.xyz\"],[\"wss://tracker.openwebtorrent.com\"],[\"wss://tracker.webtorrent.dev\"]],_=Symbol(\"itemPath\");function M(t,e,r){if(\"undefined\"!=typeof FileList&&t instanceof FileList&&(t=Array.from(t)),Array.isArray(t)||(t=[t]),0===t.length)throw new Error(\"invalid input type\");t.forEach((t=>{if(null==t)throw new Error(`invalid input type: ${t}`)})),1!==(t=t.map((t=>S(t)&&\"string\"==typeof t.path&&\"function\"==typeof v?t.path:t))).length||\"string\"==typeof t[0]||t[0].name||(t[0].name=e.name);let i=null;t.forEach(((e,r)=>{if(\"string\"==typeof e)return;let n=e.fullPath||e.name;n||(n=`Unknown File ${r+1}`,e.unknownName=!0),e[_]=n.split(\"/\"),e[_][0]||e[_].shift(),e[_].length<2?i=null:0===r&&t.length>1?i=e[_][0]:e[_][0]!==i&&(i=null)})),(void 0===e.filterJunkFiles||e.filterJunkFiles)&&(t=t.filter((t=>\"string\"==typeof t||!function(t){const e=t[t.length-1];return\".\"===e[0]&&function(t){return p.test(t)}(e)}(t[_])))),i&&t.forEach((t=>{const e=(ArrayBuffer.isView(t)||x(t))&&!t[_];\"string\"==typeof t||e||t[_].shift()})),!e.name&&i&&(e.name=i),e.name||t.some((t=>\"string\"==typeof t?(e.name=u.basename(t),!0):!t.unknownName&&(e.name=t[_][t[_].length-1],!0))),e.name||(e.name=`Unnamed Torrent ${Date.now()}`);const n=t.reduce(((t,e)=>t+Number(\"string\"==typeof e)),0);let s=1===t.length;if(1===t.length&&\"string\"==typeof t[0]){if(\"function\"!=typeof v)throw new Error(\"filesystem paths do not work in the browser\");d(t[0],((t,e)=>{if(t)return r(t);s=e,o()}))}else y(o);function o(){g(t.map((t=>e=>{const r={};if(S(t))r.getStream=t.stream(),r.length=t.size;else if(ArrayBuffer.isView(t))r.getStream=[t],r.length=t.length;else{if(!x(t)){if(\"string\"==typeof t){if(\"function\"!=typeof v)throw new Error(\"filesystem paths do not work in the browser\");return void v(t,n>1||s,e)}throw new Error(\"invalid input type\")}r.getStream=async function*(t,e){for await(const r of t)e.length+=r.length,yield r}(t,r),r.length=0}r.path=t[_],e(null,r)})),((t,e)=>{if(t)return r(t);e=e.flat(),r(null,e,s)}))}}function k(t,e){return t+e.length}function S(t){return\"undefined\"!=typeof Blob&&t instanceof Blob}function x(t){return\"object\"==typeof t&&null!=t&&\"function\"==typeof t.pipe}var A=n(7833),E=n(7237),I=n(6636),B=n(3208);self.Blob,self.File,self.FormData,self.Headers,self.Request,self.Response,self.AbortController,self.AbortSignal;const T=self.fetch||(()=>{throw new Error(\"global fetch is not available!\")}),P=[255,255,26,27,28,29,30,31,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255];const R=function(t){const e={},r=t.split(\"magnet:?\")[1];let i;return(r&&r.length>=0?r.split(\"&\"):[]).forEach((t=>{const r=t.split(\"=\");if(2!==r.length)return;const i=r[0];let n=r[1];\"dn\"===i&&(n=decodeURIComponent(n).replace(/\\+/g,\" \")),\"tr\"!==i&&\"xs\"!==i&&\"as\"!==i&&\"ws\"!==i||(n=decodeURIComponent(n)),\"kt\"===i&&(n=decodeURIComponent(n).split(\"+\")),\"ix\"===i&&(n=Number(n)),\"so\"===i&&(n=decodeURIComponent(n).split(\",\").reduce(((t,e,r,i)=>{const n=e.split(\"-\").map((t=>parseInt(t)));return t.concat(((t,e=t)=>Array.from({length:e-t+1},((e,r)=>r+t)))(...n))}),[])),e[i]?(Array.isArray(e[i])||(e[i]=[e[i]]),e[i].push(n)):e[i]=n})),e.xt&&(Array.isArray(e.xt)?e.xt:[e.xt]).forEach((t=>{(i=t.match(/^urn:btih:(.{40})/))?e.infoHash=i[1].toLowerCase():(i=t.match(/^urn:btih:(.{32})/))?e.infoHash=(0,b.V5)(function(t){if(!ArrayBuffer.isView(t)&&\"string\"!=typeof t)throw new TypeError(\"base32.decode only takes Buffer or string as parameter\");let e,r=0,i=0,n=0;ArrayBuffer.isView(t)||(t=(0,b.L0)(t));const s=new Uint8Array(Math.ceil(5*t.length/8));for(let o=0;o>>r,s[n]=e,n++,e=255&i<<8-r)}return s.subarray(0,n)}(i[1])):(i=t.match(/^urn:btmh:1220(.{64})/))&&(e.infoHashV2=i[1].toLowerCase())})),e.xs&&(Array.isArray(e.xs)?e.xs:[e.xs]).forEach((t=>{(i=t.match(/^urn:btpk:(.{64})/))&&(e.publicKey=i[1].toLowerCase())})),e.infoHash&&(e.infoHashBuffer=(0,b.fk)(e.infoHash)),e.infoHashV2&&(e.infoHashV2Buffer=(0,b.fk)(e.infoHashV2)),e.publicKey&&(e.publicKeyBuffer=(0,b.fk)(e.publicKey)),e.dn&&(e.name=e.dn),e.kt&&(e.keywords=e.kt),e.announce=[],(\"string\"==typeof e.tr||Array.isArray(e.tr))&&(e.announce=e.announce.concat(e.tr)),e.urlList=[],(\"string\"==typeof e.as||Array.isArray(e.as))&&(e.urlList=e.urlList.concat(e.as)),(\"string\"==typeof e.ws||Array.isArray(e.ws))&&(e.urlList=e.urlList.concat(e.ws)),e.peerAddresses=[],(\"string\"==typeof e[\"x.pe\"]||Array.isArray(e[\"x.pe\"]))&&(e.peerAddresses=e.peerAddresses.concat(e[\"x.pe\"])),e.announce=Array.from(new Set(e.announce)),e.urlList=Array.from(new Set(e.urlList)),e.peerAddresses=Array.from(new Set(e.peerAddresses)),e};async function C(t){if(\"string\"==typeof t&&/^(stream-)?magnet:/.test(t)){const e=R(t);if(!e.infoHash)throw new Error(\"Invalid torrent identifier\");return e}if(\"string\"==typeof t&&(/^[a-f0-9]{40}$/i.test(t)||/^[a-z2-7]{32}$/i.test(t)))return R(`magnet:?xt=urn:btih:${t}`);if(ArrayBuffer.isView(t)&&20===t.length)return R(`magnet:?xt=urn:btih:${(0,b.V5)(t)}`);if(ArrayBuffer.isView(t))return await async function(t){ArrayBuffer.isView(t)&&(t=f.A.decode(t)),j(t.info,\"info\"),j(t.info[\"name.utf-8\"]||t.info.name,\"info.name\"),j(t.info[\"piece length\"],\"info['piece length']\"),j(t.info.pieces,\"info.pieces\"),t.info.files?t.info.files.forEach((t=>{j(\"number\"==typeof t.length,\"info.files[0].length\"),j(t[\"path.utf-8\"]||t.path,\"info.files[0].path\")})):j(\"number\"==typeof t.info.length,\"info.length\");const e={info:t.info,infoBuffer:f.A.encode(t.info),name:(0,b.dU)(t.info[\"name.utf-8\"]||t.info.name),announce:[]};e.infoHashBuffer=await(0,b.tW)(e.infoBuffer),e.infoHash=(0,b.V5)(e.infoHashBuffer),void 0!==t.info.private&&(e.private=!!t.info.private),t[\"creation date\"]&&(e.created=new Date(1e3*t[\"creation date\"])),t[\"created by\"]&&(e.createdBy=(0,b.dU)(t[\"created by\"])),ArrayBuffer.isView(t.comment)&&(e.comment=(0,b.dU)(t.comment)),Array.isArray(t[\"announce-list\"])&&t[\"announce-list\"].length>0?t[\"announce-list\"].forEach((t=>{t.forEach((t=>{e.announce.push((0,b.dU)(t))}))})):t.announce&&e.announce.push((0,b.dU)(t.announce)),ArrayBuffer.isView(t[\"url-list\"])&&(t[\"url-list\"]=t[\"url-list\"].length>0?[t[\"url-list\"]]:[]),e.urlList=(t[\"url-list\"]||[]).map((t=>(0,b.dU)(t))),e.announce=Array.from(new Set(e.announce)),e.urlList=Array.from(new Set(e.urlList));const r=t.info.files||[t.info];e.files=r.map(((t,i)=>{const n=[].concat(e.name,t[\"path.utf-8\"]||t.path||[]).map((t=>ArrayBuffer.isView(t)?(0,b.dU)(t):t));return{path:u.join.apply(null,[u.sep].concat(n)).slice(1),name:n[n.length-1],length:t.length,offset:r.slice(0,i).reduce(O,0)}})),e.length=r.reduce(O,0);const i=e.files[e.files.length-1];return e.pieceLength=t.info[\"piece length\"],e.lastPieceLength=(i.offset+i.length)%e.pieceLength||e.pieceLength,e.pieces=function(t){const e=[];for(let r=0;r{r(null,i)}));else if(\"undefined\"!=typeof Blob&&t instanceof Blob)try{n(new Uint8Array(await t.arrayBuffer()))}catch(t){return r(new Error(`Error converting Blob: ${t.message}`))}else if(/^https?:/.test(t))try{const r=await T(t,{headers:{\"user-agent\":\"WebTorrent (https://webtorrent.io)\"},signal:AbortSignal.timeout(3e4),...e});n(new Uint8Array(await r.arrayBuffer()))}catch(t){return r(new Error(`Error downloading torrent: ${t.message}`))}else\"function\"==typeof B.readFile&&\"string\"==typeof t?B.readFile(t,((t,e)=>{if(t)return r(new Error(\"Invalid torrent identifier\"));n(e)})):y((()=>{r(new Error(\"Invalid torrent identifier\"))}));async function n(t){try{i=await C(t)}catch(t){return r(t)}i&&i.infoHash?r(null,i):r(new Error(\"Invalid torrent identifier\"))}}function O(t,e){return t+e.length}function j(t,e){if(!t)throw new Error(`Torrent is missing required field: ${e}`)}const N=C;var U=n(5064),q=n(8179),D=n(6310);const F=A(\"simple-peer\"),H=65536;function z(t){return t.replace(/a=ice-options:trickle\\s\\n/g,\"\")}class W extends q.Duplex{constructor(t){if(super(t=Object.assign({allowHalfOpen:!1},t)),this.__objectMode=!!t.objectMode,this._id=(0,b.V5)((0,b.po)(4)).slice(0,7),this._debug(\"new peer %o\",t),this.channelName=t.initiator?t.channelName||(0,b.V5)((0,b.po)(20)):null,this.initiator=t.initiator||!1,this.channelConfig=t.channelConfig||W.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},W.config,t.config),this.offerOptions=t.offerOptions||{},this.answerOptions=t.answerOptions||{},this.sdpTransform=t.sdpTransform||(t=>t),this.trickle=void 0===t.trickle||t.trickle,this.allowHalfTrickle=void 0!==t.allowHalfTrickle&&t.allowHalfTrickle,this.iceCompleteTimeout=t.iceCompleteTimeout||5e3,this._destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=t.wrtc&&\"object\"==typeof t.wrtc?t.wrtc:U(),!this._wrtc)throw\"undefined\"==typeof window?D(new Error(\"No WebRTC support: Specify `opts.wrtc` option in this environment\"),\"ERR_WEBRTC_SUPPORT\"):D(new Error(\"No WebRTC support: Not a supported browser\"),\"ERR_WEBRTC_SUPPORT\");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(t){return void this.__destroy(D(t,\"ERR_PC_CONSTRUCTOR\"))}this._isReactNativeWebrtc=\"number\"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=t=>{this._onIceCandidate(t)},\"object\"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch((t=>{this.__destroy(D(t,\"ERR_PC_PEER_IDENTITY\"))})),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=t=>{this._setupData(t)},this._debug(\"initial negotiation\"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once(\"finish\",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&\"open\"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(t){if(!this._destroying){if(this.destroyed)throw D(new Error(\"cannot signal after peer is destroyed\"),\"ERR_DESTROYED\");if(\"string\"==typeof t)try{t=JSON.parse(t)}catch(e){t={}}this._debug(\"signal()\"),t.renegotiate&&this.initiator&&(this._debug(\"got request to renegotiate\"),this._needsNegotiation()),t.transceiverRequest&&this.initiator&&(this._debug(\"got request for transceiver\"),this.addTransceiver(t.transceiverRequest.kind,t.transceiverRequest.init)),t.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(t.candidate):this._pendingCandidates.push(t.candidate)),t.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(t)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((t=>{this._addIceCandidate(t)})),this._pendingCandidates=[],\"offer\"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((t=>{this.__destroy(D(t,\"ERR_SET_REMOTE_DESCRIPTION\"))})),t.sdp||t.candidate||t.renegotiate||t.transceiverRequest||this.__destroy(D(new Error(\"signal() called with invalid signal data\"),\"ERR_SIGNALING\"))}}_addIceCandidate(t){const e=new this._wrtc.RTCIceCandidate(t);this._pc.addIceCandidate(e).catch((t=>{!e.address||e.address.endsWith(\".local\")?(\"Ignoring unsupported ICE candidate.\",console.warn(\"Ignoring unsupported ICE candidate.\")):this.__destroy(D(t,\"ERR_ADD_ICE_CANDIDATE\"))}))}send(t){if(!this._destroying){if(this.destroyed)throw D(new Error(\"cannot send after peer is destroyed\"),\"ERR_DESTROYED\");this._channel.send(t)}}_needsNegotiation(){this._debug(\"_needsNegotiation\"),this._batchedNegotiation||(this._batchedNegotiation=!0,y((()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug(\"starting batched negotiation\"),this.negotiate()):this._debug(\"non-initiator initial negotiation request discarded\"),this._firstNegotiation=!1})))}negotiate(){if(!this._destroying){if(this.destroyed)throw D(new Error(\"cannot negotiate after peer is destroyed\"),\"ERR_DESTROYED\");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug(\"already negotiating, queueing\")):(this._debug(\"start negotiation\"),setTimeout((()=>{this._createOffer()}),0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug(\"already negotiating, queueing\")):(this._debug(\"requesting negotiation from initiator\"),this.emit(\"signal\",{type:\"renegotiate\",renegotiate:!0})),this._isNegotiating=!0}}_final(t){this._readableState.ended||this.push(null),t(null)}__destroy(t){this.end(),this._destroy((()=>{}),t)}_destroy(t,e){this.destroyed||this._destroying||(this._destroying=!0,this._debug(\"destroying (error: %s)\",e&&(e.message||e)),setTimeout((()=>{if(this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener(\"finish\",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(t){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(t){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit(\"error\",e),t()}),0))}_setupData(t){if(!t.channel)return this.__destroy(D(new Error(\"Data channel event is missing `channel` property\"),\"ERR_DATA_CHANNEL\"));this._channel=t.channel,this._channel.binaryType=\"arraybuffer\",\"number\"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=H),this.channelName=this._channel.label,this._channel.onmessage=t=>{this._onChannelMessage(t)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=t=>{const e=t.error instanceof Error?t.error:new Error(`Datachannel error: ${t.message} ${t.filename}:${t.lineno}:${t.colno}`);this.__destroy(D(e,\"ERR_DATA_CHANNEL\"))};let e=!1;this._closingInterval=setInterval((()=>{this._channel&&\"closing\"===this._channel.readyState?(e&&this._onChannelClose(),e=!0):e=!1}),5e3)}_write(t,e){if(this.destroyed)return e(D(new Error(\"cannot write after peer is destroyed\"),\"ERR_DATA_CHANNEL\"));if(this._connected){try{this.send(t)}catch(t){return this.__destroy(D(t,\"ERR_DATA_CHANNEL\"))}this._channel.bufferedAmount>H?(this._debug(\"start backpressure: bufferedAmount %d\",this._channel.bufferedAmount),this._cb=e):e(null)}else this._debug(\"write before connect\"),this._chunk=t,this._cb=e}_onFinish(){if(this.destroyed)return;const t=()=>{setTimeout((()=>this.__destroy()),1e3)};this._connected?t():this.once(\"connect\",t)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug(\"started iceComplete timeout\"),this._iceCompleteTimer=setTimeout((()=>{this._iceComplete||(this._iceComplete=!0,this._debug(\"iceComplete timeout completed\"),this.emit(\"iceTimeout\"),this.emit(\"_iceComplete\"))}),this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then((t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=z(t.sdp)),t.sdp=this.sdpTransform(t.sdp);const e=()=>{if(this.destroyed)return;const e=this._pc.localDescription||t;this._debug(\"signal\"),this.emit(\"signal\",{type:e.type,sdp:e.sdp})};this._pc.setLocalDescription(t).then((()=>{this._debug(\"createOffer success\"),this.destroyed||(this.trickle||this._iceComplete?e():this.once(\"_iceComplete\",e))})).catch((t=>{this.__destroy(D(t,\"ERR_SET_LOCAL_DESCRIPTION\"))}))})).catch((t=>{this.__destroy(D(t,\"ERR_CREATE_OFFER\"))}))}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then((t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=z(t.sdp)),t.sdp=this.sdpTransform(t.sdp);const e=()=>{if(this.destroyed)return;const e=this._pc.localDescription||t;this._debug(\"signal\"),this.emit(\"signal\",{type:e.type,sdp:e.sdp}),this.initiator||this._requestMissingTransceivers?.()};this._pc.setLocalDescription(t).then((()=>{this.destroyed||(this.trickle||this._iceComplete?e():this.once(\"_iceComplete\",e))})).catch((t=>{this.__destroy(D(t,\"ERR_SET_LOCAL_DESCRIPTION\"))}))})).catch((t=>{this.__destroy(D(t,\"ERR_CREATE_ANSWER\"))}))}_onConnectionStateChange(){this.destroyed||this._destroying||\"failed\"===this._pc.connectionState&&this.__destroy(D(new Error(\"Connection failed.\"),\"ERR_CONNECTION_FAILURE\"))}_onIceStateChange(){if(this.destroyed)return;const t=this._pc.iceConnectionState,e=this._pc.iceGatheringState;this._debug(\"iceStateChange (connection: %s) (gathering: %s)\",t,e),this.emit(\"iceStateChange\",t,e),\"connected\"!==t&&\"completed\"!==t||(this._pcReady=!0,this._maybeReady()),\"failed\"===t&&this.__destroy(D(new Error(\"Ice connection failed.\"),\"ERR_ICE_CONNECTION_FAILURE\")),\"closed\"===t&&this.__destroy(D(new Error(\"Ice connection closed.\"),\"ERR_ICE_CONNECTION_CLOSED\"))}getStats(t){const e=t=>(\"[object Array]\"===Object.prototype.toString.call(t.values)&&t.values.forEach((e=>{Object.assign(t,e)})),t);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then((r=>{const i=[];r.forEach((t=>{i.push(e(t))})),t(null,i)}),(e=>t(e))):this._pc.getStats.length>0?this._pc.getStats((r=>{if(this.destroyed)return;const i=[];r.result().forEach((t=>{const r={};t.names().forEach((e=>{r[e]=t.stat(e)})),r.id=t.id,r.type=t.type,r.timestamp=t.timestamp,i.push(e(r))})),t(null,i)}),(e=>t(e))):t(null,[])}_maybeReady(){if(this._debug(\"maybeReady pc %s channel %s\",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const t=()=>{this.destroyed||this._destroying||this.getStats(((e,r)=>{if(this.destroyed||this._destroying)return;e&&(r=[]);const i={},n={},s={};let o=!1;r.forEach((t=>{\"remotecandidate\"!==t.type&&\"remote-candidate\"!==t.type||(i[t.id]=t),\"localcandidate\"!==t.type&&\"local-candidate\"!==t.type||(n[t.id]=t),\"candidatepair\"!==t.type&&\"candidate-pair\"!==t.type||(s[t.id]=t)}));const a=t=>{o=!0;let e=n[t.localCandidateId];e&&(e.ip||e.address)?(this.localAddress=e.ip||e.address,this.localPort=Number(e.port)):e&&e.ipAddress?(this.localAddress=e.ipAddress,this.localPort=Number(e.portNumber)):\"string\"==typeof t.googLocalAddress&&(e=t.googLocalAddress.split(\":\"),this.localAddress=e[0],this.localPort=Number(e[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(\":\")?\"IPv6\":\"IPv4\");let r=i[t.remoteCandidateId];r&&(r.ip||r.address)?(this.remoteAddress=r.ip||r.address,this.remotePort=Number(r.port)):r&&r.ipAddress?(this.remoteAddress=r.ipAddress,this.remotePort=Number(r.portNumber)):\"string\"==typeof t.googRemoteAddress&&(r=t.googRemoteAddress.split(\":\"),this.remoteAddress=r[0],this.remotePort=Number(r[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(\":\")?\"IPv6\":\"IPv4\"),this._debug(\"connect local: %s:%s remote: %s:%s\",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(r.forEach((t=>{\"transport\"===t.type&&t.selectedCandidatePairId&&a(s[t.selectedCandidatePairId]),(\"googCandidatePair\"===t.type&&\"true\"===t.googActiveConnection||(\"candidatepair\"===t.type||\"candidate-pair\"===t.type)&&t.selected)&&a(t)})),o||Object.keys(s).length&&!Object.keys(n).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.__destroy(D(e,\"ERR_DATA_CHANNEL\"))}this._chunk=null,this._debug('sent chunk from \"write before connect\"');const t=this._cb;this._cb=null,t(null)}\"number\"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug(\"connect\"),this.emit(\"connect\")}else setTimeout(t,100)}))};t()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>H||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(\"stable\"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug(\"flushing sender queue\",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach((t=>{this._pc.removeTrack(t),this._queuedNegotiation=!0})),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug(\"flushing negotiation queue\"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug(\"negotiated\"),this.emit(\"negotiated\"))),this._debug(\"signalingStateChange %s\",this._pc.signalingState),this.emit(\"signalingStateChange\",this._pc.signalingState))}_onIceCandidate(t){this.destroyed||(t.candidate&&this.trickle?this.emit(\"signal\",{type:\"candidate\",candidate:{candidate:t.candidate.candidate,sdpMLineIndex:t.candidate.sdpMLineIndex,sdpMid:t.candidate.sdpMid}}):t.candidate||this._iceComplete||(this._iceComplete=!0,this.emit(\"_iceComplete\")),t.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(t){if(this.destroyed)return;let e=t.data;e instanceof ArrayBuffer?e=new Uint8Array(e):!1===this.__objectMode&&(e=(0,b.L0)(e)),this.push(e)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug(\"ending backpressure: bufferedAmount %d\",this._channel.bufferedAmount);const t=this._cb;this._cb=null,t(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug(\"on channel open\"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug(\"on channel close\"),this.__destroy())}_debug(){const t=[].slice.call(arguments);t[0]=\"[\"+this._id+\"] \"+t[0],F.apply(null,t)}}W.WEBRTC_SUPPORT=!!U(),W.config={iceServers:[{urls:[\"stun:stun.l.google.com:19302\",\"stun:global.stun.twilio.com:3478\"]}],sdpSemantics:\"unified-plan\"},W.channelConfig={};const K=W;var V=n(1035),$=n(7541),Z=n(5725),G=n(9334),J=n(1438),Y=n(9748),X=n(8585);const Q=/^\\[?([^\\]]+)]?:(\\d+)$/;let tt=new Map;function et(t){if(1e5===tt.size&&tt.clear(),!tt.has(t)){const e=Q.exec(t);if(!e)throw new Error(`invalid addr: ${t}`);tt.set(t,[e[1],Number(e[2])])}return tt.get(t)}var rt=n(3033),it=n(4497);var nt=n(4018),st=n(9971),ot=n(4988),at=n(7180),ht=n(8454),ut=n(3209),ft=n(5307),lt=n(1565),ct=n(8287).Buffer,dt=n(5606);const pt=A(\"bittorrent-dht\"),mt=3e5;class gt extends a.EventEmitter{constructor(t={}){super(),this._tables=new ht({maxAge:mt,max:t.maxTables||1e3}),this._values=new ht(t.maxValues||1e3),this._peers=ft({maxAge:t.maxAge||0,maxSize:t.maxPeers||1e4}),this._secrets=null,this._hash=t.hash||bt,this._hashLength=this._hash(ct.from(\"\")).length,this._rpc=t.krpc||ot(Object.assign({idLength:this._hashLength},t)),this._rpc.on(\"query\",(function(t,e){r._onquery(t,e)})),this._rpc.on(\"node\",(function(t){r.emit(\"node\",t)})),this._rpc.on(\"warning\",(function(t){r.emit(\"warning\",t)})),this._rpc.on(\"error\",(function(t){r.emit(\"error\",t)})),this._rpc.on(\"listening\",(function(){r.listening=!0,r._debug(\"listening %d\",r.address().port),r.updateBucketTimestamp(),r._setBucketCheckInterval(),r.emit(\"listening\")})),this._rotateSecrets(),this._verify=t.verify||null,this._host=t.host||null,this._interval=setInterval((function(){r._rotateSecrets()}),mt),this._runningBucketCheck=!1,this._bucketCheckTimeout=null,this._bucketOutdatedTimeSpan=t.timeBucketOutdated||9e5,this.listening=!1,this.destroyed=!1,this.nodeId=this._rpc.id,this.nodes=this._rpc.nodes;const e=at((function(t,e){const i=t.older,n=t.swap;r._debug(\"received ping\",i),r._checkNodes(i,!1,((t,i)=>{if(i)return r._debug(\"swaping dead node with newer\",i),n(i),e();r._debug(\"no node added, all other nodes ok\"),e()}))}));this._rpc.on(\"ping\",((t,r)=>{e({older:t,swap:r})})),dt.nextTick((function(){r.destroyed||r._bootstrap(!1!==t.bootstrap)})),this._debug(\"new DHT %s\",this.nodeId);const r=this}_setBucketCheckInterval(){const t=this;function e(){if(Date.now()-t._rpc.nodes.metadata.lastChange{t.destroyed||(t.nodes.toArray().length<1&&t._bootstrap(!0),r())}))}function r(){if(!t._runningBucketCheck||t.destroyed)return;const r=Math.floor(6e4*Math.random()+3e4);t._bucketCheckTimeout=setTimeout(e,r)}this._runningBucketCheck=!0,r()}_pingAll(t){this._checkAndRemoveNodes(this.nodes.toArray(),t)}removeBucketCheckInterval(){this._runningBucketCheck=!1,clearTimeout(this._bucketCheckTimeout)}updateBucketTimestamp(){this._rpc.nodes.metadata.lastChange=Date.now()}_checkAndRemoveNodes(t,e){const r=this;this._checkNodes(t,!0,((t,i)=>{i&&r.removeNode(i.id),e(null,i)}))}_checkNodes(t,e,r){const i=this;!function t(n){let s=null;for(;n.length&&(s=n.pop(),s.id&&!e)&&!(Date.now()-(s.seen||0)>1e4);)s=null;if(!s)return r(null);i._sendPing(s,(e=>{if(!e)return i.updateBucketTimestamp(),t(n);r(null,s)}))}(t)}addNode(t){const e=this;if(t.id){t.id=kt(t.id);const e=!!this._rpc.nodes.get(t.id);return this._rpc.nodes.add(t),void(e||(this.emit(\"node\",t),this.updateBucketTimestamp()))}this._sendPing(t,((t,r)=>{r&&e.addNode(r)}))}removeNode(t){this._rpc.nodes.remove(kt(t))}_sendPing(t,e){const r=this,i=t.id;this._rpc.query(t,{q:\"ping\"},((t,n,s)=>t?e(t):n.r&&n.r.id&&ct.isBuffer(n.r.id)&&n.r.id.length===r._hashLength?ct.isBuffer(i)&&!i.equals(n.r.id)?e(new Error(\"Unexpected node id\")):(r.updateBucketTimestamp(),void e(null,{id:n.r.id,host:s.host||s.address,port:s.port})):e(new Error(\"Bad reply\"))))}toJSON(){const t=this,e={};return Object.keys(this._values.cache).forEach((r=>{const i=t._values.cache[r].value;e[r]={v:i.v.toString(\"hex\"),id:i.id.toString(\"hex\")},null!=i.seq&&(e[r].seq=i.seq),null!=i.sig&&(e[r].sig=i.sig.toString(\"hex\")),null!=i.k&&(e[r].k=i.k.toString(\"hex\"))})),{nodes:this._rpc.nodes.toArray().map(Mt),values:e}}put(t,e){(ct.isBuffer(t)||\"string\"==typeof t)&&(t={v:t});const r=!!t.k;if(void 0===t.v)throw new Error(\"opts.v not given\");if(t.v.length>=1e3)throw new Error(\"v must be less than 1000 bytes in put()\");if(r&&void 0!==t.cas&&\"number\"!=typeof t.cas)throw new Error(\"opts.cas must be an integer if provided\");if(r&&32!==t.k.length)throw new Error(\"opts.k ed25519 public key must be 32 bytes\");if(r&&\"function\"!=typeof t.sign&&!ct.isBuffer(t.sig))throw new Error(\"opts.sign function or options.sig signature is required for mutable put\");if(r&&t.salt&&t.salt.length>64)throw new Error(\"opts.salt is > 64 bytes long\");if(r&&void 0===t.seq)throw new Error(\"opts.seq not provided for a mutable update\");if(r&&\"number\"!=typeof t.seq)throw new Error(\"opts.seq not an integer\");return this._put(t,e)}_put(t,e){e||(e=yt);const r=!!t.k,i=\"string\"==typeof t.v?ct.from(t.v):t.v,n=r?this._hash(t.salt?ct.concat([t.k,t.salt]):t.k):this._hash(f.A.encode(i)),s=this._tables.get(n.toString(\"hex\"));if(!s)return this._preput(n,t,e);const o={q:\"put\",a:{id:this._rpc.id,token:null,v:i}};return r?(\"number\"==typeof t.cas&&(o.a.cas=t.cas),t.salt&&(o.a.salt=t.salt),o.a.k=t.k,o.a.seq=t.seq,\"function\"==typeof t.sign?o.a.sig=t.sign(_t(o.a)):ct.isBuffer(t.sig)&&(o.a.sig=t.sig)):this._values.set(n.toString(\"hex\"),o.a),this._rpc.queryAll(s.closest(n),o,null,((t,r)=>{if(t)return e(t,n,r);e(null,n,r)})),n}_preput(t,e,r){const i=this;return this._closest(t,{q:\"get\",a:{id:this._rpc.id,target:t}},null,((t,n)=>{if(t)return r(t);i.put(e,r)})),t}get(t,e,r){t=kt(t),\"function\"==typeof e&&(r=e,e=null),e||(e={});const i=e.verify||this._verify,n=this._hash;let s=this._values.get(t.toString(\"hex\"))||null;if(s&&!1!==e.cache)return s=vt(this._rpc.id,null,s),dt.nextTick(o);function o(t){if(t)return r(t);r(null,s)}this._closest(t,{q:\"get\",a:{id:this._rpc.id,target:t}},(function(r){const o=r.r;if(!o||!o.v)return!0;const a=o.k||o.sig;if(e.salt&&(o.salt=ct.from(e.salt)),a){if(!i||!o.sig||!o.k)return!0;if(!i(o.sig,_t(o),o.k))return!0;n(o.salt?ct.concat([o.k,o.salt]):o.k).equals(t)&&(!s||o.seq>s.seq)&&(s=o)}else if(n(f.A.encode(o.v)).equals(t))return s=o,!1;return!0}),o)}announce(t,e,r){if(\"function\"==typeof e)return this.announce(t,0,e);t=kt(t),r||(r=yt);const i=this._tables.get(t.toString(\"hex\"));if(!i)return this._preannounce(t,e,r);if(this._host){const r=this.listening?this.address().port:0;this._addPeer({host:this._host,port:e||r},t,{host:this._host,port:r})}const n={q:\"announce_peer\",a:{id:this._rpc.id,token:null,info_hash:t,port:e,implied_port:e?0:1}};this._debug(\"announce %s %d\",t,e),this._rpc.queryAll(i.closest(t),n,null,r)}_preannounce(t,e,r){const i=this;this.lookup(t,(n=>i.destroyed?r(new Error(\"dht is destroyed\")):n?r(n):void i.announce(t,e,r)))}lookup(t,e){t=kt(t),e||(e=yt);const r=this;let i=!1;function n(e,i){e||(e=r._peers.get(t.toString(\"hex\"),100));const n=function(t){const e=[];try{for(let r=0;r{e.emit(\"close\"),t&&t()}))}_onquery(t,e){if(void 0===t.q||null===t.q)return;const r=t.q.toString();if(this._debug(\"received %s query from %s:%d\",r,e.address,e.port),t.a)switch(r){case\"ping\":return this._rpc.response(e,t,{id:this._rpc.id});case\"find_node\":return this._onfindnode(t,e);case\"get_peers\":return this._ongetpeers(t,e);case\"announce_peer\":return this._onannouncepeer(t,e);case\"get\":return this._onget(t,e);case\"put\":return this._onput(t,e)}}_onfindnode(t,e){const r=t.a.target;if(!r)return this._rpc.error(e,t,[203,\"`find_node` missing required `a.target` field\"]);this.emit(\"find_node\",r);const i=this._rpc.nodes.closest(r);this._rpc.response(e,t,{id:this._rpc.id},i)}_ongetpeers(t,e){const r=e.address||e.host,i=t.a.info_hash;if(!i)return this._rpc.error(e,t,[203,\"`get_peers` missing required `a.info_hash` field\"]);this.emit(\"get_peers\",i);const n={id:this._rpc.id,token:this._generateToken(r)},s=this._peers.get(i.toString(\"hex\"));s.length?(n.values=s,this._rpc.response(e,t,n)):this._rpc.response(e,t,n,this._rpc.nodes.closest(i))}_onannouncepeer(t,e){const r=e.address||e.host,i=t.a.implied_port?e.port:t.a.port;if(!i||\"number\"!=typeof i||i<=0||i>65535)return;const n=t.a.info_hash,s=t.a.token;if(n&&s){if(!this._validateToken(r,s))return this._rpc.error(e,t,[203,\"cannot `announce_peer` with bad token\"]);this.emit(\"announce_peer\",n,{host:r,port:e.port}),this._addPeer({host:r,port:i},n,{host:r,port:e.port}),this._rpc.response(e,t,{id:this._rpc.id})}}_addPeer(t,e,r){this._peers.add(e.toString(\"hex\"),function(t,e){const r=ct.allocUnsafe(6),i=t.split(\".\");for(let t=0;t<4;t++)r[t]=parseInt(i[t]||0,10);return r.writeUInt16BE(e,4),r}(t.host,t.port)),this.emit(\"announce\",t,e,r)}_onget(t,e){const r=e.address||e.host,i=t.a.target;if(!i)return;const n=this._generateToken(r),s=this._values.get(i.toString(\"hex\"));if(this.emit(\"get\",i,s),s)this._rpc.response(e,t,vt(this._rpc.id,n,s));else{const r=this._rpc.nodes.closest(i);this._rpc.response(e,t,{id:this._rpc.id,token:n},r)}}_onput(t,e){const r=e.address||e.host,i=t.a;if(!i)return;const n=t.a.v;if(!n)return;const s=t.a.id;if(!s)return;const o=i.token;if(!o)return;if(!this._validateToken(r,o))return this._rpc.error(e,t,[203,\"cannot `put` with bad token\"]);if(n.length>1e3)return this._rpc.error(e,t,[205,\"data payload too large\"]);const a=!(!i.k&&!i.sig);if(a&&!i.k&&!i.sig)return;const h=a?this._hash(i.salt?ct.concat([i.k,i.salt]):i.k):this._hash(f.A.encode(n)),u=h.toString(\"hex\");if(this.emit(\"put\",h,n),a){if(!this._verify)return this._rpc.error(e,t,[400,\"verification not supported\"]);if(!this._verify(i.sig,_t(i),i.k))return;const r=this._values.get(u);if(r&&\"number\"==typeof i.cas&&r.seq!==i.cas)return this._rpc.error(e,t,[301,\"CAS mismatch, re-read and try again\"]);if(r&&\"number\"==typeof r.seq&&!(i.seq>r.seq))return this._rpc.error(e,t,[302,\"sequence number less than current\"]);this._values.set(u,{v:n,k:i.k,salt:i.salt,sig:i.sig,seq:i.seq,id:s})}else this._values.set(u,{v:n,id:s});this._rpc.response(e,t,{id:this._rpc.id})}_bootstrap(t){const e=this;if(!t)return dt.nextTick(r);function r(){e.ready||(e._debug(\"emit ready\"),e.ready=!0,e.emit(\"ready\"))}this._rpc.populate(e._rpc.id,{q:\"find_node\",a:{id:e._rpc.id,target:e._rpc.id}},r)}_closest(t,e,r,i){const n=this,s=new st({localNodeId:t,numberOfNodesPerKBucket:this._rpc.k});this._rpc.closest(t,e,(function(e,i){return!e.r||(e.r.token&&e.r.id&&ct.isBuffer(e.r.id)&&e.r.id.length===n._hashLength&&(n._debug(\"found node %s (target: %s)\",e.r.id,t),s.add({id:e.r.id,host:i.host||i.address,port:i.port,token:e.r.token})),!r||r(e,i))}),(function(e,r){if(e)return i(e);n._tables.set(t.toString(\"hex\"),s),n._debug(\"visited %d nodes\",r),i(null,r)}))}_debug(){if(!pt.enabled)return;const t=[].slice.call(arguments);t[0]=`[${this.nodeId.toString(\"hex\").substring(0,7)}] ${t[0]}`;for(let e=1;e{const e=new URL(t.replace(/^udp:/,\"http:\"));return t.match(/^udp:/)&&Object.defineProperties(e,{href:{value:e.href.replace(/^http/,\"udp\")},protocol:{value:e.protocol.replace(/^http/,\"udp\")},origin:{value:e.origin.replace(/^http/,\"udp\")}}),e},...n.t(At,2)};var It=n(826),Bt=n(61),Tt=n(2701);const Pt=A(\"simple-websocket\"),Rt=\"function\"!=typeof Tt?WebSocket:Tt;class Ct extends q.Duplex{constructor(t={}){if(\"string\"==typeof t&&(t={url:t}),super(t=Object.assign({allowHalfOpen:!1},t)),this.__objectMode=!!t.objectMode,null!=t.objectMode&&delete t.objectMode,null==t.url&&null==t.socket)throw new Error(\"Missing required `url` or `socket` option\");if(null!=t.url&&null!=t.socket)throw new Error(\"Must specify either `url` or `socket` option, not both\");if(this._id=(0,b.V5)((0,b.po)(4)).slice(0,7),this._debug(\"new websocket: %o\",t),this.connected=!1,this._chunk=null,this._cb=null,this._interval=null,t.socket)this.url=t.socket.url,this._ws=t.socket,this.connected=t.socket.readyState===Rt.OPEN;else{this.url=t.url;try{this._ws=\"function\"==typeof Tt?new Rt(t.url,{...t,encoding:void 0}):new Rt(t.url)}catch(t){return void y((()=>this.destroy(t)))}}this._ws.binaryType=\"arraybuffer\",t.socket&&this.connected?y((()=>this._handleOpen())):this._ws.onopen=()=>this._handleOpen(),this._ws.onmessage=t=>this._handleMessage(t),this._ws.onclose=()=>this._handleClose(),this._ws.onerror=t=>this._handleError(t),this._handleFinishBound=()=>this._handleFinish(),this.once(\"finish\",this._handleFinishBound)}send(t){this._ws.send(t)}_final(t){this._readableState.ended||this.push(null),t(null)}_destroy(t){if(!this.destroyed){if(this._writableState.ended||this.end(),this.connected=!1,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._handleFinishBound&&this.removeListener(\"finish\",this._handleFinishBound),this._handleFinishBound=null,this._ws){const t=this._ws,e=()=>{t.onclose=null};if(t.readyState===Rt.CLOSED)e();else try{t.onclose=e,t.close()}catch(t){e()}t.onopen=null,t.onmessage=null,t.onerror=()=>{}}this._ws=null,t()}}_write(t,e){if(this.destroyed)return e(new Error(\"cannot write after socket is destroyed\"));if(this.connected){try{this.send(t)}catch(t){return this.destroy(t)}\"function\"!=typeof Tt&&this._ws.bufferedAmount>65536?(this._debug(\"start backpressure: bufferedAmount %d\",this._ws.bufferedAmount),this._cb=e):e(null)}else this._debug(\"write before connect\"),this._chunk=t,this._cb=e}_handleOpen(){if(!this.connected&&!this.destroyed){if(this.connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.destroy(t)}this._chunk=null,this._debug('sent chunk from \"write before connect\"');const t=this._cb;this._cb=null,t(null)}\"function\"!=typeof Tt&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug(\"connect\"),this.emit(\"connect\")}}_handleMessage(t){if(this.destroyed)return;let e=t.data;e instanceof ArrayBuffer&&(e=new Uint8Array(e)),!1===this.__objectMode&&(e=(0,b.L0)(e)),this.push(e)}_handleClose(){this.destroyed||(this._debug(\"on close\"),this.destroy())}_handleError(t){this.destroy(new Error(`Error connecting to ${this.url}`))}_handleFinish(){if(this.destroyed)return;const t=()=>{setTimeout((()=>this.destroy()),1e3)};this.connected?t():this.once(\"connect\",t)}_onInterval(){if(!this._cb||!this._ws||this._ws.bufferedAmount>65536)return;this._debug(\"ending backpressure: bufferedAmount %d\",this._ws.bufferedAmount);const t=this._cb;this._cb=null,t(null)}_debug(){const t=[].slice.call(arguments);t[0]=\"[\"+this._id+\"] \"+t[0],Pt.apply(null,t)}}Ct.WEBSOCKET_SUPPORT=!!Rt;const Lt=class extends a{constructor(t,e){super(),this.client=t,this.announceUrl=e,this.interval=null,this.destroyed=!1}setInterval(t){null==t&&(t=this.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(this.interval),t&&(this.interval=setInterval((()=>{this.announce(this.client._defaultAnnounceOpts())}),t),this.interval.unref&&this.interval.unref())}},Ot=A(\"bittorrent-tracker:websocket-tracker\"),jt={};class Nt extends Lt{constructor(t,e){super(t,e),Ot(\"new websocket tracker %s\",e),this.peers={},this.socket=null,this.reconnecting=!1,this.retries=0,this.reconnectTimer=null,this.expectingResponse=!1,this._openSocket()}announce(t){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once(\"connect\",(()=>{this.announce(t)}));const e=Object.assign({},t,{action:\"announce\",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(e.trackerid=this._trackerId),\"stopped\"===t.event||\"completed\"===t.event)this._send(e);else{const r=Math.min(t.numwant,5);this._generateOffers(r,(t=>{e.numwant=r,e.offers=t,this._send(e)}))}}scrape(t){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once(\"connect\",(()=>{this.scrape(t)}));const e={action:\"scrape\",info_hash:Array.isArray(t.infoHash)&&t.infoHash.length>0?t.infoHash.map((t=>(0,b.Ht)(t))):t.infoHash&&(0,b.Ht)(t.infoHash)||this.client._infoHashBinary};this._send(e)}destroy(t=Ut){if(this.destroyed)return t(null);this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer);for(const t in this.peers){const e=this.peers[t];clearTimeout(e.trackerTimeout),e.destroy()}if(this.peers=null,this.socket&&(this.socket.removeListener(\"connect\",this._onSocketConnectBound),this.socket.removeListener(\"data\",this._onSocketDataBound),this.socket.removeListener(\"close\",this._onSocketCloseBound),this.socket.removeListener(\"error\",this._onSocketErrorBound),this.socket=null),this._onSocketConnectBound=null,this._onSocketErrorBound=null,this._onSocketDataBound=null,this._onSocketCloseBound=null,jt[this.announceUrl]&&(jt[this.announceUrl].consumers-=1),jt[this.announceUrl].consumers>0)return t();let e,r=jt[this.announceUrl];if(delete jt[this.announceUrl],r.on(\"error\",Ut),r.once(\"close\",t),!this.expectingResponse)return i();function i(){e&&(clearTimeout(e),e=null),r.removeListener(\"data\",i),r.destroy(),r=null}e=setTimeout(i,Et.DESTROY_TIMEOUT),r.once(\"data\",i)}_openSocket(){if(this.destroyed=!1,this.peers||(this.peers={}),this._onSocketConnectBound=()=>{this._onSocketConnect()},this._onSocketErrorBound=t=>{this._onSocketError(t)},this._onSocketDataBound=t=>{this._onSocketData(t)},this._onSocketCloseBound=()=>{this._onSocketClose()},this.socket=jt[this.announceUrl],this.socket)jt[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound();else{const t=new URL(this.announceUrl);let e;this.client._proxyOpts&&(e=\"wss:\"===t.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!e&&this.client._proxyOpts.socksProxy&&(e=this.client._proxyOpts.socksProxy)),this.socket=jt[this.announceUrl]=new Ct({url:this.announceUrl,agent:e}),this.socket.consumers=1,this.socket.once(\"connect\",this._onSocketConnectBound)}this.socket.on(\"data\",this._onSocketDataBound),this.socket.once(\"close\",this._onSocketCloseBound),this.socket.once(\"error\",this._onSocketErrorBound)}_onSocketConnect(){this.destroyed||this.reconnecting&&(this.reconnecting=!1,this.retries=0,this.announce(this.client._defaultAnnounceOpts()))}_onSocketData(t){if(!this.destroyed){this.expectingResponse=!1;try{t=JSON.parse((0,b.dU)(t))}catch(t){return void this.client.emit(\"warning\",new Error(\"Invalid tracker response\"))}\"announce\"===t.action?this._onAnnounceResponse(t):\"scrape\"===t.action?this._onScrapeResponse(t):this._onSocketError(new Error(`invalid action in WS response: ${t.action}`))}}_onAnnounceResponse(t){if(t.info_hash!==this.client._infoHashBinary)return void Ot(\"ignoring websocket data from %s for %s (looking for %s: reused socket)\",this.announceUrl,(0,b.HB)(t.info_hash),this.client.infoHash);if(t.peer_id&&t.peer_id===this.client._peerIdBinary)return;Ot(\"received %s from %s for %s\",JSON.stringify(t),this.announceUrl,this.client.infoHash);const e=t[\"failure reason\"];if(e)return this.client.emit(\"warning\",new Error(e));const r=t[\"warning message\"];r&&this.client.emit(\"warning\",new Error(r));const i=t.interval||t[\"min interval\"];i&&this.setInterval(1e3*i);const n=t[\"tracker id\"];if(n&&(this._trackerId=n),null!=t.complete){const e=Object.assign({},t,{announce:this.announceUrl,infoHash:(0,b.HB)(t.info_hash)});this.client.emit(\"update\",e)}let s;if(t.offer&&t.peer_id&&(Ot(\"creating peer (from remote offer)\"),s=this._createPeer(),s.id=(0,b.HB)(t.peer_id),s.once(\"signal\",(e=>{const r={action:\"announce\",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,to_peer_id:t.peer_id,answer:e,offer_id:t.offer_id};this._trackerId&&(r.trackerid=this._trackerId),this._send(r)})),this.client.emit(\"peer\",s),s.signal(t.offer)),t.answer&&t.peer_id){const e=(0,b.HB)(t.offer_id);s=this.peers[e],s?(s.id=(0,b.HB)(t.peer_id),this.client.emit(\"peer\",s),s.signal(t.answer),clearTimeout(s.trackerTimeout),s.trackerTimeout=null,delete this.peers[e]):Ot(`got unexpected answer: ${JSON.stringify(t.answer)}`)}}_onScrapeResponse(t){t=t.files||{};const e=Object.keys(t);0!==e.length?e.forEach((e=>{const r=Object.assign(t[e],{announce:this.announceUrl,infoHash:(0,b.HB)(e)});this.client.emit(\"scrape\",r)})):this.client.emit(\"warning\",new Error(\"invalid scrape response\"))}_onSocketClose(){this.destroyed||(this.destroy(),this._startReconnectTimer())}_onSocketError(t){this.destroyed||(this.destroy(),this.client.emit(\"warning\",t),this._startReconnectTimer())}_startReconnectTimer(){const t=Math.floor(3e5*Math.random())+Math.min(1e4*Math.pow(2,this.retries),36e5);this.reconnecting=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout((()=>{this.retries++,this._openSocket()}),t),this.reconnectTimer.unref&&this.reconnectTimer.unref(),Ot(\"reconnecting socket in %s ms\",t)}_send(t){if(this.destroyed)return;this.expectingResponse=!0;const e=JSON.stringify(t);Ot(\"send %s\",e),this.socket.send(e)}_generateOffers(t,e){const r=this,i=[];Ot(\"generating %s offers\",t);for(let e=0;e{i.push({offer:e,offer_id:(0,b.Ht)(t)}),s()})),e.trackerTimeout=setTimeout((()=>{Ot(\"tracker timeout: destroying peer\"),e.trackerTimeout=null,delete r.peers[t],e.destroy()}),5e4),e.trackerTimeout.unref&&e.trackerTimeout.unref()}function s(){i.length===t&&(Ot(\"generated %s offers\",t),e(i))}s()}_createPeer(t){const e=this;t=Object.assign({trickle:!1,config:e.client._rtcConfig,wrtc:e.client._wrtc},t);const r=new K(t);return r.once(\"error\",i),r.once(\"connect\",(function t(){r.removeListener(\"error\",i),r.removeListener(\"connect\",t)})),r;function i(t){e.client.emit(\"warning\",new Error(`Connection error: ${t.message}`)),r.destroy()}}}function Ut(){}Nt.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,Nt._socketPool=jt;const qt=Nt;var Dt=n(5606);const Ft=A(\"bittorrent-tracker:client\");class Ht extends a{constructor(t={}){if(super(),!t.peerId)throw new Error(\"Option `peerId` is required\");if(!t.infoHash)throw new Error(\"Option `infoHash` is required\");if(!t.announce)throw new Error(\"Option `announce` is required\");if(!Dt.browser&&!t.port)throw new Error(\"Option `port` is required\");this.peerId=\"string\"==typeof t.peerId?t.peerId:(0,b.V5)(t.peerId),this._peerIdBuffer=(0,b.fk)(this.peerId),this._peerIdBinary=(0,b.Ht)(this.peerId),this.infoHash=\"string\"==typeof t.infoHash?t.infoHash.toLowerCase():(0,b.V5)(t.infoHash),this._infoHashBuffer=(0,b.fk)(this.infoHash),this._infoHashBinary=(0,b.Ht)(this.infoHash),Ft(\"new client %s\",this.infoHash),this.destroyed=!1,this._port=t.port,this._getAnnounceOpts=t.getAnnounceOpts,this._rtcConfig=t.rtcConfig,this._userAgent=t.userAgent,this._proxyOpts=t.proxyOpts,this._wrtc=\"function\"==typeof t.wrtc?t.wrtc():t.wrtc;let e=\"string\"==typeof t.announce?[t.announce]:null==t.announce?[]:t.announce;e=e.map((t=>(ArrayBuffer.isView(t)&&(t=(0,b.dU)(t)),\"/\"===t[t.length-1]&&(t=t.substring(0,t.length-1)),t))),e=Array.from(new Set(e));const r=!1!==this._wrtc&&(!!this._wrtc||K.WEBRTC_SUPPORT),i=t=>{y((()=>{this.emit(\"warning\",t)}))};this._trackers=e.map((t=>{let e;try{e=Et.parseUrl(t)}catch(e){return i(new Error(`Invalid tracker URL: ${t}`)),null}const n=e.port;if(n<0||n>65535)return i(new Error(`Invalid tracker port: ${t}`)),null;const s=e.protocol;return\"http:\"!==s&&\"https:\"!==s||\"function\"!=typeof It?\"udp:\"===s&&\"function\"==typeof Bt?new Bt(this,t):\"ws:\"!==s&&\"wss:\"!==s||!r||\"ws:\"===s&&\"undefined\"!=typeof window&&\"https:\"===window.location.protocol?(i(new Error(`Unsupported tracker protocol: ${t}`)),null):new qt(this,t):new It(this,t)})).filter(Boolean)}start(t){(t=this._defaultAnnounceOpts(t)).event=\"started\",Ft(\"send `start` %o\",t),this._announce(t),this._trackers.forEach((t=>{t.setInterval()}))}stop(t){(t=this._defaultAnnounceOpts(t)).event=\"stopped\",Ft(\"send `stop` %o\",t),this._announce(t)}complete(t){t||(t={}),(t=this._defaultAnnounceOpts(t)).event=\"completed\",Ft(\"send `complete` %o\",t),this._announce(t)}update(t){(t=this._defaultAnnounceOpts(t)).event&&delete t.event,Ft(\"send `update` %o\",t),this._announce(t)}_announce(t){this._trackers.forEach((e=>{e.announce(t)}))}scrape(t){Ft(\"send `scrape`\"),t||(t={}),this._trackers.forEach((e=>{e.scrape(t)}))}setInterval(t){Ft(\"setInterval %d\",t),this._trackers.forEach((e=>{e.setInterval(t)}))}destroy(t){if(this.destroyed)return;this.destroyed=!0,Ft(\"destroy\");const e=this._trackers.map((t=>e=>{t.destroy(e)}));g(e,t),this._trackers=[],this._getAnnounceOpts=null}_defaultAnnounceOpts(t={}){return null==t.numwant&&(t.numwant=Et.DEFAULT_ANNOUNCE_PEERS),null==t.uploaded&&(t.uploaded=0),null==t.downloaded&&(t.downloaded=0),this._getAnnounceOpts&&(t=Object.assign({},t,this._getAnnounceOpts())),t}}Ht.scrape=(t,e)=>{if(e=xt(e),!t.infoHash)throw new Error(\"Option `infoHash` is required\");if(!t.announce)throw new Error(\"Option `announce` is required\");const r=Object.assign({},t,{infoHash:Array.isArray(t.infoHash)?t.infoHash[0]:t.infoHash,peerId:(0,b.L0)(\"01234567890123456789\"),port:6881}),i=new Ht(r);i.once(\"error\",e),i.once(\"warning\",e);let n=Array.isArray(t.infoHash)?t.infoHash.length:1;const s={};return i.on(\"scrape\",(t=>{if(n-=1,s[t.infoHash]=t,0===n){i.destroy();const t=Object.keys(s);1===t.length?e(null,s[t[0]]):e(null,s)}})),i.scrape({infoHash:t.infoHash}),i};const zt=Ht;n(7936);var Wt=n(2799),Kt=n(5606);const Vt=A(\"torrent-discovery\");class $t extends a.EventEmitter{constructor(t){if(super(),!t.peerId)throw new Error(\"Option `peerId` is required\");if(!t.infoHash)throw new Error(\"Option `infoHash` is required\");if(!Kt.browser&&!t.port)throw new Error(\"Option `port` is required\");this.peerId=\"string\"==typeof t.peerId?t.peerId:t.peerId.toString(\"hex\"),this.infoHash=\"string\"==typeof t.infoHash?t.infoHash.toLowerCase():t.infoHash.toString(\"hex\"),this._port=t.port,this._userAgent=t.userAgent,this.destroyed=!1,this._announce=t.announce||[],this._intervalMs=t.intervalMs||9e5,this._trackerOpts=null,this._dhtAnnouncing=!1,this._dhtTimeout=!1,this._internalDHT=!1,this._onWarning=t=>{this.emit(\"warning\",t)},this._onError=t=>{this.emit(\"error\",t)},this._onDHTPeer=(t,e)=>{e.toString(\"hex\")===this.infoHash&&this.emit(\"peer\",`${t.host}:${t.port}`,\"dht\")},this._onTrackerPeer=t=>{this.emit(\"peer\",t,\"tracker\")},this._onTrackerAnnounce=()=>{this.emit(\"trackerAnnounce\")},this._onLSDPeer=(t,e)=>{this.emit(\"peer\",t,\"lsd\")};const e=(t,e)=>{const r=new St(e);return r.on(\"warning\",this._onWarning),r.on(\"error\",this._onError),r.listen(t),this._internalDHT=!0,r};!1===t.tracker?this.tracker=null:t.tracker&&\"object\"==typeof t.tracker?(this._trackerOpts=Object.assign({},t.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),!1===t.dht||\"function\"!=typeof St?this.dht=null:t.dht&&\"function\"==typeof t.dht.addNode?this.dht=t.dht:t.dht&&\"object\"==typeof t.dht?this.dht=e(t.dhtPort,t.dht):this.dht=e(t.dhtPort),this.dht&&(this.dht.on(\"peer\",this._onDHTPeer),this._dhtAnnounce()),!1===t.lsd||\"function\"!=typeof Wt?this.lsd=null:this.lsd=this._createLSD()}updatePort(t){t!==this._port&&(this._port=t,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy((()=>{this.tracker=this._createTracker()}))))}complete(t){this.tracker&&this.tracker.complete(t)}destroy(t){if(this.destroyed)return;this.destroyed=!0,clearTimeout(this._dhtTimeout);const e=[];this.tracker&&(this.tracker.stop(),this.tracker.removeListener(\"warning\",this._onWarning),this.tracker.removeListener(\"error\",this._onError),this.tracker.removeListener(\"peer\",this._onTrackerPeer),this.tracker.removeListener(\"update\",this._onTrackerAnnounce),e.push((t=>{this.tracker.destroy(t)}))),this.dht&&this.dht.removeListener(\"peer\",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener(\"warning\",this._onWarning),this.dht.removeListener(\"error\",this._onError),e.push((t=>{this.dht.destroy(t)}))),this.lsd&&(this.lsd.removeListener(\"warning\",this._onWarning),this.lsd.removeListener(\"error\",this._onError),this.lsd.removeListener(\"peer\",this._onLSDPeer),e.push((t=>{this.lsd.destroy(t)}))),g(e,t),this.dht=null,this.tracker=null,this.lsd=null,this._announce=null}_createTracker(){const t=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),e=new zt(t);return e.on(\"warning\",this._onWarning),e.on(\"error\",this._onError),e.on(\"peer\",this._onTrackerPeer),e.on(\"update\",this._onTrackerAnnounce),e.setInterval(this._intervalMs),e.start(),e}_dhtAnnounce(){this._dhtAnnouncing||(Vt(\"dht announce\"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,(t=>{this._dhtAnnouncing=!1,Vt(\"dht announce complete\"),t&&this.emit(\"warning\",t),this.emit(\"dhtAnnounce\"),this.destroyed||(this._dhtTimeout=setTimeout((()=>{this._dhtAnnounce()}),this._intervalMs+Math.floor(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())})))}_createLSD(){const t=Object.assign({},{infoHash:this.infoHash,peerId:this.peerId,port:this._port}),e=new Wt(t);return e.on(\"warning\",this._onWarning),e.on(\"error\",this._onError),e.on(\"peer\",this._onLSDPeer),e.start(),e}}const Zt=$t,Gt=/[<>:\"/\\\\|?*\\u0000-\\u001F]/g;\"undefined\"!=typeof navigator&&navigator.storage?.getDirectory&&navigator.storage.getDirectory().then((t=>{t.removeEntry(\"chunks\",{recursive:!0})}));const Jt=()=>{};class Yt{constructor(t,e={}){if(this.chunkLength=Number(t),!this.chunkLength)throw new Error(\"First argument must be a chunk length\");if(\"undefined\"==typeof navigator||!navigator.storage?.getDirectory)throw new Error(\"FSA API is not supported\");if(this.closed=!1,this.name=e.name||crypto.randomUUID(),this.chunks=[],this.rootDirPromise=e.rootDir||navigator.storage.getDirectory(),this.storageDirPromise=(async()=>(await this.rootDirPromise).getDirectoryHandle(this.name,{create:!0}))(),this.chunksDirPromise=this.storageDirPromise,e.files&&e.rootDir){if(this.chunkMap=[],this.directoryMap={},this.chunksDirPromise=this._getChunksDirHandle(),this.files=e.files.map(((t,e,r)=>{if(null==t.path)throw new Error(\"File is missing `path` property\");if(null==t.length)throw new Error(\"File is missing `length` property\");if(null==t.offset)if(0===e)t.offset=0;else{const i=r[e-1];t.offset=i.offset+i.length}null==t.handle&&(t.handle=this._createFileHandle({path:t.path})),t.blob=this._createBlobReference(t.handle);const i=t.offset,n=t.offset+t.length,s=Math.floor(i/this.chunkLength),o=Math.floor((n-1)/this.chunkLength);for(let e=s;e<=o;++e){const r=e*this.chunkLength,s=ir+this.chunkLength?this.chunkLength:n-r,a=i>r?0:r-i;this.chunkMap[e]||(this.chunkMap[e]=[]),this.chunkMap[e].push({from:s,to:o,offset:a,file:t})}return t})),window.addEventListener(\"pagehide\",(()=>this.cleanup())),this.length=this.files.reduce(((t,e)=>t+e.length),0),null!=e.length&&e.length!==this.length)throw new Error(\"total `files` length is not equal to explicit `length` option\")}else this.length=Number(e.length)||1/0;this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=Math.ceil(this.length/this.chunkLength)-1)}async _getChunkHandle(t){let e=this.chunks[t];if(!e){const r=await this.chunksDirPromise;this.chunks[t]=e=await r.getFileHandle(t,{create:!0})}return e}async _createFileHandle(t){const e=t.path.slice(t.path.lastIndexOf(\"/\")+1);return(await this._getDirectoryHandle(t)).getFileHandle(e.replace(Gt,\"\"),{create:!0})}async _createBlobReference(t){return(await t).getFile()}async _getDirectoryHandle(t){const e=t.path.lastIndexOf(\"/\");if(-1===e||0===e)return this.storageDirPromise;const r=t.path=t.path.slice(0,e);return this.directoryMap[r]||(this.directoryMap[r]=(async()=>(await this._getDirectoryHandle(t)).getDirectoryHandle(r.slice(r.lastIndexOf(\"/\")+1),{create:!0}))()),this.directoryMap[r]}async _getChunksDirHandle(){const t=await navigator.storage.getDirectory();return(await t.getDirectoryHandle(\"chunks\",{create:!0})).getDirectoryHandle(this.name,{create:!0})}async put(t,e,r=Jt){try{return await this._put(t,e),r(null),null}catch(t){return queueMicrotask((()=>r(t))),t}}async _put(t,e){if(this.closed)throw new Error(\"Storage is closed\");const r=t===this.lastChunkIndex;if(r&&e.length!==this.lastChunkLength)throw new Error(`Last chunk length must be ${this.lastChunkLength}`);if(!r&&e.length!==this.chunkLength)throw new Error(`Chunk length must be ${this.chunkLength}`);const i=(async()=>{const r=await this._getChunkHandle(t),i=await r.createWritable({keepExistingData:!1});await i.write(e),await i.close()})();if(!this.files)return i;const n=this.chunkMap[t];if(!n)throw new Error(\"No files matching the request range\");const s=n.map((async({file:t,offset:r,from:i,to:n})=>{t.stream||(t.stream=await(await t.handle).createWritable({keepExistingData:!0})),await t.stream.write({type:\"write\",position:r,data:e.slice(i,n)})}));s.push(i),await Promise.all(s)}async get(t,e,r=Jt){null==e&&(e={});try{const i=await this._get(t,e);return r(null,i),i}catch(t){return r(t),t}}async _get(t,e){if(\"function\"==typeof e)return this.get(t,void 0,e);if(this.closed)throw new Error(\"Storage is closed\");const r=t===this.lastChunkIndex?this.lastChunkLength:this.chunkLength,i=e.offset||0,n=e.length?i+e.length:r,s=e.length||r-i;if(i<0||i<0||n>r)throw new Error(\"Invalid offset and/or length\");if(i===n)return new Uint8Array(0);if(!this.files||this.chunks[t]){const e=await this._getChunkHandle(t);let n=await e.getFile();0===i&&s===r||(n=n.slice(i,s+i));const o=await n.arrayBuffer();if(0===o.byteLength)throw new Error(`Index ${t} does not exist`);return new Uint8Array(o)}let o=this.chunkMap[t];if(!o)throw new Error(\"No files matching the request range\");if(e&&(o=o.filter((({from:t,to:e})=>e>i&&t(e&&(r>n&&(r=n),tqueueMicrotask((()=>t(new Error(e)))))(t,\"Storage is closed\");this.closed=!0,this.chunkMap=null,this.directoryMap=null,this.files&&await this.cleanup(),queueMicrotask((()=>t(null)))}async cleanup(){const t=[];for(const e of this.files)e.stream&&(t.push(e.stream.close()),e.stream=null);const e=(async()=>{const t=await this.chunksDirPromise;this.chunks=[];for await(const e of t.keys())await t.removeEntry(e,{recursive:!0});this.chunksDirPromise=await this._getChunksDirHandle()})();await Promise.all(t);for(const t of this.files)t.blob=this._createBlobReference(t.handle);await e}async destroy(t=Jt){this.close((async e=>{if(e)t(e);else{try{const t=await this.rootDirPromise;await t.removeEntry(this.name,{recursive:!0})}catch(e){return void t(e)}t(null)}}))}}var Xt=n(5570),Qt=n(4862);const te=(\"undefined\"!=typeof globalThis&&globalThis||\"undefined\"!=typeof self&&self||\"undefined\"!=typeof window&&window||\"undefined\"!=typeof globalThis&&globalThis).chrome?1/0:2130706432,ee=\"undefined\"!=typeof navigator&&navigator.storage?.getDirectory&&FileSystemFileHandle?.prototype?.createWritable,re=()=>{};class ie{constructor(t,e={}){if(this.chunkLength=Number(t),!this.chunkLength)throw new Error(\"First argument must be a chunk length\");this.length=Number(e.length)||1/0,this.limit=e.limit||te,this.fallbackStore=null,this.dataStore=null,this.chunkCount=0,this.stores=[],this._init(e),this.dataStore&&(e.max>0&&(this.dataStore=new it(this.dataStore,{max:e.max})),this.stores.push(this.dataStore)),this.stores.push(this.fallbackStore)}_init(t){if(t.onlyMem||this.limit=this.length)return void(this.fallbackStore=new e(this.chunkLength,t));this.chunkCount=Math.floor(Math.min(this.length,this.limit)/this.chunkLength);const r=this.chunkCount*this.chunkLength,i=this.length-r;this.dataStore=new e(this.chunkLength,{...t,length:r}),this.fallbackStore=new Qt(this.chunkLength,{...t,length:i})}get(t,e,r){t>=this.chunkCount?this.fallbackStore.get(t-this.chunkCount,e,r):this.dataStore.get(t,e,r)}put(t,e,r){t>=this.chunkCount?this.fallbackStore.put(t-this.chunkCount,e,r):this.dataStore.put(t,e,r)}close(t=re){Promise.all(this.stores.map((t=>new Promise((e=>t.close(e)))))).then((e=>{const r=e.find((t=>t));t(r)}))}destroy(t=re){Promise.all(this.stores.map((t=>new Promise((e=>t.destroy(e)))))).then((e=>{const r=e.find((t=>t));t(r)}))}}var ne=n(3714),se=n(1314);const oe=A(\"lt_donthave\"),ae=()=>{class t extends a.EventEmitter{constructor(t){super(),this._peerSupports=!1,this._wire=t}onExtendedHandshake(){this._peerSupports=!0}onMessage(t){let e;try{e=new DataView(t.buffer).getUint32(0)}catch(t){return}this._wire.peerPieces.get(e)&&(oe(\"got donthave %d\",e),this._wire.peerPieces.set(e,!1),this.emit(\"donthave\",e),this._failRequests(e))}donthave(t){if(!this._peerSupports)return;oe(\"donthave %d\",t);const e=new Uint8Array(4);new DataView(e.buffer).setUint32(0,t),this._wire.extended(\"lt_donthave\",e)}_failRequests(t){const e=this._wire.requests;for(let r=0;r{class e extends a.EventEmitter{constructor(e){super(),this._wire=e,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new rt.A(0,{grow:1e3}),ArrayBuffer.isView(t)&&this.setMetadata(t)}onHandshake(t,e,r){this._infoHash=t}onExtendedHandshake(t){return t.m&&t.m.ut_metadata?t.metadata_size?\"number\"!=typeof t.metadata_size||1e7this._metadataSize&&(r=this._metadataSize);const i=this.metadata.slice(e,r);this._data(t,i,this._metadataSize)}_onData(t,e,r){e.length>de||!this._fetching||(this.metadata.set(e,t*de),this._bitfield.set(t),this._checkDone())}_onReject(t){this._remainingRejects>0&&this._fetching?(this._request(t),this._remainingRejects-=1):this.emit(\"warning\",new Error('Peer sent \"reject\" too much'))}_requestPieces(){if(this._fetching){this.metadata=new Uint8Array(this._metadataSize);for(let t=0;t0?this._requestPieces():this.emit(\"warning\",new Error(\"Peer sent invalid metadata\"))}}return e.prototype.name=\"ut_metadata\",e};var me=n(4206),ge=n(1133);const ye=A(\"webtorrent:file-iterator\");class be extends a{constructor(t,{start:e,end:r}){super(),this._torrent=t._torrent,this._pieceLength=t._torrent.pieceLength,this._startPiece=(e+t.offset)/this._pieceLength|0,this._endPiece=(r+t.offset)/this._pieceLength|0,this._piece=this._startPiece,this._offset=e+t.offset-this._startPiece*this._pieceLength,this._missing=r-e+1,this._criticalLength=Math.min(1048576/this._pieceLength|0,2),this._torrent.select(this._startPiece,this._endPiece,!0),this.destroyed=!1}[Symbol.asyncIterator](){return this}next(){return new Promise(((t,e)=>{if(0===this._missing||this.destroyed)return t({done:!0}),this.destroy();const r=(i,n)=>{if(!this._torrent.bitfield.get(i)){const t=e=>{(e===i||this.destroyed)&&(this._torrent.removeListener(\"verified\",t),r(i,n))};return this._torrent.on(\"verified\",t),this._torrent.critical(i,i+this._criticalLength)}if(this._torrent.destroyed)return e(new Error(\"Torrent removed\"));this._torrent.store.get(i,n,((r,n)=>this.destroyed?t({done:!0}):(ye(\"read %s and yielding (length %s) (err %s)\",i,n?.length,r?.message),r?e(r):void t({value:n,done:!1}))))},i=Math.min(this._missing,this._pieceLength-this._offset);r(this._piece++,{length:i,offset:this._offset}),this._missing-=i,this._offset=0}))}async return(){return this.destroy(),{done:!0}}async throw(t){throw t}destroy(t=(()=>{}),e){this.destroyed||(this.destroyed=!0,this._torrent.destroyed||this._torrent.deselect(this._startPiece,this._endPiece,!0),this.emit(\"return\"),t(e))}}class ve extends a{constructor(t,e){super(),this._torrent=t,this._destroyed=!1,this._fileStreams=new Set,this._iterators=new Set,this.name=e.name,this.path=e.path,this.length=e.length,this.size=e.length,this.type=ge.getType(this.name)||\"application/octet-stream\",this.offset=e.offset,this.done=!1;const r=e.offset,i=r+e.length-1;this._startPiece=r/this._torrent.pieceLength|0,this._endPiece=i/this._torrent.pieceLength|0,0===this.length&&(this.done=!0,this.emit(\"done\")),this._client=t.client}get downloaded(){if(this._destroyed||!this._torrent.bitfield)return 0;const{pieces:t,bitfield:e,pieceLength:r,lastPieceLength:i}=this._torrent,{_startPiece:n,_endPiece:s}=this,o=n=>{const s=n===t.length-1?i:r;return e.get(n)?s:s-t[n].missing};let a=0;for(let e=n;e<=s;e+=1){const h=o(e);if(a+=h,e===n){const t=this.offset%r;a-=Math.min(t,h)}if(e===s){const e=(s===t.length-1?i:r)-(this.offset+this.length)%r;a-=Math.min(e,h)}}return a}get progress(){return this.length?this.downloaded/this.length:0}select(t){0!==this.length&&this._torrent.select(this._startPiece,this._endPiece,t)}deselect(){0!==this.length&&this._torrent.deselect(this._startPiece,this._endPiece,!1)}[Symbol.asyncIterator](t={}){if(0===this.length)return async function*(){}();const{start:e=0}=t??{},r=t?.end&&t.endnew Promise(((n,s)=>{t.get(e,{offset:i,length:r},((t,e)=>{t&&s(t),n(e)}))}));let o=Math.floor(n/r);const a=n%r;if(n){const t=Math.min(i,r-a);i-=t,yield s(o++,t,a)}for(let t=i;t>0;++o,t-=r)yield s(o,Math.min(t,r))}(this._torrent.store,{offset:e+this.offset,length:r-e+1});const i=new be(this,{start:e,end:r});return this._iterators.add(i),i.once(\"return\",(()=>{this._iterators.delete(i)})),i}createReadStream(t){const e=this[Symbol.asyncIterator](t),r=q.Readable.from(e);return this._fileStreams.add(r),r.once(\"close\",(()=>{this._fileStreams.delete(r)})),r}async arrayBuffer(t){const e=new Uint8Array(this.length);let r=0;for await(const i of this[Symbol.asyncIterator](t))e.set(i,r),r+=i.length;return e.buffer}async blob(t){return new Blob([await this.arrayBuffer(t)],{type:this.type})}stream(t){let e;return new ReadableStream({start:()=>{e=this[Symbol.asyncIterator](t)},async pull(t){const{value:r,done:i}=await e.next();i?t.close():t.enqueue(r)},cancel(){e.return()}})}get streamURL(){if(!this._client._server)throw new Error(\"No server created\");return`${this._client._server.pathname}/${this._torrent.infoHash}/${this.path}`}streamTo(t){return t.src=this.streamURL,t}includes(t){return this._startPiece<=t&&this._endPiece>=t}_destroy(){this._destroyed=!0,this._torrent=null;for(const t of this._fileStreams)t.destroy();this._fileStreams.clear();for(const t of this._iterators)t.destroy();this._iterators.clear()}}var we=n(5310);class _e{constructor(t){this._torrent=t,this._numPieces=t.pieces.length,this._pieces=new Array(this._numPieces),this._onWire=t=>{this.recalculate(),this._initWire(t)},this._onWireHave=t=>{this._pieces[t]+=1},this._onWireBitfield=()=>{this.recalculate()},this._torrent.wires.forEach((t=>{this._initWire(t)})),this._torrent.on(\"wire\",this._onWire),this.recalculate()}getRarestPiece(t){let e=[],r=1/0;for(let i=0;i{this._cleanupWireEvents(t)})),this._torrent=null,this._pieces=null,this._onWire=null,this._onWireHave=null,this._onWireBitfield=null}_initWire(t){t._onClose=()=>{this._cleanupWireEvents(t);for(let e=0;e{const i=await(0,b.tW)(t,\"hex\");if(this.destroyed)return;this.handshake(e,i);const n=this._torrent.pieces.length,s=new rt.A(n);for(let t=0;t<=n;t++)s.set(t,!0);this.bitfield(s)})),this.once(\"interested\",(()=>{xe(\"interested\"),this.unchoke()})),this.on(\"uninterested\",(()=>{xe(\"uninterested\")})),this.on(\"choke\",(()=>{xe(\"choke\")})),this.on(\"unchoke\",(()=>{xe(\"unchoke\")})),this.on(\"bitfield\",(()=>{xe(\"bitfield\")})),this.lt_donthave.on(\"donthave\",(()=>{xe(\"donthave\")})),this.on(\"request\",((t,e,r,i)=>{xe(\"request pieceIndex=%d offset=%d length=%d\",t,e,r),this.httpRequest(t,e,r,((e,r)=>{if(e){this.lt_donthave.donthave(t);const e=setTimeout((()=>{this.destroyed||this.have(t)}),1e4);e.unref&&e.unref()}i(e,r)}))}))}async httpRequest(t,e,r,i){i=xt(i);const n=t*this._torrent.pieceLength+e,s=n+r-1,o=this._torrent.files;let a,h;if(o.length<=1)a=[{url:this.url,start:n,end:s}];else{const t=o.filter((t=>t.offset<=s&&t.offset+t.length>n));if(t.length<1)return i(new Error(\"Could not find file corresponding to web seed range request\"));a=t.map((t=>{const e=t.offset+t.length-1;return{url:this.url+(\"/\"===this.url[this.url.length-1]?\"\":\"/\")+t.path.replace(this._torrent.path,\"\"),fileOffsetInRange:Math.max(t.offset-n,0),start:Math.max(n-t.offset,0),end:Math.min(e,s-t.offset)}}))}try{h=await Promise.all(a.map((async({start:i,end:n,url:s})=>{xe(\"Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d\",s,t,e,r,i,n);const o=await T(s,{cache:\"no-store\",method:\"GET\",headers:{\"Cache-Control\":\"no-store\",\"user-agent\":`WebTorrent/${Ae} (https://webtorrent.io)`,range:`bytes=${i}-${n}`},signal:AbortSignal.timeout(6e4)});if(!o.ok)throw new Error(`Unexpected HTTP status code ${o.status}`);const a=new Uint8Array(await o.arrayBuffer());return xe(\"Got data of length %d\",a.length),a})))}catch(t){return i(t)}i(null,(0,b.xW)(h))}destroy(){super.destroy(),this._torrent=null}}var Ie=n(5606);const Be=A(\"webtorrent:torrent\"),Te=5e3,Pe=3*fe.BLOCK_LENGTH,Re=Ie.browser?nt().length:2,Ce=[1e3,5e3,15e3],Le=`WebTorrent/${Se} (https://webtorrent.io)`;let Oe;try{Oe=u.join(J.statSync(\"/tmp\")&&\"/tmp\",\"webtorrent\")}catch(t){Oe=u.join(\"function\"==typeof X.tmpdir?X.tmpdir():\"/\",\"webtorrent\")}const je=\"undefined\"!=typeof window&&\"function\"==typeof window.requestIdleCallback&&window.requestIdleCallback;class Ne extends a{constructor(t,e,r){super(),this._debugId=\"unknown infohash\",this.client=e,this.announce=r.announce,this.urlList=r.urlList,this.path=r.path||Oe,this.addUID=r.addUID||!1,this.rootDir=r.rootDir||null,this.skipVerify=!!r.skipVerify,this._store=r.store||ie,this._preloadedStore=r.preloadedStore||null,this._storeCacheSlots=void 0!==r.storeCacheSlots?r.storeCacheSlots:20,this._destroyStoreOnDestroy=r.destroyStoreOnDestroy||!1,this.store=null,this.storeOpts=r.storeOpts,this._getAnnounceOpts=r.getAnnounceOpts,\"boolean\"==typeof r.private&&(this.private=r.private),this.strategy=r.strategy||\"sequential\",this.maxWebConns=r.maxWebConns||4,this._rechokeNumSlots=!1===r.uploads||0===r.uploads?0:+r.uploads||10,this._rechokeOptimisticWire=null,this._rechokeOptimisticTime=0,this._rechokeIntervalId=null,this._noPeersIntervalId=null,this._noPeersIntervalTime=r.noPeersIntervalTime?1e3*r.noPeersIntervalTime:3e4,this.ready=!1,this.destroyed=!1,this.paused=r.paused||!1,this.done=!1,this.metadata=null,this.files=[],this.pieces=[],this._amInterested=!1,this._selections=[],this._critical=[],this.wires=[],this._queue=[],this._peers={},this._peersLength=0,this.received=0,this.uploaded=0,this._downloadSpeed=V(),this._uploadSpeed=V(),this._servers=[],this._xsRequests=[],this._fileModtimes=r.fileModtimes,null!==t&&this._onTorrentId(t),this._debug(\"new torrent\")}get timeRemaining(){return this.done?0:0===this.downloadSpeed?1/0:(this.length-this.downloaded)/this.downloadSpeed*1e3}get downloaded(){if(!this.bitfield)return 0;let t=0;for(let e=0,r=this.pieces.length;e{this.destroyed||this._onParsedTorrent(e)}))):L(t,((t,e)=>{if(!this.destroyed)return t?this._destroy(t):void this._onParsedTorrent(e)}))}_onParsedTorrent(t){if(!this.destroyed){if(this._processParsedTorrent(t),!this.infoHash)return this._destroy(new Error(\"Malformed torrent data: No info hash\"));this._rechokeIntervalId=setInterval((()=>{this._rechoke()}),1e4),this._rechokeIntervalId.unref&&this._rechokeIntervalId.unref(),this.emit(\"_infoHash\",this.infoHash),this.destroyed||(this.emit(\"infoHash\",this.infoHash),this.destroyed||(this.client.listening?this._onListening():this.client.once(\"listening\",(()=>{this._onListening()}))))}}_processParsedTorrent(t){this._debugId=(0,b.V5)(t.infoHash).substring(0,7),void 0!==this.private&&(t.private=this.private),this.announce&&(t.announce=t.announce.concat(this.announce)),this.client.tracker&&globalThis.WEBTORRENT_ANNOUNCE&&!t.private&&(t.announce=t.announce.concat(globalThis.WEBTORRENT_ANNOUNCE)),this.urlList&&(t.urlList=t.urlList.concat(this.urlList)),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),Object.assign(this,t),this.magnetURI=function(t){t=Object.assign({},t);let e=new Set;t.xt&&\"string\"==typeof t.xt&&e.add(t.xt),t.xt&&Array.isArray(t.xt)&&(e=new Set(t.xt)),t.infoHashBuffer&&e.add(`urn:btih:${(0,b.V5)(t.infoHashBuffer)}`),t.infoHash&&e.add(`urn:btih:${t.infoHash}`),t.infoHashV2Buffer&&e.add(t.xt=`urn:btmh:1220${(0,b.V5)(t.infoHashV2Buffer)}`),t.infoHashV2&&e.add(`urn:btmh:1220${t.infoHashV2}`);const r=Array.from(e);1===r.length&&(t.xt=r[0]),r.length>1&&(t.xt=r),t.publicKeyBuffer&&(t.xs=`urn:btpk:${(0,b.V5)(t.publicKeyBuffer)}`),t.publicKey&&(t.xs=`urn:btpk:${t.publicKey}`),t.name&&(t.dn=t.name),t.keywords&&(t.kt=t.keywords),t.announce&&(t.tr=t.announce),t.urlList&&(t.ws=t.urlList,delete t.as),t.peerAddresses&&(t[\"x.pe\"]=t.peerAddresses);let i=\"magnet:?\";return Object.keys(t).filter((t=>2===t.length||\"x.pe\"===t)).forEach(((e,r)=>{const n=Array.isArray(t[e])?t[e]:[t[e]];var s;n.forEach(((t,n)=>{(r>0||n>0)&&(\"kt\"!==e&&\"so\"!==e||0===n)&&(i+=\"&\"),\"dn\"===e&&(t=encodeURIComponent(t).replace(/%20/g,\"+\")),\"tr\"!==e&&\"as\"!==e&&\"ws\"!==e||(t=encodeURIComponent(t)),\"xs\"!==e||t.startsWith(\"urn:btpk:\")||(t=encodeURIComponent(t)),\"kt\"===e&&(t=encodeURIComponent(t)),\"so\"!==e&&(i+=\"kt\"===e&&n>0?`+${t}`:`${e}=${t}`)})),\"so\"===e&&(i+=`${e}=${s=n,s.reduce(((t,e,r,i)=>(0!==r&&e===i[r-1]+1||t.push([]),t[t.length-1].push(e),t)),[]).map((t=>t.length>1?`${t[0]}-${t[t.length-1]}`:`${t[0]}`))}`)})),i}(t),this.torrentFile=function(t){const e={info:t.info};return e[\"announce-list\"]=(t.announce||[]).map((t=>(e.announce||(e.announce=t),[t=(0,b.L0)(t)]))),e[\"url-list\"]=t.urlList||[],void 0!==t.private&&(e.private=Number(t.private)),t.created&&(e[\"creation date\"]=t.created.getTime()/1e3|0),t.createdBy&&(e[\"created by\"]=t.createdBy),t.comment&&(e.comment=t.comment),f.A.encode(e)}(t)}_onListening(){this.destroyed||(this.info?this._onMetadata(this):(this.xs&&this._getMetadataFromServer(),this._startDiscovery()))}_startDiscovery(){if(this.discovery||this.destroyed)return;let t=this.client.tracker;t&&(t=Object.assign({},this.client.tracker,{getAnnounceOpts:()=>{if(this.destroyed)return;const t={uploaded:this.uploaded,downloaded:this.downloaded,left:Math.max(this.length-this.downloaded,0)};return this.client.tracker.getAnnounceOpts&&Object.assign(t,this.client.tracker.getAnnounceOpts()),this._getAnnounceOpts&&Object.assign(t,this._getAnnounceOpts()),t}})),this.peerAddresses&&this.peerAddresses.forEach((t=>this.addPeer(t,we.default.SOURCE_MANUAL))),this.discovery=new Zt({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:t,port:this.client.torrentPort,userAgent:Le,lsd:this.client.lsd}),this.discovery.on(\"error\",(t=>{this._destroy(t)})),this.discovery.on(\"peer\",((t,e)=>{this._debug(\"peer %s discovered via %s\",t,e),\"string\"==typeof t&&this.done||this.addPeer(t,e)})),this.discovery.on(\"trackerAnnounce\",(()=>{this.emit(\"trackerAnnounce\")})),this.discovery.on(\"dhtAnnounce\",(()=>{this.emit(\"dhtAnnounce\")})),this.discovery.on(\"warning\",(t=>{this.emit(\"warning\",t)})),this._noPeersIntervalId=setInterval((()=>{if(this.destroyed)return;const t={[we.default.SOURCE_TRACKER]:{enabled:!!this.client.tracker,numPeers:0},[we.default.SOURCE_DHT]:{enabled:!!this.client.dht,numPeers:0},[we.default.SOURCE_LSD]:{enabled:!!this.client.lsd,numPeers:0},[we.default.SOURCE_UT_PEX]:{enabled:this.client.utPex&&\"function\"==typeof me,numPeers:0}};for(const e of Object.values(this._peers)){const r=t[e.source];void 0!==r&&r.numPeers++}for(const e of Object.keys(t)){const r=t[e];r.enabled&&0===r.numPeers&&this.emit(\"noPeers\",e)}}),this._noPeersIntervalTime),this._noPeersIntervalId.unref&&this._noPeersIntervalId.unref()}_getMetadataFromServer(){const t=this,e=Array.isArray(this.xs)?this.xs:[this.xs];t._xsRequestsController=new AbortController;const r=t._xsRequestsController.signal,i=e.map((e=>i=>{!async function(e,i){if(0!==e.indexOf(\"http://\")&&0!==e.indexOf(\"https://\"))return t.emit(\"warning\",new Error(`skipping non-http xs param: ${e}`)),i(null);const n={method:\"GET\",headers:{\"user-agent\":Le},signal:r};let s,o,a;try{s=await T(e,n)}catch(r){return t.emit(\"warning\",new Error(`http error from xs param: ${e}`)),i(null)}if(t.destroyed)return i(null);if(t.metadata)return i(null);if(200!==s.status)return t.emit(\"warning\",new Error(`non-200 status code ${s.status} from xs param: ${e}`)),i(null);try{o=new Uint8Array(await s.arrayBuffer())}catch(e){return t.emit(\"warning\",e),i(null)}try{a=await N(o)}catch(t){}a?a.infoHash!==t.infoHash?(t.emit(\"warning\",new Error(`got torrent file with incorrect info hash from xs param: ${e}`)),i(null)):(t._onMetadata(a),i(null)):(t.emit(\"warning\",new Error(`got invalid torrent file from xs param: ${e}`)),i(null))}(e,i)}));g(i)}async _onMetadata(t){if(this.metadata||this.destroyed)return;let e;if(this._debug(\"got metadata\"),this._xsRequestsController?.abort(),this._xsRequestsController=null,t&&t.infoHash)e=t;else try{e=await N(t)}catch(t){return this._destroy(t)}this._processParsedTorrent(e),this.metadata=this.torrentFile,this.client.enableWebSeeds&&this.urlList.forEach((t=>{this.addWebSeed(t)})),this._rarityMap=new _e(this),this.files=this.files.map((t=>new ve(this,t)));let r=this._preloadedStore;if(r||(r=new this._store(this.pieceLength,{...this.storeOpts,torrent:this,path:this.path,files:this.files,length:this.length,name:this.name+\" - \"+this.infoHash.slice(0,8),addUID:this.addUID,rootDir:this.rootDir,max:this._storeCacheSlots})),this._storeCacheSlots>0&&!(r instanceof Qt||r instanceof ie)&&(r=new it(r,{max:this._storeCacheSlots})),this.store=new ne(r),this.so?this.files.forEach(((t,e)=>{this.so.includes(e)?this.files[e].select():this.files[e].deselect()})):0!==this.pieces.length&&this.select(0,this.pieces.length-1,!1),this._hashes=this.pieces,this.pieces=this.pieces.map(((t,e)=>{const r=e===this.pieces.length-1?this.lastPieceLength:this.pieceLength;return new fe(r)})),this._reservations=this.pieces.map((()=>[])),this.bitfield=new rt.A(this.pieces.length),this.emit(\"metadata\"),!this.destroyed)if(this.skipVerify)this._markAllVerified(),this._onStore();else{const t=t=>{if(t)return this._destroy(t);this._debug(\"done verifying\"),this._onStore()};this._debug(\"verifying existing torrent data\"),this._fileModtimes&&this._store===ie?this.getFileModtimes(((e,r)=>{if(e)return this._destroy(e);this.files.map(((t,e)=>r[e]===this._fileModtimes[e])).every((t=>t))?(this._markAllVerified(),this._onStore()):this._verifyPieces(t)})):this._verifyPieces(t)}}getFileModtimes(t){const e=[];he(this.files.map(((t,r)=>i=>{const n=this.addUID?u.join(this.name+\" - \"+this.infoHash.slice(0,8)):u.join(this.path,t.path);J.stat(n,((t,n)=>{if(t&&\"ENOENT\"!==t.code)return i(t);e[r]=n&&n.mtime.getTime(),i(null)}))})),Re,(r=>{this._debug(\"done getting file modtimes\"),t(r,e)}))}_verifyPieces(t){he(this.pieces.map(((t,e)=>t=>{if(this.destroyed)return t(new Error(\"torrent is destroyed\"));const r={};e===this.pieces.length-1&&(r.length=this.lastPieceLength),this.store.get(e,r,(async(r,i)=>{if(this.destroyed)return t(new Error(\"torrent is destroyed\"));if(r)return y((()=>t(null)));const n=await(0,b.tW)(i,\"hex\");if(this.destroyed)return t(new Error(\"torrent is destroyed\"));n===this._hashes[e]?(this._debug(\"piece verified %s\",e),this._markVerified(e)):(this._markUnverified(e),this._debug(\"piece invalid %s\",e)),t(null)}))})),Re,t)}rescanFiles(t){if(this.destroyed)throw new Error(\"torrent is destroyed\");t||(t=qe),this._verifyPieces((e=>{if(e)return this._destroy(e),t(e);this._checkDone(),t(null)}))}_markAllVerified(){for(let t=0;t{e.done&&e.includes(t)&&(e.done=!1)}))}_hasAllPieces(){for(let t=0;tt))return!0;return!1}_onStore(){this.destroyed||(this._debug(\"on store\"),this._startDiscovery(),this.ready=!0,this.emit(\"ready\"),this._checkDone(),this._updateSelections(),this.wires.forEach((t=>{t.ut_metadata&&t.ut_metadata.setMetadata(this.metadata),this._onWireWithMetadata(t)})))}destroy(t,e){if(\"function\"==typeof t)return this.destroy(null,t);this._destroy(null,t,e)}_destroy(t,e,r){if(\"function\"==typeof e)return this._destroy(t,null,e);if(this.destroyed)return;this.destroyed=!0,this._debug(\"destroy\"),this.client._remove(this),clearInterval(this._rechokeIntervalId),clearInterval(this._noPeersIntervalId),this._xsRequestsController?.abort(),this._rarityMap&&this._rarityMap.destroy();for(const t in this._peers)this.removePeer(t);this.files.forEach((t=>{t instanceof ve&&t._destroy()}));const i=this._servers.map((t=>e=>{t.destroy(e)}));if(this.discovery&&i.push((t=>{this.discovery.destroy(t)})),this.store){let t=this._destroyStoreOnDestroy;e&&void 0!==e.destroyStore&&(t=e.destroyStore),i.push((e=>{t?this.store.destroy(e):this.store.close(e)}))}g(i,r),t&&(0===this.listenerCount(\"error\")?this.client.emit(\"error\",t):this.emit(\"error\",t)),this.emit(\"close\"),this.client=null,this.files=[],this.discovery=null,this.store=null,this._rarityMap=null,this._peers=null,this._servers=null,this._xsRequests=null}addPeer(t,e){if(this.destroyed)throw new Error(\"torrent is destroyed\");if(!this.infoHash)throw new Error(\"addPeer() must not be called before the `infoHash` event\");let r;if(this.client.blocked){if(\"string\"==typeof t){let e;try{e=et(t)}catch(e){return this._debug(\"ignoring peer: invalid %s\",t),this.emit(\"invalidPeer\",t),!1}r=e[0]}else\"string\"==typeof t.remoteAddress&&(r=t.remoteAddress);if(r&&this.client.blocked.contains(r))return this._debug(\"ignoring peer: blocked %s\",t),\"string\"!=typeof t&&t.destroy(),this.emit(\"blockedPeer\",t),!1}const i=this.client.utp&&this._isIPv4(r)?\"utp\":\"tcp\",n=!!this._addPeer(t,i,e);return n?this.emit(\"peer\",t):this.emit(\"invalidPeer\",t),n}_addPeer(t,e,r){if(this.destroyed)return\"string\"!=typeof t&&t.destroy(),null;if(\"string\"==typeof t&&!this._validAddr(t))return this._debug(\"ignoring peer: invalid %s\",t),null;const i=t&&t.id||t;if(this._peers[i])return this._debug(\"ignoring peer: duplicate (%s)\",i),\"string\"!=typeof t&&t.destroy(),null;if(this.paused)return this._debug(\"ignoring peer: torrent is paused\"),\"string\"!=typeof t&&t.destroy(),null;let n;return this._debug(\"add peer %s\",i),n=\"string\"==typeof t?\"utp\"===e?we.default.createUTPOutgoingPeer(t,this,this.client.throttleGroups):we.default.createTCPOutgoingPeer(t,this,this.client.throttleGroups):we.default.createWebRTCPeer(t,this,this.client.throttleGroups),this._registerPeer(n),\"string\"==typeof t&&(this._queue.push(n),this._drain()),n}addWebSeed(t){if(this.destroyed)throw new Error(\"torrent is destroyed\");let e,r;if(\"string\"==typeof t){if(e=t,!/^https?:\\/\\/.+/.test(e))return this.emit(\"warning\",new Error(`ignoring invalid web seed: ${e}`)),void this.emit(\"invalidPeer\",e);if(this._peers[e])return this.emit(\"warning\",new Error(`ignoring duplicate web seed: ${e}`)),void this.emit(\"invalidPeer\",e);r=new Ee(e,this)}else{if(!t||\"string\"!=typeof t.connId)return void this.emit(\"warning\",new Error(\"addWebSeed must be passed a string or connection object with id property\"));if(r=t,e=r.connId,this._peers[e])return this.emit(\"warning\",new Error(`ignoring duplicate web seed: ${e}`)),void this.emit(\"invalidPeer\",e)}this._debug(\"add web seed %s\",e);const i=we.default.createWebSeedPeer(r,e,this,this.client.throttleGroups);this._registerPeer(i),this.emit(\"peer\",e)}_addIncomingPeer(t){return this.destroyed?t.destroy(new Error(\"torrent is destroyed\")):this.paused?t.destroy(new Error(\"torrent is paused\")):(this._debug(\"add incoming peer %s\",t.id),void this._registerPeer(t))}_registerPeer(t){t.on(\"download\",(t=>{this.destroyed||(this.received+=t,this._downloadSpeed(t),this.client._downloadSpeed(t),this.emit(\"download\",t),this.destroyed||this.client.emit(\"download\",t))})),t.on(\"upload\",(t=>{this.destroyed||(this.uploaded+=t,this._uploadSpeed(t),this.client._uploadSpeed(t),this.emit(\"upload\",t),this.destroyed||this.client.emit(\"upload\",t))})),this._peers[t.id]=t,this._peersLength+=1}removePeer(t){const e=t?.id||t;t&&!t.id&&(t=this._peers?.[e]),t&&(t.destroy(),this.destroyed||(this._debug(\"removePeer %s\",e),delete this._peers[e],this._peersLength-=1,this._drain()))}select(t,e,r,i){if(this.destroyed)throw new Error(\"torrent is destroyed\");if(t<0||ee.priority-t.priority)),this._updateSelections()}deselect(t,e,r){if(this.destroyed)throw new Error(\"torrent is destroyed\");r=Number(r)||0,this._debug(\"deselect %s-%s (priority %s)\",t,e,r);for(let i=0;i{if(!this.destroyed&&!this.client.dht.destroyed){if(!t.remoteAddress)return this._debug(\"ignoring PORT from peer with no address\");if(0===r||r>65536)return this._debug(\"ignoring invalid PORT from peer\");this._debug(\"port: %s (from %s)\",r,e),this.client.dht.addNode({host:t.remoteAddress,port:r})}})),t.on(\"timeout\",(()=>{this._debug(\"wire timeout (%s)\",e),t.destroy()})),\"webSeed\"!==t.type&&t.setTimeout(3e4,!0),t.setKeepAlive(!0),t.use(pe(this.metadata)),t.ut_metadata.on(\"warning\",(t=>{this._debug(\"ut_metadata warning: %s\",t.message)})),this.metadata||(t.ut_metadata.on(\"metadata\",(t=>{this._debug(\"got metadata via ut_metadata\"),this._onMetadata(t)})),t.ut_metadata.fetch()),this.client.utPex&&\"function\"==typeof me&&!this.private&&(t.use(me()),t.ut_pex.on(\"peer\",(t=>{this.done||(this._debug(\"ut_pex: got peer: %s (from %s)\",t,e),this.addPeer(t,we.default.SOURCE_UT_PEX))})),t.ut_pex.on(\"dropped\",(t=>{const r=this._peers[t];r&&!r.connected&&(this._debug(\"ut_pex: dropped peer: %s (from %s)\",t,e),this.removePeer(t))})),t.once(\"close\",(()=>{t.ut_pex.reset()}))),t.use(ae()),this.emit(\"wire\",t,e),this.ready&&y((()=>{this._onWireWithMetadata(t)}))}_onWireWithMetadata(t){let e=null;const r=()=>{this.destroyed||t.destroyed||(this._numQueued>2*(this._numConns-this.numPeers)&&t.amInterested?t.destroy():(e=setTimeout(r,Te),e.unref&&e.unref()))};let i;const n=()=>{if(t.peerPieces.buffer.length===this.bitfield.buffer.length){for(i=0;i{n(),this._update(),this._updateWireInterest(t)})),t.on(\"have\",(()=>{n(),this._update(),this._updateWireInterest(t)})),t.lt_donthave.on(\"donthave\",(()=>{n(),this._update(),this._updateWireInterest(t)})),t.on(\"have-all\",(()=>{t.isSeeder=!0,t.choke(),this._update(),this._updateWireInterest(t)})),t.on(\"have-none\",(()=>{t.isSeeder=!1,this._update(),this._updateWireInterest(t)})),t.on(\"allowed-fast\",(t=>{this._update()})),t.once(\"interested\",(()=>{t.unchoke()})),t.once(\"close\",(()=>{clearTimeout(e)})),t.on(\"choke\",(()=>{clearTimeout(e),e=setTimeout(r,Te),e.unref&&e.unref()})),t.on(\"unchoke\",(()=>{clearTimeout(e),this._update()})),t.on(\"request\",((e,r,i,n)=>{if(i>131072)return t.destroy();this.pieces[e]||this.store.get(e,{offset:r,length:i},n)})),t.hasFast&&this._hasAllPieces()?t.haveAll():t.hasFast&&this._hasNoPieces()?t.haveNone():t.bitfield(this.bitfield),this._updateWireInterest(t),t.peerExtensions.dht&&this.client.dht&&this.client.dht.listening&&t.port(this.client.dht.address().port),\"webSeed\"!==t.type&&(e=setTimeout(r,Te),e.unref&&e.unref()),t.isSeeder=!1,n()}_updateSelections(){this.ready&&!this.destroyed&&(y((()=>{this._gcSelections()})),this._updateInterest(),this._update())}_gcSelections(){for(let t=0;tthis._updateWireInterest(t))),t!==this._amInterested&&(this._amInterested?this.emit(\"interested\"):this.emit(\"uninterested\"))}_updateWireInterest(t){let e=!1;for(let r=0;rthis._updateWireWrapper()),{timeout:250}):this._updateWireWrapper()}_updateWireWrapper(){if(this.destroyed)return;const t=le(this.wires);let e;for(;e=t();)this._updateWire(e)}_updateWire(t){if(t.destroyed)return!1;const e=this,r=Ue(t,.5);if(t.requests.length>=r)return;const i=Ue(t,1);if(t.peerChoking)t.hasFast&&t.peerAllowedFastSet.length>0&&!this._hasMorePieces(t.peerAllowedFastSet.length-1)&&function(){if(t.requests.length>=i)return!1;for(const r of t.peerAllowedFastSet){if(t.peerPieces.get(r)&&!e.bitfield.get(r))for(;e._request(t,r,!1)&&t.requests.length=i.from+i.offset;--s)if(t.peerPieces.get(s)&&e._request(t,s,!1))return}}();o(!1)||o(!0)}function n(e,r,i,n){return s=>s>=e&&s<=r&&!(s in i)&&t.peerPieces.get(s)&&(!n||n(s))}function s(t){let r=t;for(let i=t;i=i)return!0;const o=function(){const r=t.downloadSpeed()||1;if(r>Pe)return()=>!0;const i=Math.max(1,t.requests.length)*fe.BLOCK_LENGTH/r;let n=10,s=0;return t=>{if(!n||e.bitfield.get(t))return!0;let o=e.pieces[t].missing;for(;s0))return n--,!1}return!0}}();for(let a=0;a({wire:t,random:Math.random()}))).sort(((t,e)=>{const r=t.wire,i=e.wire;return r.downloadSpeed()!==i.downloadSpeed()?r.downloadSpeed()-i.downloadSpeed():r.uploadSpeed()!==i.uploadSpeed()?r.uploadSpeed()-i.uploadSpeed():r.amChoking!==i.amChoking?r.amChoking?-1:1:t.random-e.random})).map((t=>t.wire));this._rechokeOptimisticTime<=0?this._rechokeOptimisticWire=null:this._rechokeOptimisticTime-=1;let e=0;for(;t.length>0&&e0){const e=t.filter((t=>t.peerInterested));if(e.length>0){const t=e[(r=e.length,Math.random()*r|0)];t.unchoke(),this._rechokeOptimisticWire=t,this._rechokeOptimisticTime=2}}var r;t.filter((t=>t!==this._rechokeOptimisticWire)).forEach((t=>t.choke()))}_hotswap(t,e){const r=t.downloadSpeed();if(r=Pe||2*a>r||a>o||(n=e,o=a)}if(!n)return!1;for(s=0;s=o)return!1;const a=i.pieces[e];let h=s?a.reserveRemaining():a.reserve();if(-1===h&&r&&i._hotswap(t,e)&&(h=s?a.reserveRemaining():a.reserve()),-1===h)return!1;let u=i._reservations[e];u||(u=i._reservations[e]=[]);let f=u.indexOf(null);-1===f&&(f=u.length),u[f]=t;const l=a.chunkOffset(h),c=s?a.chunkLengthRemaining(h):a.chunkLength(h);function d(){y((()=>{i._update()}))}return t.request(e,l,c,(async function r(n,o){if(i.destroyed)return;if(!i.ready)return i.once(\"ready\",(()=>{r(n,o)}));if(u[f]===t&&(u[f]=null),a!==i.pieces[e])return d();if(n)return i._debug(\"error getting piece %s (offset: %s length: %s) from %s: %s\",e,l,c,`${t.remoteAddress}:${t.remotePort}`,n.message),s?a.cancelRemaining(h):a.cancel(h),void d();if(i._debug(\"got piece %s (offset: %s length: %s) from %s\",e,l,c,`${t.remoteAddress}:${t.remotePort}`),!a.set(h,o,t))return d();const p=a.flush(),m=await(0,b.tW)(p,\"hex\");i.destroyed||(m===i._hashes[e]?(i._debug(\"piece verified %s\",e),i.store.put(e,p,(t=>{t?i._destroy(t):(i.pieces[e]=null,i._markVerified(e),i.wires.forEach((t=>{t.have(e)})),i._checkDone()&&!i.destroyed&&i.discovery.complete(),d())}))):(i.pieces[e]=new fe(a.length),i.emit(\"warning\",new Error(`Piece ${e} failed verification`)),d()))})),!0}_checkDone(){if(this.destroyed)return;this.files.forEach((t=>{if(!t.done){for(let e=t._startPiece;e<=t._endPiece;++e)if(!this.bitfield.get(e))return;t.done=!0,t.emit(\"done\"),this._debug(`file done: ${t.name}`)}}));let t=!0;for(const e of this._selections){for(let r=e.from;r<=e.to;r++)if(!this.bitfield.get(r)){t=!1;break}if(!t)break}return!this.done&&t?(this.done=!0,this._debug(`torrent done: ${this.infoHash}`),this.emit(\"done\")):this.done=!1,this._gcSelections(),t}async load(t,e){if(this.destroyed)throw new Error(\"torrent is destroyed\");if(!this.ready)return this.once(\"ready\",(()=>{this.load(t,e)}));Array.isArray(t)||(t=[t]),e||(e=qe);try{await async function(t,e,r={}){if(!t?.put)throw new Error(\"First argument must be an abstract-chunk-store compliant store\");const i=r.chunkLength||t.chunkLength;if(!i)throw new Error(\"missing required `chunkLength` property\");const n=r.storeMaxOutstandingPuts||16;let s=0,o=0,a=()=>{},h=!1;for await(const u of l(e,i,{zeroPadding:r.zeroPadding||!1}))await new Promise((e=>{s++<=n&&e(),t.put(o++,u,(t=>{if(t)throw t;--s,e(),h&&0===s&&a()}))}));0!==s&&(h=new Promise((t=>{a=t})),await h)}(this.store,m(t),{chunkLength:this.pieceLength}),this._markAllVerified(),this._checkDone(),e(null)}catch(t){return e(t),t}}pause(){this.destroyed||(this._debug(\"pause\"),this.paused=!0)}resume(){this.destroyed||(this._debug(\"resume\"),this.paused=!1,this._drain())}_debug(){const t=[].slice.call(arguments);t[0]=`[${this.client?this.client._debugId:\"No Client\"}] [${this._debugId}] ${t[0]}`,Be(...t)}_drain(){if(this._debug(\"_drain numConns %s maxConns %s\",this._numConns,this.client.maxConns),\"function\"!=typeof Y.connect||this.destroyed||this.paused||this._numConns>=this.client.maxConns)return;this._debug(\"drain (%s queued, %s/%s peers)\",this._numQueued,this.numPeers,this.client.maxConns);const t=this._queue.shift();if(!t)return;this._debug(\"%s connect attempt to %s\",t.type,t.addr);const e=et(t.addr),r={host:e[0],port:e[1]};this.client.utp&&t.type===we.default.TYPE_UTP_OUTGOING?t.conn=Me.connect(r.port,r.host):t.conn=Y.connect(r);const i=t.conn;i.once(\"connect\",(()=>{this.destroyed||t.onConnect()})),i.once(\"error\",(e=>{t.destroy(e)})),t.startConnectTimeout(),i.on(\"close\",(()=>{if(this.destroyed)return;if(t.retries>=Ce.length){if(this.client.utp){const e=this._addPeer(t.addr,\"tcp\",t.source);e&&(e.retries=0)}else this._debug(\"conn %s closed: will not re-add (max %s attempts)\",t.addr,Ce.length);return}const e=Ce[t.retries];this._debug(\"conn %s closed: will re-add to queue in %sms (attempt %s)\",t.addr,e,t.retries+1);const r=setTimeout((()=>{if(this.destroyed)return;const e=et(t.addr)[0],r=this.client.utp&&this._isIPv4(e)?\"utp\":\"tcp\",i=this._addPeer(t.addr,r,t.source);i&&(i.retries=t.retries+1)}),e);r.unref&&r.unref()}))}_validAddr(t){let e;try{e=et(t)}catch(t){return!1}const r=e[0],i=e[1];return i>0&&i<65535&&!(\"127.0.0.1\"===r&&i===this.client.torrentPort)}_isIPv4(t){return/^((?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/.test(t)}}function Ue(t,e){let r=2+Math.ceil(e*t.downloadSpeed()/fe.BLOCK_LENGTH);if(t.peerExtendedHandshake){const e=t.peerExtendedHandshake.reqq;\"number\"==typeof e&&e>0&&(r=Math.min(r,e))}return r}function qe(){}var De=n(3643),Fe=n(580),He=n(815),ze=n(2878);class We{constructor(t,e={}){this.client=t,e.origin||(e.origin=\"*\"),this.opts=e,this.pendingReady=new Set}static serveIndexPage(t,e,r){const i=e.map((t=>`
  • \\n \\n ${Fe(t.name)}\\n \\n (${Fe(t.length)} bytes)\\n
  • `)).join(\"
    \");return t.status=200,t.headers[\"Content-Type\"]=\"text/html\",t.body=$e(\"WebTorrent\",`

    WebTorrent

    \\n
      ${i}
    `),t}isOriginAllowed(t){return!1!==this.opts.origin&&(\"*\"===this.opts.origin||t.headers.origin===this.opts.origin)}static serveMethodNotAllowed(t){return t.status=405,t.headers[\"Content-Type\"]=\"text/html\",t.body=$e(\"405 - Method Not Allowed\",\"

    405 - Method Not Allowed

    \"),t}static serve404Page(t){return t.status=404,t.headers[\"Content-Type\"]=\"text/html\",t.body=$e(\"404 - Not Found\",\"

    404 - Not Found

    \"),t}static serveTorrentPage(t,e,r){const i=t.files.map((e=>`
  • \\n \\n ${Fe(e.path)}\\n \\n (${Fe(e.length)} bytes)\\n
  • `)).join(\"
    \");return e.status=200,e.headers[\"Content-Type\"]=\"text/html\",e.body=$e(`${Fe(t.name)} - WebTorrent`,`

    ${Fe(t.name)}

    \\n
      ${i}
    `),e}static serveOptionsRequest(t,e){return e.status=204,e.headers[\"Access-Control-Max-Age\"]=\"600\",e.headers[\"Access-Control-Allow-Methods\"]=\"GET,HEAD\",t.headers[\"access-control-request-headers\"]&&(e.headers[\"Access-Control-Allow-Headers\"]=t.headers[\"access-control-request-headers\"]),e}static serveFile(t,e,r){r.status=200,r.headers.Expires=\"0\",r.headers[\"Cache-Control\"]=\"no-cache, no-store, must-revalidate, max-age=0\",r.headers[\"Accept-Ranges\"]=\"bytes\",r.headers[\"Content-Type\"]=t.type,r.headers[\"transferMode.dlna.org\"]=\"Streaming\",r.headers[\"contentFeatures.dlna.org\"]=\"DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000\",\"document\"===e.destination?(r.headers[\"Content-Type\"]=\"application/octet-stream\",r.headers[\"Content-Disposition\"]=`attachment; filename*=UTF-8''${Ze(t.name)}`,r.body=\"DOWNLOAD\"):r.headers[\"Content-Disposition\"]=`inline; filename*=UTF-8''${Ze(t.name)}`;let i=ze(t.length,e.headers.range||\"\");if(Array.isArray(i)?(r.status=206,i=i[0],r.headers[\"Content-Range\"]=`bytes ${i.start}-${i.end}/${t.length}`,r.headers[\"Content-Length\"]=i.end-i.start+1):(r.statusCode=200,i=null,r.headers[\"Content-Length\"]=t.length),\"GET\"===e.method){const n=t[Symbol.asyncIterator](i);let s=null;t.emit(\"iterator\",{iterator:n,req:e,file:t},(t=>{s=t}));const o=q.Readable.from(s||n);let a=null;t.emit(\"stream\",{stream:o,req:e,file:t},(t=>{a=He(o,t)})),r.body=a||o}else r.body=!1;return r}async onRequest(t,e){let r=new URL(t.url,\"http://example.com\").pathname;r=r.slice(r.indexOf(this.pathname)+this.pathname.length+1);const i={headers:{\"X-Content-Type-Options\":\"nosniff\",\"Content-Security-Policy\":\"base-uri 'none'; frame-ancestors 'none'; form-action 'none';\"}};if(this.isOriginAllowed(t)&&(i.headers[\"Access-Control-Allow-Origin\"]=\"*\"===this.opts.origin?\"*\":t.headers.origin),\"favicon.ico\"===r)return e(We.serve404Page(i));if(\"OPTIONS\"===t.method)return this.isOriginAllowed(t)?e(We.serveOptionsRequest(t,i)):e(We.serveMethodNotAllowed(i));const n=async()=>{this.pendingReady.delete(n);const t=await s();e(t)},s=async()=>{if(\"\"===r)return We.serveIndexPage(i,this.client.torrents,this.pathname);let[e,...n]=r.split(\"/\");n=decodeURI(n.join(\"/\"));const s=await this.client.get(e);if(!e||!s)return We.serve404Page(i);if(!n)return We.serveTorrentPage(s,i,this.pathname);const o=s.files.find((t=>t.path.replace(/\\\\/g,\"/\")===n));return o?We.serveFile(o,t,i):We.serve404Page(i)};if(\"GET\"===t.method||\"HEAD\"===t.method){if(this.client.ready){const t=await s();return e(t)}return this.pendingReady.add(n),void this.client.once(\"ready\",n)}return e(We.serveMethodNotAllowed(i))}close(t=(()=>{})){this.closed=!0,this.pendingReady.forEach((t=>{this.client.removeListener(\"ready\",t)})),this.pendingReady.clear(),y(t)}destroy(t=(()=>{})){this.closed?y(t):this.close(t),this.client=null}}class Ke extends We{constructor(t,e){super(t,e),this.server=De.createServer(),this._listen=this.server.listen,this.server.listen=this.listen.bind(this),this._close=this.server.close,this.server.close=this.close.bind(this),this.sockets=new Set,this.closed=!1,this.pathname=e?.pathname||\"/webtorrent\"}wrapRequest(t,e){return this.opts.hostname&&t.headers.host!==`${this.opts.hostname}:${this.server.address().port}`?t.destroy():new URL(t.url,\"http://example.com\").pathname.startsWith(this.pathname)?void this.onRequest(t,(({status:t,headers:r,body:i})=>{e.writeHead(t,r),i._readableState||i._writableState?He(i,e):e.end(i)})):t.destroy()}onConnection(t){t.setTimeout(36e6),this.sockets.add(t),t.once(\"close\",(()=>{this.sockets.delete(t)}))}address(){return this.server.address()}listen(...t){return this.closed=!1,this.server.on(\"connection\",this.onConnection.bind(this)),this.server.on(\"request\",this.wrapRequest.bind(this)),this._listen.apply(this.server,t)}close(t=(()=>{})){this.server.removeAllListeners(\"connection\"),this.server.removeAllListeners(\"request\"),this.server.removeAllListeners(\"listening\"),super.close(),this._close.call(this.server,t)}destroy(t){this.sockets.forEach((t=>{t.destroy()})),super.destroy(t)}}class Ve extends We{constructor(t,e){super(t,e),this.registration=e.controller,this.workerKeepAliveInterval=null,this.workerPortCount=0;const r=new URL(e.controller.scope);this.pathname=r.pathname+\"webtorrent\",this._address={port:r.port,family:\"IPv4\",address:r.hostname},this.boundHandler=this.wrapRequest.bind(this),navigator.serviceWorker.addEventListener(\"message\",this.boundHandler),fetch(`${this.pathname}/cancel/`).then((t=>{t.body.cancel()}))}wrapRequest(t){const e=t.data;if(\"webtorrent\"===!e?.type||!e.url)return null;const[r]=t.ports;this.onRequest(e,(({status:t,headers:e,body:i})=>{const n=i[Symbol.asyncIterator]?.(),s=()=>{r.onmessage=null,i?.destroy&&i.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};r.onmessage=async t=>{if(t.data){let t;try{t=(await n.next()).value}catch(t){}r.postMessage(t),t||s(),this.workerKeepAliveInterval||(this.workerKeepAliveInterval=setInterval((()=>fetch(`${this.pathname}/keepalive/`)),2e4))}else s()},this.workerPortCount++,r.postMessage({status:t,headers:e,body:n?\"STREAM\":i})}))}listen(t,e){e()}address(){return this._address}close(t){navigator.serviceWorker.removeEventListener(\"message\",this.boundHandler),super.close(t)}destroy(t){super.destroy(t)}}function $e(t,e){return`\\n \\n \\n \\n \\n ${t}\\n \\n \\n ${e}\\n \\n \\n `}function Ze(t){return encodeURIComponent(t).replace(/['()]/g,escape).replace(/\\*/g,\"%2A\").replace(/%(?:7C|60|5E)/g,unescape)}const Ge=Se,Je=A(\"webtorrent\"),Ye=Ge.replace(/\\d*./g,(t=>(\"0\"+t%100).slice(-2))).slice(0,4),Xe=`-WW${Ye}-`;class Qe extends a{constructor(t={}){super(),\"string\"==typeof t.peerId?this.peerId=t.peerId:ArrayBuffer.isView(t.peerId)?this.peerId=(0,b.V5)(t.peerId):this.peerId=(0,b.V5)((0,b.L0)(Xe+(0,b.NJ)((0,b.po)(9)))),this.peerIdBuffer=(0,b.fk)(this.peerId),\"string\"==typeof t.nodeId?this.nodeId=t.nodeId:ArrayBuffer.isView(t.nodeId)?this.nodeId=(0,b.V5)(t.nodeId):this.nodeId=(0,b.V5)((0,b.po)(20)),this.nodeIdBuffer=(0,b.fk)(this.nodeId),this._debugId=this.peerId.substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=t.torrentPort||0,this.dhtPort=t.dhtPort||0,this.tracker=void 0!==t.tracker?t.tracker:{},this.lsd=!1!==t.lsd,this.utPex=!1!==t.utPex,this.natUpnp=t.natUpnp??!0,this.natPmp=t.natPmp??!0,this.torrents=[],this.maxConns=Number(t.maxConns)||55,this.utp=Qe.UTP_SUPPORT&&!1!==t.utp,this._downloadLimit=Math.max(\"number\"==typeof t.downloadLimit?t.downloadLimit:-1,-1),this._uploadLimit=Math.max(\"number\"==typeof t.uploadLimit?t.uploadLimit:-1,-1),(this.natUpnp||this.natPmp)&&\"function\"==typeof Z&&(this.natTraversal=new Z({enableUPNP:this.natUpnp,enablePMP:this.natPmp,upnpPermanentFallback:\"permanent\"===t.natUpnp})),!0===t.secure&&Promise.resolve().then(n.bind(n,5310)).then((({enableSecure:t})=>t())),this._debug(\"new webtorrent (peerId %s, nodeId %s, port %s)\",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new $.ThrottleGroup({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new $.ThrottleGroup({rate:Math.max(this._uploadLimit,0),enabled:this._uploadLimit>=0})},this.tracker&&(\"object\"!=typeof this.tracker&&(this.tracker={}),globalThis.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=globalThis.WRTC)),\"function\"==typeof G?this._connPool=new G(this):y((()=>{this._onListening()})),this._downloadSpeed=V(),this._uploadSpeed=V(),!1!==t.dht&&\"function\"==typeof E.Client?(this.dht=new E.Client(Object.assign({},{nodeId:this.nodeId},t.dht)),this.dht.once(\"error\",(t=>{this._destroy(t)})),this.dht.once(\"listening\",(()=>{const t=this.dht.address();t&&(this.dhtPort=t.port,this.natTraversal&&this.natTraversal.map({publicPort:this.dhtPort,privatePort:this.dhtPort,protocol:\"udp\",description:\"WebTorrent DHT\"}).catch((t=>{Je(\"error mapping DHT port via UPnP/PMP: %o\",t)})))})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==t.webSeeds;const e=()=>{this.destroyed||(this.ready=!0,this.emit(\"ready\"))};\"function\"==typeof I&&null!=t.blocklist?I(t.blocklist,{headers:{\"user-agent\":`WebTorrent/${Ge} (https://webtorrent.io)`}},((t,r)=>{if(t)return console.error(`Failed to load blocklist: ${t.message}`);this.blocked=r,e()})):y(e)}createServer(t,e){if(this.destroyed)throw new Error(\"torrent is destroyed\");if(this._server)throw new Error(\"server already created\");if(\"undefined\"!=typeof window&&\"node\"!==e||\"browser\"===e){if(!(t?.controller instanceof ServiceWorkerRegistration))throw new Error(\"Invalid worker registration\");if(\"activated\"!==t.controller.active.state)throw new Error(\"Worker isn't activated\");return this._server=new Ve(this,t),this._server}return this._server=new Ke(this,t),this._server}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const t=this.torrents.filter((t=>1!==t.progress));return t.reduce(((t,e)=>t+e.downloaded),0)/(t.reduce(((t,e)=>t+(e.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((t,e)=>t+e.uploaded),0)/(this.torrents.reduce(((t,e)=>t+e.received),0)||1)}async get(t){if(t instanceof Ne){if(this.torrents.includes(t))return t}else{const e=this.torrents;let r;try{r=await N(t)}catch(t){}if(!r)return null;if(!r.infoHash)throw new Error(\"Invalid torrent identifier\");for(const t of e)if(t.infoHash===r.infoHash)return t}return null}add(t,e={},r=(()=>{})){if(this.destroyed)throw new Error(\"client is destroyed\");\"function\"==typeof e&&([e,r]=[{},e]);const i=()=>{if(!this.destroyed)for(const t of this.torrents)if(t.infoHash===s.infoHash&&t!==s)return s._destroy(new Error(`Cannot add duplicate torrent ${s.infoHash}`)),void r(t)},n=()=>{this.destroyed||(r(s),this.emit(\"torrent\",s))};this._debug(\"add\"),e=e?Object.assign({},e):{};const s=new Ne(t,this,e);return this.torrents.push(s),s.once(\"_infoHash\",i),s.once(\"ready\",n),s.once(\"close\",(function t(){s.removeListener(\"_infoHash\",i),s.removeListener(\"ready\",n),s.removeListener(\"close\",t)})),s}seed(t,e,r){if(this.destroyed)throw new Error(\"client is destroyed\");\"function\"==typeof e&&([e,r]=[{},e]),this._debug(\"seed\"),(e=e?Object.assign({},e):{}).skipVerify=!0;const i=\"string\"==typeof t;i&&(e.path=u.dirname(t)),e.createdBy||(e.createdBy=`WebTorrent/${Ye}`);const n=t=>{this._debug(\"on seed\"),\"function\"==typeof r&&r(t),t.emit(\"seed\"),this.emit(\"seed\",t)},s=this.add(null,e,(t=>{const r=[r=>{if(i||e.preloadedStore)return r();t.load(o,r)}];this.dht&&r.push((e=>{t.once(\"dhtAnnounce\",e)})),g(r,(e=>{if(!this.destroyed)return e?t._destroy(e):void n(t)}))}));let o;return\"undefined\"!=typeof FileList&&t instanceof FileList?t=Array.from(t):Array.isArray(t)||(t=[t]),g(t.map((t=>async r=>{if(!e.preloadedStore&&function(t){return\"object\"==typeof t&&null!=t&&\"function\"==typeof t.pipe}(t)){const e=[];try{for await(const r of t)e.push(r)}catch(t){return r(t)}const i=(0,b.xW)(e);i.name=t.name,r(null,i)}else r(null,t)})),((t,i)=>{if(!this.destroyed)return t?s._destroy(t):void function(t,e,r){\"function\"==typeof e&&([e,r]=[r,e]),M(t,e=e?Object.assign({},e):{},r)}(i,e,((t,n)=>{if(!this.destroyed){if(t)return s._destroy(t);o=n.map((t=>t.getStream)),function(t,e,r){\"function\"==typeof e&&([e,r]=[r,e]),M(t,e=e?Object.assign({},e):{},((t,i,n)=>{if(t)return r(t);e.singleFileTorrent=n,function(t,e,r){let i=e.announceList;i||(\"string\"==typeof e.announce?i=[[e.announce]]:Array.isArray(e.announce)&&(i=e.announce.map((t=>[t])))),i||(i=[]),globalThis.WEBTORRENT_ANNOUNCE&&(\"string\"==typeof globalThis.WEBTORRENT_ANNOUNCE?i.push([[globalThis.WEBTORRENT_ANNOUNCE]]):Array.isArray(globalThis.WEBTORRENT_ANNOUNCE)&&(i=i.concat(globalThis.WEBTORRENT_ANNOUNCE.map((t=>[t]))))),void 0===e.announce&&void 0===e.announceList&&(i=i.concat(w)),\"string\"==typeof e.urlList&&(e.urlList=[e.urlList]);const n={info:{name:e.name},\"creation date\":Math.ceil((Number(e.creationDate)||Date.now())/1e3),encoding:\"UTF-8\"};0!==i.length&&(n.announce=i[0][0],n[\"announce-list\"]=i),void 0!==e.comment&&(n.comment=e.comment),void 0!==e.createdBy&&(n[\"created by\"]=e.createdBy),void 0!==e.private&&(n.info.private=Number(e.private)),void 0!==e.info&&Object.assign(n.info,e.info),void 0!==e.sslCert&&(n.info[\"ssl-cert\"]=e.sslCert),void 0!==e.urlList&&(n[\"url-list\"]=e.urlList);const s=t.reduce(k,0),o=e.pieceLength||c(s);n.info[\"piece length\"]=o,async function(t,e,r,i,n){const s=[];let o=0,a=0;const h=t.map((t=>t.getStream)),u=i.onProgress;let f=0,c=0,d=!1;const p=l(m(h),e,{zeroPadding:!1});try{for await(const t of p)await new Promise((e=>{o+=t.length;const i=c;++c,++f<5&&e(),(0,b.tW)(t,\"hex\").then((h=>{s[i]=h,--f,a+=t.length,u&&u(a,r),e(),d&&0===f&&n(null,(0,b.fk)(s.join(\"\")),o)}))}));if(0===f)return n(null,(0,b.fk)(s.join(\"\")),o);d=!0}catch(t){n(t)}}(t,o,s,e,((i,s,o)=>{if(i)return r(i);n.info.pieces=s,t.forEach((t=>{delete t.getStream})),e.singleFileTorrent?n.info.length=o:n.info.files=t,r(null,f.A.encode(n))}))}(i,e,r)}))}(i,e,(async(t,e)=>{if(this.destroyed)return;if(t)return s._destroy(t);const i=await this.get(e);i?(console.warn(\"A torrent with the same id is already being seeded\"),s._destroy(),\"function\"==typeof r&&r(i)):s._onTorrentId(e)}))}}))})),s}async remove(t,e,r){if(\"function\"==typeof e)return this.remove(t,null,e);this._debug(\"remove\");const i=await this.get(t);if(!i)throw new Error(`No torrent with id ${t}`);this._remove(i,e,r)}_remove(t,e,r){if(t){if(\"function\"==typeof e)return this._remove(t,null,e);this.torrents.splice(this.torrents.indexOf(t),1),t.destroy(e,r),this.dht&&this.dht._tables.remove(t.infoHash)}}address(){return this.listening?this._connPool?this._connPool.tcpServer.address():{address:\"0.0.0.0\",family:\"IPv4\",port:0}:null}throttleDownload(t){return t=Number(t),!(isNaN(t)||!isFinite(t)||t<-1)&&(this._downloadLimit=t,this._downloadLimit<0?this.throttleGroups.down.setEnabled(!1):(this.throttleGroups.down.setEnabled(!0),void this.throttleGroups.down.setRate(this._downloadLimit)))}throttleUpload(t){return t=Number(t),!(isNaN(t)||!isFinite(t)||t<-1)&&(this._uploadLimit=t,this._uploadLimit<0?this.throttleGroups.up.setEnabled(!1):(this.throttleGroups.up.setEnabled(!0),void this.throttleGroups.up.setRate(this._uploadLimit)))}destroy(t){if(this.destroyed)throw new Error(\"client already destroyed\");this._destroy(null,t)}_destroy(t,e){this._debug(\"client destroy\"),this.destroyed=!0;const r=this.torrents.map((t=>e=>{t.destroy(e)}));this._connPool&&r.push((t=>{this._connPool.destroy(t)})),this.dht&&r.push((t=>{this.dht.destroy(t)})),this._server&&r.push((t=>{this._server.destroy(t)})),this.natTraversal&&r.push((t=>{this.natTraversal.destroy().then((()=>t()))})),g(r,e),t&&this.emit(\"error\",t),this.torrents=[],this._connPool=null,this.dht=null,this.throttleGroups.down.destroy(),this.throttleGroups.up.destroy()}_onListening(){if(this._debug(\"listening\"),this.listening=!0,this._connPool){const t=this._connPool.tcpServer.address();t&&(this.torrentPort=t.port,this.natTraversal&&this.natTraversal.map({publicPort:this.torrentPort,privatePort:this.torrentPort,protocol:this.utp?null:\"tcp\",description:\"WebTorrent Torrent\"}).catch((t=>{Je(\"error mapping WebTorrent port via UPnP/PMP: %o\",t)})))}this.emit(\"listening\")}_debug(){const t=[].slice.call(arguments);t[0]=`[${this._debugId}] ${t[0]}`,Je(...t)}async _getByHash(t){for(const e of this.torrents)if(e.infoHashHash||(e.infoHashHash=await(0,b.tW)((0,b.fk)(\"72657132\"+e.infoHash),\"hex\")),t===e.infoHashHash)return e;return null}}Qe.WEBRTC_SUPPORT=K.WEBRTC_SUPPORT,Qe.UTP_SUPPORT=G.UTP_SUPPORT,Qe.VERSION=Ge;var tr=n(6763),er=n.n(tr),rr=n(6011),ir=n.n(rr);function nr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function sr(t,e){var r=\"undefined\"!=typeof Symbol&&t[Symbol.iterator]||t[\"@@iterator\"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if(\"string\"==typeof t)return or(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return\"Object\"===r&&t.constructor&&(r=t.constructor.name),\"Map\"===r||\"Set\"===r?Array.from(t):\"Arguments\"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?or(t,e):void 0}}(t))||e&&t&&\"number\"==typeof t.length){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var s,o=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw s}}}}function or(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r=48)i=10*i+(o-48);else if(s!==e||43!==o){if(s!==e||45!==o){if(46===o)break;throw new Error(\"not a number: buffer[\"+s+\"] = \"+o)}n=-1}}return i*n}function dr(t){if(null==t||0===t.length)return{};var e,r=0;e=o.Buffer.isBuffer(t)?t:o.Buffer.from(t.buffer,t.byteOffset,t.byteLength);var i=function(){switch(e[r]){case 100:return a();case 108:return h();case 105:return u();default:return s()}},n=function(t){for(var i=r,n=e.length,s=e;it.length)&&(e=t.length);for(var r=0,i=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var s,o=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw s}}}}(t);try{for(i.s();!(e=i.n()).done;){var n=e.value;r+=\"string\"==typeof n||\"number\"==typeof n||\"boolean\"==typeof n?n+\",\\n\":JSON.stringify(n,void 0,4)+\",\\n\"}}catch(t){i.e(t)}finally{i.f()}return r.replace(/,\\n$/,\"\")}},{key:\"debug\",value:function(){if(\"debug\"===this.logLevel){for(var t=arguments.length,e=new Array(t),r=0;rt.length)&&(e=t.length);for(var r=0,i=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,r),Tr(Ir(t=xr(this,r)),\"torrent\",null),Tr(Ir(t),\"torrentCreated\",!1),Tr(Ir(t),\"peers\",{}),Tr(Ir(t),\"seen\",{}),Tr(Ir(t),\"api\",{}),Tr(Ir(t),\"callbacks\",{}),Tr(Ir(t),\"serveraddress\",null),Tr(Ir(t),\"heartbeattimer\",null),Tr(Ir(t),\"logLevel\",10);var s=n.identifier,a=n.announce,h=n.seed,u=n.loggingEnabled;return t.logger=new vr({scope:\"Meerkat\",enabled:u}),t.announce=a||[\"wss://tracker.openwebtorrent.com\",\"wss://dev.tracker.cf-identity-wallet.metadata.dev.cf-deployments.org\",\"wss://tracker.files.fm:7073/announce\",\"ws://tracker.files.fm:7072/announce\",\"wss://tracker.openwebtorrent.com:443/announce\"],t.seed=h||t.encodeseed(e().randomBytes(32)),t.keyPair=e().sign.keyPair.fromSeed(Uint8Array.from(i().decode(t.seed)).slice(2)),t.keyPairEncrypt=e().box.keyPair(),t.publicKey=er().encode(o.Buffer.from(t.keyPair.publicKey)),t.encryptedPublicKey=er().encode(o.Buffer.from(t.keyPairEncrypt.publicKey)),t.identifier=s||t.address(),t.logger.debug(\"Meerkat address: \".concat(t.identifier)),t.lastwirecount=null,t.webTorrent=new Qe({}),t.torrent=t.webTorrent.seed(o.Buffer.from(t.identifier),{name:t.identifier,announce:t.announce},(function(){t.emit(\"torrent\",t.identifier,t.torrent),t.torrent.discovery.tracker&&t.torrent.discovery.tracker.on(\"update\",(function(e){t.emit(\"tracker\",t.identifier,e)})),t.torrent.discovery.on(\"trackerAnnounce\",(function(){t.emit(\"announce\",t.identifier),t.connections()}))})),t.torrentCreated=!0,t.torrent.on(\"wire\",(function(e){return t.attach(e)})),t}var n,s,a;return function(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function\");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,\"prototype\",{writable:!1}),e&&Br(t,e)}(r,t),n=r,s=[{key:\"disableLogging\",value:function(){this.logger.disable()}},{key:\"enableLogging\",value:function(){this.logger.enable()}},{key:\"setLogLevel\",value:function(t){this.logger.logLevel=t}},{key:\"attach\",value:function(t){var e=this;t.use(this.extension(t)),t.on(\"close\",(function(){return e.detach(t)}))}},{key:\"detach\",value:function(t){this.emit(\"wireleft\",this.torrent.wires.length,t),this.connections()}},{key:\"extension\",value:function(t){var e,r,i,n=this,s=(e=this.identifier,r=this.publicKey,i=this.encryptedPublicKey,function(t){t.extendedHandshake.identifier=e,t.extendedHandshake.publicKey=r,t.extendedHandshake.encryptedPublicKey=i,this.wire=t});return s.prototype.name=Cr,s.prototype.onExtendedHandshake=function(e){return n.onExtendedHandshake(t,e)},s.prototype.onMessage=function(t){return n.onMessage(t)},s}},{key:\"onMessage\",value:function(t){var i=r.toHex(e().hash(t).slice(16)),n=(new Date).getTime();if(this.seen[i])this.logger.debug(\"already seen\",i);else{var s=dr(t);if(s.e&&s.n&&s.ek){var o=s.ek.toString(),a=e().box.open(s.e,s.n,er().decode(o),this.keyPairEncrypt.secretKey);s=a?dr(a):null}if(s&&s.p&&s.s){var h=hr(s.p),u=dr(h);if(void 0!==u.pk&&void 0!==u.ek&&void 0!==u.t&&void 0!==u.i){var f=u.pk.toString(),l=u.i.toString(),c=u.y?u.y.toString():\"\",d=e().sign.detached.verify(h,s.s,er().decode(f)),p=l===this.identifier,m=u.t+Rr>n;if(d&&p&&m){var g=u.ek.toString();if(this.sawPeer(f,g),\"m\"==c){var y=u.v.toString(),b=null;try{b=JSON.parse(y)}catch(t){this.logger.warn(t)}b&&this.emit(\"message\",this.address(f),b,u)}else if(\"r\"==c){var v,w=u.c.toString(),_=u.a.toString();try{v=JSON.parse(_)}catch(t){v=null,this.logger.error(\"Malformed args JSON: \".concat(_))}var M=u.rn||new Uint8Array;this.emit(\"rpc\",this.address(f),w,v,r.toHex(M)),this.rpcCall(f,w,v,M)}else if(\"rr\"===c){var k=r.toHex(u.rn);if(this.callbacks[k]){var S,x=\"\";void 0!==u.rr?x=u.rr.toString():this.logger.debug(\"Empty rr in rpc response.\");try{S=JSON.parse(x)}catch(t){this.logger.error(\"Malformed response JSON: \"+x),S=null}this.callbacks[k]&&S?(this.logger.debug(\"rpc-response\",this.address(f),k,S),this.emit(\"rpc-response\",this.address(f),k,S),this.callbacks[k](S),delete this.callbacks[k]):this.logger.debug(\"RPC response nonce not known:\",k)}else this.logger.debug(\"dropped response with no callback.\",k)}else if(\"p\"===c){var A=this.address(f);this.logger.debug(\"ping from\",A),this.emit(\"ping\",A)}else if(\"x\"===c){var E=this.address(f);this.logger.debug(\"got left from\",E),delete this.peers[E],this.emit(\"left\",E)}else this.logger.warn(\"unknown packet type\")}else this.logger.warn(\"dropping bad packet\",i,d,p,m)}else this.logger.debug(\"skipping packet with no payload\",i,s)}else this.logger.debug(\"packet has no payload\",i,s);this.sendRaw(t)}this.seen[i]=n}},{key:\"onExtendedHandshake\",value:function(t,e){this.emit(\"wireseen\",this.torrent.wires.length,t),this.connections(),this.sawPeer((new TextDecoder).decode(e.publicKey),(new TextDecoder).decode(e.encryptedPublicKey))}},{key:\"register\",value:function(t,e){this.api[t]=e}},{key:\"rpc\",value:function(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){};if(!this.peers[t])throw t+\" not seen - no public key.\";var o=this.peers[t].publicKey,a=e().randomBytes(8);this.callbacks[r.toHex(a)]=s,this.makeEncryptSendPacket(o,{y:\"r\",c:i,a:JSON.stringify(n),rn:a})}},{key:\"rpcCall\",value:function(t,e,r,i){var n=this,s={y:\"rr\",rn:i,rr:\"\"};this.api[e]?this.api[e](this.address(t),r,(function(e){s.rr=JSON.stringify(e),n.makeEncryptSendPacket(t,s)})):(s.rr=JSON.stringify({error:\"No such API call.\"}),this.makeEncryptSendPacket(t,s))}},{key:\"makeEncryptSendPacket\",value:function(t,e){var r=this.makePacket(e),i=this.encryptPacket(t,r);this.sendRaw(i)}},{key:\"encryptPacket\",value:function(t,r){if(!this.peers[this.address(t)])throw this.address(t)+\" not seen - no encryption key.\";var i=e().randomBytes(e().box.nonceLength);return hr({n:i,ek:er().encode(o.Buffer.from(this.keyPairEncrypt.publicKey)),e:e().box(r,i,er().decode(this.peers[this.address(t)].encryptedPublicKey),this.keyPairEncrypt.secretKey)})}},{key:\"sawPeer\",value:function(t,e){var r=(new Date).getTime(),i=this.address(t);if(i!=this.address())if(!this.peers[i]||this.peers[i].last+Rr=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var s,o=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw s}}}}(this.torrent.wires);try{for(r.s();!(e=r.n()).done;){var i=e.value,n=i.peerExtendedHandshake;n&&n.m&&n.m[Cr]&&i.extended(Cr,t)}}catch(t){r.e(t)}finally{r.f()}}},{key:\"makePacket\",value:function(t){var r=Mr(Mr({},t),{},{t:(new Date).getTime(),i:this.identifier,pk:this.publicKey,ek:this.encryptedPublicKey,n:e().randomBytes(8)}),i=hr(r);return hr({s:e().sign.detached(i,this.keyPair.secretKey),p:r})}},{key:\"encodeAddress\",value:function(t){return i().encode(o.Buffer.concat([o.Buffer.from(\"55\",\"hex\"),(new(ir())).update(o.Buffer.from(e().hash(t))).digest()]))}},{key:\"address\",value:function(t){var e;return e=\"string\"==typeof t?er().decode(t):this.keyPair.publicKey,this.encodeAddress(e)}},{key:\"heartbeat\",value:function(t){throw new Error(\"Method not implemented.\")}},{key:\"encodeseed\",value:function(t){return i().encode(o.Buffer.concat([o.Buffer.from(\"490a\",\"hex\"),o.Buffer.from(t)]))}}],a=[{key:\"toHex\",value:function(t){return void 0===t?\"\":o.Buffer.from(t).toString(\"hex\")}}],s&&Sr(n.prototype,s),a&&Sr(n,a),Object.defineProperty(n,\"prototype\",{writable:!1}),r}(h())})(),s.default})()));\n//# sourceMappingURL=meerkat.min.js.map","/**\n * @fileoverview\n * - modified davidshimjs/qrcodejs library for use in node.js\n * - Using the 'QRCode for Javascript library'\n * - Fixed dataset of 'QRCode for Javascript library' for support full-spec.\n * - this library has no dependencies.\n *\n * @version 0.9.1 (2016-02-12)\n * @author davidshimjs, papnkukn\n * @see http://www.d-project.com/\n * @see http://jeromeetienne.github.com/jquery-qrcode/\n * @see https://github.com/davidshimjs/qrcodejs\n */\n\n//---------------------------------------------------------------------\n// QRCode for JavaScript\n//\n// Copyright (c) 2009 Kazuhiko Arase\n//\n// URL: http://www.d-project.com/\n//\n// Licensed under the MIT license:\n// http://www.opensource.org/licenses/mit-license.php\n//\n// The word \"QR Code\" is registered trademark of \n// DENSO WAVE INCORPORATED\n// http://www.denso-wave.com/qrcode/faqpatent-e.html\n//\n//---------------------------------------------------------------------\nfunction QR8bitByte(data) {\n this.mode = QRMode.MODE_8BIT_BYTE;\n this.data = data;\n this.parsedData = [];\n\n // Added to support UTF-8 Characters\n for (var i = 0, l = this.data.length; i < l; i++) {\n var byteArray = [];\n var code = this.data.charCodeAt(i);\n\n if (code > 0x10000) {\n byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);\n byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);\n byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);\n byteArray[3] = 0x80 | (code & 0x3F);\n } else if (code > 0x800) {\n byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);\n byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);\n byteArray[2] = 0x80 | (code & 0x3F);\n } else if (code > 0x80) {\n byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);\n byteArray[1] = 0x80 | (code & 0x3F);\n } else {\n byteArray[0] = code;\n }\n\n this.parsedData.push(byteArray);\n }\n\n this.parsedData = Array.prototype.concat.apply([], this.parsedData);\n\n if (this.parsedData.length != this.data.length) {\n this.parsedData.unshift(191);\n this.parsedData.unshift(187);\n this.parsedData.unshift(239);\n }\n}\n\nQR8bitByte.prototype = {\n getLength: function (buffer) {\n return this.parsedData.length;\n },\n write: function (buffer) {\n for (var i = 0, l = this.parsedData.length; i < l; i++) {\n buffer.put(this.parsedData[i], 8);\n }\n }\n};\n\nfunction QRCodeModel(typeNumber, errorCorrectLevel) {\n this.typeNumber = typeNumber;\n this.errorCorrectLevel = errorCorrectLevel;\n this.modules = null;\n this.moduleCount = 0;\n this.dataCache = null;\n this.dataList = [];\n}\n\nQRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+\",\"+col);}\nreturn this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row=7){this.setupTypeNumber(test);}\nif(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);}\nthis.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}}\nreturn pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;}\nfor(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}}\nfor(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}}\nthis.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex>>bitIndex)&1)==1);}\nvar mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;}\nthis.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}}\nrow+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;itotalDataCount*8){throw new Error(\"code length overflow. (\"\n+buffer.getLengthInBits()\n+\">\"\n+totalDataCount*8\n+\")\");}\nif(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);}\nwhile(buffer.getLengthInBits()%8!=0){buffer.putBit(false);}\nwhile(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;}\nbuffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;}\nbuffer.put(QRCodeModel.PAD1,8);}\nreturn QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r=0)?modPoly.get(modIndex):0;}}\nvar totalCodeCount=0;for(var i=0;i=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));}\nreturn((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));}\nreturn(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;}\nreturn digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error(\"bad maskPattern:\"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i5){lostPoint+=(3+sameCount-5);}}}\nfor(var row=0;row=256){n-=255;}\nreturn QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);}\nif(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));}\nthis.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];\n\n\n/** Constructor */\nfunction QRCode(options) {\n var instance = this;\n \n //Default options\n this.options = {\n padding: 4,\n width: 256, \n height: 256,\n typeNumber: 4,\n color: \"#000000\",\n background: \"#ffffff\",\n ecl: \"M\"\n };\n \n //In case the options is string\n if (typeof options === 'string') {\n options = {\n content: options\n };\n }\n \n //Merge options\n if (options) {\n for (var i in options) {\n this.options[i] = options[i];\n }\n }\n \n if (typeof this.options.content !== 'string') {\n throw new Error(\"Expected 'content' as string!\");\n }\n \n if (this.options.content.length === 0 /* || this.options.content.length > 7089 */) {\n throw new Error(\"Expected 'content' to be non-empty!\");\n }\n \n if (!(this.options.padding >= 0)) {\n throw new Error(\"Expected 'padding' value to be non-negative!\");\n }\n \n if (!(this.options.width > 0) || !(this.options.height > 0)) {\n throw new Error(\"Expected 'width' or 'height' value to be higher than zero!\");\n }\n \n //Gets the error correction level\n function _getErrorCorrectLevel(ecl) {\n switch (ecl) {\n case \"L\":\n return QRErrorCorrectLevel.L;\n \n case \"M\":\n return QRErrorCorrectLevel.M;\n \n case \"Q\":\n return QRErrorCorrectLevel.Q;\n \n case \"H\":\n return QRErrorCorrectLevel.H;\n \n default:\n throw new Error(\"Unknwon error correction level: \" + ecl);\n }\n }\n \n //Get type number\n function _getTypeNumber(content, ecl) { \n var length = _getUTF8Length(content);\n \n var type = 1;\n var limit = 0;\n for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {\n var table = QRCodeLimitLength[i];\n if (!table) {\n throw new Error(\"Content too long: expected \" + limit + \" but got \" + length);\n }\n \n switch (ecl) {\n case \"L\":\n limit = table[0];\n break;\n \n case \"M\":\n limit = table[1];\n break;\n \n case \"Q\":\n limit = table[2];\n break;\n \n case \"H\":\n limit = table[3];\n break;\n \n default:\n throw new Error(\"Unknwon error correction level: \" + ecl);\n }\n \n if (length <= limit) {\n break;\n }\n \n type++;\n }\n \n if (type > QRCodeLimitLength.length) {\n throw new Error(\"Content too long\");\n }\n \n return type;\n }\n\n //Gets text length\n function _getUTF8Length(content) {\n var result = encodeURI(content).toString().replace(/\\%[0-9a-fA-F]{2}/g, 'a');\n return result.length + (result.length != content ? 3 : 0);\n }\n \n //Generate QR Code matrix\n var content = this.options.content;\n var type = _getTypeNumber(content, this.options.ecl);\n var ecl = _getErrorCorrectLevel(this.options.ecl);\n this.qrcode = new QRCodeModel(type, ecl);\n this.qrcode.addData(content);\n this.qrcode.make();\n}\n\n/** Generates QR Code as SVG image */\nQRCode.prototype.svg = function(opt) {\n var options = this.options || { };\n var modules = this.qrcode.modules;\n \n if (typeof opt == \"undefined\") {\n opt = { container: options.container || \"svg\" };\n }\n \n //Apply new lines and indents in SVG?\n var pretty = typeof options.pretty != \"undefined\" ? !!options.pretty : true;\n \n var indent = pretty ? ' ' : '';\n var EOL = pretty ? '\\r\\n' : '';\n var width = options.width;\n var height = options.height;\n var length = modules.length;\n var xsize = width / (length + 2 * options.padding);\n var ysize = height / (length + 2 * options.padding);\n \n //Join (union, merge) rectangles into one shape?\n var join = typeof options.join != \"undefined\" ? !!options.join : false;\n \n //Swap the X and Y modules, pull request #2\n var swap = typeof options.swap != \"undefined\" ? !!options.swap : false;\n \n //Apply declaration in SVG?\n var xmlDeclaration = typeof options.xmlDeclaration != \"undefined\" ? !!options.xmlDeclaration : true;\n \n //Populate with predefined shape instead of \"rect\" elements, thanks to @kkocdko\n var predefined = typeof options.predefined != \"undefined\" ? !!options.predefined : false;\n var defs = predefined ? indent + '' + EOL : '';\n \n //Background rectangle\n var bgrect = indent + '' + EOL;\n \n //Rectangles representing modules\n var modrect = '';\n var pathdata = '';\n\n for (var y = 0; y < length; y++) {\n for (var x = 0; x < length; x++) {\n var module = modules[x][y];\n if (module) {\n \n var px = (x * xsize + options.padding * xsize);\n var py = (y * ysize + options.padding * ysize);\n \n //Some users have had issues with the QR Code, thanks to @danioso for the solution\n if (swap) {\n var t = px;\n px = py;\n py = t;\n }\n \n if (join) {\n //Module as a part of svg path data, thanks to @danioso\n var w = xsize + px\n var h = ysize + py\n\n px = (Number.isInteger(px))? Number(px): px.toFixed(2);\n py = (Number.isInteger(py))? Number(py): py.toFixed(2);\n w = (Number.isInteger(w))? Number(w): w.toFixed(2);\n h = (Number.isInteger(h))? Number(h): h.toFixed(2);\n\n pathdata += ('M' + px + ',' + py + ' V' + h + ' H' + w + ' V' + py + ' H' + px + ' Z ');\n }\n else if (predefined) {\n //Module as a predefined shape, thanks to @kkocdko\n modrect += indent + '' + EOL;\n }\n else {\n //Module as rectangle element\n modrect += indent + '' + EOL;\n }\n }\n }\n }\n \n if (join) {\n modrect = indent + '';\n }\n\n var svg = \"\";\n switch (opt.container) {\n //Wrapped in SVG document\n case \"svg\":\n if (xmlDeclaration) {\n svg += '' + EOL;\n }\n svg += '' + EOL;\n svg += defs + bgrect + modrect;\n svg += '';\n break;\n \n //Viewbox for responsive use in a browser, thanks to @danioso\n case \"svg-viewbox\":\n if (xmlDeclaration) {\n svg += '' + EOL;\n }\n svg += '' + EOL;\n svg += defs + bgrect + modrect;\n svg += '';\n break;\n \n \n //Wrapped in group element \n case \"g\":\n svg += '' + EOL;\n svg += defs + bgrect + modrect;\n svg += '';\n break;\n \n //Without a container\n default:\n svg += (defs + bgrect + modrect).replace(/^\\s+/, \"\"); //Clear indents on each line\n break;\n }\n \n return svg;\n};\n\n/** Writes QR Code image to a file */\nQRCode.prototype.save = function(file, callback) {\n var data = this.svg();\n if (typeof callback != \"function\") {\n callback = function(error, result) { };\n }\n try {\n //Package 'fs' is available in node.js but not in a web browser\n var fs = require('fs');\n fs.writeFile(file, data, callback);\n }\n catch (e) {\n //Sorry, 'fs' is not available\n callback(e);\n }\n};\n\nif (typeof module != \"undefined\") {\n module.exports = QRCode;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export default class AutoConnectHelper {\n private static storageKey = 'cardano-peer-autoconnect-id';\n private static discoveryStorageKey = 'cardano-peer-discovery-id';\n private static walletDiscoveryStorageKey = 'cardano-wallet-discovery-address';\n\n public static addAutoConnectId = (id: string): void => {\n let autoConnectIds = [];\n\n const ids = localStorage.getItem(this.storageKey);\n\n if (ids !== null) {\n autoConnectIds = JSON.parse(ids);\n }\n\n if (this.isAutoConnectId(id)) {\n return;\n }\n\n autoConnectIds.push(id);\n\n localStorage.setItem(this.storageKey, JSON.stringify(autoConnectIds));\n };\n\n public static getAutoConnectIds = (): string[] => {\n return JSON.parse(localStorage.getItem(this.storageKey) ?? '[]');\n };\n\n public static isAutoConnectId = (id: string): boolean => {\n return this.getAutoConnectIds().includes(id);\n };\n\n public static resetAutoConnectIds = (): void => {\n localStorage.setItem(this.storageKey, JSON.stringify([]));\n };\n\n public static removeAutoConnectId = (id: string): void => {\n let autoConnectIds = [];\n const ids = localStorage.getItem(this.storageKey);\n\n if (ids !== null) {\n autoConnectIds = JSON.parse(ids);\n }\n\n const index = autoConnectIds.indexOf(id);\n\n if (index !== -1) {\n autoConnectIds = autoConnectIds.splice(index, 1);\n\n localStorage.setItem(this.storageKey, JSON.stringify(autoConnectIds));\n return;\n }\n };\n\n public static saveWalletAutoDiscoverySeed = (id: string): void => {\n localStorage.setItem(this.discoveryStorageKey, id);\n };\n\n public static getWalletAutoDiscoverySeed = (): string | null => {\n return localStorage.getItem(this.discoveryStorageKey);\n };\n\n public static saveWalletDiscoveryAddress = (id: string): void => {\n localStorage.setItem(this.walletDiscoveryStorageKey, id);\n };\n\n public static getWalletDiscoveryAddress = (): string | null => {\n return localStorage.getItem(this.walletDiscoveryStorageKey);\n };\n}\n","import { identicon } from '@basementuniverse/marble-identicons';\n\nexport default class PeerConnectIdenticon {\n public static getBase64Identicon = (hash: string): string | null => {\n if (hash.length < 68) {\n console.warn(\n 'Meerkat connection hash is to short. Not generating identicon.'\n );\n\n return null;\n }\n\n return identicon(\n hash\n .split('')\n .reverse()\n .map((char: string, index: number) =>\n index > 0 && index % 10 === 0 ? '-' : char\n )\n .join(''),\n {\n size: 100,\n baseSeed: 'cardano-peer-connect',\n fontSize: 0.17,\n initialsColours: ['#000000', '#FF0000', '#0000FF'],\n }\n ).toDataURL();\n };\n}\n","/**\n * The ExperimentalContainer is a utility designed to facilitate communication\n * between two distributed systems, such as Peer DApps, by serializing an\n * object's structure, properties, and functions. This allows the object to\n * be transferred to a remote system, which can then interact with the object\n * without prior knowledge of its structure or implementation details.\n *\n * By capturing the blueprint of an object, including its properties and\n * functions, and converting it into a transferable format called TypeMapping,\n * the ExperimentalContainer enables seamless integration between different\n * systems. The receiving system, or Peer DApp, can use this blueprint to\n * interact with the object as if it had direct knowledge of the object's\n * structure. This is particularly useful when the remote system needs to call\n * the other endpoint or interact with it in a more complex manner, as it can\n * do so without requiring prior knowledge of the specific object.\n *\n * In summary, the ExperimentalContainer provides a powerful tool for\n * facilitating communication between distributed systems like Peer DApps by\n * allowing them to share and interact with objects without needing to know\n * the details of their implementation. This enables seamless integration and\n * interaction between different systems, even when they need to call each\n * other's endpoints or perform complex operations.\n */\nimport { ExperimentalRpcEndpoint } from '../types';\nimport Meerkat from '@fabianbormann/meerkat';\n\n// The Value type represents all possible types of values in a DynamicObject.\nexport type Value = string | number | boolean | symbol | bigint | object | null\n | ((...args: any[]) => any)\n | ((...args: any[]) => Promise);\n\n/**\n * The ExperimentalContainer class allows adding properties and functions of\n * various types, and provides methods to set and get these values using their\n * keys.\n *\n * The ExperimentalContainer is used to store properties and functions of\n * a wallets experimental features.\n */\nexport class ExperimentalContainer> {\n /**\n * The constructor takes an object of type T and assigns its properties\n * to the class instance using Object.assign.\n */\n constructor(obj: T) {\n Object.assign(this, obj);\n }\n\n /**\n * The get method retrieves the value of the specified key.\n * @param key The key of the property or function to retrieve.\n * @returns The value of the specified key.\n */\n get(key: K): T[K] {\n return (this as unknown as T)[key];\n }\n\n /**\n * The set method sets the value of the specified key.\n * @param key The key of the property or function to set.\n * @param value The new value to set for the specified key.\n */\n set(key: K, value: T[K]): void {\n (this as unknown as T)[key] = value;\n }\n}\n\n// The ValueType type represents all possible value types in a TypeMapping.\nexport type ValueType = \"string\" | \"number\" | \"boolean\" | \"symbol\" | \"bigint\" | \"object\" | \"null\" | \"function\" | \"async_function\";\n\n// The TypeInfo interface represents the type information for each property or function.\nexport interface TypeInfo {\n valueType: ValueType;\n value?: Value; // Add an optional value property for non-function values\n}\n\n// The TypeMapping type is a Map that stores the type information for each property or function.\nexport type TypeMapping = Map;\n\n/**\n * The createTypeMapping function generates a TypeMapping for an object.\n * @param obj The object for which to create a TypeMapping.\n * @returns A TypeMapping containing the type information and values for each property or function in the object.\n */\nexport function createTypeMapping>(obj: T): TypeMapping {\n const typeMapping = new Map();\n\n for (const key in obj) {\n const value = obj[key];\n let valueType: ValueType;\n\n if (typeof value === \"function\") {\n valueType = value.constructor.name === \"AsyncFunction\" ? \"async_function\" : \"function\";\n typeMapping.set(key, { valueType });\n } else if (typeof value === \"object\") {\n valueType = \"object\";\n typeMapping.set(key, { valueType, value: JSON.parse(JSON.stringify(value)) }); // Deep copy the object value\n } else {\n valueType = typeof value as ValueType;\n typeMapping.set(key, { valueType, value }); // Include the value for non-function properties\n }\n }\n\n return typeMapping;\n}\n\n/**\n * Execute the function or retrieve the property value from an object using a given TypeMapping.\n * @param container The object containing the properties and functions to interact with.\n * @param name The name of the property or function to retrieve or call.\n * @param args Optional arguments for the function if `name` corresponds to a function.\n * @returns The result of calling the function or the value of the property, or an error if the name is not found.\n */\nexport async function executeOrGetProperty(\n container: ExperimentalContainer,\n name: string,\n ...args: any[]\n): Promise {\n\n const typeMapping = createTypeMapping(container);\n const typeInfo = typeMapping.get(name);\n\n if (!typeInfo) {\n throw new Error(`No property or function with the name '${name}' found.`);\n }\n\n if (typeInfo.valueType === \"function\" || typeInfo.valueType === \"async_function\") {\n const fn: (...args: any[]) => any | Promise = (container as any)[name];\n return await fn(...args);\n } else {\n return (container as any)[name];\n }\n}\n\n\n/**\n * Serializes a type mapping object into a JSON string representation.\n * The serialized string can be easily transmitted or stored and later deserialized back into a type mapping object.\n *\n * @param typeMapping A type mapping object containing information about methods and properties.\n * @returns A JSON string representation of the type mapping object.\n */\nexport function serializeTypeMapping(typeMapping: TypeMapping): string {\n const plainObj: Record = {};\n\n typeMapping.forEach((value, key) => {\n plainObj[key] = value;\n });\n\n return JSON.stringify(plainObj);\n}\n\n/**\n * Deserializes a serialized type mapping JSON string into a type mapping object.\n * The deserialized object can be used to interact with the remote endpoint or for reconstructing the original object.\n *\n * @param serializedTypeMapping A JSON string representation of a type mapping object.\n * @returns A type mapping object containing information about methods and properties.\n */\nexport function deserializeTypeMapping(jsonString: string): TypeMapping {\n const plainObj: Record = JSON.parse(jsonString);\n const typeMapping = new Map();\n\n for (const key in plainObj) {\n typeMapping.set(key, plainObj[key]);\n }\n\n return typeMapping;\n}\n\n/**\n * Builds a set of API calls for a given Meerkat instance, address, serialized API mapping, and remote endpoint.\n * The function creates an object containing methods and properties from the serialized API mapping, making it\n * easy to interact with the remote endpoint.\n *\n * @param meerkat A Meerkat instance used to perform JSON-RPC calls.\n * @param address The address to send to.\n * @param serializedApiMapping A string created from serializeTypeMapping.\n * @param endpoint Remote endpoint to call.\n * @returns An object containing methods and properties for the specified experimental mapping.\n */\nexport const buildApiCalls = (\n meerkat: Meerkat,\n address: string,\n serializedApiMapping: string,\n endpoint: ExperimentalRpcEndpoint\n): Record => {\n\n const experimentalMapping = deserializeTypeMapping(serializedApiMapping);\n\n const apiObjectRecord: Record = {};\n\n for (const method of experimentalMapping.keys()) {\n const typeInfo = experimentalMapping.get(method);\n\n if (!typeInfo) continue;\n\n if (typeInfo.valueType === \"function\" || typeInfo.valueType === \"async_function\") {\n apiObjectRecord[method] = (...params: Array) => {\n // Default to an empty array if params are undefined.\n params = params ?? [];\n\n return new Promise((resolve, reject) => {\n meerkat.rpc(address, endpoint, [method, ...params], (result: any) => {\n if (result.error) {\n reject(result.error)\n } else {\n resolve(result)\n }\n });\n });\n };\n } else {\n\n // dealing with non-function properties.\n apiObjectRecord[method] = typeInfo.value ?? null;\n }\n }\n\n return apiObjectRecord;\n};\n\n\n/**\n * Registers an experimental endpoint with a Meerkat instance, enabling the remote endpoint to interact with\n * the given experimental container. The function associates the specified identifier with the experimental\n * container and sets up a callback to handle incoming requests.\n *\n * @param meerkat A Meerkat instance used to register the experimental endpoint.\n * @param endpoint The experimental RPC endpoint to be registered.\n * @param experimentalContainer An ExperimentalContainer instance containing methods and properties to be exposed.\n * @param identifier A unique string identifier to associate with the experimental container.\n */\nexport const registerExperimentalEndpoint = (\n meerkat: Meerkat,\n endpoint: ExperimentalRpcEndpoint,\n experimentalContainer: ExperimentalContainer,\n identifier: string\n) => {\n\n meerkat.register(\n endpoint,\n async (address: string, args: Array, callback: Function) => {\n\n const functionName = args[0] as string;\n\n if (address === identifier) {\n\n const result = await executeOrGetProperty(experimentalContainer, functionName, ...args.splice(1))\n\n if (typeof result !== 'undefined') {\n callback(result);\n }\n }\n }\n )\n}\n","import Meerkat from '@fabianbormann/meerkat';\nimport type {\n Cip30Function,\n Cbor,\n Paginate,\n Bytes,\n Cip30DataSignature,\n IConnectMessage,\n IWalletInfo,\n} from './types';\nimport {\n Value,\n ExperimentalContainer,\n createTypeMapping,\n serializeTypeMapping,\n registerExperimentalEndpoint,\n} from './lib/ExperimentalContainer';\nimport { LogLevel } from '@fabianbormann/meerkat/dist/types';\nimport AutoConnectHelper from './lib/AutoConnectHelper';\nimport PeerConnectIdenticon from './lib/PeerConnectIdenticon';\n\nexport default abstract class CardanoPeerConnect {\n protected meerkats: Map = new Map();\n protected walletInfo: IWalletInfo;\n protected onConnect: (connectMessage: IConnectMessage) => void;\n protected onDisconnect: (connectMessage: IConnectMessage) => void;\n protected onServerShutdown: (connectMessage: IConnectMessage) => void;\n protected onApiInject: (connectMessage: IConnectMessage) => void;\n protected identicon: string | null = null;\n protected meerkat: Meerkat | null = null;\n protected logLevel: LogLevel = 'info';\n\n protected DAppDiscoveryMeerkat: Meerkat | null = null;\n // https://cips.cardano.org/cips/cip30/\n protected cip30Functions: Array = [\n 'getNetworkId',\n 'getUtxos',\n 'getCollateral',\n 'getBalance',\n 'getUsedAddresses',\n 'getUnusedAddresses',\n 'getChangeAddress',\n 'getRewardAddresses',\n 'signTx',\n 'signData',\n 'submitTx',\n ];\n protected _cip30ExperimentalApi?: ExperimentalContainer;\n protected _cip30EnableExperimentalApi?: ExperimentalContainer;\n\n protected seed: string | null;\n protected discoverySeed: string | null;\n protected announceEndpoints: string[];\n\n constructor(\n walletInfo: IWalletInfo,\n args: {\n seed?: string | null;\n announce?: string[];\n discoverySeed?: string | null;\n logLevel?: LogLevel;\n } = {}\n ) {\n this.walletInfo = walletInfo;\n\n this.seed = args.seed ?? null;\n this.discoverySeed = args.discoverySeed ?? null;\n this.announceEndpoints = args.announce ?? [\n 'wss://tracker.openwebtorrent.com',\n 'wss://dev.tracker.cf-identity-wallet.metadata.dev.cf-deployments.org',\n 'wss://tracker.files.fm:7073/announce',\n 'ws://tracker.files.fm:7072/announce',\n 'wss://tracker.openwebtorrent.com:443/announce',\n ];\n this.logLevel = args.logLevel ?? 'info';\n\n this.onConnect = (connectMessage: IConnectMessage) => {};\n this.onDisconnect = (connectMessage: IConnectMessage) => {};\n this.onServerShutdown = () => {};\n this.onApiInject = () => {};\n\n this.setUpDiscoveryMeerkat();\n }\n\n protected setLogLevel = (level: LogLevel) => {\n this.logLevel = level;\n\n if (this.meerkat) {\n this.meerkat.logger.logLevel = level;\n }\n if (this.DAppDiscoveryMeerkat) {\n this.DAppDiscoveryMeerkat.logger.logLevel = level;\n }\n };\n\n protected setUpDiscoveryMeerkat = () => {\n this.DAppDiscoveryMeerkat = new Meerkat({\n announce: this.announceEndpoints,\n seed: this.discoverySeed ? this.discoverySeed : undefined,\n loggingEnabled: true,\n }).setMaxListeners(20);\n\n this.clearSeen();\n\n this.DAppDiscoveryMeerkat.logger.logLevel = this.logLevel;\n\n this.DAppDiscoveryMeerkat?.logger.debug(\n 'WALLET: discovery address:',\n this.DAppDiscoveryMeerkat.address()\n );\n\n if (!this.discoverySeed) {\n AutoConnectHelper.saveWalletAutoDiscoverySeed(\n this.DAppDiscoveryMeerkat.seed\n );\n }\n\n this.DAppDiscoveryMeerkat.register(\n 'connect',\n (\n address: string,\n params: { dappAddress: string },\n callback: (args: any) => void\n ) => {\n this.DAppDiscoveryMeerkat?.logger.debug(\n 'Wallet: DApp is connecting to discovery server!',\n params.dappAddress\n );\n\n this.connect(params.dappAddress);\n\n callback(true);\n }\n );\n\n this.addMeerkat(\n this.DAppDiscoveryMeerkat.address(),\n this.DAppDiscoveryMeerkat\n );\n };\n\n public getDiscoveryMeerkatSeed = (): string | null => {\n return this.DAppDiscoveryMeerkat?.seed ?? null;\n };\n\n public getDiscoveryMeerkatAddress = (): string | null => {\n return this.DAppDiscoveryMeerkat?.address() ?? null;\n };\n\n public setOnConnect = (\n onConnectCallback: (connectMessage: IConnectMessage) => void\n ) => {\n this.onConnect = onConnectCallback;\n };\n\n public setOnDisconnect = (\n onDisconnectCallback: (connectMessage: IConnectMessage) => void\n ) => {\n this.onDisconnect = onDisconnectCallback;\n };\n\n public setOnServerShutdown = (\n onServerShutdown: (connectMessage: IConnectMessage) => void\n ) => {\n this.onServerShutdown = onServerShutdown;\n };\n\n public setOnApiInject = (\n onApiInject: (connectMessage: IConnectMessage) => void\n ) => {\n this.onApiInject = onApiInject;\n };\n\n public setExperimentalApi>(\n dynamicObj: ExperimentalContainer\n ): void {\n this._cip30ExperimentalApi = dynamicObj;\n }\n\n public setEnableExperimentalApi>(\n dynamicObj: ExperimentalContainer\n ): void {\n this._cip30EnableExperimentalApi = dynamicObj;\n }\n\n public getMeercat(identifier: string): Meerkat | undefined {\n return this.meerkats.get(identifier);\n }\n\n public clearSeen = () => {\n if (this.meerkat) {\n this.meerkat.logger.debug('WALLET: meerkat clear all seen clients.');\n this.meerkat.seen = {};\n }\n\n if (this.DAppDiscoveryMeerkat) {\n this.DAppDiscoveryMeerkat.logger.debug(\n 'WALLET: discovery meerkat clear all seen clients.'\n );\n this.DAppDiscoveryMeerkat.seen = {};\n }\n };\n\n public injectApi = (identifier: string, overwrite: boolean = false) => {\n if (!this.meerkat) {\n throw new Error('Merrkat not connected.');\n }\n\n const expApiTypeMapping = createTypeMapping(\n this._cip30ExperimentalApi ?? new ExperimentalContainer({})\n );\n const expFullApiTypeMapping = createTypeMapping(\n this._cip30EnableExperimentalApi ?? new ExperimentalContainer({})\n );\n\n let args = {\n api: {\n apiVersion: this.walletInfo.version,\n name: this.walletInfo.name,\n icon: this.walletInfo.icon,\n methods: this.cip30Functions,\n experimentalApi: serializeTypeMapping(expApiTypeMapping),\n fullExperimentalApi: serializeTypeMapping(expFullApiTypeMapping),\n },\n overwrite: overwrite,\n };\n\n this.meerkat.rpc(\n identifier,\n 'api',\n args,\n (connectMessage: IConnectMessage) => {\n if (!this.meerkat) {\n throw new Error('Meerkat not connected.');\n }\n\n if (connectMessage.error) {\n this.meerkat.logger.warn(\n 'Api could note be injected. Error: ' + connectMessage.errorMessage\n ? connectMessage.errorMessage\n : 'unknown error.'\n );\n }\n\n this.onApiInject(connectMessage);\n }\n );\n };\n\n public connect(identifier: string): string {\n this.meerkat = new Meerkat({\n identifier: identifier,\n announce: this.announceEndpoints,\n seed: this.seed ?? undefined,\n }).setMaxListeners(20);\n this.meerkat.logger.logLevel = this.logLevel;\n\n this.meerkat?.logger.debug(\n 'WALLET: calling to connect to DApp:',\n identifier\n );\n\n this.meerkat.register(\n 'shutdown',\n async (address: string, args: IConnectMessage, callback: Function) => {\n if (address !== args.dApp.address) {\n throw new Error(\n `Address ${args.address} tries to send shutdown for server, ${args.address}.`\n );\n }\n\n this.clearSeen();\n this.onServerShutdown(args);\n\n this.meerkat?.logger.debug(\n 'WALLET: setup discovery again after server did shutdown.'\n );\n\n this.setUpDiscoveryMeerkat();\n }\n );\n\n this.meerkat.register(\n 'invoke',\n async (address: string, args: Array, callback: Function) => {\n const cip30Function = args[0] as Cip30Function;\n\n if (address === identifier) {\n const result = await (this[cip30Function])(...args.splice(1));\n if (typeof result !== 'undefined') {\n callback(result);\n }\n }\n }\n );\n\n registerExperimentalEndpoint(\n this.meerkat,\n 'invokeExperimental',\n this._cip30ExperimentalApi!,\n identifier\n );\n registerExperimentalEndpoint(\n this.meerkat,\n 'invokeEnableExperimental',\n this._cip30EnableExperimentalApi!,\n identifier\n );\n\n this.meerkat.on('server', () => {\n this.meerkat?.logger.debug(\n 'WALLET: DApp server seen, create connection!'\n );\n\n if (!this.meerkat) {\n throw new Error('Meerkat not connected.');\n }\n\n this.meerkat.rpc(\n identifier,\n 'connect',\n this.walletInfo,\n (connectStatus: IConnectMessage) => {\n this.meerkat?.logger.debug(\n 'WALLET: DApp now connected with status:',\n connectStatus\n );\n\n if (connectStatus.connected) {\n this.injectApi(identifier);\n\n if (this.DAppDiscoveryMeerkat) {\n //close discovery meerkat as we are connected\n this.meerkat?.logger.debug(\n 'WALLET: Close discovery after successfully connected to server.'\n );\n this.DAppDiscoveryMeerkat.close();\n }\n } else {\n if (!this.meerkat) {\n throw new Error('Merrkat not connected.');\n }\n\n this.meerkat.logger.warn(\n 'Connection failed. Another wallet has already been connected to this dApp.'\n );\n }\n\n this.generateIdenticon();\n\n if (this.DAppDiscoveryMeerkat?.address()) {\n this.meerkat!.rpc(\n identifier,\n 'setDiscovery',\n { walletDiscoveryAddress: this.DAppDiscoveryMeerkat.address() },\n (connectStatus: boolean) => {\n this.meerkat?.logger.debug(\n 'WALLET: result of setDiscovery call',\n connectStatus\n );\n }\n );\n } else {\n this.meerkat?.logger.debug(\n 'WALLET: discovery meerkat has no address ?'\n );\n }\n\n this.meerkat?.logger.debug(\n 'WALLET: calling onConnect event callback from wallet!',\n this.onConnect\n );\n\n this.onConnect(connectStatus);\n }\n );\n });\n\n this.addMeerkat(identifier, this.meerkat);\n\n return this.meerkat.seed;\n }\n\n protected addMeerkat = (identifier: string, meerkat: Meerkat) => {\n const meerkatInstance = this.meerkats.get(identifier);\n if (meerkatInstance) {\n try {\n meerkatInstance.close();\n } catch (e: any) {\n this.meerkat?.logger.warn('Error closing meerkat connection', e);\n }\n this.meerkats.delete(identifier);\n }\n\n this.meerkats.set(identifier, meerkat);\n };\n\n protected getMeerkat = (identifier: string): Meerkat | null => {\n return this.meerkats.get(identifier) ?? null;\n };\n\n public generateIdenticon = () => {\n if (!this.meerkat?.address()) {\n throw new Error('Server meerkat address not defined.');\n }\n\n if (!this.meerkat?.identifier) {\n throw new Error('Client meerkat address not defined.');\n }\n\n this.identicon = PeerConnectIdenticon.getBase64Identicon(\n this.meerkat?.address() + this.meerkat?.identifier\n );\n };\n\n public disconnect(address: string) {\n if (!this.meerkat) {\n throw new Error('Meerkat not connected.');\n }\n\n this.meerkat.rpc(\n address,\n 'disconnect',\n this.walletInfo,\n (connectStatus: IConnectMessage) => {\n if (this.meerkat) {\n this.meerkat.close();\n }\n\n this.clearSeen();\n this.onDisconnect(connectStatus);\n\n this.meerkat?.logger.debug(\n 'WALLET: setup discovery after disconnect was called'\n );\n this.setUpDiscoveryMeerkat();\n }\n );\n }\n\n public getIdenticon = () => {\n return this.identicon;\n };\n\n protected abstract getNetworkId(): Promise;\n protected abstract getUtxos(\n amount?: Cbor,\n paginate?: Paginate\n ): Promise;\n protected abstract getCollateral(params?: {\n amount?: Cbor;\n }): Promise;\n protected abstract getBalance(): Promise;\n protected abstract getUsedAddresses(): Promise;\n protected abstract getUnusedAddresses(): Promise;\n protected abstract getChangeAddress(): Promise;\n protected abstract getRewardAddresses(): Promise;\n protected abstract signTx(tx: Cbor, partialSign: boolean): Promise;\n protected abstract signData(\n addr: string,\n payload: Bytes\n ): Promise;\n protected abstract submitTx(tx: Cbor): Promise;\n}\n","export type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\nexport class Logger {\n logLevel: LogLevel = 'info';\n private scope: string;\n\n constructor({\n scope,\n logLevel,\n enabled = true,\n }: {\n scope: string;\n logLevel?: LogLevel;\n enabled?: boolean;\n }) {\n this.scope = scope;\n if (logLevel) {\n this.logLevel = logLevel;\n }\n\n if (typeof enabled === 'boolean') {\n if (enabled) {\n localStorage.setItem('Peer-Connect-Logging', 'true');\n } else {\n localStorage.setItem('Peer-Connect-Logging', 'false');\n }\n }\n }\n\n disable() {\n localStorage.setItem('Peer-Connect-Logging', 'false');\n }\n\n enable() {\n localStorage.setItem('Peer-Connect-Logging', 'true');\n }\n\n private formatMessage(logLevel: LogLevel, message: string): string {\n let tag = 'Info';\n\n if (logLevel == 'error') {\n tag = 'Error';\n } else if (logLevel == 'warn') {\n tag = 'Warning';\n } else if (logLevel == 'debug') {\n tag = 'Debug';\n }\n\n return `%c${tag}%c %c${this.scope}%c ${message}`;\n }\n\n private getTagStyle(logLevel: LogLevel): string {\n let tagStyle = `\n padding: 2px 4px; \n border-radius: 4px; \n font-weight: bold';\n `;\n\n if (logLevel == 'error') {\n tagStyle = `\n color: white; \n background-color: #FF0012;\n ${tagStyle} \n `;\n } else if (logLevel == 'warn') {\n tagStyle = `\n color: black; \n background-color: #FFD900;\n ${tagStyle} \n `;\n } else if (logLevel == 'info') {\n tagStyle = `\n color: white; \n background-color: #0084B0; \n ${tagStyle}\n `;\n } else if (logLevel == 'debug') {\n tagStyle = `\n color: white; \n background-color: #5BE300; \n ${tagStyle}\n `;\n }\n\n return tagStyle;\n }\n\n private log(logLevel: LogLevel, message: string) {\n const scopeStyle = `\n color: white; \n background-color: #454545; \n padding: 2px 4px; \n border-radius: 4px; \n font-weight: bold';\n `;\n\n if (localStorage.getItem('Peer-Connect-Logging') === 'true') {\n if (logLevel === 'debug' || logLevel === 'info') {\n console.log(\n this.formatMessage(logLevel, message),\n this.getTagStyle(logLevel),\n '',\n scopeStyle,\n 'color: black'\n );\n } else if (logLevel === 'warn') {\n console.warn(\n this.formatMessage(logLevel, message),\n this.getTagStyle(logLevel),\n '',\n scopeStyle,\n 'color: black'\n );\n } else if (logLevel === 'error') {\n console.error(\n this.formatMessage(logLevel, message),\n this.getTagStyle(logLevel),\n '',\n scopeStyle,\n 'color: black'\n );\n }\n }\n }\n\n private argsToString(args: any[]): string {\n let message = '';\n\n for (const arg of args) {\n if (\n typeof arg === 'string' ||\n typeof arg === 'number' ||\n typeof arg === 'boolean'\n ) {\n message += arg + ',\\n';\n } else {\n message += JSON.stringify(arg, undefined, 4) + ',\\n';\n }\n }\n\n return message.replace(/,\\n$/, '');\n }\n\n debug(...args: any[]) {\n if (this.logLevel === 'debug') {\n this.log('debug', this.argsToString(args));\n }\n }\n\n info(...args: any[]) {\n if (['debug', 'info'].includes(this.logLevel)) {\n this.log('info', this.argsToString(args));\n }\n }\n\n warn(...args: any[]) {\n if (['debug', 'info', 'warn'].includes(this.logLevel)) {\n this.log('warn', this.argsToString(args));\n }\n }\n\n error(...args: any[]) {\n this.log('error', this.argsToString(args));\n }\n}\n","import Meerkat from '@fabianbormann/meerkat';\nimport type {\n PeerConnectApi,\n DAppPeerConnectParameters,\n Cip30Api,\n Cip30Function,\n IConnectMessage,\n IDAppInfos,\n IWalletInfo,\n} from './types';\nimport QRCode from 'qrcode-svg';\nimport { Value, buildApiCalls } from './lib/ExperimentalContainer';\nimport AutoConnectHelper from './lib/AutoConnectHelper';\nimport PeerConnectIdenticon from './lib/PeerConnectIdenticon';\nimport { Logger, LogLevel } from './lib/Logger';\n\nexport default class DAppPeerConnect {\n private meerkat: Meerkat;\n private walletDiscoveryMeerkat: Meerkat | null = null;\n\n private connectedWallet: string | null = null;\n protected enableLogging: boolean = false;\n protected logger: Logger;\n protected logLevel: LogLevel = 'info';\n\n protected readonly dAppInfo: IDAppInfos;\n\n protected identicon: string | null = null;\n\n protected onConnect?: (address: string, walletInfo?: IWalletInfo) => void;\n protected onDisconnect?: (address: string) => void;\n protected onApiEject?: (name: string, address: string) => void;\n protected onApiInject?: (name: string, address: string) => void;\n\n protected setUpDiscoveryMeerkcat = (\n announce: Array,\n address?: string\n ) => {\n if (address || AutoConnectHelper.getWalletDiscoveryAddress()) {\n this.meerkat.logger.debug(\n 'DApp: create discovery with address',\n address ?? AutoConnectHelper.getWalletDiscoveryAddress()\n );\n this.meerkat.logger.debug(\n 'DApp: create discovery with seed',\n AutoConnectHelper.getWalletAutoDiscoverySeed()\n );\n\n this.walletDiscoveryMeerkat = new Meerkat({\n seed: AutoConnectHelper.getWalletAutoDiscoverySeed() ?? undefined,\n announce: announce,\n loggingEnabled: this.enableLogging,\n identifier: address ?? AutoConnectHelper.getWalletDiscoveryAddress()!,\n }).setMaxListeners(20);\n this.walletDiscoveryMeerkat.logger.logLevel = this.logLevel as LogLevel;\n\n this.meerkat.logger.debug(\n 'DApp: walletDiscoveryMeerkat address:',\n this.walletDiscoveryMeerkat.address()\n );\n\n AutoConnectHelper.saveWalletAutoDiscoverySeed(\n this.walletDiscoveryMeerkat.seed\n );\n\n this.meerkat.logger.debug(\n 'DApp: Adding onServer event for discover wallet discovery meerkat.'\n );\n\n this.walletDiscoveryMeerkat.on('server', () => {\n this.meerkat.logger.debug(\n 'DApp: SERVER discovery: received on server event'\n );\n\n if (!this.walletDiscoveryMeerkat) {\n throw new Error('Meerkat not connected.');\n }\n\n this.meerkat.logger.debug(\n 'DApp: SERVER discovery: Calling rpc connect on wallet.'\n );\n\n this.walletDiscoveryMeerkat.rpc(\n AutoConnectHelper.getWalletDiscoveryAddress()!,\n 'connect',\n { dappAddress: this.meerkat.address() },\n (connectStatus: any) => {\n this.meerkat.logger.debug(\n 'DApp: SERVER discovery: Client connect status: ',\n connectStatus\n );\n }\n );\n });\n }\n };\n\n public setLogLevel = (level: LogLevel, meerkat: boolean = false) => {\n this.logLevel = level;\n this.logger.logLevel = level;\n\n if (this.meerkat && meerkat) {\n this.meerkat.logger.logLevel = level as LogLevel;\n }\n\n if (this.walletDiscoveryMeerkat && meerkat) {\n this.walletDiscoveryMeerkat.logger.logLevel = level as LogLevel;\n }\n };\n\n constructor({\n dAppInfo,\n seed,\n discoverySeed,\n announce,\n loggingEnabled,\n verifyConnection,\n onConnect,\n onDisconnect,\n onApiEject,\n onApiInject,\n useWalletDiscovery,\n }: DAppPeerConnectParameters) {\n if (loggingEnabled) {\n this.enableLogging = loggingEnabled;\n }\n\n if (!announce) {\n announce = [\n 'wss://tracker.openwebtorrent.com',\n 'wss://dev.tracker.cf-identity-wallet.metadata.dev.cf-deployments.org',\n 'wss://tracker.files.fm:7073/announce',\n 'ws://tracker.files.fm:7072/announce',\n 'wss://tracker.openwebtorrent.com:443/announce',\n ];\n }\n\n this.meerkat = new Meerkat({\n seed: seed || localStorage.getItem('meerkat-dapp-seed') || undefined,\n announce: announce,\n loggingEnabled: loggingEnabled,\n }).setMaxListeners(20);\n\n this.dAppInfo = {\n ...dAppInfo,\n address: this.meerkat.address(),\n };\n\n this.logger = new Logger({\n scope: 'DAppPeerConnect',\n logLevel: 'info',\n enabled: loggingEnabled,\n });\n this.meerkat.logger.logLevel = this.logLevel as LogLevel;\n\n if (useWalletDiscovery) {\n setTimeout(() => {\n //initialize discovery meerkat 1 second later\n this.setUpDiscoveryMeerkcat(announce!, discoverySeed);\n }, 1000);\n }\n\n this.onConnect = onConnect;\n this.onDisconnect = onDisconnect;\n this.onApiEject = onApiEject;\n this.onApiInject = onApiInject;\n\n localStorage.setItem('meerkat-dapp-seed', this.meerkat.seed);\n\n this.logger.info(\n `The generated meerkat address is: ${this.meerkat.address()}`\n );\n\n this.dAppInfo.address = this.meerkat.address();\n\n let connected = false;\n\n this.meerkat.on('connections', () => {\n if (!connected) {\n connected = true;\n this.logger.info('server ready');\n }\n });\n\n this.meerkat.on('seen', (address) => {\n const globalCardano = (window as any).cardano || {};\n if (\n Object.keys(globalCardano).find(\n (apiName) => globalCardano[apiName].identifier === address\n )\n ) {\n this.logger.info(`Saw address ${address}`);\n } else {\n this.logger.info(\n `Saw address ${address} but it has not injected it's api yet`\n );\n }\n });\n\n this.meerkat.on('left', (address: string) => {\n this.leftServer(address);\n });\n\n this.meerkat.register(\n 'connect',\n (\n address: string,\n walletInfo: IWalletInfo,\n callback: (args: IConnectMessage) => void\n ) => {\n if (!this.connectedWallet) {\n const connectWallet = (\n granted: boolean,\n allowAutoConnect: boolean = false,\n connectedWalletInfo?: IWalletInfo\n ) => {\n if (walletInfo.requestAutoconnect && granted && allowAutoConnect) {\n AutoConnectHelper.addAutoConnectId(address);\n }\n\n if (granted) {\n this.connectedWallet = address;\n this.logger.info(\n `Successfully connected ${this.connectedWallet}`\n );\n\n callback({\n dApp: this.dAppInfo,\n address: address,\n connected: true,\n error: false,\n autoConnect: allowAutoConnect,\n });\n\n this.generateIdenticon();\n\n if (this.onConnect) {\n this.onConnect(address, connectedWalletInfo);\n }\n } else {\n callback({\n dApp: this.dAppInfo,\n address: address,\n connected: false,\n error: true,\n errorMessage: `User denied connection to ${address}`,\n autoConnect: allowAutoConnect,\n });\n\n this.logger.info(`User denied connection to ${address}`);\n }\n };\n\n if (typeof verifyConnection !== 'undefined') {\n if (AutoConnectHelper.isAutoConnectId(address)) {\n connectWallet(true, true, walletInfo);\n } else {\n verifyConnection(\n {\n ...walletInfo,\n address: address,\n },\n connectWallet\n );\n }\n } else {\n connectWallet(true);\n }\n } else if (this.connectedWallet === address) {\n this.logger.info(\n `Connection has already been established to ${address}.`\n );\n\n callback({\n address: address,\n dApp: this.dAppInfo,\n connected: true,\n error: false,\n });\n } else {\n callback({\n dApp: this.dAppInfo,\n address: address,\n connected: false,\n error: false,\n errorMessage:\n 'Connection failed. Another wallet has already been connected to this dApp.',\n });\n\n this.logger.info(\n 'Connection failed. Another wallet has already been connected to this dApp.'\n );\n }\n }\n );\n\n /**\n * Client signals that it is disconnecting\n */\n this.meerkat.register(\n 'disconnect',\n\n (\n address: string,\n walletInfo: IWalletInfo,\n callback: (args: IConnectMessage) => void\n ) => {\n if (this.connectedWallet) {\n if (this.connectedWallet !== address) {\n this.logger.info(\n `Unregistered address ${address} is calling disconnect.`\n );\n\n callback({\n dApp: this.dAppInfo,\n connected: false,\n error: true,\n errorMessage:\n 'Unregistered address ${address} is calling disconnect.',\n });\n\n return;\n }\n\n this.logger.info(\n `Wallet ${this.connectedWallet} is calling disconnect.`\n );\n\n callback({\n dApp: this.dAppInfo,\n connected: false,\n error: false,\n });\n\n this.leftServer(address);\n this.connectedWallet = null;\n\n return;\n }\n\n this.logger.info(`Calling disconnect with no connected wallet.`);\n\n callback({\n dApp: this.dAppInfo,\n connected: false,\n error: true,\n errorMessage: 'No wallet is connected.',\n });\n }\n );\n\n this.meerkat.register(\n 'setDiscovery',\n (\n address: string,\n args: { walletDiscoveryAddress: string },\n callback: (args: boolean) => void\n ) => {\n this.logger.debug('DApp: SERVER: setDiscovery with:', args);\n\n if (useWalletDiscovery) {\n AutoConnectHelper.saveWalletDiscoveryAddress(\n args.walletDiscoveryAddress\n );\n\n return callback(true);\n } else {\n return callback(false);\n }\n }\n );\n\n this.meerkat.register(\n 'api',\n (\n address: string,\n args: { api: PeerConnectApi; overwrite?: boolean },\n callback: (args: IConnectMessage) => void\n ) => {\n if (address !== this.connectedWallet) {\n return;\n }\n\n const injectedClients = this.getInjectedApis();\n if (injectedClients.includes(address) && !args.overwrite) {\n this.logger.info(`${address} already injected`);\n return;\n }\n\n const api: {\n [key in Cip30Function | 'experimental']?:\n | Function\n | Record;\n } = {};\n\n for (const method of args.api.methods) {\n api[method] = (...params: Array) => {\n return new Promise((resolve, reject) => {\n if (typeof params === 'undefined') {\n params = [];\n }\n\n this.meerkat.rpc(\n address,\n 'invoke',\n [method, ...params],\n (result: any) => resolve(result)\n );\n });\n };\n }\n\n const initialExperimentalApi = buildApiCalls(\n this.meerkat,\n address,\n args.api.experimentalApi,\n 'invokeExperimental'\n );\n\n const fullExperimentalApi = buildApiCalls(\n this.meerkat,\n address,\n args.api.fullExperimentalApi,\n 'invokeEnableExperimental'\n );\n\n api['experimental'] = fullExperimentalApi;\n\n const cip30Api: Cip30Api = {\n apiVersion: args.api.apiVersion,\n name: args.api.name,\n icon: args.api.icon,\n identifier: address,\n experimental: initialExperimentalApi,\n isEnabled: () => new Promise((resolve, reject) => resolve(true)),\n enable: () => new Promise((resovle, reject) => resovle(api)),\n };\n\n if (this.isWalletNameInjected(args.api.name) && !args.overwrite) {\n this.logger.info(\n `Not injecting wallet api. API for wallet '${args.api.name}' is already injected.`\n );\n return callback({\n dApp: this.dAppInfo,\n connected: false,\n error: true,\n errorMessage: `Wallet with name ${args.api.name} is already injected.`,\n });\n }\n\n if (!this.isP2pWalletCompliantName(args.api.name)) {\n this.logger.warn(\n `Injected wallet does not contain 'p2p' in name, this is discouraged. `\n );\n }\n\n (window as any).cardano = (window as any).cardano || {};\n (window as any).cardano[args.api.name.toLowerCase()] = cip30Api;\n this.logger.info(\n `injected api of ${args.api.name} into window.cardano`\n );\n\n callback({\n dApp: this.dAppInfo,\n connected: true,\n error: false,\n });\n\n if (onApiInject) {\n onApiInject(args.api.name, address);\n }\n }\n );\n }\n\n private leftServer = (address: string) => {\n if (address === this.connectedWallet) {\n this.connectedWallet = null;\n\n if (this.onDisconnect) {\n this.onDisconnect(address);\n }\n\n const globalCardano = (window as any).cardano || {};\n const apiName = Object.keys(globalCardano).find(\n (apiName) => globalCardano[apiName].identifier === address\n );\n if (apiName) {\n this.logger.info(\n `${this.connectedWallet} disconnected. ${apiName} has been removed from the global window object`\n );\n delete (window as any).cardano[apiName.toLowerCase()];\n if (this.onApiEject) {\n this.onApiEject(apiName, address);\n }\n } else {\n this.logger.info(\n `${this.connectedWallet} disconnected. Cleanup was not necessary.`\n );\n }\n }\n };\n\n public shutdownServer = () => {\n if (this.connectedWallet) {\n const status: IConnectMessage = {\n connected: false,\n error: false,\n errorMessage: 'Server is closing connections.',\n dApp: this.dAppInfo,\n };\n\n this.meerkat.rpc(this.connectedWallet, 'shutdown', status, () => {});\n }\n };\n\n private getInjectedApis() {\n const globalCardano = (window as any).cardano || {};\n return Object.keys(globalCardano)\n .filter((client) => typeof globalCardano[client].identifier === 'string')\n .map((client) => globalCardano[client].identifier);\n }\n\n /**\n * Checks if wallet with name is already injected into global cardano namespace.\n * @param name\n */\n private isWalletNameInjected = (name: string) => {\n const globalCardano = (window as any).cardano || {};\n\n return Object.keys(globalCardano).find(\n (apiName) => apiName === name.toLowerCase()\n );\n };\n\n /**\n * Checks if wallet name contains the string p2p to distinguish from other injection.\n * @param name\n */\n private isP2pWalletCompliantName = (name: string) => {\n return name.includes('p2p');\n };\n\n generateQRCode(canvas: HTMLElement) {\n const data = `${this.meerkat.address()}:meerkat:${new Date().getTime()}`;\n var qrcode = new QRCode({\n content: data,\n padding: 4,\n width: 256,\n height: 256,\n color: '#000000',\n background: '#ffffff',\n ecl: 'M',\n });\n canvas.innerHTML = qrcode.svg();\n }\n\n getConnectedWallet() {\n return this.connectedWallet;\n }\n\n getAddress() {\n return this.meerkat.address();\n }\n\n getSeed() {\n return this.meerkat.seed;\n }\n\n public generateIdenticon = () => {\n this.identicon = PeerConnectIdenticon.getBase64Identicon(\n this.connectedWallet + this.getAddress()\n );\n };\n\n public getIdenticon = () => {\n return this.identicon;\n };\n}\n"],"names":["root","factory","exports","module","define","amd","this","self","__webpack_modules__","Math","floatEquals","a","b","p","Number","EPSILON","abs","clamp","min","max","frac","floor","ceil","lerp","i","unlerp","blerp","c00","c10","c01","c11","ix","iy","remap","a1","a2","b1","b2","smoothstep","pow","radians","degrees","PI","randomBetween","random","randomIntBetween","cltRandom","mu","sigma","samples","total","cltRandomInt","weightedRandom","w","reduce","n","r","lerpArray","f","s","length","trunc","dot","v","factorial","result","permutation","combination","Array","times","fill","map","_","range","zip","k","Object","defineProperty","prototype","value","l","slice","sort","vec","x","y","components","ux","uy","add","mul","sub","len","sqrt","manhattan","nor","rot","sin","c","cos","eq","rad","atan2","cpy","str","mat","m","entries","concat","identity","get","j","set","row","col","scale","trans","flat","minor","ii","jj","push","det","sign","d","adj","minors","cofactors","inv","ms","ns","chunk","join","__unused_webpack_exports","width","pool","GLOBAL","g","window","startdenom","significance","overflow","mask","oldRandom","ARC4","key","t","keylen","me","S","count","flatten","obj","depth","prop","typ","e","mixkey","seed","smear","stringseed","charCodeAt","tostring","String","fromCharCode","apply","options","global","arc4","entropy","arguments","crypto","getRandomValues","Uint8Array","Date","navigator","plugins","screen","autoseed","resetGlobal","__webpack_module_cache__","moduleId","cachedModule","undefined","globalThis","Function","identicon","commonjs_1","defaultIdenticonSettings","size","baseSeed","font","fontStyle","fontSize","backgroundColours","initialsColours","initialsOffset","initialsAlpha","initialsCompositeOperation","stripeColours","stripeAlpha","stripeCompositeOperation","stripes","stripeWidth","stripeDeviation","curveAmount","curveOffset","startWidthSign","endWidthSign","TAU","SIGN_FACTOR","positive","negative","drawStripe","context","settings","t1","s1","shuffle","t2","t3","s2","t4","t5","center","radius","pointOnCircle","beginPath","moveTo","quadraticCurveTo","lineTo","closePath","theta","name","actualSettings","assign","initials","split","toUpperCase","actualSeed","canvas","document","createElement","getContext","height","save","colour","fillStyle","fillRect","globalAlpha","globalCompositeOperation","countStripes","restore","colourIndex","textAlign","textBaseline","fillText","drawInitials","draw","isSafeInteger","Error","constructor","includes","create","outputLen","blockLen","o","destroyed","finished","output","exists","hash","bytes","bool","number","h","default","SHA2","Hash","super","padOffset","isLE","pos","buffer","view","createView","update","toBytes","subarray","process","roundClean","digestInto","setBigUint64","BigInt","u","setUint32","digest","destroy","_cloneInto","sha224","sha256","Uint32Array","A","B","C","D","E","F","G","H","getUint32","rotr","wrapConstructor","randomBytes","wrapXOFConstructorWithOpts","wrapConstructorWithOpts","checkOpts","concatBytes","utf8ToBytes","asyncLoop","nextTick","hexToBytes","bytesToHex","u32","u8","byteOffset","byteLength","DataView","from","toString","padStart","TextEncoder","encode","async","now","clone","call","EventEmitter","chunkLength","closed","lastChunkLength","lastChunkIndex","dbPromise","openDB","upgrade","createObjectStore","blocking","close","terminated","emit","put","notFound","offset","deleteDB","bignum","base","constants","decoders","encoders","body","_createNamed","code","_initNamed","_getDecoder","hasOwnProperty","decode","_getEncoder","Reporter","Buffer","isBuffer","error","isArray","reporter","isEmpty","readUInt8","skip","_reporterState","raw","forEach","write","copy","DecoderBuffer","EncoderBuffer","Node","_baseState","enc","parent","children","tag","args","reverseArgs","choice","optional","any","use","useDecoder","explicit","implicit","contains","_wrap","_init","filter","equal","_useArgs","keys","def","_decode","wrapResult","enterKey","_peekTag","isError","_decodeGeneric","_decodeChoice","enterObject","_decodeTag","track","path","_getUse","leaveObject","exitKey","leaveKey","_decodeList","test","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeBool","_decodeInt","_use","some","type","_createEncoderBuffer","_encode","_encodeValue","_skipDefault","_encodeChoice","_encodePrimitive","_encodeComposite","JSON","stringify","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool","_isNumstr","_isPrintstr","errors","rethrow","pathLen","message","stack","partial","captureStackTrace","tagClass","tagClassByName","_reverse","tagByName","der","entity","tree","cls","primitive","tagStr","_skipUntilEnd","unused","data","readUInt16BE","UTC","pem","label","match","replace","writeUInt16BE","splice","getFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","toArray","unshift","defaultBuffer","super_","isBN","words","red","BN","wordSize","cmp","_initNumber","_initArray","_parseHex","_parseBase","strip","imuln","_iaddn","_expand","_normSign","inspect","isZero","modn","idivn","toNumber","toJSON","toBuffer","toArrayLike","andln","iushrn","clz32","_countBits","_zeroBits","bitLength","zeroBits","toTwos","inotn","iaddn","fromTwos","testn","notn","ineg","isNeg","neg","iuor","ior","or","uor","iuand","iand","and","uand","iuxor","ixor","xor","uxor","setn","iadd","isub","M","I","T","P","R","L","O","N","U","q","z","W","K","V","$","Z","J","Y","X","Q","tt","et","rt","it","nt","st","ot","at","ht","ut","ft","lt","ct","dt","pt","mt","gt","imul","yt","bt","vt","wt","_t","Mt","kt","St","xt","At","Et","It","Bt","Tt","Pt","Rt","Ct","Lt","mulp","mulTo","makeRBT","revBin","permute","transform","guessLen13b","conjugate","normalize13b","round","convert13b","stub","mulf","muln","sqr","isqr","iushln","ishln","ishrn","shln","ushln","shrn","ushrn","imaskn","maskn","isubn","addn","subn","iabs","_ishlnsubmul","_wordDiv","div","mod","divmod","divn","umod","divRound","egcd","isEven","isOdd","gcd","_invmp","cmpn","invm","bincn","ucmp","gtn","gten","gte","ltn","lten","lte","eqn","toRed","convertTo","_forceRed","fromRed","convertFrom","forceRed","redAdd","redIAdd","redSub","redISub","redShl","shl","redMul","_verify2","redIMul","redSqr","_verify1","redISqr","redSqrt","redInvm","redNeg","redPow","k256","p224","p192","p25519","tmp","_tmp","_prime","prime","shift","r2","imod","rinv","minv","ireduce","imulK","_strip","mont","nmd","Uint16Array","of","ArrayBuffer","isView","indexOf","lastIndexOf","isEncoding","alloc","allocUnsafe","allocUnsafeSlow","compare","getUint8","RangeError","copyWithin","equals","swap16","swap32","swap64","writeDoubleLE","setFloat64","writeFloatLE","setFloat32","writeUInt32LE","writeInt32LE","setInt32","readDoubleLE","getFloat64","readFloatLE","getFloat32","readUInt32LE","readInt32LE","getInt32","substring","TextDecoder","fromCodePoint","encodeInto","codePointAt","TypeError","charAt","log","repeat","decodeUnsafe","toByteArray","fromByteArray","nopad","zeroPadding","_move","Symbol","for","modrn","_toArrayLikeLE","_toArrayLikeBE","rand","generate","Rand","_rand","getBytes","getByte","msCrypto","readUInt32BE","SBOX","INV_SBOX","SUB_MIX","INV_SUB_MIX","_key","_reset","blockSize","keySize","_nRounds","_keySchedule","_invKeySchedule","encryptBlockRaw","encryptBlock","writeUInt32BE","decryptBlock","scrub","AES","_cipher","_ghash","_finID","writeUIntBE","state","_prev","_cache","_secCache","_decrypt","_alen","_len","_mode","_authTag","_called","_update","encrypt","_final","final","getAuthTag","setAuthTag","setAAD","createCipher","Cipher","createCipheriv","Cipheriv","createDecipher","Decipher","createDecipheriv","Decipheriv","listCiphers","getCiphers","_last","_autopadding","cache","toLowerCase","mode","iv","decrypt","flush","setAutoPadding","writeUInt8","ghash","_multiply","ECB","CBC","CFB","CFB8","CFB1","OFB","CTR","GCM","instantiate","EDE","DES","_des","des","des3","modulus","prime1","prime2","blinder","publicExponent","unblinder","coefficient","exponent1","exponent2","getr","Writable","_hashType","_hash","_tag","id","_signType","_write","end","verify","Sign","Verify","createSign","createVerify","ec","curve","keyFromPrivate","privateKey","toDER","params","priv_key","padding","getKey","makeKey","algorithm","subjectPrivateKey","pub_key","signature","SlowBuffer","INSPECT_MAX_BYTES","setPrototypeOf","SharedArrayBuffer","valueOf","toPrimitive","parseInt","substr","kMaxLength","TYPED_ARRAY_SUPPORT","foo","console","enumerable","poolSize","_isBuffer","toLocaleString","trim","isFinite","_arr","readUintLE","readUIntLE","readUintBE","readUIntBE","readUint8","readUint16LE","readUInt16LE","readUint16BE","readUint32LE","readUint32BE","readBigUInt64LE","readBigUInt64BE","readIntLE","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32BE","readBigInt64LE","readBigInt64BE","read","readFloatBE","readDoubleBE","writeUintLE","writeUIntLE","writeUintBE","writeUint8","writeUint16LE","writeUInt16LE","writeUint16BE","writeUint32LE","writeUint32BE","writeBigUInt64LE","writeBigUInt64BE","writeIntLE","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32BE","writeBigInt64LE","writeBigInt64BE","writeFloatBE","writeDoubleBE","writable","configurable","ERR_OUT_OF_RANGE","ERR_INVALID_ARG_TYPE","ERR_BUFFER_OUT_OF_BOUNDS","isInteger","store","inProgressGets","Map","remove","opts","cb","delete","Transform","hashMode","_finalOrDigest","__final","_decoder","_encoding","_toString","_transform","_flush","isBoolean","isNull","isNullOrUndefined","isNumber","isString","isSymbol","isUndefined","isRegExp","isObject","isDate","isFunction","isPrimitive","hardwareConcurrency","model","speed","user","nice","sys","idle","irq","secp256k1","secp224r1","prime256v1","prime192v1","ed25519","secp384r1","secp521r1","curveType","p256","secp256r1","secp192r1","p384","p521","generateKeys","genKeyPair","getPublicKey","computeSecret","keyFromPublic","getPublic","getPrivate","getX","getPrivateKey","setPublicKey","_importPublic","setPrivateKey","_importPrivate","_alg","_ipad","_opad","rng","pseudoRandomBytes","prng","createHash","createHmac","Hmac","getHashes","pbkdf2","pbkdf2Sync","DiffieHellmanGroup","createDiffieHellmanGroup","getDiffieHellman","createDiffieHellman","DiffieHellman","createECDH","publicEncrypt","privateEncrypt","publicDecrypt","privateDecrypt","randomFill","randomFillSync","createCredentials","DH_CHECK_P_NOT_SAFE_PRIME","DH_CHECK_P_NOT_PRIME","DH_UNABLE_TO_CHECK_GENERATOR","DH_NOT_SUITABLE_GENERATOR","NPN_ENABLED","ALPN_ENABLED","RSA_PKCS1_PADDING","RSA_SSLV23_PADDING","RSA_NO_PADDING","RSA_PKCS1_OAEP_PADDING","RSA_X931_PADDING","RSA_PKCS1_PSS_PADDING","POINT_CONVERSION_COMPRESSED","POINT_CONVERSION_UNCOMPRESSED","POINT_CONVERSION_HYBRID","formatArgs","useColors","namespace","humanize","diff","color","storage","setItem","removeItem","load","getItem","env","DEBUG","__nwjs","userAgent","documentElement","style","WebkitAppearance","firebug","exception","table","RegExp","$1","localStorage","warn","colors","debug","formatters","enabled","prev","curr","coerce","selectColor","extend","namespaces","init","disable","names","skips","enable","utils","_cbcInit","_cbcState","bufferOff","_updateDecrypt","_updateEncrypt","_buffer","_flushBuffer","_finalEncrypt","_finalDecrypt","_pad","_unpad","_desState","deriveKeys","pc1","r28shl","pc2","ip","_encrypt","expand","substitute","rip","ciphers","_edeState","padSplit","binary","hex","base64","gen","_pub","_priv","setGenerator","__prime","_primeLen","_primeCode","simpleSieve","fermatTest","__gen","_gen","getPrime","getGenerator","version","rE","curves","eddsa","getNAF","getJSF","assert","zero","one","two","pointFromJSON","gRed","_wnafT1","_wnafT2","_wnafT3","_wnafT4","_bitLength","redN","_maxwellTrick","precomputed","point","validate","_fixedNafMul","_getDoubles","step","jpoint","mixedAdd","points","toP","_wnafMul","_getNAFPoints","wnd","dblp","_wnafMulAdd","toJ","BasePoint","decodePoint","pointFromX","encodeCompressed","getY","precompute","doubles","naf","beta","_getBeta","_hasDoubles","dbl","twisted","mOneA","extended","c2","dd","oneC","zOne","_mulA","_mulC","pointFromY","isInfinity","normalize","fromJSON","_extDbl","_projDbl","_extAdd","_projAdd","mulAdd","jmulAdd","eqXToP","short","edwards","i4","a24","diffAdd","jumlAdd","tinv","zeroA","threeA","endo","_getEndomorphism","_endoWnafT1","_endoWnafT2","inf","_getEndoRoots","lambda","basis","_getEndoBasis","_endoSplit","k1","k2","_endoWnafMulAdd","parse","_zeroDbl","_threeDbl","_dbl","trpl","PresetCurve","sha384","sha512","nh","keyPair","fromPrivate","fromPublic","pers","persEnc","hmacStrength","entropyEnc","nonce","_truncateToN","canonical","recoveryParam","recoverPubKey","getKeyRecoveryParam","priv","pub","privEnc","pubEnc","reason","derive","_importDER","place","LN2","parseBytes","pointClass","encodingLength","keyFromSecret","hashInt","messagePrefix","encodePoint","pubBytes","makeSignature","Rencoded","intFromLE","fromSecret","encodeInt","decodeInt","isPoint","cachedProperty","_secret","secret","_pubBytes","privBytes","getSecret","_R","_S","_Rencoded","_Sencoded","Sencoded","toHex","zero2","_writableState","_readableState","readable","ended","req","on","setHeader","abort","stdio","removeListener","getPrototypeOf","EvalError","ReferenceError","SyntaxError","URIError","exec","index","Reflect","ownKeys","getOwnPropertySymbols","getOwnPropertyNames","isNaN","once","Promise","_events","_eventsCount","_maxListeners","defaultMaxListeners","newListener","listener","warned","emitter","fired","target","wrapFn","bind","addEventListener","removeEventListener","setMaxListeners","getMaxListeners","addListener","prependListener","prependOnceListener","pop","off","removeAllListeners","listeners","rawListeners","listenerCount","eventNames","top","btm","next","clear","peek","hwm","head","tail","ReadableStream","asyncIterator","preventCancel","getReader","return","releaseLock","cancel","done","getIterator","RTCPeerConnection","mozRTCPeerConnection","webkitRTCPeerConnection","RTCSessionDescription","mozRTCSessionDescription","webkitRTCSessionDescription","RTCIceCandidate","mozRTCIceCandidate","webkitRTCIceCandidate","getOwnPropertyDescriptor","__proto__","AggregateError","iterator","Atomics","BigInt64Array","BigUint64Array","Boolean","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","eval","Float32Array","Float64Array","FinalizationRegistry","Int8Array","Int16Array","Int32Array","parseFloat","Proxy","Set","Uint8ClampedArray","WeakMap","WeakRef","WeakSet","alias","hasArrayLengthDefineBug","propertyIsEnumerable","toStringTag","_block","_blockSize","_blockOffset","_length","_finalized","_digest","common","sha","ripemd","hmac","sha1","ripemd160","pending","pendingTotal","outSize","padLength","endian","_delta8","_delta32","BlockHash","join32","inner","outer","rotl32","sum32","sum32_3","sum32_4","inherits","toHex32","split32","sum32_5","ft_1","ch32","maj32","s0_256","s1_256","g0_256","g1_256","rotr64_hi","rotr64_lo","shr64_hi","shr64_lo","sum64","sum64_hi","sum64_lo","sum64_4_hi","sum64_4_lo","sum64_5_hi","sum64_5_lo","_prepareBlock","rotr32","p32","htonl","zero8","predResist","outLen","minEntropy","_reseed","reseedInterval","nonceEnc","_hmac","reseed","unwrap","wrap","IDBTransaction","objectStoreNames","objectStore","has","IDBRequest","then","IDBCursor","catch","IDBDatabase","transaction","advance","continue","continuePrimaryKey","DOMException","IDBObjectStore","IDBIndex","blocked","indexedDB","open","oldVersion","newVersion","deleteDatabase","all","NaN","mem","callee","isLegacyArguments","localNodeId","numberOfNodesPerKBucket","numberOfNodesToPing","distance","arbiter","metadata","contacts","dontSplit","left","right","vectorClock","_determineNode","_indexOf","_split","closest","toIterable","isIP","timeout","inflight","socket","createSocket","port","_ids","_reqs","peer","host","address","callback","_tick","_timer","setInterval","ttl","_cancel","response","send","clearInterval","query","_resolveAndQuery","lookup","position","encoding","dictionary","list","integer","find","getType","_floatConversionDetected","dict","dictMap","listSet","string","trace","digitCount","log10","_idLength","nodes","seen","_addNode","idLength","nodeId","krpcSocket","bootstrap","concurrency","backgroundConcurrency","queryAll","token","populate","_closest","RateLimiter","TokenBucket","hrtime","getTime","tokenBucket","content","curIntervalStart","tokensThisInterval","fireImmediately","removeTokens","bucketSize","interval","tokensPerInterval","setTimeout","tryRemoveTokens","getTokensRemaining","drip","parentBucket","lastDrip","POSITIVE_INFINITY","maxAge","_unlink","_checkAge","modified","evict","_a","_b","_c","_d","chunks","_randbelow","_randrange","getDivisor","_types","_extensions","getExtension","long","called","onceError","strict","proto","certificate","seq","int","RSAPrivateKey","RSAPublicKey","objid","null_","bitstr","PublicKey","octstr","PrivateKey","EncryptedPrivateKey","DSAPrivateKey","DSAparam","namedCurve","ECPrivateKey","utcTime","utctime","generalTime","gentime","setof","seqof","rdnSequence","passphrase","tbsCertificate","subjectPublicKeyInfo","subjectPublicKey","kde","kdeparams","salt","iters","cipher","algo","parameters","resolve","cwd","isAbsolute","relative","_makeLong","dirname","basename","extname","format","dir","ext","sep","delimiter","win32","posix","subtle","queueMicrotask","setImmediate","importKey","deriveBits","iterations","browser","md5","rmd160","ipad1","ipad2","opad","alg","blocksize","run","log2","clearTimeout","fun","array","title","argv","versions","binding","chdir","umask","pipe","ReadStream","WriteStream","start","combine","every","randomNative","randomUInt32","randomByte","randomFloat","currentState","setState","currentStateString","setStateString","RC4small","allowHalfOpen","highWaterMark","_destroy","ReadableState","debuglog","objectMode","readableObjectMode","readableHighWaterMark","pipes","pipesCount","flowing","endEmitted","reading","sync","needReadable","emittedReadable","readableListening","resumeScheduled","defaultEncoding","awaitDrain","readingMore","decoder","_read","_undestroy","undestroy","isPaused","setEncoding","stdout","stderr","hasUnpiped","needDrain","pause","unpipe","resume","_fromList","_transformState","transforming","writecb","writechunk","afterTransform","needTransform","writeencoding","entry","finish","pendingcb","corkedRequestsFree","WritableState","deprecate","writableObjectMode","writableHighWaterMark","finalCalled","ending","decodeStrings","writing","corked","bufferProcessing","onwrite","writelen","errorEmitted","bufferedRequest","lastBufferedRequest","prefinished","bufferedRequestCount","writev","_writev","isBuf","allBuffers","getBuffer","hasInstance","cork","uncork","setDefaultEncoding","custom","Stream","Readable","Duplex","PassThrough","records","maxSize","_onstale","onStale","onstale","_fresh","_stale","_interval","_gced","_gcAuto","unref","record","_gc","_e","_finalSize","_w","_f","_g","_h","_ah","_bh","_ch","_dh","_eh","_fh","_gh","_hh","_al","_bl","_cl","_dl","_el","_fl","_gl","_hl","Throttle","ThrottleGroup","throttles","setEnabled","setRate","rate","chunksize","getEnabled","_enabled","getRate","bucket","getChunksize","setChunksize","throttle","group","_addThrottle","_removeThrottle","wait","_setEnabled","_group","_emitter","_destroyed","getGroup","_processChunk","_waitForTokens","_areBothEnabled","pipeline","_isStdio","getHighWaterMark","ERR_STREAM_PUSH_AFTER_EOF","ERR_METHOD_NOT_IMPLEMENTED","ERR_STREAM_UNSHIFT_AFTER_END_EVENT","errorOrDestroy","paused","emitClose","autoDestroy","first","consume","ERR_MULTIPLE_CALLBACK","ERR_TRANSFORM_ALREADY_TRANSFORMING","ERR_TRANSFORM_WITH_LENGTH_0","ERR_STREAM_CANNOT_PIPE","ERR_STREAM_DESTROYED","ERR_STREAM_NULL_VALUES","ERR_STREAM_WRITE_AFTER_END","ERR_UNKNOWN_ENCODING","stream","reject","getOwnPropertyDescriptors","defineProperties","_getString","_getBuffer","customInspect","ERR_STREAM_PREMATURE_CLOSE","ERR_MISSING_ARGS","ERR_INVALID_OPT_VALUE","mapWritable","byteLengthWritable","queue","buffered","drains","afterWrite","afterUpdateNextTick","_duplexState","autoBatch","updateNonPrimary","continueUpdate","_open","updateCallback","updateNextTick","mapReadable","byteLengthReadable","readAhead","pipeTo","afterRead","drain","afterFinal","to","afterPipe","pipeToFinished","writes","predestroy","_predestroy","signal","destroying","eagerOpen","_fromAsyncIterator","isBackpressured","throw","drained","pipelinePromise","isStream","isStreamx","getStreamError","text","fillLast","lastNeed","lastTotal","lastChar","pad","leftover","fin","blocks","lowlevel","crypto_core_hsalsa20","crypto_stream_xor","crypto_stream","crypto_stream_salsa20_xor","crypto_stream_salsa20","crypto_onetimeauth","crypto_onetimeauth_verify","crypto_verify_16","crypto_verify_32","crypto_secretbox","crypto_secretbox_open","crypto_scalarmult","crypto_scalarmult_base","crypto_box_beforenm","crypto_box_afternm","crypto_box","crypto_box_open","crypto_box_keypair","crypto_hash","crypto_sign","crypto_sign_keypair","crypto_sign_open","crypto_secretbox_KEYBYTES","crypto_secretbox_NONCEBYTES","crypto_secretbox_ZEROBYTES","crypto_secretbox_BOXZEROBYTES","crypto_scalarmult_BYTES","crypto_scalarmult_SCALARBYTES","crypto_box_PUBLICKEYBYTES","crypto_box_SECRETKEYBYTES","crypto_box_BEFORENMBYTES","crypto_box_NONCEBYTES","crypto_box_ZEROBYTES","crypto_box_BOXZEROBYTES","crypto_sign_BYTES","crypto_sign_PUBLICKEYBYTES","crypto_sign_SECRETKEYBYTES","crypto_sign_SEEDBYTES","crypto_hash_BYTES","gf","pack25519","unpack25519","pow2523","set25519","modL","scalarmult","scalarbase","secretbox","keyLength","nonceLength","overheadLength","scalarMult","scalarLength","groupElementLength","box","before","after","publicKey","secretKey","fromSecretKey","publicKeyLength","secretKeyLength","sharedKeyLength","detached","fromSeed","seedLength","signatureLength","hashLength","setPRNG","nacl","working","isArgumentsObject","isGeneratorFunction","isTypedArray","isPromise","isArrayBufferView","isUint8Array","isUint8ClampedArray","isUint16Array","isUint32Array","isInt8Array","isInt16Array","isInt32Array","isFloat32Array","isFloat64Array","isBigInt64Array","isBigUint64Array","isMap","isSet","isWeakMap","isWeakSet","isArrayBuffer","isDataView","isSharedArrayBuffer","isAsyncFunction","isMapIterator","isSetIterator","isGeneratorObject","isWebAssemblyCompiledModule","isNumberObject","isStringObject","isBooleanObject","isBigIntObject","isSymbolObject","isBoxedPrimitive","isAnyArrayBuffer","noDeprecation","throwDeprecation","traceDeprecation","NODE_DEBUG","stylize","showHidden","_extend","styles","toUTCString","pid","bold","italic","underline","inverse","white","grey","black","blue","cyan","green","magenta","yellow","special","boolean","null","date","regexp","types","isNativeError","getHours","getMinutes","getSeconds","getDate","getMonth","promisify","callbackify","xW","L0","dU","V5","grow","setAll","piece","_debugId","po","_debug","peerId","peerIdBuffer","amChoking","amInterested","peerChoking","peerInterested","peerPieces","extensions","peerExtensions","requests","peerRequests","extendedMapping","peerExtendedMapping","extendedHandshake","peerExtendedHandshake","hasFast","allowedFastSet","peerAllowedFastSet","_ext","_nextExt","uploaded","downloaded","uploadSpeed","downloadSpeed","_keepAliveInterval","_timeout","_timeoutMs","_timeoutExpiresAt","_finished","_parserSize","_parser","_bufferSize","_peEnabled","_myPubKey","_peerPubKey","_sharedSecret","_peerCryptoProvide","_cryptoHandshakeDone","_cryptoSyncPattern","_waitMaxBytes","_encryptionMethod","_encryptGenerator","_decryptGenerator","_setGenerators","_onFinish","_determineHandshakeType","_parsePe2","_parseHandshake","setKeepAlive","keepAlive","_timeoutUnref","_resetTimeout","_onUninterested","_onChoke","onHandshake","onExtendedHandshake","onMessage","_push","sendPe1","fk","sendPe2","sendPe3","setEncrypt","tW","_utfToHex","getUint16","setInt16","_encryptHandshake","sendPe4","handshake","_infoHash","dht","fast","_handshakeSent","_extendedHandshakeSent","_sendExtendedHandshake","choke","unchoke","interested","uninterested","have","_message","bitfield","request","_callback","_pull","setUint16","suggest","haveAll","haveNone","allowedFast","values","_onKeepAlive","_onPe1","_onPe2","_onPe3","_onPe3Encrypted","LC","_onPe4","_onHandshake","_onUnchoke","_onInterested","_onHave","_onBitField","_onRequest","_onPiece","_onCancel","_onPort","_onSuggest","_onHaveAll","_onHaveNone","_onReject","_onAllowedFast","_onExtended","_onTimeout","_parse","_parseUntil","_onMessageLength","_onMessage","_onHandshakeBuffer","_parsePe1","_parsePe3","_parsePe4","_parsePe3Encrypted","_decryptHandshake","MAX_VALUE","NJ","HB","Ht","webkitSubtle","enableSecure","addr","conn","swarm","wire","source","connected","retries","sentPe1","sentPe2","sentPe3","sentPe4","sentHandshake","onConnect","connectTimeout","onPe1","onPe2","onPe3","onPe4","startHandshakeTimeout","setThrottlePipes","infoHash","infoHashHash","clearPipes","throttleGroups","down","up","handshakeTimeout","remoteAddress","remotePort","_onWire","private","client","startConnectTimeout","webrtc","tcpOutgoing","utpOutgoing","wires","removePeer","TYPE_TCP_INCOMING","TYPE_TCP_OUTGOING","TYPE_UTP_INCOMING","TYPE_UTP_OUTGOING","TYPE_WEBRTC","TYPE_WEBSEED","SOURCE_MANUAL","SOURCE_TRACKER","SOURCE_DHT","SOURCE_LSD","SOURCE_UT_PEX","createWebRTCPeer","createTCPIncomingPeer","_createIncomingPeer","createUTPIncomingPeer","createTCPOutgoingPeer","_createOutgoingPeer","createUTPOutgoingPeer","createWebSeedPeer","loaded","__esModule","paths","Lr","FileList","fullPath","unknownName","filterJunkFiles","getStream","Blob","File","FormData","Headers","Request","Response","AbortController","AbortSignal","fetch","infoHashV2","xs","infoHashBuffer","infoHashV2Buffer","publicKeyBuffer","dn","keywords","announce","tr","urlList","as","ws","peerAddresses","info","pieces","files","infoBuffer","created","createdBy","comment","pieceLength","lastPieceLength","arrayBuffer","headers","readFile","__objectMode","_id","channelName","initiator","channelConfig","channelNegotiated","negotiated","config","offerOptions","answerOptions","sdpTransform","trickle","allowHalfTrickle","iceCompleteTimeout","_destroying","_connected","remoteFamily","localAddress","localFamily","localPort","_wrtc","wrtc","_pcReady","_channelReady","_iceComplete","_iceCompleteTimer","_channel","_pendingCandidates","_isNegotiating","_firstNegotiation","_batchedNegotiation","_queuedNegotiation","_sendersAwaitingStable","_closingInterval","_remoteTracks","_remoteStreams","_chunk","_cb","_pc","__destroy","_isReactNativeWebrtc","_peerConnectionId","oniceconnectionstatechange","_onIceStateChange","onicegatheringstatechange","onconnectionstatechange","_onConnectionStateChange","onsignalingstatechange","_onSignalingStateChange","onicecandidate","_onIceCandidate","peerIdentity","_setupData","channel","createDataChannel","ondatachannel","_needsNegotiation","_onFinishBound","bufferSize","bufferedAmount","readyState","family","renegotiate","transceiverRequest","addTransceiver","kind","candidate","remoteDescription","_addIceCandidate","sdp","setRemoteDescription","_createAnswer","addIceCandidate","endsWith","negotiate","_createOffer","_senderMap","onmessage","onopen","onclose","onerror","ontrack","binaryType","bufferedAmountLowThreshold","_onChannelMessage","onbufferedamountlow","_onChannelBufferedAmountLow","_onChannelOpen","_onChannelClose","filename","lineno","colno","_startIceCompleteTimeout","createOffer","localDescription","setLocalDescription","createAnswer","_requestMissingTransceivers","connectionState","iceConnectionState","iceGatheringState","_maybeReady","getStats","stat","timestamp","_connecting","localCandidateId","ipAddress","portNumber","googLocalAddress","remoteCandidateId","googRemoteAddress","selectedCandidatePairId","googActiveConnection","selected","_onInterval","signalingState","removeTrack","sdpMLineIndex","sdpMid","WEBRTC_SUPPORT","iceServers","urls","sdpSemantics","_tables","maxTables","_values","maxValues","_peers","maxPeers","_secrets","_hashLength","_rpc","krpc","_onquery","listening","updateBucketTimestamp","_setBucketCheckInterval","_rotateSecrets","_verify","_host","_runningBucketCheck","_bucketCheckTimeout","_bucketOutdatedTimeSpan","timeBucketOutdated","older","swap","_checkNodes","_bootstrap","lastChange","_pingAll","_checkAndRemoveNodes","removeBucketCheckInterval","removeNode","_sendPing","addNode","sig","cas","_put","_preput","_preannounce","_addPeer","info_hash","implied_port","listen","_onfindnode","_ongetpeers","_onannouncepeer","_onget","_onput","_generateToken","_validateToken","ready","DEFAULT_ANNOUNCE_PEERS","MAX_ANNOUNCE_PEERS","parseUrl","URL","href","protocol","origin","WebSocket","url","_ws","OPEN","_handleOpen","_handleMessage","_handleClose","_handleError","_handleFinishBound","_handleFinish","CLOSED","WEBSOCKET_SUPPORT","announceUrl","DEFAULT_ANNOUNCE_INTERVAL","_defaultAnnounceOpts","Ot","jt","Nt","peers","reconnecting","reconnectTimer","expectingResponse","_openSocket","action","_infoHashBinary","peer_id","_peerIdBinary","_trackerId","trackerid","event","_send","numwant","_generateOffers","offers","scrape","Ut","trackerTimeout","_onSocketConnectBound","_onSocketDataBound","_onSocketCloseBound","_onSocketErrorBound","consumers","DESTROY_TIMEOUT","_onSocketConnect","_onSocketError","_onSocketData","_onSocketClose","_proxyOpts","httpsAgent","httpAgent","socksProxy","agent","_onAnnounceResponse","_onScrapeResponse","complete","offer","_createPeer","to_peer_id","answer","offer_id","_startReconnectTimer","_rtcConfig","_socketPool","qt","Dt","Ft","_peerIdBuffer","_infoHashBuffer","_port","_getAnnounceOpts","getAnnounceOpts","rtcConfig","_userAgent","proxyOpts","_trackers","location","_announce","stop","zt","Wt","Kt","Vt","$t","_intervalMs","intervalMs","_trackerOpts","_dhtAnnouncing","_dhtTimeout","_internalDHT","_onWarning","_onError","_onDHTPeer","_onTrackerPeer","_onTrackerAnnounce","_onLSDPeer","tracker","_createTracker","dhtPort","_dhtAnnounce","lsd","_createLSD","updatePort","Zt","Gt","getDirectory","removeEntry","recursive","Jt","Yt","randomUUID","rootDirPromise","rootDir","storageDirPromise","getDirectoryHandle","chunksDirPromise","chunkMap","directoryMap","_getChunksDirHandle","handle","_createFileHandle","blob","_createBlobReference","file","cleanup","_getChunkHandle","getFileHandle","_getDirectoryHandle","getFile","createWritable","keepExistingData","_get","Xt","Qt","te","chrome","ee","FileSystemFileHandle","re","ie","limit","fallbackStore","dataStore","chunkCount","stores","onlyMem","ne","se","oe","ae","_peerSupports","_wire","_failRequests","donthave","he","ue","fe","missing","sources","_chunks","_remainder","_buffered","_cancellations","_reservations","_flushed","chunkLengthRemaining","chunkOffset","reserve","reserveRemaining","cancelRemaining","BLOCK_LENGTH","le","ce","de","pe","_fetching","_metadataComplete","_metadataSize","_remainingRejects","_bitfield","setMetadata","ut_metadata","metadata_size","_numPieces","_requestPieces","msg_type","_onData","total_size","_request","_data","_reject","_checkDone","_failedMetadata","ge","ye","be","_torrent","_pieceLength","_startPiece","_endPiece","_piece","_offset","_missing","_criticalLength","select","critical","deselect","ve","_fileStreams","_iterators","_client","progress","createReadStream","pull","enqueue","streamURL","_server","pathname","streamTo","src","we","_pieces","recalculate","_initWire","_onWireHave","_onWireBitfield","getRarestPiece","_cleanupWireEvents","_onClose","Me","ke","Se","xe","Ae","Ee","connId","lt_donthave","httpRequest","fileOffsetInRange","method","ok","status","Ie","Be","Te","Pe","Re","Ce","Le","Oe","statSync","tmpdir","je","requestIdleCallback","Ne","addUID","skipVerify","_store","_preloadedStore","preloadedStore","_storeCacheSlots","storeCacheSlots","_destroyStoreOnDestroy","destroyStoreOnDestroy","storeOpts","strategy","maxWebConns","_rechokeNumSlots","uploads","_rechokeOptimisticWire","_rechokeOptimisticTime","_rechokeIntervalId","_noPeersIntervalId","_noPeersIntervalTime","noPeersIntervalTime","_amInterested","_selections","_critical","_queue","_peersLength","received","_downloadSpeed","_uploadSpeed","_servers","_xsRequests","_fileModtimes","fileModtimes","_onTorrentId","timeRemaining","ratio","numPeers","torrentFileBlob","torrentFile","_numQueued","_numConns","_onParsedTorrent","_processParsedTorrent","_rechoke","_onListening","WEBTORRENT_ANNOUNCE","magnetURI","startsWith","_onMetadata","_getMetadataFromServer","_startDiscovery","discovery","addPeer","torrentPort","utPex","_xsRequestsController","enableWebSeeds","addWebSeed","_rarityMap","torrent","so","_hashes","_markAllVerified","_onStore","getFileModtimes","_verifyPieces","mtime","_markVerified","_markUnverified","rescanFiles","qe","_hasAllPieces","_hasNoPieces","_hasMorePieces","_updateSelections","_onWireWithMetadata","_remove","destroyStore","utp","_isIPv4","_validAddr","_registerPeer","_drain","_addIncomingPeer","priority","notify","ut_pex","reset","isSeeder","_updateWireInterest","_gcSelections","_updateInterest","_updateWireWrapper","_updateWire","Ue","_hotswap","storeMaxOutstandingPuts","maxConns","connect","reqq","De","Fe","He","ze","We","pendingReady","serveIndexPage","$e","isOriginAllowed","serveMethodNotAllowed","serve404Page","serveTorrentPage","serveOptionsRequest","serveFile","Expires","destination","Ze","statusCode","onRequest","torrents","Ke","server","createServer","_listen","_close","sockets","wrapRequest","hostname","writeHead","onConnection","Ve","registration","controller","workerKeepAliveInterval","workerPortCount","scope","_address","boundHandler","serviceWorker","ports","postMessage","escape","unescape","Ge","Je","Ye","Xe","Qe","nodeIdBuffer","natUpnp","natPmp","UTP_SUPPORT","_downloadLimit","downloadLimit","_uploadLimit","uploadLimit","natTraversal","enableUPNP","enablePMP","upnpPermanentFallback","secure","WRTC","_connPool","Client","publicPort","privatePort","description","webSeeds","blocklist","ServiceWorkerRegistration","active","singleFileTorrent","announceList","creationDate","sslCert","onProgress","tcpServer","throttleDownload","throttleUpload","_getByHash","VERSION","er","rr","ir","nr","sr","ar","hr","ur","fr","lr","cr","dr","pr","mr","yr","br","vr","logLevel","formatMessage","getTagStyle","argsToString","gr","wr","_r","Mr","Tr","kr","Sr","Pr","xr","Er","Ir","Ar","construct","Br","Rr","Cr","identifier","loggingEnabled","logger","encodeseed","keyPairEncrypt","encryptedPublicKey","lastwirecount","webTorrent","connections","torrentCreated","attach","extension","detach","ek","pk","sawPeer","rn","rpcCall","callbacks","sendRaw","api","makeEncryptSendPacket","makePacket","encryptPacket","last","serveraddress","encodeAddress","QR8bitByte","QRMode","MODE_8BIT_BYTE","parsedData","byteArray","QRCodeModel","typeNumber","errorCorrectLevel","modules","moduleCount","dataCache","dataList","getLength","addData","newData","isDark","getModuleCount","make","makeImpl","getBestMaskPattern","maskPattern","setupPositionProbePattern","setupPositionAdjustPattern","setupTimingPattern","setupTypeInfo","setupTypeNumber","createData","mapData","minLostPoint","pattern","lostPoint","QRUtil","getLostPoint","createMovieClip","target_mc","instance_name","qr_mc","createEmptyMovieClip","beginFill","endFill","getPatternPosition","bits","getBCHTypeNumber","getBCHTypeInfo","inc","bitIndex","byteIndex","dark","getMask","PAD0","PAD1","rsBlocks","QRRSBlock","getRSBlocks","QRBitBuffer","getLengthInBits","totalDataCount","dataCount","putBit","createBytes","maxDcCount","maxEcCount","dcdata","ecdata","dcCount","ecCount","totalCount","rsPoly","getErrorCorrectPolynomial","modPoly","QRPolynomial","modIndex","totalCodeCount","MODE_NUMBER","MODE_ALPHA_NUM","MODE_KANJI","PATTERN_POSITION_TABLE","G15","G18","G15_MASK","getBCHDigit","digit","errorCorrectLength","multiply","QRMath","gexp","qrCode","sameCount","darkCount","glog","LOG_TABLE","EXP_TABLE","num","RS_BLOCK_TABLE","rsBlock","getRsBlockTable","bufIndex","bit","QRCodeLimitLength","QRCode","background","ecl","_getUTF8Length","_getTypeNumber","_getErrorCorrectLevel","qrcode","svg","opt","container","pretty","indent","EOL","xsize","ysize","xmlDeclaration","predefined","defs","bgrect","modrect","pathdata","px","py","toFixed","writeFile","__webpack_require__","getter","definition","AutoConnectHelper","_createClass","_classCallCheck","_AutoConnectHelper","_defineProperty","autoConnectIds","ids","storageKey","isAutoConnectId","_localStorage$getItem","getAutoConnectIds","discoveryStorageKey","walletDiscoveryStorageKey","PeerConnectIdenticon","_regeneratorRuntime","Generator","Context","makeInvokeMethod","tryCatch","arg","GeneratorFunction","GeneratorFunctionPrototype","defineIteratorMethods","_invoke","AsyncIterator","invoke","_typeof","__await","callInvokeWithMethodAndArg","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","resultName","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","displayName","mark","awrap","reverse","rval","delegateYield","_toConsumableArray","arr","_arrayLikeToArray","_arrayWithoutHoles","iter","_iterableToArray","_unsupportedIterableToArray","_nonIterableSpread","minLen","arr2","asyncGeneratorStep","_next","_throw","_asyncToGenerator","fn","err","_defineProperties","props","descriptor","_toPropertyKey","_toPrimitive","char","toDataURL","ExperimentalContainer","instance","Constructor","protoProps","createTypeMapping","typeMapping","valueType","executeOrGetProperty","_x","_x2","_executeOrGetProperty","_callee2","typeInfo","_args2","_context2","serializeTypeMapping","plainObj","buildApiCalls","meerkat","serializedApiMapping","endpoint","_step","experimentalMapping","jsonString","deserializeTypeMapping","apiObjectRecord","_iterator","allowArrayLike","normalCompletion","didErr","_e2","_createForOfIteratorHelper","_loop","_typeInfo$value","_params","_len2","_key2","rpc","registerExperimentalEndpoint","experimentalContainer","register","_ref","_callee","functionName","_context","_x3","_x4","_x5","CardanoPeerConnect","walletInfo","_args$seed","_args$discoverySeed","_args$announce","_args$logLevel","_this","level","DAppDiscoveryMeerkat","_this$DAppDiscoveryMe","Meerkat","announceEndpoints","discoverySeed","clearSeen","saveWalletAutoDiscoverySeed","_this$DAppDiscoveryMe2","dappAddress","addMeerkat","_this$DAppDiscoveryMe3","_this$DAppDiscoveryMe4","_this$DAppDiscoveryMe5","_this$DAppDiscoveryMe6","onConnectCallback","onDisconnectCallback","onDisconnect","onServerShutdown","onApiInject","_this$_cip30Experimen","_this$_cip30EnableExp","overwrite","expApiTypeMapping","_cip30ExperimentalApi","expFullApiTypeMapping","_cip30EnableExperimentalApi","apiVersion","icon","methods","cip30Functions","experimentalApi","fullExperimentalApi","connectMessage","errorMessage","meerkatInstance","meerkats","_this$meerkat","_this$meerkats$get","_this$meerkat2","_this$meerkat3","_this$meerkat4","_this$meerkat5","getBase64Identicon","setUpDiscoveryMeerkat","dynamicObj","_this$seed","_this$meerkat6","_this2","_this2$meerkat","dApp","_ref2","cip30Function","_x6","_this2$meerkat2","connectStatus","_this2$meerkat3","_this2$DAppDiscoveryM","_this2$meerkat7","_this2$meerkat6","_this2$meerkat4","injectApi","generateIdenticon","walletDiscoveryAddress","_this2$meerkat5","_this3","_this3$meerkat","Logger","_ref$enabled","tagStyle","scopeStyle","_len3","_key3","_len4","_key4","DAppPeerConnect","dAppInfo","verifyConnection","onApiEject","useWalletDiscovery","_AutoConnectHelper$ge","getWalletDiscoveryAddress","getWalletAutoDiscoverySeed","walletDiscoveryMeerkat","enableLogging","connectedWallet","globalCardano","cardano","apiName","getAddress","_objectSpread","setUpDiscoveryMeerkcat","leftServer","connectWallet","granted","allowAutoConnect","connectedWalletInfo","requestAutoconnect","addAutoConnectId","autoConnect","saveWalletDiscoveryAddress","getInjectedApis","initialExperimentalApi","cip30Api","experimental","isEnabled","resovle","isWalletNameInjected","isP2pWalletCompliantName","innerHTML"],"sourceRoot":""} \ No newline at end of file