diff --git a/CHANGELOG.md b/CHANGELOG.md index d06d147845..2b68a85c29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.6.3](https://github.com/webtorrent/webtorrent/compare/v2.6.2...v2.6.3) (2025-04-18) + + +### Bug Fixes + +* **deps:** update dependency torrent-discovery to ^11.0.16 ([#2943](https://github.com/webtorrent/webtorrent/issues/2943)) ([6c0154e](https://github.com/webtorrent/webtorrent/commit/6c0154e5255f9c6590dcb62c466ed22c043d5ee0)) + ## [2.6.2](https://github.com/webtorrent/webtorrent/compare/v2.6.1...v2.6.2) (2025-04-18) diff --git a/dist/webtorrent.chromeapp.js b/dist/webtorrent.chromeapp.js index bca1af6838..54573bb2a4 100644 --- a/dist/webtorrent.chromeapp.js +++ b/dist/webtorrent.chromeapp.js @@ -1,2 +1,2 @@ -var t={20:(t,e,r)=>{var i=r(2861).Buffer,n=r(7108),s=r(96),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}},76:t=>{t.exports=Function.prototype.call},82:(t,e,r)=>{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;"seqof"===t?t="seq":"setof"===t&&(t="set");if(a.tagByName.hasOwnProperty(t))n=a.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return i.error("Unknown tag: "+t);n=t}if(n>=31)return i.error("Multi-octet tag encoding unsupported");e||(n|=32);return n|=a.tagClassByName[r||"universal"]<<6,n}(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--){o=t[i];for(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=r(717),n=r(8310);"disable"===i.env.READABLE_STREAM&&n?(t.exports=n,(e=t.exports=n.Readable).Readable=n.Readable,e.Writable=n.Writable,e.Duplex=n.Duplex,e.Transform=n.Transform,e.PassThrough=n.PassThrough,e.Stream=n):((e=t.exports=r(206)).Stream=n||e,e.Readable=e,e.Writable=r(7314),e.Duplex=r(6248),e.Transform=r(1816),e.PassThrough=r(5242))},113:t=>{const e={};function r(t,r,i){i||(i=Error);class n extends i{constructor(t,e,i){super(function(t,e,i){return"string"==typeof r?r:r(t,e,i)}(t,e,i))}}n.prototype.name=i.name,n.prototype.code=t,e[t]=n}function i(t,e){if(Array.isArray(t)){const r=t.length;return t=t.map((t=>String(t))),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:2===r?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}return`of ${e} ${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){let n;var s,o;let a;if("string"==typeof e&&(s="not ",e.substr(!o||o<0?0:+o,s.length)===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-e.length,r)===e}(t," argument"))a=`The ${t} ${n} ${i(e,"type")}`;else{const r=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a=`The "${t}" ${r} ${n} ${i(e,"type")}`}return a+=". Received type "+typeof r,a}),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},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())}},206:(t,e,r)=>{var i=r(717),n=r(3225);t.exports=v;var s,o=r(2240);v.ReadableState=b;r(7007).EventEmitter;var a=function(t,e){return t.listeners(e).length},h=r(1862),u=r(4116).Buffer,f=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l=Object.create(r(5622));l.inherits=r(6698);var c=r(537),d=void 0;d=c&&c.debuglog?c.debuglog("stream"):function(){};var p,m=r(672),g=r(6278);l.inherits(v,h);var y=["error","close","destroy","pause","resume"];function b(t,e){t=t||{};var i=e instanceof(s=s||r(6248));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(6427).I),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function v(t){if(s=s||r(6248),!(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;null===e?(o.reading=!1,function(t,e){if(e.ended)return;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,k(t)}(t,o)):(n||(s=function(t,e){var r;i=e,u.isBuffer(i)||i instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return 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):x(t,o)):_(t,o,e,!1))):i||(o.reading=!1));return 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 k(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(E,t):E(t))}function E(t){d("emit readable"),t.emit("readable"),P(t)}function x(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(A,t,e))}function A(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;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;i.data.copy(r),t-=i.data.length;for(;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);return 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(O,e,t))}function O(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function B(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):k(this),null;if(0===(t=S(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?C(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?f:v;function u(e,i){d("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),t.removeListener("close",y),t.removeListener("finish",b),t.removeListener("drain",l),t.removeListener("error",g),t.removeListener("unpipe",u),r.removeListener("end",f),r.removeListener("end",v),r.removeListener("data",m),c=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function f(){d("onend"),t.end()}s.endEmitted?n.nextTick(h):r.once("end",h),t.on("unpipe",u);var l=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",l);var c=!1;var p=!1;function m(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==B(s.pipes,t))&&!c&&(d("false write response, pause",s.awaitDrain),s.awaitDrain++,p=!0),r.pause())}function g(e){d("onerror",e),v(),t.removeListener("error",g),0===a(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",b),v()}function b(){d("onfinish"),t.removeListener("close",y),v()}function v(){d("unpipe"),r.unpipe(t)}return r.on("data",m),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",g),t.once("close",y),t.once("finish",b),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{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)&&(s(e.length===2*t.encodingLength,"Signature has invalid size"),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},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}},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{var i=r(8276);t.exports=function(t){return(new i).update(t).digest()}},345:(t,e,r)=>{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),i&&o(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}()},370:(t,e,r)=>{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()}},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},405:t=>{t.exports=async function*(t){for(let e of t)"function"==typeof e&&(e=e()),yield*e}},414:t=>{t.exports=Math.round},453:(t,e,r)=>{var i,n=r(9612),s=r(9383),o=r(1237),a=r(9290),h=r(9538),u=r(8068),f=r(9675),l=r(5345),c=r(9133),d=r(8968),p=r(6188),m=r(8002),g=r(5880),y=r(414),b=r(3093),v=Function,w=function(t){try{return v('"use strict"; return ('+t+").constructor;")()}catch(t){}},_=r(5795),M=r(655),S=function(){throw new f},k=_?function(){try{return S}catch(t){try{return _(arguments,"callee").get}catch(t){return S}}}():S,E=r(4039)(),x=r(3628),A=r(1064),I=r(8648),T=r(1002),P=r(76),C={},R="undefined"!=typeof Uint8Array&&x?x(Uint8Array):i,O={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":E&&x?x([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":C,"%AsyncGenerator%":C,"%AsyncGeneratorFunction%":C,"%AsyncIteratorPrototype%":C,"%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%":s,"%eval%":eval,"%EvalError%":o,"%Float16Array%":"undefined"==typeof Float16Array?i:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":C,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":E&&x?x(x([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&E&&x?x((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":n,"%Object.getOwnPropertyDescriptor%":_,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":a,"%ReferenceError%":h,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&E&&x?x((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":E&&x?x(""[Symbol.iterator]()):i,"%Symbol%":E?Symbol:i,"%SyntaxError%":u,"%ThrowTypeError%":k,"%TypedArray%":R,"%TypeError%":f,"%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%":l,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet,"%Function.prototype.call%":P,"%Function.prototype.apply%":T,"%Object.defineProperty%":M,"%Object.getPrototypeOf%":A,"%Math.abs%":c,"%Math.floor%":d,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":g,"%Math.round%":y,"%Math.sign%":b,"%Reflect.getPrototypeOf%":I};if(x)try{null.error}catch(t){var B=x(x(t));O["%Error.prototype%"]=B}var L=function t(e){var r;if("%AsyncFunction%"===e)r=w("async function () {}");else if("%GeneratorFunction%"===e)r=w("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=w("async function* () {}");else if("%AsyncGenerator%"===e){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&x&&(r=x(n.prototype))}return O[e]=r,r},N={__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"]},j=r(6743),U=r(9957),q=j.call(P,Array.prototype.concat),D=j.call(T,Array.prototype.splice),H=j.call(P,String.prototype.replace),F=j.call(P,String.prototype.slice),z=j.call(P,RegExp.prototype.exec),$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,W=/\\(\\)?/g,K=function(t,e){var r,i=t;if(U(N,i)&&(i="%"+(r=N[i])[0]+"%"),U(O,i)){var n=O[i];if(n===C&&(n=L(i)),void 0===n&&!e)throw new f("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new u("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new f("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new f('"allowMissing" argument must be a boolean');if(null===z(/^%?[^%]*%?$/,t))throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=F(t,0,1),r=F(t,-1);if("%"===e&&"%"!==r)throw new u("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new u("invalid intrinsic syntax, expected opening `%`");var i=[];return H(t,$,(function(t,e,r,n){i[i.length]=r?H(n,W,"$1"):e||t})),i}(t),i=r.length>0?r[0]:"",n=K("%"+i+"%",e),s=n.name,o=n.value,a=!1,h=n.alias;h&&(i=h[0],D(r,q([0,1],h)));for(var l=1,c=!0;l=r.length){var g=_(o,d);o=(c=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:o[d]}else c=U(o,d),o=o[d];c&&!a&&(O[s]=o)}}return o}},462:(t,e,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},480:(t,e,r)=>{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]})},507:(t,e,r)=>{var i=r(453),n=r(6556),s=r(8859),o=r(9675),a=i("%Map%",!0),h=n("Map.prototype.get",!0),u=n("Map.prototype.set",!0),f=n("Map.prototype.has",!0),l=n("Map.prototype.delete",!0),c=n("Map.prototype.size",!0);t.exports=!!a&&function(){var t,e={assert:function(t){if(!e.has(t))throw new o("Side channel does not contain "+s(t))},delete:function(e){if(t){var r=l(t,e);return 0===c(t)&&(t=void 0),r}return!1},get:function(e){if(t)return h(t,e)},has:function(e){return!!t&&f(t,e)},set:function(e,r){t||(t=new a),u(t,e,r)}};return 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},537:(t,e,r)=>{var i=r(717),n=/%[sdj%]/g;e.format=function(t){if(!y(t)){for(var e=[],r=0;r=s)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}})),h=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&e._extend(i,r),b(i.showHidden)&&(i.showHidden=!1),b(i.depth)&&(i.depth=2),b(i.colors)&&(i.colors=!1),b(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=h),f(i,t,i.depth)}function h(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function u(t,e){return t}function f(t,r,i){if(t.customInspect&&r&&S(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return y(n)||(n=f(t,n,i)),n}var s=function(t,e){if(b(e))return t.stylize("undefined","undefined");if(y(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(g(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(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)),M(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return l(r);if(0===o.length){if(S(r)){var h=r.name?": "+r.name:"";return t.stylize("[Function"+h+"]","special")}if(v(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(_(r))return t.stylize(Date.prototype.toString.call(r),"date");if(M(r))return l(r)}var u,w="",k=!1,E=["{","}"];(d(r)&&(k=!0,E=["[","]"]),S(r))&&(w=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(w=" "+RegExp.prototype.toString.call(r)),_(r)&&(w=" "+Date.prototype.toUTCString.call(r)),M(r)&&(w=" "+l(r)),0!==o.length||k&&0!=r.length?i<0?v(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),u=k?function(t,e,r,i,n){for(var s=[],o=0,a=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(i>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(u,w,E)):E[0]+w+E[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function c(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")),A(i,n)||(o="["+n+"]"),a||(t.seen.indexOf(h.value)<0?(a=m(r)?f(t,h.value,null):f(t,h.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),b(o)){if(s&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function d(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return"number"==typeof t}function y(t){return"string"==typeof t}function b(t){return void 0===t}function v(t){return w(t)&&"[object RegExp]"===k(t)}function w(t){return"object"==typeof t&&null!==t}function _(t){return w(t)&&"[object Date]"===k(t)}function M(t){return w(t)&&("[object Error]"===k(t)||t instanceof Error)}function S(t){return"function"==typeof t}function k(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(b(s)&&(s=i.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(s)){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=a,a.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]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=g,e.isString=y,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=b,e.isRegExp=v,e.isObject=w,e.isDate=_,e.isError=M,e.isFunction=S,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(2503);var x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){var t,r;console.log("%s - %s",(t=new Date,r=[E(t.getHours()),E(t.getMinutes()),E(t.getSeconds())].join(":"),[t.getDate(),x[t.getMonth()],r].join(" ")),e.format.apply(e,arguments))},e.inherits=r(6622),e._extend=function(t,e){if(!e||!w(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t}},580:t=>{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=0;)n++;if("::"===t.substr(0,2)&&n--,"::"===t.substr(-2,2)&&n--,n>e)return null;for(i=e-n,r=":";i--;)r+="0:";return":"===(t=t.replace("::",r))[0]&&(t=t.slice(1)),":"===t[t.length-1]&&(t=t.slice(0,-1)),{parts:e=function(){const e=t.split(":"),r=[];for(let t=0;t0;){if(n=r-i,n<0&&(n=0),t[s]>>n!=e[s]>>n)return!1;i-=r,s+=1}return!0}function l(t){if(s.test(t))return parseInt(t,16);if("0"===t[0]&&!isNaN(parseInt(t[1],10))){if(n.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function c(t,e){for(;t.length=0;i-=1){if(n=this.octets[i],!(n in r))return null;if(s=r[n],e&&0!==s)return null;8!==s&&(e=!0),t+=s}return 32-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),d.IPv4.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[];let s=0;for(;s<4;)n.push(parseInt(r[s],10)|255^parseInt(i[s],10)),s++;return new this(n)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(t){return null!==this.parser(t)},d.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(t){return!1}},d.IPv4.isValidCIDR=function(t){try{return this.parseCIDR(t),!0}catch(t){return!1}},d.IPv4.isValidFourPartDecimal=function(t){return!(!d.IPv4.isValid(t)||!t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(t){let e,r,i,n,s;try{for(e=this.parseCIDR(t),i=e[0].toByteArray(),s=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[],r=0;r<4;)n.push(parseInt(i[r],10)&parseInt(s[r],10)),r++;return new this(n)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(t){const e=this.parser(t);if(null===e)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(e)},d.IPv4.parseCIDR=function(t){let e;if(e=t.match(/^(.+)\/(\d+)$/)){const t=parseInt(e[2]);if(t>=0&&t<=32){const r=[this.parse(e[1]),t];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(t){let e,r,n;if(e=t.match(i.fourOctet))return function(){const t=e.slice(1,6),i=[];for(let e=0;e4294967295||n<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(n>>e&255);return t}().reverse()}return(e=t.match(i.twoOctet))?function(){const t=e.slice(1,4),r=[];if(n=l(t[1]),n>16777215||n<0)throw new Error("ipaddr: address outside defined range");return r.push(l(t[0])),r.push(n>>16&255),r.push(n>>8&255),r.push(255&n),r}():(e=t.match(i.threeOctet))?function(){const t=e.slice(1,5),r=[];if(n=l(t[2]),n>65535||n<0)throw new Error("ipaddr: address outside defined range");return r.push(l(t[0])),r.push(l(t[1])),r.push(n>>8&255),r.push(255&n),r}():null},d.IPv4.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>32)throw new Error("ipaddr: invalid IPv4 prefix length");const e=[0,0,0,0];let r=0;const i=Math.floor(t/8);for(;r=0;s-=1){if(i=this.parts[s],!(i in r))return null;if(n=r[i],e&&0!==n)return null;16!==n&&(e=!0),t+=n}return 128-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){let t;const e=[],r=this.parts;for(let i=0;i>8),e.push(255&t);return e},t.prototype.toFixedLengthString=function(){const t=function(){const t=[];for(let e=0;e>8,255&e,r>>8,255&r])},t.prototype.toNormalizedString=function(){const t=function(){const t=[];for(let e=0;en&&(i=r.index,n=r[0].length);return n<0?e:`${e.substring(0,i)}::${e.substring(i+n)}`},t.prototype.toString=function(){return this.toRFC5952String()},t}(),d.IPv6.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[];let s=0;for(;s<16;)n.push(parseInt(r[s],10)|255^parseInt(i[s],10)),s++;return new this(n)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.isIPv6=function(t){return null!==this.parser(t)},d.IPv6.isValid=function(t){if("string"==typeof t&&-1===t.indexOf(":"))return!1;try{const e=this.parser(t);return new this(e.parts,e.zoneId),!0}catch(t){return!1}},d.IPv6.isValidCIDR=function(t){if("string"==typeof t&&-1===t.indexOf(":"))return!1;try{return this.parseCIDR(t),!0}catch(t){return!1}},d.IPv6.networkAddressFromCIDR=function(t){let e,r,i,n,s;try{for(e=this.parseCIDR(t),i=e[0].toByteArray(),s=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[],r=0;r<16;)n.push(parseInt(i[r],10)&parseInt(s[r],10)),r++;return new this(n)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.parse=function(t){const e=this.parser(t);if(null===e.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(e.parts,e.zoneId)},d.IPv6.parseCIDR=function(t){let e,r,i;if((r=t.match(/^(.+)\/(\d+)$/))&&(e=parseInt(r[2]),e>=0&&e<=128))return i=[this.parse(r[1]),e],Object.defineProperty(i,"toString",{value:function(){return this.join("/")}}),i;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(t){let e,r,i,n,s,o;if(i=t.match(h.deprecatedTransitional))return this.parser(`::ffff:${i[1]}`);if(h.native.test(t))return u(t,8);if((i=t.match(h.transitional))&&(o=i[6]||"",e=i[1],i[1].endsWith("::")||(e=e.slice(0,-1)),e=u(e+o,6),e.parts)){for(s=[parseInt(i[2]),parseInt(i[3]),parseInt(i[4]),parseInt(i[5])],r=0;r128)throw new Error("ipaddr: invalid IPv6 prefix length");const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const i=Math.floor(t/8);for(;r{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},655:t=>{var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}t.exports=e},672:(t,e,r)=>{var i=r(4116).Buffer,n=r(537);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,s=i.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=s,n=a,e.copy(r,n),a+=o.data.length,o=o.next;return s},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})},681:(t,e,r)=>{var i={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20},n=r(3507),s=r(2861).Buffer,o=r(4196),a=r(2455),h=r(3382);t.exports=function(t,e,r,u,f){o(r,u),t=h(t,a,"Password"),e=h(e,a,"Salt"),f=f||"sha1";var l=s.allocUnsafe(u),c=s.allocUnsafe(e.length+4);e.copy(c,0,0,e.length);for(var d=0,p=i[f],m=Math.ceil(u/p),g=1;g<=m;g++){c.writeUInt32BE(g,e.length);for(var y=n(f,t).update(c).digest(),b=y,v=1;v{r.r(e),r.d(e,{addListener:()=>c,argv:()=>a,binding:()=>k,browser:()=>s,chdir:()=>E,cwd:()=>M,emit:()=>y,env:()=>o,listeners:()=>_,nextTick:()=>w,off:()=>p,on:()=>l,once:()=>d,prependListener:()=>b,prependOnceListener:()=>v,removeAllListeners:()=>g,removeListener:()=>m,title:()=>n,umask:()=>S,version:()=>h,versions:()=>u});var i=r(9596);const n="browser",s=!0,o={},a=[],h="",u={};function f(){}const l=f,c=f,d=f,p=f,m=f,g=f,y=f,b=f,v=f,w=(t,...e)=>i((()=>t(...e))),_=t=>[],M=()=>"/",S=()=>0,k=t=>{throw new Error("process.binding is not supported")},E=t=>{throw new Error("process.chdir is not supported")}},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{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,e){let r=0,i=0,n=-1,s=0;for(;r"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){e.save(t),e.namespaces=t,e.names=[],e.skips=[];const r=("string"==typeof t?t:"").trim().replace(" ",",").split(",").filter(Boolean);for(const t of r)"-"===t[0]?e.skips.push(t.slice(1)):e.names.push(t)},e.enabled=function(t){for(const r of e.skips)if(n(t,r))return!1;for(const r of e.names)if(n(t,r))return!0;return!1},e.humanize=r(6585),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((r=>{e[r]=t[r]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let r=0;for(let e=0;e{var i,n=r(717),s=r(3519),o=r(6611);try{i=r(2376)}catch(t){}var a=function(){},h=/^v?\.0/.test(n.version),u=function(t){return"function"==typeof t},f=function(t,e,r,n){n=s(n);var f=!1;t.on("close",(function(){f=!0})),o(t,{readable:e,writable:r},(function(t){if(t)return n(t);f=!0,n()}));var l=!1;return function(e){if(!f&&!l)return l=!0,function(t){return!!h&&!!i&&(t instanceof(i.ReadStream||a)||t instanceof(i.WriteStream||a))&&u(t.close)}(t)?t.close(a):function(t){return t.setHeader&&u(t.abort)}(t)?t.abort():u(t.destroy)?t.destroy():void n(e||new Error("stream was destroyed"))}},l=function(t){t()},c=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(n,s){var o=s0,(function(e){t||(t=e),e&&i.forEach(l),o||(i.forEach(l),r(t))}))}));return e.reduce(c)}},894:(t,e,r)=>{var i=e;i.base=r(6677),i.short=r(9188),i.mont=r(370),i.edwards=r(1298)},920:(t,e,r)=>{var i=r(9675),n=r(8859),s=r(4803),o=r(507),a=r(2271)||o||s;t.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new i("Side channel does not contain "+n(t))},delete:function(e){return!!t&&t.delete(e)},get:function(e){return t&&t.get(e)},has:function(e){return!!t&&t.has(e)},set:function(e,r){t||(t=a()),t.set(e,r)}};return e}},975:t=>{var e=function(){function t(t,e,r){this.name=t,this.max=e,this.constructor=null!=r?r:function(){},this.list=[]}return t.prototype.alloc=function(){return this.list.length?this.list.shift():this.constructor.apply(this,arguments)},t.prototype.free=function(t){return this.list.length{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())}c.bytes=0,c.position=0,c.data=null,c.encoding=null,c.next=function(){switch(c.data[c.position]){case 100:return c.dictionary();case 108:return c.list();case 105:return c.integer();default:return c.buffer()}},c.find=function(t){let e=c.position;const r=c.data.length,i=c.data;for(;e{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){if(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)}},1002:t=>{t.exports=Function.prototype.apply},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{var i=r(9612);t.exports=i.getPrototypeOf||null},1093:t=>{var e=Object.prototype.toString;t.exports=function(t){var r=e.call(t),i="[object Arguments]"===r;return i||(i="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),i}},1133:(t,e,r)=>{let i=r(8673);t.exports=new i(r(8446))},1137:(t,e,r)=>{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())}))},1158:function(t,e,r){!function(t,e){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(8287).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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},1189:(t,e,r)=>{var i=Array.prototype.slice,n=r(1093),s=Object.keys,o=s?function(t){return s(t)}:r(8875),a=Object.keys;o.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return n(t)?a(i.call(t)):a(t)})}else Object.keys=o;return Object.keys||o},t.exports=o},1200:(t,e,r)=>{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,r){return this.ec.verify(t,e,this,void 0,r)},s.prototype.inspect=function(){return""}},1220:()=>{},1237:t=>{t.exports=EvalError},1241:(t,e,r)=>{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)}},1298:(t,e,r)=>{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},1314:t=>{t.exports=function(t,e){if(e>=t.length||e<0)return;var r=t.pop();if(e{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{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(var i 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 n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var s=Object.getOwnPropertyDescriptor(t,e);if(42!==s.value||!0!==s.enumerable)return!1}return!0}},1416:(t,e,r)=>{t.exports=r(8310)},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))}},1514:(t,e,r)=>{var i=r(8403);t.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),r={},i=0;i{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(5488);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\nwe accept pull requests\nhttps://github.com/browserify/crypto-browserify")},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}},1591:t=>{t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},1630:t=>{function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,r,i,n){r=r||"&",i=i||"=";var s={};if("string"!=typeof t||0===t.length)return s;var o=/\+/g;t=t.split(r);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var h=t.length;a>0&&h>a&&(h=a);for(var u=0;u=0?(f=p.substr(0,m),l=p.substr(m+1)):(f=p,l=""),c=decodeURIComponent(f),d=decodeURIComponent(l),e(s,c)?Array.isArray(s[c])?s[c].push(d):s[c]=[s[c],d]:s[c]=d}return s}},1636:t=>{t.exports={rE:"6.6.1"}},1672:(t,e,r)=>{var i=r(717);t.exports=function(t,e){var r=0,n=[],s=!0;function o(t){function r(){e&&e(t,n)}s?i.nextTick(r):r()}t.length>0?t[0]((function e(i,s){n.push(s),++r>=t.length||i?o(i):t[r](e)})):o(null);s=!1}},1678:(t,e,r)=>{const i=r(537),n=r(8957),s=r(5905).HTTPParser,o=r(4529).ok,a=r(2728),h=a.parsers,u=a.freeParser,f=a.debug,l=a.CRLF,c=a.continueExpression,d=a.chunkExpression,p=a.httpSocketSetup,m=r(8419).OutgoingMessage,g=e.STATUS_CODES={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},y=0|s.kOnExecute;function b(t){m.call(this),"HEAD"===t.method&&(this._hasBody=!1),this.sendDate=!0,(t.httpVersionMajor<1||t.httpVersionMinor<1)&&(this.useChunkedEncodingByDefault=d.test(t.headers.te),this.shouldKeepAlive=!1)}function v(){this._httpMessage&&this._httpMessage.emit("close")}function w(t){if(!(this instanceof w))return new w(t);n.Server.call(this,{allowHalfOpen:!0}),t&&this.addListener("request",t),this.httpAllowHalfOpen=!1,this.addListener("connection",_),this.timeout=12e4,this._pendingResponseData=0}function _(t){var e=this,r=[],i=[],n=0;function a(e){if(n+=e,t._paused&&n=t._writableState.highWaterMark)&&(t._paused=!0,t.pause())}var u=new b(s);u._onPendingData=a,u.shouldKeepAlive=h,t._httpMessage?r.push(u):u.assignSocket(t);u.on("finish",(function(){o(0===i.length||i[0]===s),i.shift(),s._consuming||s._readableState.resumeScheduled||s._dump();if(u.detachSocket(t),u._last)t.destroySoon();else{var e=r.shift();e&&e.assignSocket(t)}})),void 0!==s.headers.expect&&1==s.httpVersionMajor&&1==s.httpVersionMinor?c.test(s.headers.expect)?(u._expect_continue=!0,e.listenerCount("checkContinue")>0?e.emit("checkContinue",s,u):(u.writeContinue(),e.emit("request",s,u))):e.listenerCount("checkExpectation")>0?e.emit("checkExpectation",s,u):(u.writeHead(417),u.end()):e.emit("request",s,u);return!1},t.on("end",x),t.on("data",w),t.on("resume",M),t.on("pause",S),t.on("drain",A),t.on=E;var g=t._handle&&t._handle._externalStream;function v(t){this.removeListener("error",v),this.on("error",(()=>{})),e.emit("clientError",t,this)||this.destroy(t)}function w(e){o(!t._paused),f("SERVER socketOnData %d",e.length),_(m.execute(e),e)}function _(r,i){if(r instanceof Error)f("parse error"),v.call(t,r);else if(m.incoming&&m.incoming.upgrade){var n=r,s=m.incoming;f("SERVER upgrade or connect",s.method),i||(i=m.getCurrentBuffer()),t.removeListener("data",w),t.removeListener("end",x),t.removeListener("close",d),k(m,t),m.finish(),u(m,s,null),m=null;var o="CONNECT"===s.method?"connect":"upgrade";if(e.listenerCount(o)>0){f("SERVER have listener for %s",o);var a=i.slice(n,i.length);t._readableState.flowing=null,e.emit(o,s,t,a)}else t.destroy()}t._paused&&t.parser&&(f("pause parser"),t.parser.pause())}function x(){var t=this,i=m.finish();if(i instanceof Error)return f("parse error"),void v.call(t,i);e.httpAllowHalfOpen?r.length?r[r.length-1]._last=!0:t._httpMessage?t._httpMessage._last=!0:t.writable&&t.end():(l(),t.writable&&t.end())}function A(){var e=n>t._writableState.highWaterMark;t._paused&&!e&&(t._paused=!1,t.parser&&t.parser.resume(),t.resume())}g&&(m._consumed=!0,m.consume(g)),g=null,m[y]=function(e,r){t._unrefTimer(),f("SERVER socketOnParserExecute %d",e),_(e,void 0)},t._paused=!1}function M(){this._paused?this.pause():this._handle&&!this._handle.reading&&(this._handle.reading=!0,this._handle.readStart())}function S(){this._handle&&this._handle.reading&&(this._handle.reading=!1,this._handle.readStop())}function k(t,e){e._handle&&(t._consumed&&t.unconsume(e._handle._externalStream),t._consumed=!1,e.removeListener("pause",S),e.removeListener("resume",M))}function E(t,e){var r=n.Socket.prototype.on.call(this,t,e);return this.parser?("data"!==t&&"readable"!==t||k(this.parser,this),r):(this.on=n.Socket.prototype.on,r)}i.inherits(b,m),b.prototype._finish=function(){m.prototype._finish.call(this)},e.ServerResponse=b,b.prototype.statusCode=200,b.prototype.statusMessage=void 0,b.prototype.assignSocket=function(t){o(!t._httpMessage),t._httpMessage=this,t.on("close",v),this.socket=t,this.connection=t,this.emit("socket",t),this._flush()},b.prototype.detachSocket=function(t){o(t._httpMessage===this),t.removeListener("close",v),t._httpMessage=null,this.socket=this.connection=null},b.prototype.writeContinue=function(t){this._writeRaw("HTTP/1.1 100 Continue"+l+l,"ascii",t),this._sent100=!0},b.prototype._implicitHeader=function(){this.writeHead(this.statusCode)},b.prototype.writeHead=function(t,e,r){var i;if("string"==typeof e?this.statusMessage=e:(this.statusMessage=this.statusMessage||g[t]||"unknown",r=e),this.statusCode=t,this._headers){if(r)for(var n=Object.keys(r),s=0;s999)throw new RangeError(`Invalid status code: ${t}`);var a="HTTP/1.1 "+t.toString()+" "+this.statusMessage+l;(204===t||304===t||100<=t&&t<=199)&&(this._hasBody=!1),this._expect_continue&&!this._sent100&&(this.shouldKeepAlive=!1),this._storeHeader(a,i)},b.prototype.writeHeader=function(){this.writeHead.apply(this,arguments)},i.inherits(w,n.Server),w.prototype.setTimeout=function(t,e){return this.timeout=t,e&&this.on("timeout",e),this},e.Server=w,e._connectionListener=_},1800:(t,e,r)=>{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{t.exports=o;var i=r(6248),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{},1862:(t,e,r)=>{t.exports=r(8310)},1911:(t,e,r)=>{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")}},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{t.exports=function(t,e){for(var r=t.length,i=-1;++i{t.exports={wait:function(t){return new Promise((e=>setTimeout(e,t)))}}},2085:(t,e,r)=>{var i=r(640),n=function(t){switch(t.length){case 6:return t[0]+"."+t[1]+"."+t[2]+"."+t[3]+":"+t.readUInt16BE(4);case 18:for(var e=[],r=0;r<8;r++)e.push(t.readUInt16BE(2*r).toString(16));return"["+i.parse(e.join(":")).toString()+"]:"+t.readUInt16BE(16);default:throw new Error("Invalid Compact IP/PORT, It should contain 6 or 18 bytes")}};n.multi=function(t){if(t.length%6!=0)throw new Error("buf length isn't multiple of compact IP/PORTs (6 bytes)");for(var e=[],r=0;r<=t.length-1;r+=6)e.push(n(t.slice(r,r+6)));return e},n.multi6=function(t){if(t.length%18!=0)throw new Error("buf length isn't multiple of compact IP6/PORTs (18 bytes)");for(var e=[],r=0;r<=t.length-1;r+=18)e.push(n(t.slice(r,r+18)));return e},t.exports=n},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)},2195:(t,e,r)=>{const i=r(537),n=i,s=r(7007);e.IncomingMessage=r(3989).IncomingMessage;const o=r(2728);e.METHODS=o.methods.slice().sort(),e.OutgoingMessage=r(8419).OutgoingMessage;const a=r(1678);e.ServerResponse=a.ServerResponse,e.STATUS_CODES=a.STATUS_CODES;const h=r(8748),u=e.Agent=h.Agent;e.globalAgent=h.globalAgent;const f=r(5930),l=e.ClientRequest=f.ClientRequest;e.request=function(t,e){return new l(t,e)},e.get=function(t,r){var i=e.request(t,r);return i.end(),i},e._connectionListener=a._connectionListener;const c=e.Server=a.Server;function d(t,e){if(!(this instanceof d))return new d(t,e);s.call(this),e=e||"localhost",t=t||80,this.host=e,this.port=t,this.agent=new u({host:e,port:t,maxSockets:1})}e.createServer=function(t){return new c(t)},i.inherits(d,s),d.prototype.request=function(t,e,r){var i=this,n={};n.host=i.host,n.port=i.port,"/"===t[0]&&(r=e,e=t,t="GET"),n.method=t,n.path=e,n.headers=r,n.agent=i.agent;var s=new l(n);return s.on("error",(function(t){i.emit("error",t)})),s.on("socket",(function(t){t.on("end",(function(){if(i._decoder){var t=i._decoder.end();t&&i.emit("data",t)}i.emit("end")}))})),s},e.Client=n.deprecate(d,"http.Client is deprecated."),e.createClient=n.deprecate((function(t,e){return new d(t,e)}),"http.createClient is deprecated. Use http.request instead.")},2211:(t,e,r)=>{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)}},2240:t=>{var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},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{var i=r(453),n=r(6556),s=r(8859),o=r(507),a=r(9675),h=i("%WeakMap%",!0),u=n("WeakMap.prototype.get",!0),f=n("WeakMap.prototype.set",!0),l=n("WeakMap.prototype.has",!0),c=n("WeakMap.prototype.delete",!0);t.exports=h?function(){var t,e,r={assert:function(t){if(!r.has(t))throw new a("Side channel does not contain "+s(t))},delete:function(r){if(h&&r&&("object"==typeof r||"function"==typeof r)){if(t)return c(t,r)}else if(o&&e)return e.delete(r);return!1},get:function(r){return h&&r&&("object"==typeof r||"function"==typeof r)&&t?u(t,r):e&&e.get(r)},has:function(r){return h&&r&&("object"==typeof r||"function"==typeof r)&&t?l(t,r):!!e&&e.has(r)},set:function(r,i){h&&r&&("object"==typeof r||"function"==typeof r)?(t||(t=new h),f(t,r,i)):o&&(e||(e=o()),e.set(r,i))}};return r}:o},2287:(t,e,r)=>{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=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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},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{},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}},2455:(t,e,r)=>{var i,n=r(717);if(globalThis.process&&globalThis.process.browser)i="utf-8";else if(globalThis.process&&globalThis.process.version){i=parseInt(n.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else i="utf-8";t.exports=i},2503:(t,e,r)=>{var i=r(8287).Buffer;t.exports=function(t){return t instanceof i}},2509:function(t,e,r){!function(t,e){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(8287).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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},2632:(t,e)=>{e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},2642:(t,e,r)=>{var i=r(7720),n=Object.prototype.hasOwnProperty,s=Array.isArray,o={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:i.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},a=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},h=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},u=function(t,e,r,i){if(t){var s=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(s),u=a?s.slice(0,a.index):s,f=[];if(u){if(!r.plainObjects&&n.call(Object.prototype,u)&&!r.allowPrototypes)return;f.push(u)}for(var l=0;r.depth>0&&null!==(a=o.exec(s))&&l=0;--s){var o,a=t[s];if("[]"===a&&r.parseArrays)o=r.allowEmptyArrays&&(""===n||r.strictNullHandling&&null===n)?[]:[].concat(n);else{o=r.plainObjects?Object.create(null):{};var u="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,f=r.decodeDotInKeys?u.replace(/%2E/g,"."):u,l=parseInt(f,10);r.parseArrays||""!==f?!isNaN(l)&&a!==f&&String(l)===f&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[])[l]=n:"__proto__"!==f&&(o[f]=n):o={0:n}}n=o}return n}(f,e,r,i)}};t.exports=function(t,e){var r=function(t){if(!t)return o;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?o.charset:t.charset,r=void 0===t.duplicates?o.duplicates:t.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||o.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:o.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:o.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:o.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:o.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:o.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:o.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:o.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:o.decoder,delimiter:"string"==typeof t.delimiter||i.isRegExp(t.delimiter)?t.delimiter:o.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:o.depth,duplicates:r,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:o.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:o.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:o.plainObjects,strictDepth:"boolean"==typeof t.strictDepth?!!t.strictDepth:o.strictDepth,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:o.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var f="string"==typeof t?function(t,e){var r={__proto__:null},u=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;u=u.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var f,l=e.parameterLimit===1/0?void 0:e.parameterLimit,c=u.split(e.delimiter,l),d=-1,p=e.charset;if(e.charsetSentinel)for(f=0;f-1&&(g=s(g)?[g]:g);var w=n.call(r,m);w&&"combine"===e.duplicates?r[m]=i.combine(r[m],g):w&&"last"!==e.duplicates||(r[m]=g)}return r}(t,r):t,l=r.plainObjects?Object.create(null):{},c=Object.keys(f),d=0;d{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{const i=r(5905),n=i.methods,s=i.HTTPParser,o=r(975).FreeList,a=r(3989),h=a.IncomingMessage,u=a.readStart,f=a.readStop,l=r(537).debuglog("http");e.debug=l,e.CRLF="\r\n",e.chunkExpression=/chunk/i,e.continueExpression=/100-continue/i,e.methods=n;const c=0|s.kOnHeaders,d=0|s.kOnHeadersComplete,p=0|s.kOnBody,m=0|s.kOnMessageComplete,g=0|s.kOnExecute;function y(t,e){(this.maxHeaderPairs<=0||this._headers.length0&&(c=Math.min(c,l.maxHeaderPairs)),l.incoming._addHeaderLines(r,c),"number"==typeof i?l.incoming.method=n[i]:(l.incoming.statusCode=o,l.incoming.statusMessage=a),!u||null===l.outgoing||void 0!==l.outgoing._headers.upgrade&&/(^|\W)upgrade(\W|$)/i.test(l.outgoing._headers.connection)||(u=!1),l.incoming.upgrade=u;var d=0;return u||(d=l.onIncoming(l.incoming,f)),"number"!=typeof d?d?1:0:d}function v(t,e,r){var i=this.incoming;if(i){var n=i.socket;if(r>0&&!i._dumped){var s=t.slice(e,e+r);i.push(s)||f(n)}}}function w(){var t=this,e=t.incoming;if(e){e.complete=!0;var r=t._headers;r&&(t.incoming._addHeaderLines(r,r.length),t._headers=[],t._url=""),e.push(null)}u(t.socket)}var _=new o("parsers",1e3,(function(){var t=new s(s.REQUEST);return t._headers=[],t._url="",t._consumed=!1,t.socket=null,t.incoming=null,t.outgoing=null,t[c]=y,t[d]=b,t[p]=v,t[m]=w,t[g]=null,t}));function M(){this._httpMessage&&this._httpMessage.emit("drain")}function S(t){return t>=94&&t<=122||(t>=65&&t<=90||(45===t||(t>=48&&t<=57||34!==t&&40!==t&&41!==t&&44!==t&&(t>=33&&t<=46||(124===t||126===t)))))}e.parsers=_,e.freeParser=function(t,e,r){t&&(t._headers=[],t.onIncoming=null,t._consumed&&t.unconsume(),t._consumed=!1,t.socket&&(t.socket.parser=null),t.socket=null,t.incoming=null,t.outgoing=null,t[g]=null,!1===_.free(t)&&t.close(),t=null),e&&(e.parser=null),r&&(r.parser=null)},e.httpSocketSetup=function(t){t.removeListener("drain",M),t.on("drain",M)},e._checkIsHttpToken=function(t){if("string"!=typeof t||0===t.length)return!1;if(!S(t.charCodeAt(0)))return!1;const e=t.length;if(e>1){if(!S(t.charCodeAt(1)))return!1;if(e>2){if(!S(t.charCodeAt(2)))return!1;if(e>3){if(!S(t.charCodeAt(3)))return!1;for(var r=4;r255||127===e)return!0;if(t.length<2)return!1;if((e=t.charCodeAt(1))<=31&&9!==e||e>255||127===e)return!0;if(t.length<3)return!1;if((e=t.charCodeAt(2))<=31&&9!==e||e>255||127===e)return!0;for(var r=3;r255||127===e)return!0;return!1}},2791:function(t,e,r){var i=r(717);!function(t){if(!t.setImmediate){var e,r,n,s,o,a=1,h={},u=!1,f=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?e=function(t){i.nextTick((function(){d(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((n=new MessageChannel).port1.onmessage=function(t){d(t.data)},e=function(t){n.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(r=f.documentElement,e=function(t){var e=f.createElement("script");e.onreadystatechange=function(){d(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):e=function(t){setTimeout(d,0,t)}:(s="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&d(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),e=function(e){t.postMessage(s+e,"*")}),l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var r=new Array(arguments.length-1),i=0;i=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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},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)},2808:(t,e,r)=>{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{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},2853:(t,e,r)=>{var i=e;i.der=r(2010),i.pem=r(8903)},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)}},2878:t=>{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})}if(u.length<1)return-1;return 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}},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)}},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,S=0|this._dl,k=0|this._el,E=0|this._fl,x=0|this._gl,A=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],C=d(T,P),R=p(P,T),O=m(T=e[I-4],P=e[I-4+1]),B=g(P,T),L=e[I-14],N=e[I-14+1],j=e[I-32],U=e[I-32+1],q=R+N|0,D=C+L+y(q,R)|0;D=(D=D+O+y(q=q+B|0,B)|0)+j+y(q=q+U|0,U)|0,e[I]=D,e[I+1]=q}for(var H=0;H<160;H+=2){D=e[H],q=e[H+1];var F=f(r,i,n),z=f(w,_,M),$=l(r,w),W=l(w,r),K=c(a,k),V=c(k,a),Z=o[H],G=o[H+1],Y=u(a,h,b),J=u(k,E,x),X=A+V|0,Q=v+K+y(X,A)|0;Q=(Q=(Q=Q+Y+y(X=X+J|0,J)|0)+Z+y(X=X+G|0,G)|0)+D+y(X=X+q|0,q)|0;var tt=W+z|0,et=$+F+y(tt,W)|0;v=b,A=x,b=h,x=E,h=a,E=k,a=s+Q+y(k=S+X|0,S)|0,s=n,S=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+S|0,this._el=this._el+k|0,this._fl=this._fl+E|0,this._gl=this._gl+x|0,this._hl=this._hl+A|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,S)|0,this._eh=this._eh+a+y(this._el,k)|0,this._fh=this._fh+h+y(this._fl,E)|0,this._gh=this._gh+b+y(this._gl,x)|0,this._hh=this._hh+v+y(this._hl,A)|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},2951:t=>{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"}}')},2955:(t,e,r)=>{var i,n=r(717);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,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");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(6238),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((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}},s(i,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}},3033:(t,e,r)=>{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{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{var i=r(717),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},3085:(t,e,r)=>{var i=r(717);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()}},3093:(t,e,r)=>{var i=r(4459);t.exports=function(t){return i(t)||0===t?t:t<0?-1:1}},3126:(t,e,r)=>{var i=r(6743),n=r(9675),s=r(76),o=r(3144);t.exports=function(t){if(t.length<1||"function"!=typeof t[0])throw new n("a function is required");return o(i,s,t)}},3141:(t,e,r)=>{var i=r(2861).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){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)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 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}},3144:(t,e,r)=>{var i=r(6743),n=r(1002),s=r(76),o=r(7119);t.exports=o||i.call(s,n)},3208:()=>{},3209:(t,e,r)=>{var i=r(717),n=65536,s=4294967295;var o=r(2861).Buffer,a=globalThis.crypto||globalThis.msCrypto;a&&a.getRandomValues?t.exports=function(t,e){if(t>s)throw new RangeError("requested too many random bytes");var r=o.allocUnsafe(t);if(t>0)if(t>n)for(var h=0;h{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"}}')},3225:(t,e,r)=>{var i=r(717);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{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"}}')},3278:()=>{},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)}},3382:(t,e,r)=>{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")}},3389:(t,e,r)=>{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{"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})}))},3507:(t,e,r)=>{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{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})}))},3549:()=>{},3600:(t,e,r)=>{t.exports=n;var i=r(4610);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)}},3628:(t,e,r)=>{var i=r(8648),n=r(1064),s=r(7176);t.exports=i?function(t){return i(t)}:n?function(t){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("getProto: not an object");return n(t)}:s?function(t){return s(t)}:null},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)}}},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},3832:(t,e,r)=>{var i,n,s=r(2861).Buffer,o=r(4196),a=r(2455),h=r(681),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)}))}},3917:(t,e,r)=>{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{const i=r(537),n=r(8310);function s(t){t&&!t._paused&&t.readable&&t.resume()}function o(t){n.Readable.call(this),this._readableState.readingMore=!0,this.socket=t,this.connection=t,this.httpVersionMajor=null,this.httpVersionMinor=null,this.httpVersion=null,this.complete=!1,this.headers={},this.rawHeaders=[],this.trailers={},this.rawTrailers=[],this.readable=!0,this.upgrade=null,this.url="",this.method=null,this.statusCode=null,this.statusMessage=null,this.client=t,this._consuming=!1,this._dumped=!1}e.readStart=s,e.readStop=function(t){t&&t.pause()},i.inherits(o,n.Readable),e.IncomingMessage=o,o.prototype.setTimeout=function(t,e){return e&&this.on("timeout",e),this.socket.setTimeout(t),this},o.prototype.read=function(t){return this._consuming||(this._readableState.readingMore=!1),this._consuming=!0,this.read=n.Readable.prototype.read,this.read(t)},o.prototype._read=function(t){this.socket.readable&&s(this.socket)},o.prototype.destroy=function(t){this.socket&&this.socket.destroy(t)},o.prototype._addHeaderLines=function(t,e){if(t&&t.length){var r,i;this.complete?(r=this.rawTrailers,i=this.trailers):(r=this.rawHeaders,i=this.headers);for(var n=0;n{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"]]}}},4018:t=>{t.exports=function(){for(var t=navigator.hardwareConcurrency||1,e=[],r=0;r{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())))}},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())}},4101:(t,e,r)=>{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}}},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},4116:(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)}},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")}},4343:()=>{},4367:(t,e)=>{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}},4459:t=>{t.exports=Number.isNaN||function(t){return t!=t}},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)}}},4529:(t,e,r)=>{var i=r(1514)();function n(t,e){if(t===e)return 0;for(var r=t.length,i=e.length,n=0,s=Math.min(r,i);n=0;u--)if(f[u]!==l[u])return!1;for(u=f.length-1;u>=0;u--)if(!v(t[a=f[u]],e[a],r,i))return!1;return!0}(t,e,r,i))}return r?t===e:t==e}function w(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function M(t,e,r,i){var n;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(t){var e;try{t()}catch(t){e=t}return e}(e),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!n&&y(n,r,"Missing expected exception"+i);var s="string"==typeof i,a=!t&&n&&!r;if((!t&&o.isError(n)&&s&&_(n,r)||a)&&y(n,r,"Got unwanted exception"+i),t&&n&&r&&!_(n,r)||!t&&n)throw n}c.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return m(g(t.actual),128)+" "+t.operator+" "+m(g(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,n=p(e),s=i.indexOf("\n"+n);if(s>=0){var o=i.indexOf("\n",s+1);i=i.substring(o+1)}this.stack=i}}},o.inherits(c.AssertionError,Error),c.fail=y,c.ok=b,c.equal=function(t,e,r){t!=e&&y(t,e,r,"==",c.equal)},c.notEqual=function(t,e,r){t==e&&y(t,e,r,"!=",c.notEqual)},c.deepEqual=function(t,e,r){v(t,e,!1)||y(t,e,r,"deepEqual",c.deepEqual)},c.deepStrictEqual=function(t,e,r){v(t,e,!0)||y(t,e,r,"deepStrictEqual",c.deepStrictEqual)},c.notDeepEqual=function(t,e,r){v(t,e,!1)&&y(t,e,r,"notDeepEqual",c.notDeepEqual)},c.notDeepStrictEqual=function t(e,r,i){v(e,r,!0)&&y(e,r,i,"notDeepStrictEqual",t)},c.strictEqual=function(t,e,r){t!==e&&y(t,e,r,"===",c.strictEqual)},c.notStrictEqual=function(t,e,r){t===e&&y(t,e,r,"!==",c.notStrictEqual)},c.throws=function(t,e,r){M(!0,t,e,r)},c.doesNotThrow=function(t,e,r){M(!1,t,e,r)},c.ifError=function(t){if(t)throw t},c.strict=i((function t(e,r){e||y(e,!0,r,"==",t)}),c,{equal:c.strictEqual,deepEqual:c.deepStrictEqual,notEqual:c.notStrictEqual,notDeepEqual:c.notDeepStrictEqual}),c.strict.strict=c.strict;var S=Object.keys||function(t){var e=[];for(var r in t)a.call(t,r)&&e.push(r);return e}},4589:t=>{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"}')},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)},4610:(t,e,r)=>{t.exports=f;var i=r(113).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(5382);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{const i=r(7042);t.exports=class{constructor(t){this.encoding=t}get remaining(){return 0}decode(t){return i.toString(t,this.encoding)}flush(){return""}}},4643:t=>{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)}}},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=e;i.der=r(82),i.pem=r(735)},4729:(t,e,r)=>{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)};var o="undefined"!=typeof Uint8Array,a="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(i.prototype instanceof Uint8Array||i.TYPED_ARRAY_SUPPORT);s.prototype.update=function(t,e){if(this._finalized)throw new Error("Digest already called");t=function(t,e){if(t instanceof i)return t;if("string"==typeof t)return i.from(t,e);if(a&&ArrayBuffer.isView(t)){if(0===t.byteLength)return i.alloc(0);var r=i.from(t.buffer,t.byteOffset,t.byteLength);if(r.byteLength===t.byteLength)return r}if(o&&t instanceof Uint8Array)return i.from(t);if(i.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return i.from(t);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(t,e);for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var s=this._blockOffset;s0;++h)this._length[h]+=u,(u=this._length[h]/4294967296|0)>0&&(this._length[h]-=4294967296*u);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},4765:t=>{var e=String.prototype.replace,r=/%20/g,i="RFC1738",n="RFC3986";t.exports={default:n,formatters:{RFC1738:function(t){return e.call(t,r,"+")},RFC3986:function(t){return String(t)}},RFC1738:i,RFC3986:n}},4803:(t,e,r)=>{var i=r(8859),n=r(9675),s=function(t,e,r){for(var i,n=t;null!=(i=n.next);n=i)if(i.key===e)return n.next=i.next,r||(i.next=t.next,t.next=i),i};t.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new n("Side channel does not contain "+i(t))},delete:function(e){var r=t&&t.next,i=function(t,e){if(t)return s(t,e,!0)}(t,e);return i&&r&&r===i&&(t=void 0),!!i},get:function(e){return function(t,e){if(t){var r=s(t,e);return r&&r.value}}(t,e)},has:function(e){return function(t,e){return!!t&&!!s(t,e)}(t,e)},set:function(e,r){t||(t={next:void 0}),function(t,e,r){var i=s(t,e);i?i.value=r:t.next={key:e,next:t.next,value:r}}(t,e,r)}};return e}},4847:(t,e,r)=>{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),m=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);return 0===m.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{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)))}},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}}},4988:(t,e,r)=>{var i=r(717),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{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{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)}}},5185:()=>{},5221:(t,e,r)=>{const{isIPv4:i,isIPv6:n}=r(8957);e.lookup=function t(e,r,s){if("function"==typeof r)return t(e,null,r);chrome.dns.resolve(e,(t=>{if(0!==t.resultCode)return s(new Error("DNS lookup error: "+chrome.runtime.lastError.message));const e=t.address,r=i(e)?4:n(e)?6:0;s(null,e,r)}))}},5242:(t,e,r)=>{t.exports=s;var i=r(1816),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)}},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(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},5291:(t,e,r)=>{var i=r(113).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}}},5307:(t,e,r)=>{const i=r(7042);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}},5335:(t,e,r)=>{const i=r(4611),n=r(6045);t.exports=class{constructor(t="utf8"){switch(this.encoding=function(t){switch(t=t.toLowerCase()){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:throw new Error("Unknown encoding: "+t)}}(t),this.encoding){case"utf8":this.decoder=new n;break;case"utf16le":case"base64":throw new Error("Unsupported encoding: "+this.encoding);default:this.decoder=new i(this.encoding)}}get remaining(){return this.decoder.remaining}push(t){return"string"==typeof t?t:this.decoder.decode(t)}write(t){return this.push(t)}end(t){let e="";return t&&(e=this.push(t)),e+=this.decoder.flush(),e}}},5345:t=>{t.exports=URIError},5359:(t,e,r)=>{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{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;Array.isArray(t)?(n=[],o=s=t.length):(a=Object.keys(t),n={},o=s=a.length);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{var i=r(8636),n=r(2642),s=r(4765);t.exports={formats:s,parse:n,stringify:i}},5380:(t,e,r)=>{var i=r(8287).Buffer,n=r(4934),s=r(3241),o=r(4910);var 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)))}},5382:(t,e,r)=>{var i=r(717),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=f;var s=r(5412),o=r(6708);r(6698)(f,s);for(var a=n(o.prototype),h=0;h{var i,n=r(717);t.exports=E,E.ReadableState=k;r(7007).EventEmitter;var s=function(t,e){return t.listeners(e).length},o=r(1416),a=r(8287).Buffer,h=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var u,f=r(537);u=f&&f.debuglog?f.debuglog("stream"):function(){};var l,c,d,p=r(345),m=r(5896),g=r(5291).getHighWaterMark,y=r(113).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)(E,o);var M=m.errorOrDestroy,S=["error","close","destroy","pause","resume"];function k(t,e,n){i=i||r(5382),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 E(t){if(i=i||r(5382),!(this instanceof E))return new E(t);var e=this instanceof i;this._readableState=new k(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function x(t,e,r,i,n){u("readableAddChunk",e);var s,o=t._readableState;if(null===e)o.reading=!1,function(t,e){if(u("onEofChunk"),e.ended)return;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,C(t)))}(t,o);else if(n||(s=function(t,e){var r;i=e,a.isBuffer(i)||i instanceof h||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e));var i;return r}(o,e)),s)M(t,s);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)o.endEmitted?M(t,new _):A(t,o,e,!0);else if(o.ended)M(t,new v);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?A(t,o,e,!1):R(t,o)):A(t,o,e,!1)}else i||(o.reading=!1,R(t,o));return!o.ended&&(o.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;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(C,t))}function C(t){var e=t._readableState;u("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,j(t)}function R(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(O,t,e))}function O(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function L(t){u("readable nexttick read 0"),t.read(0)}function N(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(u("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;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(D,e,t))}function D(t,e){if(u("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 H(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?q(this):P(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&q(this),null;var i,n=e.needReadable;return u("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},E.prototype._read=function(t){M(this,new w("_read()"))},E.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,u("pipe count=%d opts=%j",i.pipesCount,e);var o=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?h:g;function a(e,n){u("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",a),r.removeListener("end",h),r.removeListener("end",g),r.removeListener("data",c),l=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function h(){u("onend"),t.end()}i.endEmitted?n.nextTick(o):r.once("end",o),t.on("unpipe",a);var f=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,j(t))}}(r);t.on("drain",f);var l=!1;function c(e){u("ondata");var n=t.write(e);u("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==H(i.pipes,t))&&!l&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function d(e){u("onerror",e),g(),t.removeListener("error",d),0===s(t,"error")&&M(t,e)}function p(){t.removeListener("finish",m),g()}function m(){u("onfinish"),t.removeListener("close",p),g()}function g(){u("unpipe"),r.unpipe(t)}return r.on("data",c),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",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),i.flowing||(u("pipe resume"),r.resume()),t},E.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,u("on readable",i.length,i.reading),i.length?P(this):i.reading||n.nextTick(L,this))),r},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(t,e){var r=o.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(B,this),r},E.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(B,this),e},E.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(N,t,e))}(this,t)),t.paused=!1,this},E.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(u("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){(u("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{var i=r(717),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},5488:(t,e,r)=>{var i=r(1565),n=r(4196),s=r(2455),o=r(3382);i.pbkdf2Sync&&-1!==i.pbkdf2Sync.toString().indexOf("keylen, digest")?(e.pbkdf2Sync=function(t,e,r,a,h){return n(r,a),t=o(t,s,"Password"),e=o(e,s,"Salt"),h=h||"sha1",i.pbkdf2Sync(t,e,r,a,h)},e.pbkdf2=function(t,e,r,a,h,u){if(n(r,a),t=o(t,s,"Password"),e=o(e,s,"Salt"),"function"==typeof h&&(u=h,h="sha1"),"function"!=typeof u)throw new Error("No callback provided to pbkdf2");return i.pbkdf2(t,e,r,a,h,u)}):(e.pbkdf2Sync=r(681),e.pbkdf2=r(3832))},5579:t=>{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"}')},5622:(t,e,r)=>{var i=r(8287).Buffer;function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(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]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(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=i.isBuffer},5658:(t,e,r)=>{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);const t={webrtc:25e3,tcpOutgoing:5e3,utpOutgoing:5e3};this.connectTimeout=setTimeout((()=>{this.destroy(new Error("connect timeout"))}),t[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,i=null)=>{const n=new g(t.id,"webrtc");if(n.conn=t,n.swarm=e,n.throttleGroups=r,n.source=i,n.conn.connected)n.onConnect();else{const t=()=>{n.conn.removeListener("connect",e),n.conn.removeListener("error",r)},e=()=>{t(),n.onConnect()},r=e=>{t(),n.destroy(e)};n.conn.once("connect",e),n.conn.once("error",r),n.startConnectTimeout()}return n},g.createTCPIncomingPeer=(t,e)=>g._createIncomingPeer(t,h,e),g.createUTPIncomingPeer=(t,e)=>g._createIncomingPeer(t,f,e),g.createTCPOutgoingPeer=(t,e,r,i)=>g._createOutgoingPeer(t,e,u,r,i),g.createUTPOutgoingPeer=(t,e,r,i)=>g._createOutgoingPeer(t,e,l,r,i),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,n=null)=>{const s=new g(t,r);return s.addr=t,s.swarm=e,s.throttleGroups=i,s.source=n,s},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}},5715:(t,e,r)=>{t.exports=r(2951)},5795:(t,e,r)=>{var i=r(6549);if(i)try{i([],"length")}catch(t){i=null}t.exports=i},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{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]}}},5880:t=>{t.exports=Math.pow},5892:(t,e,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},5896:(t,e,r)=>{var i=r(717);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)}}},5905:(t,e,r)=>{var i=r(4529);function n(t){i.ok(t===n.REQUEST||t===n.RESPONSE),this.type=t,this.state=t+"_LINE",this.info={headers:[],upgrade:!1},this.trailers=[],this.line="",this.isChunked=!1,this.connection="",this.headerSize=0,this.body_bytes=null,this.isUserCall=!1,this.hadError=!1}e.HTTPParser=n,n.encoding="ascii",n.maxHeaderSize=81920,n.REQUEST="REQUEST",n.RESPONSE="RESPONSE";var s=n.kOnHeaders=0,o=n.kOnHeadersComplete=1,a=n.kOnBody=2,h=n.kOnMessageComplete=3;n.prototype[s]=n.prototype[o]=n.prototype[a]=n.prototype[h]=function(){};var u=!0;Object.defineProperty(n,"kOnExecute",{get:function(){return u=!1,4}});var f=e.methods=n.methods=["DELETE","GET","HEAD","POST","PUT","CONNECT","OPTIONS","TRACE","COPY","LOCK","MKCOL","MOVE","PROPFIND","PROPPATCH","SEARCH","UNLOCK","BIND","REBIND","UNBIND","ACL","REPORT","MKACTIVITY","CHECKOUT","MERGE","M-SEARCH","NOTIFY","SUBSCRIBE","UNSUBSCRIBE","PATCH","PURGE","MKCALENDAR","LINK","UNLINK"],l=f.indexOf("CONNECT");n.prototype.reinitialize=n,n.prototype.close=n.prototype.pause=n.prototype.resume=n.prototype.free=function(){},n.prototype._compatMode0_11=!1,n.prototype.getAsyncId=function(){return 0};var c={REQUEST_LINE:!0,RESPONSE_LINE:!0,HEADER:!0};n.prototype.execute=function(t,e,r){if(!(this instanceof n))throw new TypeError("not a HTTPParser");e=e||0,r="number"==typeof r?r:t.length,this.chunk=t,this.offset=e;var i=this.end=e+r;try{for(;this.offsetn.maxHeaderSize)?new Error("max header size exceeded"):r};var d={REQUEST_LINE:!0,RESPONSE_LINE:!0,BODY_RAW:!0};n.prototype.finish=function(){if(!this.hadError)return d[this.state]?void("BODY_RAW"===this.state&&this.userCall()(this[h]())):new Error("invalid state for EOF")},n.prototype.consume=n.prototype.unconsume=n.prototype.getCurrentBuffer=function(){},n.prototype.userCall=function(){this.isUserCall=!0;var t=this;return function(e){return t.isUserCall=!1,e}},n.prototype.nextRequest=function(){this.userCall()(this[h]()),this.reinitialize(this.type)},n.prototype.consumeLine=function(){for(var t=this.end,e=this.chunk,r=this.offset;r0&&this.info.versionMinor>0){if(-1!==this.connection.indexOf("close"))return!1}else if(-1===this.connection.indexOf("keep-alive"))return!1;return!(null===this.body_bytes&&!this.isChunked)},n.prototype.HEADER=function(){var t=this.consumeLine();if(void 0!==t){var e=this.info;if(t)this.parseHeader(t,e.headers);else{for(var r,i,s=e.headers,a=!1,h=!1,f=0;f{var i=r(717);const n=r(537),s=r(8957),o=r(8835),a=r(5905).HTTPParser,h=r(4529).ok,u=r(2728),f=u.httpSocketSetup,l=u.parsers,c=u.freeParser,d=u.debug,p=r(8419).OutgoingMessage,m=r(8748),g=r(8287).Buffer;function y(t,e){var r=this;if(p.call(r),"string"==typeof t){if(!(t=o.parse(t)).hostname)throw new Error("Unable to determine the domain name")}else t=n._extend({},t);var a=t.agent,h=t._defaultAgent||m.globalAgent;!1===a?a=new h.constructor:null==a&&"function"!=typeof t.createConnection&&(a=h),r.agent=a;var f=t.protocol||h.protocol,l=h.protocol;if(r.agent&&r.agent.protocol&&(l=r.agent.protocol),t.path&&/ /.test(t.path))throw new TypeError("Request path contains unescaped characters");if(f!==l)throw new Error('Protocol "'+f+'" not supported. Expected "'+l+'"');const c=t.defaultPort||r.agent&&r.agent.defaultPort;var y=t.port=t.port||c||80,b=t.host=t.hostname||t.host||"localhost";if(void 0===t.setHost)var v=!0;r.socketPath=t.socketPath;var w=r.method=(t.method||"GET").toUpperCase();if(!u._checkIsHttpToken(w))throw new TypeError("Method must be a valid HTTP token");if(r.path=t.path||"/",e&&r.once("response",e),!Array.isArray(t.headers)){if(t.headers)for(var _=Object.keys(t.headers),M=0,S=_.length;M0?(r.upgradeOrConnect=!0,e.emit("agentRemove"),e.removeListener("close",w),e.removeListener("error",_),e._readableState.flowing=null,r.emit(u,o,e,a),r.emit("close")):e.destroy(),c(i,r,e)}else i.incoming&&i.incoming.complete&&100!==i.incoming.statusCode&&(e.removeListener("data",k),e.removeListener("end",S),c(i,r,e))}function E(t,e){var r=this.socket,i=r._httpMessage;if(i.domain&&!t.domain&&(d('setting "res.domain"'),t.domain=i.domain),d("AGENT incoming response!"),!i.res){if(i.res=t,"CONNECT"===i.method)return t.upgrade=!0,2;var n="HEAD"===i.method;return d("AGENT isHeadResponse",n),100===t.statusCode?(delete i.res,i.emit("continue"),!0):(!i.shouldKeepAlive||e||i.upgradeOrConnect||(i.shouldKeepAlive=!1),i.res=t,t.req=i,t.on("end",A),i.on("prefinish",I),i.emit("response",t)||t._dump(),n)}r.destroy()}function x(t,e){var r=e.socket;e.shouldKeepAlive?(d("AGENT socket keep-alive"),e.timeoutCb&&(r.setTimeout(0,e.timeoutCb),e.timeoutCb=null),r.removeListener("close",w),r.removeListener("error",_),r.once("error",M),i.nextTick(T,r)):(r.writable&&(d("AGENT socket.destroySoon()"),r.destroySoon()),h(!r.writable))}function A(){const t=this.req;t._ended=!0,t.shouldKeepAlive&&!t.finished||x(0,t)}function I(){const t=this;this.res;t.shouldKeepAlive&&t._ended&&x(0,t)}function T(t){t.emit("free")}function P(t,e){t.aborted?e.emit("free"):function(t,e){var r=l.alloc();t.socket=e,t.connection=e,r.reinitialize(a.RESPONSE),r.socket=e,r.incoming=null,r.outgoing=t,t.parser=r,e.parser=r,e._httpMessage=t,f(e),"number"==typeof t.maxHeadersCount?r.maxHeaderPairs=t.maxHeadersCount<<1:r.maxHeaderPairs=2e3,r.onIncoming=E,e.removeListener("error",M),e.on("error",_),e.on("data",k),e.on("end",S),e.on("close",w),t.emit("socket",e)}(t,e)}n.inherits(y,p),e.ClientRequest=y,y.prototype.aborted=void 0,y.prototype._finish=function(){p.prototype._finish.call(this)},y.prototype._implicitHeader=function(){this._storeHeader(this.method+" "+this.path+" HTTP/1.1\r\n",this._renderHeaders())},y.prototype.abort=function(){void 0===this.aborted&&i.nextTick(b,this),this.aborted=Date.now(),this.res?this.res._dump():this.once("response",(function(t){t._dump()})),this.socket&&this.socket.destroy()},y.prototype.onSocket=function(t){i.nextTick(P,this,t)},y.prototype._deferToConnect=function(t,e,r){var i=this;function n(){t&&i.socket[t].apply(i.socket,e),"function"==typeof r&&r()}var s=function(){i.socket.writable?n():i.socket.once("connect",n)};i.socket?s():i.once("socket",s)},y.prototype.setTimeout=function(t,e){e&&this.once("timeout",e);var r=this;function i(){r.emit("timeout")}if(this.socket&&this.socket.writable)return this.timeoutCb&&this.socket.setTimeout(0,this.timeoutCb),this.timeoutCb=i,this.socket.setTimeout(t,i),this;if(this.timeoutCb=i,this.socket){var n=this.socket;return this.socket.once("connect",(function(){n.setTimeout(t,i)})),this}return this.once("socket",(function(e){e.setTimeout(t,i)})),this},y.prototype.setNoDelay=function(){const t=arguments.length,e=new Array(t);for(var r=0;r{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,S=0|this._d,k=0|this._e,E=0;E<80;E+=1){var x,A;E<16?(x=m(r,i,n,s,d,t[a[E]],l[0],u[E]),A=v(w,_,M,S,k,t[h[E]],c[0],f[E])):E<32?(x=g(r,i,n,s,d,t[a[E]],l[1],u[E]),A=b(w,_,M,S,k,t[h[E]],c[1],f[E])):E<48?(x=y(r,i,n,s,d,t[a[E]],l[2],u[E]),A=y(w,_,M,S,k,t[h[E]],c[2],f[E])):E<64?(x=b(r,i,n,s,d,t[a[E]],l[3],u[E]),A=g(w,_,M,S,k,t[h[E]],c[3],f[E])):(x=v(r,i,n,s,d,t[a[E]],l[4],u[E]),A=m(w,_,M,S,k,t[h[E]],c[4],f[E])),r=d,d=s,s=p(n,10),n=i,i=x,w=k,k=S,S=p(M,10),M=_,_=A}var I=this._b+n+S|0;this._b=this._c+s+k|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},6045:(t,e,r)=>{const i=r(7042);t.exports=class{constructor(){this.codePoint=0,this.bytesSeen=0,this.bytesNeeded=0,this.lowerBoundary=128,this.upperBoundary=191}get remaining(){return this.bytesSeen}decode(t){if(0===this.bytesNeeded){let e=!0;for(let r=Math.max(0,t.byteLength-4),i=t.byteLength;rthis.upperBoundary?(this.codePoint=0,this.bytesNeeded=0,this.bytesSeen=0,this.lowerBoundary=128,this.upperBoundary=191,e+="�"):(this.lowerBoundary=128,this.upperBoundary=191,this.codePoint=this.codePoint<<6|63&i,this.bytesSeen++,this.bytesSeen===this.bytesNeeded&&(e+=String.fromCodePoint(this.codePoint),this.codePoint=0,this.bytesNeeded=0,this.bytesSeen=0)):i<=127?e+=String.fromCharCode(i):(this.bytesSeen=1,i>=194&&i<=223?(this.bytesNeeded=2,this.codePoint=31&i):i>=224&&i<=239?(224===i?this.lowerBoundary=160:237===i&&(this.upperBoundary=159),this.bytesNeeded=3,this.codePoint=15&i):i>=240&&i<=244?(240===i&&(this.lowerBoundary=144),244===i&&(this.upperBoundary=143),this.bytesNeeded=4,this.codePoint=7&i):e+="�")}return e}flush(){const t=this.bytesNeeded>0?"�":"";return this.codePoint=0,this.bytesNeeded=0,this.bytesSeen=0,this.lowerBoundary=128,this.upperBoundary=191,t}}},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}}},6166:(t,e,r)=>{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{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);var a="undefined"!=typeof Uint8Array,h="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(i.prototype instanceof Uint8Array||i.TYPED_ARRAY_SUPPORT);o.prototype.update=function(t,e,r){var n=function(t,e){if(t instanceof i)return t;if("string"==typeof t)return i.from(t,e);if(h&&ArrayBuffer.isView(t)){if(0===t.byteLength)return i.alloc(0);var r=i.from(t.buffer,t.byteOffset,t.byteLength);if(r.byteLength===t.byteLength)return r}if(a&&t instanceof Uint8Array)return i.from(t);if(i.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return i.from(t);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(t,e),s=this._update(n);return this.hashMode?this:(r&&(s=this._toString(s,r)),s)},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},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");var r=-1;for(;++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},6188:t=>{t.exports=Math.max},6225:(t,e,r)=>{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}},6229:(t,e,r)=>{e.sha1=r(3917),e.sha224=r(7714),e.sha256=r(2287),e.sha384=r(1911),e.sha512=r(7766)},6238:(t,e,r)=>{var i=r(113).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{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(206),a=r(7314);s.inherits(l,o);for(var h=n(a.prototype),u=0;u{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)}}},6310:t=>{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(){};n.prototype=Object.create(Object.getPrototypeOf(t));return e(new n,i)}}},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}},6413:(t,e,r)=>{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},6427:(t,e,r)=>{var i=r(8393).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){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)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 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}},6458:(t,e,r)=>{r.d(e,{A:()=>P});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)("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]),S=new Uint8Array([0,0,0,0,0,0,0,0]),k=new Uint8Array([0,0,1,2]),E=new Uint8Array([0,0,0,2]);function x(t,e){for(let r=t.length;r--;)t[r]^=e[r];return t}class A{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=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=x(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(S),s.set(k,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(S),i.set(E,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 A(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 A(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(S);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=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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},6532:(t,e,r)=>{function i(t,e,r,i,n,s,o){try{var a=t[s](o),h=a.value}catch(t){return void r(t)}a.done?e(h):Promise.resolve(h).then(i,n)}function n(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 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,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");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(113).F.ERR_INVALID_ARG_TYPE;t.exports=function(t,e,r){var a;if(e&&"function"==typeof e.next)a=e;else if(e&&e[Symbol.asyncIterator])a=e[Symbol.asyncIterator]();else{if(!e||!e[Symbol.iterator])throw new o("iterable",["Iterable"],e);a=e[Symbol.iterator]()}var h=new t(function(t){for(var e=1;e{t.exports=Object.getOwnPropertyDescriptor},6556:(t,e,r)=>{var i=r(453),n=r(3126),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}},6585:t=>{var e=1e3,r=60*e,i=60*r,n=24*i,s=7*n,o=365.25*n;function a(t,e,r,i){var n=e>=1.5*r;return Math.round(t/r)+" "+i+(n?"s":"")}t.exports=function(t,h){h=h||{};var u=typeof t;if("string"===u&&t.length>0)return function(t){if((t=String(t)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!a)return;var h=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*s;case"days":case"day":case"d":return h*n;case"hours":case"hour":case"hrs":case"hr":case"h":return h*i;case"minutes":case"minute":case"mins":case"min":case"m":return h*r;case"seconds":case"second":case"secs":case"sec":case"s":return h*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}(t);if("number"===u&&isFinite(t))return h.long?function(t){var s=Math.abs(t);if(s>=n)return a(t,s,n,"day");if(s>=i)return a(t,s,i,"hour");if(s>=r)return a(t,s,r,"minute");if(s>=e)return a(t,s,e,"second");return t+" ms"}(t):function(t){var s=Math.abs(t);if(s>=n)return Math.round(t/n)+"d";if(s>=i)return Math.round(t/i)+"h";if(s>=r)return Math.round(t/r)+"m";if(s>=e)return Math.round(t/e)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},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{var i=r(717),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)?f&&!a&&(t.on("end",c),t.on("close",c)):(t.on("complete",d),t.on("abort",y),t.req?v():t.on("request",v)),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},6622:t=>{"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},6661:(t,e,r)=>{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},6677:(t,e,r)=>{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 k=0;a>=0;){var E=!0;for(h=0;h=0&&k++,M=M.dblp(k),a<0)break;for(h=0;h0?u=l[h][x-1>>1]:x<0&&(u=l[h][-x-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{},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}}},6708:(t,e,r)=>{var i,n=r(717);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=E,E.WritableState=k;var o={deprecate:r(4643)},a=r(1416),h=r(8287).Buffer,u=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var f,l=r(5896),c=r(5291).getHighWaterMark,d=r(113).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 S(){}function k(t,e,o){i=i||r(5382),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(C,t,e),t._writableState.errorEmitted=!0,M(t,i)):(s(i),t._writableState.errorEmitted=!0,M(t,i),C(t,e))}(t,r,i,e,s);else{var o=T(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),i?n.nextTick(A,t,r,o,s):A(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 E(t){var e=this instanceof(i=i||r(5382));if(!e&&!f.call(E,this))return new E(t);this._writableState=new k(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)),a.call(this)}function x(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 A(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),C(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,x(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(x(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"),C(t,e)}))}function C(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)(E,a),k.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(k.prototype,"buffer",{get:o.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]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(t){return!!f.call(this,t)||this===E&&(t&&t._writableState instanceof k)}})):f=function(t){return t instanceof this},E.prototype.pipe=function(){M(this,new y)},E.prototype.write=function(t,e,r){var i,s=this._writableState,o=!1,a=!s.objectMode&&(i=t,h.isBuffer(i)||i instanceof u);return a&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=s.defaultEncoding),"function"!=typeof r&&(r=S),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){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,r));return e}(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var a=e.objectMode?1:i.length;e.length+=a;var u=e.length-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(t,e,r){r(new m("_write()"))},E.prototype._writev=null,E.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,C(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),E.prototype.destroy=l.destroy,E.prototype._undestroy=l.undestroy,E.prototype._destroy=function(t,e){e(t)}},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},6729:(t,e,r)=>{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)},6743:(t,e,r)=>{var i=r(9353);t.exports=Function.prototype.bind||i},6784:(t,e,r)=>{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,S=0;S<80;S++){var k=o(s(h(r,l(S,i,n,u),t[p[S]+e],c(S)),g[S]),f);r=f,f=u,u=s(n,10),n=i,i=k,k=o(s(h(b,l(79-S,v,w,_),t[m[S]+e],d(S)),y[S]),M),b=M,M=_,_=s(w,10),w=v,v=k}k=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]=k},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]},6814:(t,e,r)=>{var i=r(8287).Buffer;const{digitCount:n,getType:s}=r(7972);function o(t){if(null==t)return 0;const e=s(t);switch(e){case"buffer":return n(t.length)+1+t.length;case"arraybufferview":return function(t){const e=t.byteLength-t.byteOffset;return n(e)+1+e}(t);case"string":return function(t){const e=i.byteLength(t);return n(e)+1+e}(t);case"array":case"set":return function(t){let e=2;for(const r of t)e+=o(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{t.exports=r(8330).version},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{},6975:(t,e,r)=>{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(717);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){void 0===e&&(e=0);if(!(a.isBuffer(t)||t instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');l(e,t.length),void 0===r&&(r=t.length-e);return c(r,e,t.length),d(t,e,r)}):(e.randomFill=n,e.randomFillSync=n)},7007:t=>{var e=Object.create||function(t){var e=function(){};return e.prototype=t,new e},r=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},i=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function n(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=e(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0;var s,o=10;try{var a={};Object.defineProperty&&Object.defineProperty(a,"x",{value:0}),s=0===a.x}catch(t){s=!1}function h(t){return void 0===t._maxListeners?n.defaultMaxListeners:t._maxListeners}function u(t,r,i,n){var s,o,a;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",r,i.listener?i.listener:i),o=t._events),a=o[r]):(o=t._events=e(null),t._eventsCount=0),a){if("function"==typeof a?a=o[r]=n?[i,a]:[a,i]:n?a.unshift(i):a.push(i),!a.warned&&(s=h(t))&&s>0&&a.length>s){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(r)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=t,u.type=r,u.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else a=o[r]=i,++t._eventsCount;return t}function f(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var h=new Error('Unhandled "error" event. ('+e+")");throw h.context=e,h}if(!(r=o[t]))return!1;var u="function"==typeof r;switch(i=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var i=t.length,n=p(t,i),s=0;s=0;o--)if(i[o]===r||i[o].listener===r){a=i[o].listener,s=o;break}if(s<0)return this;0===s?i.shift():function(t,e){for(var r=e,i=r+1,n=t.length;i=0;s--)this.removeListener(t,i[s]);return this},n.prototype.listeners=function(t){return c(this,t,!0)},n.prototype.rawListeners=function(t){return c(this,t,!1)},n.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},n.prototype.listenerCount=d,n.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},7011:(t,e,r)=>{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")}},7042:(t,e,r)=>{var i=r(8287).Buffer;function n(t){return i.isBuffer(t)?t:i.from(t.buffer,t.byteOffset,t.byteLength)}t.exports={isBuffer:function(t){return i.isBuffer(t)||t instanceof Uint8Array},isEncoding:function(t){return i.isEncoding(t)},alloc:function(t,e,r){return i.alloc(t,e,r)},allocUnsafe:function(t){return i.allocUnsafe(t)},allocUnsafeSlow:function(t){return i.allocUnsafeSlow(t)},byteLength:function(t,e){return i.byteLength(t,e)},compare:function(t,e){return i.compare(t,e)},concat:function(t,e){return i.concat(t,e)},copy:function(t,e,r,i,s){return n(t).copy(e,r,i,s)},equals:function(t,e){return n(t).equals(e)},fill:function(t,e,r,i,s){return n(t).fill(e,r,i,s)},from:function(t,e,r){return i.from(t,e,r)},includes:function(t,e,r,i){return n(t).includes(e,r,i)},indexOf:function(t,e,r,i){return n(t).indexOf(e,r,i)},lastIndexOf:function(t,e,r,i){return n(t).lastIndexOf(e,r,i)},swap16:function(t){return n(t).swap16()},swap32:function(t){return n(t).swap32()},swap64:function(t){return n(t).swap64()},toBuffer:n,toString:function(t,e,r,i){return n(t).toString(e,r,i)},write:function(t,e,r,i,s){return n(t).write(e,r,i,s)},writeDoubleLE:function(t,e,r){return n(t).writeDoubleLE(e,r)},writeFloatLE:function(t,e,r){return n(t).writeFloatLE(e,r)},writeUInt32LE:function(t,e,r){return n(t).writeUInt32LE(e,r)},writeInt32LE:function(t,e,r){return n(t).writeInt32LE(e,r)},readDoubleLE:function(t,e){return n(t).readDoubleLE(e)},readFloatLE:function(t,e){return n(t).readFloatLE(e)},readUInt32LE:function(t,e){return n(t).readUInt32LE(e)},readInt32LE:function(t,e){return n(t).readInt32LE(e)},writeDoubleBE:function(t,e,r){return n(t).writeDoubleBE(e,r)},writeFloatBE:function(t,e,r){return n(t).writeFloatBE(e,r)},writeUInt32BE:function(t,e,r){return n(t).writeUInt32BE(e,r)},writeInt32BE:function(t,e,r){return n(t).writeInt32BE(e,r)},readDoubleBE:function(t,e){return n(t).readDoubleBE(e)},readFloatBE:function(t,e){return n(t).readFloatBE(e)},readUInt32BE:function(t,e){return n(t).readUInt32BE(e)},readInt32BE:function(t,e){return n(t).readInt32BE(e)}}},7103:function(t,e,r){var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function s(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new s(n.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new s(n.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(2791),e.setImmediate="undefined"!=typeof self&&self.setImmediate||"undefined"!=typeof globalThis&&globalThis.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||"undefined"!=typeof globalThis&&globalThis.clearImmediate||this&&this.clearImmediate},7108:(t,e,r)=>{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))}},7119:t=>{t.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},7168:(t,e,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)}},7176:(t,e,r)=>{var i,n=r(3126),s=r(5795);try{i=[].__proto__===Array.prototype}catch(t){if(!t||"object"!=typeof t||!("code"in t)||"ERR_PROTO_ACCESS"!==t.code)throw t}var o=!!i&&s&&s(Object.prototype,"__proto__"),a=Object,h=a.getPrototypeOf;t.exports=o&&"function"==typeof o.get?n([o.get]):"function"==typeof h&&function(t){return h(null==t?t:a(t))}},7180:t=>{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.decode=e.parse=r(1630),e.encode=e.stringify=r(9106)},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}},7266:(t,e,r)=>{var i=r(3549);function n(t){return i.existsSync(t)&&i.statSync(t).isFile()}t.exports=function(t,e){if(!e)return n(t);i.stat(t,(function(t,r){return t?e(t):e(null,r.isFile())}))},t.exports.sync=n},7314:(t,e,r)=>{var i=r(717),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;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),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={deprecate:r(4643)},f=r(1862),l=r(4116).Buffer,c=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var d,p=r(6278);function m(){}function g(t,e){o=o||r(6248),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(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(s(i),t._writableState.errorEmitted=!0,t.emit("error",i),S(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(6248),!(d.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)),f.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(),S(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"),S(t,e)}))}function S(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,f),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:u.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]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===y&&(t&&t._writableState instanceof g)}})):d=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,l.isBuffer(i)||i instanceof c);return a&&!l.isBuffer(t)&&(t=function(t){return l.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){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,r));return 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,S(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)}},7332:(t,e,r)=>{var i=r(9404),n=r(3209),s=r(2861).Buffer;function o(t){var e,r=t.modulus.byteLength();do{e=new i(n(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(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),n=e.modulus.byteLength(),a=new i(t).mul(r.blinder).umod(e.modulus),h=a.toRed(i.mont(e.prime1)),u=a.toRed(i.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(s,"be",n)}a.getr=o,t.exports=a},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));var n=-1;for(;++n=e.length){s++;break}var o=e.slice(2,n-1);("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&s++;o.length<8&&s++;if(s)throw new Error("decryption error");return e.slice(n)}(0,c,r);if(3===l)return c;throw new Error("unknown padding")}},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)}},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}}},7426:(t,e,r)=>{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}},7447:(t,e,r)=>{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,r){var n;if(i.isBN(t)||"number"==typeof t)n=(t=new i(t,16)).byteLength();else if("object"==typeof t)n=t.length,t=new i(t,16);else{var s=t.toString();n=s.length+1>>>1,t=new i(s,16)}"number"!=typeof r&&(r=8*n);var o=r-this.n.bitLength();return o>0&&(t=t.ushrn(o)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},l.prototype.sign=function(t,e,r,s){if("object"==typeof r&&(s=r,r=null),s||(s={}),"string"!=typeof t&&"number"!=typeof t&&!i.isBN(t)){h("object"==typeof t&&t&&"number"==typeof t.length,"Expected message to be an array-like, a hex string, or a BN instance"),h(t.length>>>0===t.length);for(var o=0;o=0)){var g=this.g.mul(m);if(!g.isInfinity()){var y=g.getX(),b=y.umod(this.n);if(0!==b.cmpn(0)){var v=m.invm(this.n).mul(b.mul(e.getPrivate()).iadd(t));if(0!==(v=v.umod(this.n)).cmpn(0)){var w=(g.getY().isOdd()?1:0)|(0!==y.cmp(b)?2:0);return s.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),w^=1),new f({r:b,s:v,recoveryParam:w})}}}}}},l.prototype.verify=function(t,e,r,i,n){n||(n={}),t=this._truncateToN(t,!1,n.msgBitLength),r=this.keyFromPublic(r,i);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")}},7526:(t,e)=>{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;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);return 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));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]+"="));return 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},7541:(t,e,r)=>{const i=r(8765),n=r(8499);t.exports={Throttle:i,ThrottleGroup:n}},7558:(t,e,r)=>{var i=r(8287).Buffer,n=r(7861),s=r(8394),o=r(8957).isIP,a=r(5221),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)return;if(!r.port)return;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)return;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)}))}},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)},7626:(t,e)=>{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(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")}},7720:(t,e,r)=>{var i=r(4765),n=Object.prototype.hasOwnProperty,s=Array.isArray,o=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),a=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},i=0;i1;){var e=t.pop(),r=e.obj[e.prop];if(s(r)){for(var i=[],n=0;n=h?a.slice(f,f+h):a,c=[],d=0;d=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||s===i.RFC1738&&(40===p||41===p)?c[c.length]=l.charAt(d):p<128?c[c.length]=o[p]:p<2048?c[c.length]=o[192|p>>6]+o[128|63&p]:p<55296||p>=57344?c[c.length]=o[224|p>>12]+o[128|p>>6&63]+o[128|63&p]:(d+=1,p=65536+((1023&p)<<10|1023&l.charCodeAt(d)),c[c.length]=o[240|p>>18]+o[128|p>>12&63]+o[128|p>>6&63]+o[128|63&p])}u+=c.join("")}return u},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(s(t)){for(var r=[],i=0;i{var i;var n=r(113).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)}},7766:(t,e,r)=>{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 S(t,e,r,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function k(t,e){var r=o(t,e,28)^o(e,t,2)^o(e,t,7);return r<0&&(r+=4294967296),r}function E(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function x(t,e){var r=o(t,e,14)^o(t,e,18)^o(e,t,9);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 I(t,e){var r=o(t,e,1)^o(t,e,8)^h(t,e,7);return r<0&&(r+=4294967296),r}function T(t,e){var r=a(t,e,1)^a(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function P(t,e){var r=o(t,e,19)^o(e,t,29)^h(t,e,6);return r<0&&(r+=4294967296),r}function C(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{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},7833:(t,e,r)=>{var i=r(717);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){}!t&&void 0!==i&&"env"in i&&(t=i.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return"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&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[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}}},7861:(t,e,r)=>{var i=r(8287).Buffer;e.Socket=u;var n=r(7007).EventEmitter,s=r(6698),o=r(1672),a=0,h={};function u(t,e){var r=this;if(n.call(r),"string"==typeof t&&(t={type:t}),"udp4"!==t.type)throw new Error("Bad socket type specified. Valid types are: udp4");"function"==typeof e&&r.on("message",e),r._destroyed=!1,r._bindState=a,r._bindTasks=[]}"object"==typeof chrome&&"object"==typeof chrome.runtime&&"string"==typeof chrome.runtime.id&&"object"==typeof chrome.sockets&&"object"==typeof chrome.sockets.udp&&(chrome.sockets.udp.onReceive.addListener((function(t){t.socketId in h?h[t.socketId]._onReceive(t):console.error("Unknown socket id: "+t.socketId)})),chrome.sockets.udp.onReceiveError.addListener((function(t){t.socketId in h?h[t.socketId]._onReceiveError(t.resultCode):console.error("Unknown socket id: "+t.socketId)}))),e.createSocket=function(t,e){return new u(t,e)},s(u,n),u.prototype.bind=function(t,e,r){var i=this;if("function"==typeof e&&(r=e,e=void 0),e||(e="0.0.0.0"),t||(t=0),i._bindState!==a)throw new Error("Socket is already bound");i._bindState=1,"function"==typeof r&&i.once("listening",r),chrome.sockets.udp.create((function(r){i.id=r.socketId,h[i.id]=i;var n=i._bindTasks.map((function(t){return t.fn}));o(n,(function(r){if(r)return i.emit("error",r);chrome.sockets.udp.bind(i.id,e,t,(function(t){t<0?i.emit("error",new Error("Socket "+i.id+" failed to bind. "+chrome.runtime.lastError.message)):chrome.sockets.udp.getInfo(i.id,(function(t){t.localPort&&t.localAddress?(i._port=t.localPort,i._address=t.localAddress,i._bindState=2,i.emit("listening"),i._bindTasks.map((function(t){t.callback()}))):i.emit("error",new Error("Cannot get local port/address for Socket "+i.id))}))}))}))}))},u.prototype._onReceive=function(t){var e=i.from(new Uint8Array(t.data)),r={address:t.remoteAddress,family:"IPv4",port:t.remotePort,size:e.length};this.emit("message",e,r)},u.prototype._onReceiveError=function(t){this.emit("error",new Error("Socket "+this.id+" receive error "+t))},u.prototype.send=function(t,e,r,n,s,o){var h,u=this;if(s||n&&"function"!=typeof n?t=function(t,e,r){if("string"==typeof t)t=i.from(t);else if(!(t instanceof i))throw new TypeError("First argument must be a buffer or string");e>>>=0,r>>>=0;var n=t.buffer;(t.byteOffset||t.byteLength!==n.byteLength)&&(n=n.slice(t.byteOffset,t.byteOffset+t.byteLength));(e||r!==t.length)&&(n=n.slice(e,r));return i.from(n)}(t,e,r):(o=n,n=e,s=r),Array.isArray(t)){if(!(h=function(t){for(var e=new Array(t.length),r=0,n=t.length;r>>=0)||n>65535)throw new RangeError("Port should be > 0 and < 65536");if("function"!=typeof o&&(o=function(){}),u._bindState===a&&u.bind(0),2!==u._bindState)return u._sendQueue||(u._sendQueue=[],u.once("listening",(function(){for(var t=0;t{},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},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}},8002:t=>{t.exports=Math.min},8068:t=>{t.exports=SyntaxError},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}}},8093:(t,e,r)=>{t.exports=r(537).inspect},8170:(t,e,r)=>{var i=r(1137),n=r(5579),s=r(4101),o=r(1241),a=r(5488),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},8179:(t,e,r)=>{const{EventEmitter:i}=r(7007),n=new Error("Stream was destroyed"),s=new Error("Premature close"),o=r(6080),a=r(5335),h=536870911,u=1^h,f=2^h,l=32,c=64,d=128,p=256,m=1024,g=2048,y=4096,b=8192,v=16384,w=32768,_=131072,M=131328,S=16^h,k=536805375,E=768^h,x=536838143,A=536739839,I=1<<18,T=2<<18,P=4<<18,C=8<<18,R=16<<18,O=32<<18,B=64<<18,L=128<<18,N=256<<18,j=512<<18,U=1024<<18,q=535822335,D=503316479,H=268435455,F=262160,z=536608751,$=8404992,W=14,K=15,V=8405006,Z=33587200,G=33587215,Y=2359296,J=270794767,X=Symbol.asyncIterator||Symbol("asyncIterator");class Q{constructor(t,{highWaterMark:e=16384,map:r=null,mapWritable:i,byteLength:n,byteLengthWritable:s}={}){this.stream=t,this.queue=new o,this.highWaterMark=e,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=s||n||St,this.map=i||r,this.afterWrite=ot.bind(this),this.afterUpdateNextTick=ut.bind(this)}get ended(){return!!(this.stream._duplexState&O)}push(t){return!(142606350&this.stream._duplexState)&&(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||St,this.map=i||r,this.pipeTo=null,this.afterRead=at.bind(this),this.afterUpdateNextTick=ht.bind(this)}get ended(){return!!(this.stream._duplexState&v)}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 rt(this.stream,t,e),e&&this.stream.on("error",kt),Mt(t))t._writableState.pipeline=this.pipeline,e&&t.on("error",kt),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",it.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=536805311&e._duplexState|1024,!1):null!==this.map&&null===(t=this.map(t))?(e._duplexState&=k,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 ot(t){const e=this.stream;t&&e.destroy(t),e._duplexState&=469499903,null!==this.drains&&function(t){for(let e=0;e0)?null:r(i)},this}_read(t){t(null)}pipe(t,e){return this._readableState.updateNextTick(),this._readableState.pipe(t,e),t}read(){return this._readableState.updateNextTick(),this._readableState.read()}push(t){return this._readableState.updateNextTickIfOpen(),this._readableState.push(t)}unshift(t){return this._readableState.updateNextTickIfOpen(),this._readableState.unshift(t)}resume(){return this._duplexState|=M,this._readableState.updateNextTick(),this}pause(){return this._duplexState&=!1===this._readableState.readAhead?536739583:536870655,this}static _fromAsyncIterator(t,e){let r;const i=new pt({...e,read(e){t.next().then(n).then(e.bind(null,null)).catch(e)},predestroy(){r=t.return()},destroy(t){if(!r)return t(null);r.then(t.bind(null,null)).catch(t)}});return i;function n(t){t.done?i.push(null):i.push(t.value)}}static from(t,e){if(Mt(r=t)&&r.readable)return t;var r;if(t[X])return this._fromAsyncIterator(t[X](),e);Array.isArray(t)||(t=void 0===t?[]:[t]);let i=0;return new pt({...e,read(e){this.push(i===t.length?null:t[i++]),e(null)}})}static isBackpressured(t){return!!(17422&t._duplexState)||t._readableState.buffered>=t._readableState.highWaterMark}static isPaused(t){return!(t._duplexState&p)}[X](){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)})),{[X](){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&v?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 mt extends dt{constructor(t){super(t),this._duplexState|=16385,this._writableState=new Q(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())}cork(){this._duplexState|=U}uncork(){this._duplexState&=H,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!==mt.prototype._writev&&r._writev!==gt.prototype._writev?Math.min(1,e.queue.length):e.queue.length)+(t._duplexState&N?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 gt extends pt{constructor(t){super(t),this._duplexState=1|this._duplexState&_,this._writableState=new Q(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final))}cork(){this._duplexState|=U}uncork(){this._duplexState&=H,this._writableState.updateNextTick()}_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 yt extends gt{constructor(t){super(t),this._transformState=new et(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(bt.bind(this))}}function bt(t,e){const r=this._transformState.afterFinal;if(t)return r(t);null!=e&&this.push(e),this.push(null),r(null)}function vt(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=Mt(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(){if(e&&t._readableState&&!t._readableState.ended)return i(s);if(r&&t._writableState&&!t._writableState.ended)return i(s)}))}function u(t){if(t&&!a){a=t;for(const e of r)e.destroy(t)}}}function wt(t){return t}function _t(t){return!!t._readableState||!!t._writableState}function Mt(t){return"number"==typeof t._duplexState&&_t(t)}function St(t){return function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.byteLength}(t)?t.byteLength:1024}function kt(){}function Et(){this.destroy(new Error("Stream aborted."))}t.exports={pipeline:vt,pipelinePromise:function(...t){return new Promise(((e,r)=>vt(...t,(t=>{if(t)return r(t);e()}))))},isStream:_t,isStreamx:Mt,isEnded:function(t){return!!t._readableState&&t._readableState.ended},isFinished:function(t){return!!t._writableState&&t._writableState.ended},isDisturbed:function(t){return!!(1&~t._duplexState)||!!(t._duplexState&Z)},getStreamError:function(t,e={}){const r=t._readableState&&t._readableState.error||t._writableState&&t._writableState.error;return e.all||r!==n?r:null},Stream:dt,Writable:mt,Readable:pt,Duplex:gt,Transform:yt,PassThrough:class extends yt{}}},8190:(t,e,r)=>{t.exports=function(t,e){let r,n,s,o=!0;Array.isArray(t)?(r=[],n=t.length):(s=Object.keys(t),r={},n=s.length);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)}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)},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{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},8287:(t,e,r)=>{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){+t!=t&&(t=0);return 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){"string"==typeof e&&""!==e||(e="utf8");if(!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);n!==r&&(i=i.slice(0,n));return 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}if(void 0!==t.length)return"number"!=typeof t.length||Y(t.length)?a(0):c(t);if("Buffer"===t.type&&Array.isArray(t.data))return c(t.data)}(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 K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(n)return i?-1:K(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 x(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(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),Y(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 E(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function x(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<=A)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 S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(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 A=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 O(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 B(t,e,r,i,n){F(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 L(t,e,r,i,n){F(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 N(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 j(t,e,r,i,s){return e=+e,r>>>=0,s||N(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||N(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||$(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||$(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||$(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||$(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){if(t=+t,e>>>=0,r>>>=0,!i){O(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){O(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||O(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||O(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||O(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||O(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||O(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 B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),h.prototype.writeBigUInt64BE=X((function(t,e=0){return L(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);O(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);O(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||O(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||O(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||O(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||O(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||O(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 B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeBigInt64BE=X((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},h.prototype.writeFloatBE=function(t,e,r){return j(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 F(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]||$(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 $(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=H(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=H(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function K(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 V(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(W,"")).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 Y(t){return t!=t}const J=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")}},8310:(t,e,r)=>{t.exports=n;var i=r(7007).EventEmitter;function n(){i.call(this)}r(6698)(n,i),n.Readable=r(5412),n.Writable=r(6708),n.Duplex=r(5382),n.Transform=r(4610),n.PassThrough=r(3600),n.finished=r(6238),n.pipeline=r(7758),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}},8330:t=>{t.exports={version:"2.6.1"}},8393:(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)}},8394:(t,e,r)=>{const i=t.exports;i.encode=r(8746),i.decode=r(4662),i.byteLength=i.encodingLength=r(6814)},8403:(t,e,r)=>{var i=r(1189),n=r(1333)(),s=r(6556),o=r(9612),a=s("Array.prototype.push"),h=s("Object.prototype.propertyIsEnumerable"),u=n?o.getOwnPropertySymbols:null;t.exports=function(t,e){if(null==t)throw new TypeError("target must be an object");var r=o(t);if(1===arguments.length)return r;for(var s=1;s{var i=r(717);const n=r(4529).ok,s=r(8310),o=r(7103),a=r(537),h=a,u=r(8287).Buffer,f=r(2728),l=f.CRLF,c=f.chunkExpression,d=f.debug,p=/^Connection$/i,m=/^Transfer-Encoding$/i,g=/close/i,y=/^Content-Length$/i,b=/^Date$/i,v=/^Expect$/i,w=/^Trailer$/i,_={connection:!0,"content-length":!0,"transfer-encoding":!0,date:!0};var M;function S(){if(!M){var t=new Date;M=t.toUTCString(),o.enroll(S,1e3-t.getMilliseconds()),o._unrefActive(S)}return M}function k(){s.call(this),this.output=[],this.outputEncodings=[],this.outputCallbacks=[],this.outputSize=0,this.writable=!0,this._last=!1,this.chunkedEncoding=!1,this.shouldKeepAlive=!0,this.useChunkedEncodingByDefault=!0,this.sendDate=!1,this._removedHeader={},this._contentLength=null,this._hasBody=!0,this._trailer="",this.finished=!1,this._headerSent=!1,this.socket=null,this.connection=null,this._header=null,this._headers=null,this._headerNames={},this._onPendingData=null}function E(t,e,r,i){if(!f._checkIsHttpToken(r))throw new TypeError('Header name must be a valid HTTP Token ["'+r+'"]');if(!0===f._checkInvalidHeaderChar(i))throw new TypeError("The header content contains invalid characters");e.messageHeader+=r+": "+I(i)+l,p.test(r)?(e.sentConnectionHeader=!0,g.test(i)?t._last=!0:t.shouldKeepAlive=!0):m.test(r)?(e.sentTransferEncodingHeader=!0,c.test(i)&&(t.chunkedEncoding=!0)):y.test(r)?e.sentContentLengthHeader=!0:b.test(r)?e.sentDateHeader=!0:v.test(r)?e.sentExpect=!0:w.test(r)&&(e.sentTrailer=!0)}function x(t,e,r){t.emit("error",e),r&&r(e)}function A(t){t.uncork()}function I(t){return/[\r\n]/.test(t)?t.replace(/[\r\n]+[ \t]*/g,""):t}S._onTimeout=function(){M=void 0},a.inherits(k,s),e.OutgoingMessage=k,k.prototype.setTimeout=function(t,e){return e&&this.on("timeout",e),this.socket?this.socket.setTimeout(t):this.once("socket",(function(e){e.setTimeout(t)})),this},k.prototype.destroy=function(t){this.socket?this.socket.destroy(t):this.once("socket",(function(e){e.destroy(t)}))},k.prototype._send=function(t,e,r){return this._headerSent||("string"==typeof t&&"hex"!==e&&"base64"!==e?t=this._header+t:(this.output.unshift(this._header),this.outputEncodings.unshift("binary"),this.outputCallbacks.unshift(null),this.outputSize+=this._header.length,"function"==typeof this._onPendingData&&this._onPendingData(this._header.length)),this._headerSent=!0),this._writeRaw(t,e,r)},k.prototype._writeRaw=function(t,e,r){"function"==typeof e&&(r=e,e=null);var n=this.connection;if(n&&n._httpMessage===this&&n.writable&&!n.destroyed){if(this.output.length>0)this._flushOutput(n);else if(0===t.length)return"function"==typeof r&&i.nextTick(r),!0;return n.write(t,e,r)}return(!n||!n.destroyed)&&this._buffer(t,e,r)},k.prototype._buffer=function(t,e,r){return this.output.push(t),this.outputEncodings.push(e),this.outputCallbacks.push(r),this.outputSize+=t.length,"function"==typeof this._onPendingData&&this._onPendingData(t.length),!1},k.prototype._storeHeader=function(t,e){var r={sentConnectionHeader:!1,sentContentLengthHeader:!1,sentTransferEncodingHeader:!1,sentDateHeader:!1,sentExpect:!1,sentTrailer:!1,messageHeader:t};if(e)for(var i,n,s=Object.keys(e),o=Array.isArray(e),a=0,h=s.length;a{this.emit("finish")};return i=this._hasBody&&this.chunkedEncoding?this._send("0\r\n"+this._trailer+"\r\n","binary",n):this._send("","binary",n),this.connection&&t&&this.connection.uncork(),this.finished=!0,d("outgoing message end."),0===this.output.length&&this.connection&&this.connection._httpMessage===this&&this._finish(),i},k.prototype._finish=function(){n(this.connection),this.emit("prefinish")},k.prototype._flush=function(){var t,e=this.socket;e&&e.writable&&(t=this._flushOutput(e),this.finished?this._finish():t&&this.emit("drain"))},k.prototype._flushOutput=function(t){var e,r=this.output.length;if(r<=0)return e;var i=this.output,n=this.outputEncodings,s=this.outputCallbacks;t.cork();for(var o=0;o{t.exports=function(t){return Math.max(16384,1<{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"]}},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})}}},8490:function(t,e,r){!function(t,e){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(8287).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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},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)}}},8545:(t,e,r)=>{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;if(0===t[e.place])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;if(128&t[r.place])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;if(128&t[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)}},8636:(t,e,r)=>{var i=r(920),n=r(7720),s=r(4765),o=Object.prototype.hasOwnProperty,a={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},h=Array.isArray,u=Array.prototype.push,f=function(t,e){u.apply(t,h(e)?e:[e])},l=Date.prototype.toISOString,c=s.default,d={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:n.encode,encodeValuesOnly:!1,format:c,formatter:s.formatters[c],indices:!1,serializeDate:function(t){return l.call(t)},skipNulls:!1,strictNullHandling:!1},p={},m=function t(e,r,s,o,a,u,l,c,m,g,y,b,v,w,_,M,S,k){for(var E,x=e,A=k,I=0,T=!1;void 0!==(A=A.get(p))&&!T;){var P=A.get(e);if(I+=1,void 0!==P){if(P===I)throw new RangeError("Cyclic object value");T=!0}void 0===A.get(p)&&(I=0)}if("function"==typeof g?x=g(r,x):x instanceof Date?x=v(x):"comma"===s&&h(x)&&(x=n.maybeMap(x,(function(t){return t instanceof Date?v(t):t}))),null===x){if(u)return m&&!M?m(r,d.encoder,S,"key",w):r;x=""}if("string"==typeof(E=x)||"number"==typeof E||"boolean"==typeof E||"symbol"==typeof E||"bigint"==typeof E||n.isBuffer(x))return m?[_(M?r:m(r,d.encoder,S,"key",w))+"="+_(m(x,d.encoder,S,"value",w))]:[_(r)+"="+_(String(x))];var C,R=[];if(void 0===x)return R;if("comma"===s&&h(x))M&&m&&(x=n.maybeMap(x,m)),C=[{value:x.length>0?x.join(",")||null:void 0}];else if(h(g))C=g;else{var O=Object.keys(x);C=y?O.sort(y):O}var B=c?r.replace(/\./g,"%2E"):r,L=o&&h(x)&&1===x.length?B+"[]":B;if(a&&h(x)&&0===x.length)return L+"[]";for(var N=0;N0?w+v:""}},8648:t=>{t.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null},8650:(t,e,r)=>{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){if(t=a(t),(e=this.makeSignature(e)).S().gte(e.eddsa.curve.n)||e.S().isNeg())return!1;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{function e(){this._types=Object.create(null),this._extensions=Object.create(null);for(let t=0;t{function e(t){return parseInt(t,10)===t}function r(t){function r(e){if(void 0===e){e=new Array(t);for(var r=0;r{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(717);const n=r(8957),s=r(537),o=r(7007),a=s.debuglog("http");function h(t){if(!(this instanceof h))return new h(t);o.call(this);var e=this;e.defaultPort=80,e.protocol="http:",e.options=s._extend({},t),e.options.path=null,e.requests={},e.sockets={},e.freeSockets={},e.keepAliveMsecs=e.options.keepAliveMsecs||1e3,e.keepAlive=e.options.keepAlive||!1,e.maxSockets=e.options.maxSockets||h.defaultMaxSockets,e.maxFreeSockets=e.options.maxFreeSockets||256,e.on("free",(function(t,r){var i=e.getName(r);if(a("agent.on(free)",i),t.writable&&e.requests[i]&&e.requests[i].length)e.requests[i].shift().onSocket(t),0===e.requests[i].length&&delete e.requests[i];else{var n=t._httpMessage;if(n&&n.shouldKeepAlive&&t.writable&&e.keepAlive){var s=e.freeSockets[i],o=s?s.length:0,h=o;e.sockets[i]&&(h+=e.sockets[i].length),h>e.maxSockets||o>=e.maxFreeSockets?t.destroy():(s=s||[],e.freeSockets[i]=s,t.setKeepAlive(!0,e.keepAliveMsecs),t.unref(),t._httpMessage=null,e.removeSocket(t,r),s.push(t))}else t.destroy()}}))}s.inherits(h,o),e.Agent=h,h.defaultMaxSockets=1/0,h.prototype.createConnection=n.createConnection,h.prototype.getName=function(t){var e=t.host||"localhost";return e+=":",t.port&&(e+=t.port),e+=":",t.localAddress&&(e+=t.localAddress),4!==t.family&&6!==t.family||(e+=":"+t.family),e},h.prototype.addRequest=function(t,e){"string"==typeof e&&(e={host:e,port:arguments[2],localAddress:arguments[3]}),e=s._extend({},e),e=s._extend(e,this.options);var r=this.getName(e);this.sockets[r]||(this.sockets[r]=[]);var n=this.freeSockets[r]?this.freeSockets[r].length:0,o=n+this.sockets[r].length;if(n){var h=this.freeSockets[r].shift();a("have free socket"),this.freeSockets[r].length||delete this.freeSockets[r],h.ref(),t.onSocket(h),this.sockets[r].push(h)}else o{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)},8835:(t,e,r)=>{var i=r(9655);function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var s=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,h=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(h),f=["%","/","?",";","#"].concat(u),l=["/","?","#"],c=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=r(5373);function b(t,e,r){if(t&&"object"==typeof t&&t instanceof n)return t;var i=new n;return i.parse(t,e,r),i}n.prototype.parse=function(t,e,r){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),o=-1!==n&&n127?R+="x":R+=C[O];if(!R.match(c)){var L=T.slice(0,x),N=T.slice(x+1),j=C.match(d);j&&(L.push(j[1]),N.unshift(j[2])),N.length&&(b="/"+N.join(".")+b),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=i.toASCII(this.hostname));var U=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+U,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!p[_])for(x=0,P=u.length;x0)&&r.host.split("@"))&&(r.auth=I.shift(),r.hostname=I.shift(),r.host=r.hostname);return r.search=t.search,r.query=t.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!M.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var k=M.slice(-1)[0],E=(r.host||t.host||M.length>1)&&("."===k||".."===k)||""===k,x=0,A=M.length;A>=0;A--)"."===(k=M[A])?M.splice(A,1):".."===k?(M.splice(A,1),x++):x&&(M.splice(A,1),x--);if(!w&&!_)for(;x--;x)M.unshift("..");!w||""===M[0]||M[0]&&"/"===M[0].charAt(0)||M.unshift(""),E&&"/"!==M.join("/").substr(-1)&&M.push("");var I,T=""===M[0]||M[0]&&"/"===M[0].charAt(0);S&&(r.hostname=T?"":M.length?M.shift():"",r.host=r.hostname,(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.hostname=I.shift(),r.host=r.hostname));return(w=w||r.host&&M.length)&&!T&&M.unshift(""),M.length>0?r.pathname=M.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=o.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)},e.parse=b,e.resolve=function(t,e){return b(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?b(t,!1,!0).resolveObject(e):e},e.format=function(t){return"string"==typeof t&&(t=b(t)),t instanceof n?t.format():n.prototype.format.call(t)},e.Url=n},8859:(t,e,r)=>{var i="function"==typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,s=i&&n&&"function"==typeof n.get?n.get:null,o=i&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,h=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=a&&h&&"function"==typeof h.get?h.get:null,f=a&&Set.prototype.forEach,l="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,c="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,m=Object.prototype.toString,g=Function.prototype.toString,y=String.prototype.match,b=String.prototype.slice,v=String.prototype.replace,w=String.prototype.toUpperCase,_=String.prototype.toLowerCase,M=RegExp.prototype.test,S=Array.prototype.concat,k=Array.prototype.join,E=Array.prototype.slice,x=Math.floor,A="function"==typeof BigInt?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,P="function"==typeof Symbol&&"object"==typeof Symbol.iterator,C="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===P||"symbol")?Symbol.toStringTag:null,R=Object.prototype.propertyIsEnumerable,O=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function B(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||M.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var i=t<0?-x(-t):x(t);if(i!==t){var n=String(i),s=b.call(e,n.length+1);return v.call(n,r,"$&_")+"."+v.call(v.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(e,r,"$&_")}var L=r(8093),N=L.custom,j=W(N)?N:null,U={__proto__:null,double:'"',single:"'"},q={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function D(t,e,r){var i=r.quoteStyle||e,n=U[i];return n+t+n}function H(t){return v.call(String(t),/"/g,""")}function F(t){return!C||!("object"==typeof t&&(C in t||void 0!==t[C]))}function z(t){return"[object Array]"===Z(t)&&F(t)}function $(t){return"[object RegExp]"===Z(t)&&F(t)}function W(t){if(P)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!T)return!1;try{return T.call(t),!0}catch(t){}return!1}t.exports=function t(e,r,i,n){var a=r||{};if(V(a,"quoteStyle")&&!V(U,a.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(V(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var h=!V(a,"customInspect")||a.customInspect;if("boolean"!=typeof h&&"symbol"!==h)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(V(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(V(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var m=a.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return Y(e,a);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var w=String(e);return m?B(e,w):w}if("bigint"==typeof e){var M=String(e)+"n";return m?B(e,M):M}var x=void 0===a.depth?5:a.depth;if(void 0===i&&(i=0),i>=x&&x>0&&"object"==typeof e)return z(e)?"[Array]":"[Object]";var I=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=k.call(Array(t.indent+1)," ")}return{base:r,prev:k.call(Array(e+1),r)}}(a,i);if(void 0===n)n=[];else if(G(n,e)>=0)return"[Circular]";function N(e,r,s){if(r&&(n=E.call(n)).push(r),s){var o={depth:a.depth};return V(a,"quoteStyle")&&(o.quoteStyle=a.quoteStyle),t(e,o,i+1,n)}return t(e,a,i+1,n)}if("function"==typeof e&&!$(e)){var q=function(t){if(t.name)return t.name;var e=y.call(g.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),K=rt(e,N);return"[Function"+(q?": "+q:" (anonymous)")+"]"+(K.length>0?" { "+k.call(K,", ")+" }":"")}if(W(e)){var J=P?v.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):T.call(e);return"object"!=typeof e||P?J:X(J)}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var it="<"+_.call(String(e.nodeName)),nt=e.attributes||[],st=0;st"}if(z(e)){if(0===e.length)return"[]";var ot=rt(e,N);return I&&!function(t){for(var e=0;e=0)return!1;return!0}(ot)?"["+et(ot,I)+"]":"[ "+k.call(ot,", ")+" ]"}if(function(t){return"[object Error]"===Z(t)&&F(t)}(e)){var at=rt(e,N);return"cause"in Error.prototype||!("cause"in e)||R.call(e,"cause")?0===at.length?"["+String(e)+"]":"{ ["+String(e)+"] "+k.call(at,", ")+" }":"{ ["+String(e)+"] "+k.call(S.call("[cause]: "+N(e.cause),at),", ")+" }"}if("object"==typeof e&&h){if(j&&"function"==typeof e[j]&&L)return L(e,{depth:x-i});if("symbol"!==h&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!s||!t||"object"!=typeof t)return!1;try{s.call(t);try{u.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var ht=[];return o&&o.call(e,(function(t,r){ht.push(N(r,e,!0)+" => "+N(t,e))})),tt("Map",s.call(e),ht,I)}if(function(t){if(!u||!t||"object"!=typeof t)return!1;try{u.call(t);try{s.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var ut=[];return f&&f.call(e,(function(t){ut.push(N(t,e))})),tt("Set",u.call(e),ut,I)}if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{l.call(t,l);try{c.call(t,c)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return Q("WeakMap");if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t,c);try{l.call(t,l)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return Q("WeakSet");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{return d.call(t),!0}catch(t){}return!1}(e))return Q("WeakRef");if(function(t){return"[object Number]"===Z(t)&&F(t)}(e))return X(N(Number(e)));if(function(t){if(!t||"object"!=typeof t||!A)return!1;try{return A.call(t),!0}catch(t){}return!1}(e))return X(N(A.call(e)));if(function(t){return"[object Boolean]"===Z(t)&&F(t)}(e))return X(p.call(e));if(function(t){return"[object String]"===Z(t)&&F(t)}(e))return X(N(String(e)));if("undefined"!=typeof window&&e===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&e===globalThis||"undefined"!=typeof globalThis&&e===globalThis)return"{ [object globalThis] }";if(!function(t){return"[object Date]"===Z(t)&&F(t)}(e)&&!$(e)){var ft=rt(e,N),lt=O?O(e)===Object.prototype:e instanceof Object||e.constructor===Object,ct=e instanceof Object?"":"null prototype",dt=!lt&&C&&Object(e)===e&&C in e?b.call(Z(e),8,-1):ct?"Object":"",pt=(lt||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(dt||ct?"["+k.call(S.call([],dt||[],ct||[]),": ")+"] ":"");return 0===ft.length?pt+"{}":I?pt+"{"+et(ft,I)+"}":pt+"{ "+k.call(ft,", ")+" }"}return String(e)};var K=Object.prototype.hasOwnProperty||function(t){return t in this};function V(t,e){return K.call(t,e)}function Z(t){return m.call(t)}function G(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return Y(b.call(t,0,e.maxStringLength),e)+i}var n=q[e.quoteStyle||"single"];return n.lastIndex=0,D(v.call(v.call(t,n,"\\$1"),/[\x00-\x1f]/g,J),"single",e)}function J(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+w.call(e.toString(16))}function X(t){return"Object("+t+")"}function Q(t){return t+" { ? }"}function tt(t,e,r,i){return t+" ("+e+") {"+(i?et(r,i):k.call(r,", "))+"}"}function et(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+k.call(t,","+r)+"\n"+e.prev}function rt(t,e){var r=z(t),i=[];if(r){i.length=t.length;for(var n=0;n{var i;if(!Object.keys){var n=Object.prototype.hasOwnProperty,s=Object.prototype.toString,o=r(1093),a=Object.prototype.propertyIsEnumerable,h=!a.call({toString:null},"toString"),u=a.call((function(){}),"prototype"),f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!c["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{l(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();i=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===s.call(t),i=o(t),a=e&&"[object String]"===s.call(t),c=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=u&&r;if(a&&t.length>0&&!n.call(t,0))for(var m=0;m0)for(var g=0;g{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");i=r?l.alloc(o-s-3,255):function(t){var e,r=l.allocUnsafe(t),i=0,s=n(2*t),o=0;for(;i=0)throw new Error("data too long for modulus")}return r?f(d,p):u(d,p)}},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(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{var i,n,s=r(717),o=r(7007),a=r(6698),h=r(8310),u=r(537).deprecate,f=r(7103),l=r(8287).Buffer,c={},d={};function p(t,e){if(!(this instanceof p))return new p(t,e);if(o.call(this),"function"==typeof t)e=t,t={},this.on("connection",e);else{if(null!=t&&"object"!=typeof t)throw new TypeError("options must be an object");t=t||{},"function"==typeof e&&this.on("connection",e)}this._connections=0,Object.defineProperty(this,"connections",{get:u((()=>this._connections),"Server.connections property is deprecated. Use Server.getConnections method instead."),set:u((t=>this._connections=t),"Server.connections property is deprecated."),configurable:!0,enumerable:!1}),this.id=null,this.connecting=!1,this.allowHalfOpen=t.allowHalfOpen||!1,this.pauseOnConnect=!!t.pauseOnConnect,this._address=null,this._host=null,this._port=null,this._backlog=null}function m(t){t.id||t.connecting||t._connections||t.emit("close")}function g(t){if(!(this instanceof g))return new g(t);if("number"==typeof t?t={fd:t}:void 0===t&&(t={}),t.handle)throw new Error("handle is not supported in Chrome Apps.");if(void 0!==t.fd)throw new Error("fd is not supported in Chrome Apps.");t.decodeStrings=!0,t.objectMode=!1,h.Duplex.call(this,t),this.destroyed=!1,this._hadError=!1,this.id=null,this._parent=null,this._host=null,this._port=null,this._pendingData=null,this.ondata=null,this.onend=null,this._init(),this._reset(),this.allowHalfOpen=t.allowHalfOpen||!1,this.on("finish",this.destroy),t.server&&(this.server=this._server=t.server,this.id=t.id,d[this.id]=this,t.pauseOnCreate&&(this._readableState.flowing=!1),this.connecting=!0,this.writable=!0,this._onConnect())}"object"==typeof chrome&&"object"==typeof chrome.runtime&&"string"==typeof chrome.runtime.id&&"object"==typeof chrome.sockets&&"object"==typeof chrome.sockets.tcpServer&&"object"==typeof chrome.sockets.tcp&&(chrome.sockets.tcpServer.onAccept.addListener((function(t){t.socketId in c?c[t.socketId]._onAccept(t.clientSocketId):console.error("Unknown server socket id: "+t.socketId)})),chrome.sockets.tcpServer.onAcceptError.addListener((function(t){t.socketId in c?c[t.socketId]._onAcceptError(t.resultCode):console.error("Unknown server socket id: "+t.socketId)})),chrome.sockets.tcp.onReceive.addListener((function(t){t.socketId in d?d[t.socketId]._onReceive(t.data):console.error("Unknown socket id: "+t.socketId)})),chrome.sockets.tcp.onReceiveError.addListener((function(t){if(t.socketId in d)d[t.socketId]._onReceiveError(t.resultCode);else{if(-100===t.resultCode)return;console.error("Unknown socket id: "+t.socketId)}}))),e.createServer=function(t,e){return new p(t,e)},e.connect=e.createConnection=function(){const t=arguments.length;for(var e=new Array(t),r=0;r=0)throw new Error("fd is not supported in Chrome Apps.");if(n.backlog&&(i=n.backlog),!("number"==typeof n.port||"string"==typeof n.port||void 0===n.port&&"port"in n))throw n.path&&_(n.path)?new Error("Pipes are not supported in Chrome Apps."):new Error("Invalid listen argument: "+n);e=n.host||null,r=n.port}else{if(_(arguments[0]))throw new Error("Pipes are not supported in Chrome Apps.");e=void 0===arguments[1]||"function"==typeof arguments[1]||"number"==typeof arguments[1]?null:arguments[1]}this.id&&this.close(),function(t){if(void 0!==t&&!M(t))throw new RangeError('"port" argument must be >= 0 and < 65536')}(r),this._port=0|r,this._host=e;var s=!this._host;return s&&(this._host="::"),this._backlog="number"==typeof i?i:void 0,this.connecting=!0,chrome.sockets.tcpServer.create((t=>{if(!this.connecting||this.id)return S(),void chrome.sockets.tcpServer.close(t.socketId);if(chrome.runtime.lastError)this.emit("error",new Error(chrome.runtime.lastError.message));else{var e=this.id=t.socketId;c[this.id]=this;var r=()=>chrome.sockets.tcpServer.listen(this.id,this._host,this._port,this._backlog,(t=>{if(this.id===e)return 0!==t&&s?(S(),this._host="0.0.0.0",s=!1,r()):void this._onListen(t);S()}));r()}})),this},p.prototype._onListen=function(t){if(this.connecting=!1,0===t){var e=this.id;chrome.sockets.tcpServer.getInfo(this.id,(t=>{this.id===e?chrome.runtime.lastError?this._onListen(-2):(this._address={port:t.localPort,family:t.localAddress&&-1!==t.localAddress.indexOf(":")?"IPv6":"IPv4",address:t.localAddress},this.emit("listening")):S()}))}else this.emit("error",I(t,"listen",this._host,this._port)),this.id&&(chrome.sockets.tcpServer.close(this.id),delete c[this.id],this.id=null)},p.prototype._onAccept=function(t){if(this.maxConnections&&this._connections>=this.maxConnections)return chrome.sockets.tcp.close(t),void console.warn("Rejected connection - hit `maxConnections` limit");this._connections+=1;var e=new g({server:this,id:t,allowHalfOpen:this.allowHalfOpen,pauseOnCreate:this.pauseOnConnect});e.on("connect",(()=>this.emit("connection",e)))},p.prototype._onAcceptError=function(t){this.emit("error",A(t,"accept")),this.close()},p.prototype.close=function(t){return"function"==typeof t&&(this.id?this.once("close",t):this.once("close",(()=>t(new Error("Not running"))))),this.id&&(chrome.sockets.tcpServer.close(this.id),delete c[this.id],this.id=null),this._address=null,this.connecting=!1,this._emitCloseIfDrained(),this},p.prototype._emitCloseIfDrained=function(){this.id||this.connecting||this._connections||s.nextTick(m,this)},Object.defineProperty(p.prototype,"listening",{get:function(){return!!this._address},configurable:!0,enumerable:!0}),p.prototype.address=function(){return this._address},p.prototype.unref=p.prototype.ref=function(){return this},p.prototype.getConnections=function(t){s.nextTick(t,null,this._connections)},a(g,h.Duplex),e.Socket=g,g.prototype._init=function(){this.bytesRead=0,this._bytesDispatched=0,this.server=null,this._server=null},g.prototype._reset=function(){this.remoteAddress=this.remotePort=this.localAddress=this.localPort=null,this.remoteFamily="IPv4",this.readable=this.writable=!1,this.connecting=!1},g.prototype.connect=function(){const t=arguments.length;for(var e=new Array(t),r=0;r= 0 and < 65536: '+this._port)}return this._port|=0,this._init(),this._unrefTimer(),"function"==typeof n&&this.once("connect",n),chrome.sockets.tcp.create((t=>{if(!this.connecting||this.id)return S(),void chrome.sockets.tcp.close(t.socketId);chrome.runtime.lastError?this.destroy(new Error(chrome.runtime.lastError.message)):(this.id=t.socketId,d[this.id]=this,chrome.sockets.tcp.setPaused(this.id,!0),chrome.sockets.tcp.connect(this.id,this._host,this._port,(e=>{this.id===t.socketId?0===e?(this._unrefTimer(),this._onConnect()):this.destroy(I(e,"connect",this._host,this._port)):S()})))})),this},g.prototype._onConnect=function(){var t=this.id;chrome.sockets.tcp.getInfo(this.id,(e=>{this.id===t?chrome.runtime.lastError?this.destroy(new Error(chrome.runtime.lastError.message)):(this.remoteAddress=e.peerAddress,this.remoteFamily=e.peerAddress&&-1!==e.peerAddress.indexOf(":")?"IPv6":"IPv4",this.remotePort=e.peerPort,this.localAddress=e.localAddress,this.localPort=e.localPort,this.connecting=!1,this.readable=!0,this.emit("connect"),this.isPaused()||this.read(0)):S()}))},Object.defineProperty(g.prototype,"bufferSize",{get:function(){if(this.id){var t=this._writableState.length;return this._pendingData&&(t+=this._pendingData.length),t}}}),g.prototype.end=function(t,e){h.Duplex.prototype.end.call(this,t,e),this.writable=!1},g.prototype._write=function(t,e,r){if(r||(r=()=>{}),this.connecting)return this._pendingData=t,void this.once("connect",(()=>this._write(t,e,r)));if(this._pendingData=null,this.id){var i=t.buffer;t.byteLength!==i.byteLength&&(i=i.slice(t.byteOffset,t.byteOffset+t.byteLength));var n=this.id;chrome.sockets.tcp.send(this.id,i,(t=>{this.id===n?t.resultCode<0?this._destroy(I(t.resultCode,"write",this.remoteAddress,this.remotePort),r):(this._unrefTimer(),r(null)):S()})),this._bytesDispatched+=t.length}else r(new Error("This socket is closed"))},g.prototype._read=function(t){if(!this.connecting&&this.id){chrome.sockets.tcp.setPaused(this.id,!1);var e=this.id;chrome.sockets.tcp.getInfo(this.id,(t=>{this.id===e?!chrome.runtime.lastError&&t.connected||this._onReceiveError(-15):S()}))}else this.once("connect",(()=>this._read(t)))},g.prototype._onReceive=function(t){var e=l.from(t),r=this.bytesRead;this.bytesRead+=e.length,this._unrefTimer(),this.ondata&&(console.error("socket.ondata = func is non-standard, use socket.on('data', func)"),this.ondata(e,r,this.bytesRead)),this.push(e)||chrome.sockets.tcp.setPaused(this.id,!0)},g.prototype._onReceiveError=function(t){-100===t?(this.onend&&(console.error("socket.onend = func is non-standard, use socket.on('end', func)"),this.once("end",this.onend)),this.push(null),this.destroy()):t<0&&this.destroy(A(t,"read"))},i="bytesWritten",n=function(){if(this.id)return this._bytesDispatched+this.bufferSize},Object.defineProperty(g.prototype,i,{configurable:!1,enumerable:!0,get:n}),g.prototype.destroy=function(t){this._destroy(t)},g.prototype._destroy=function(t,e){var r=()=>{e&&e(t),t&&!this._writableState.errorEmitted&&(s.nextTick(E,this,t),this._writableState.errorEmitted=!0)};if(this.destroyed)r();else{this._server&&(this._server._connections-=1,this._server._emitCloseIfDrained&&this._server._emitCloseIfDrained()),this._reset();for(var i=this;null!==i;i=i._parent)f.unenroll(i);this.destroyed=!0,this.id&&(delete d[this.id],chrome.sockets.tcp.close(this.id,(()=>{this.destroyed&&this.emit("close",!!t)})),this.id=null),r()}},g.prototype.destroySoon=function(){this.writable&&this.end(),this._writableState.finished&&this.destroy()},g.prototype.setTimeout=function(t,e){return 0===t?(f.unenroll(this),e&&this.removeListener("timeout",e)):(f.enroll(this,t),f._unrefActive(this),e&&this.once("timeout",e)),this},g.prototype._onTimeout=function(){this.emit("timeout")},g.prototype._unrefTimer=function(){for(var t=this;null!==t;t=t._parent)f._unrefActive(t)},g.prototype.setNoDelay=function(t,e){return this.id?(t=void 0===t||!!t,chrome.sockets.tcp.setNoDelay(this.id,t,k(e)),this):(this.once("connect",(()=>this.setNoDelay(t,e))),this)},g.prototype.setKeepAlive=function(t,e,r){return this.id?(chrome.sockets.tcp.setKeepAlive(this.id,!!t,~~(e/1e3),k(r)),this):(this.once("connect",(()=>this.setKeepAlive(t,e,r))),this)},g.prototype.address=function(){return{address:this.localAddress,port:this.localPort,family:this.localAddress&&-1!==this.localAddress.indexOf(":")?"IPv6":"IPv4"}},Object.defineProperty(g.prototype,"_connecting",{get:function(){return this.connecting}}),Object.defineProperty(g.prototype,"readyState",{get:function(){return this.connecting?"opening":this.readable&&this.writable?"open":"closed"}}),g.prototype.unref=g.prototype.ref=function(){return this};var y=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,b=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;function v(t){var e={};if(null!==t[0]&&"object"==typeof t[0])e=t[0];else{if(_(t[0]))throw new Error("Pipes are not supported in Chrome Apps.");e.port=t[0],"string"==typeof t[1]&&(e.host=t[1])}var r=t[t.length-1];return"function"==typeof r?[e,r]:[e]}function w(t){return(t=Number(t))>=0&&t}function _(t){return"string"==typeof t&&!1===w(t)}function M(t){return!("number"!=typeof t&&"string"!=typeof t||"string"==typeof t&&0===t.trim().length)&&(+t==+t>>>0&&t<=65535)}function S(){chrome.runtime.lastError}function k(t){return()=>{var e;chrome.runtime.lastError&&(console.error(chrome.runtime.lastError.message),e=new Error(chrome.runtime.lastError.message)),t&&t(e)}}function E(t,e){t.emit("error",e)}e.isIPv4=y.test.bind(y),e.isIPv6=b.test.bind(b),e.isIP=function(t){return e.isIPv4(t)?4:e.isIPv6(t)?6:0};var x={"-10":"EACCES","-22":"EACCES","-138":"EACCES","-147":"EADDRINUSE","-108":"EADDRNOTAVAIL","-103":"ECONNABORTED","-102":"ECONNREFUSED","-101":"ECONNRESET","-16":"EEXIST","-8":"EFBIG","-109":"EHOSTUNREACH","-4":"EINVAL","-23":"EISCONN","-6":"ENOENT","-13":"ENOMEM","-106":"ENONET","-18":"ENOSPC","-11":"ENOSYS","-15":"ENOTCONN","-105":"ENOTFOUND","-118":"ETIMEDOUT","-100":"EOF"};function A(t,e,r){var i=x[t]||"UNKNOWN",n=e+" "+t+" "+r;chrome.runtime.lastError&&(n+=" "+chrome.runtime.lastError.message),n+=" (mapped uv code: "+i+")";var s=new Error(n);return s.code=s.errno=i,s.syscall=e,s}function I(t,e,r,i,n){var s;s=i&&i>0?r+":"+i:r,n&&(s+=" - Local ("+n+")");var o=A(t,e,s);return o.address=r,i&&(o.port=i),o}},8968:t=>{t.exports=Math.floor},9106:t=>{var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,r,i,n){return r=r||"&",i=i||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(n){var s=encodeURIComponent(e(n))+i;return Array.isArray(t[n])?t[n].map((function(t){return s+encodeURIComponent(e(t))})).join(r):s+encodeURIComponent(e(t[n]))})).filter(Boolean).join(r):n?encodeURIComponent(e(n))+i+encodeURIComponent(e(t)):""}},9133:t=>{t.exports=Math.abs},9188:(t,e,r)=>{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)}},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}},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())}},9290:t=>{t.exports=RangeError},9353:t=>{var e=Object.prototype.toString,r=Math.max,i=function(t,e){for(var r=[],i=0;i{t.exports=Error},9404:function(t,e,r){!function(t,e){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(8287).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];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)};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.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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 x(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 S(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(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 A(t){x.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 S;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return w[t]=e,e},x.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},x.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")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(f(t,t.umod(this.m)._forceRed(this)),t)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.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)},x.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},x.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)},x.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},x.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},x.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.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},x.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},x.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new A(t)},n(A,x),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.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)},A.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)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9439:(t,e,r)=>{e.RateLimiter=r(3065),e.TokenBucket=r(5472)},9538:t=>{t.exports=ReferenceError},9560:(t,e,r)=>{e.utils=r(7626),e.Cipher=r(2808),e.DES=r(2211),e.CBC=r(3389),e.EDE=r(5279)},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)))},9612:t=>{t.exports=Object},9639:(t,e,r)=>{r.d(e,{NJ:()=>y,V5:()=>o,dU:()=>p,HB:()=>b,xW:()=>h,LC:()=>u,tW:()=>k,fk:()=>a,Ht:()=>v,po:()=>E,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)=>{if(!e)return d.decode(t);return new TextDecoder(e).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?S[e](i):i},E=t=>{const e=new Uint8Array(t);return _.getRandomValues(e)}},9655:function(t,e,r){var i;t=r.nmd(t),function(){e&&e.nodeType,t&&t.nodeType;var n="object"==typeof globalThis&&globalThis;n.global!==n&&n.window!==n&&n.self;var s,o=2147483647,a=36,h=/^xn--/,u=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},c=Math.floor,d=String.fromCharCode;function p(t){throw new RangeError(l[t])}function m(t,e){for(var r=t.length,i=[];r--;)i[r]=e(t[r]);return i}function g(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+m((t=t.replace(f,".")).split("."),e).join(".")}function y(t){for(var e,r,i=[],n=0,s=t.length;n=55296&&e<=56319&&n65535&&(e+=d((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=d(t)})).join("")}function v(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function w(t,e,r){var i=0;for(t=r?c(t/700):t>>1,t+=c(t/e);t>455;i+=a)t=c(t/35);return c(i+36*t/(t+38))}function _(t){var e,r,i,n,s,h,u,f,l,d,m,g=[],y=t.length,v=0,_=128,M=72;for((r=t.lastIndexOf("-"))<0&&(r=0),i=0;i=128&&p("not-basic"),g.push(t.charCodeAt(i));for(n=r>0?r+1:0;n=y&&p("invalid-input"),((f=(m=t.charCodeAt(n++))-48<10?m-22:m-65<26?m-65:m-97<26?m-97:a)>=a||f>c((o-v)/h))&&p("overflow"),v+=f*h,!(f<(l=u<=M?1:u>=M+26?26:u-M));u+=a)h>c(o/(d=a-l))&&p("overflow"),h*=d;M=w(v-s,e=g.length+1,0==s),c(v/e)>o-_&&p("overflow"),_+=c(v/e),v%=e,g.splice(v++,0,_)}return b(g)}function M(t){var e,r,i,n,s,h,u,f,l,m,g,b,_,M,S,k=[];for(b=(t=y(t)).length,e=128,r=0,s=72,h=0;h=e&&gc((o-r)/(_=i+1))&&p("overflow"),r+=(u-e)*_,e=u,h=0;ho&&p("overflow"),g==e){for(f=r,l=a;!(f<(m=l<=s?1:l>=s+26?26:l-s));l+=a)S=f-m,M=a-m,k.push(d(v(m+S%M,0))),f=c(S/M);k.push(d(v(f,0))),s=w(r,_,i==n),r=0,++i}++r,++e}return k.join("")}s={version:"1.4.1",ucs2:{decode:y,encode:b},decode:_,encode:M,toASCII:function(t){return g(t,(function(t){return u.test(t)?"xn--"+M(t):t}))},toUnicode:function(t){return g(t,(function(t){return h.test(t)?_(t.slice(4).toLowerCase()):t}))}},void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()},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)},9675:t=>{t.exports=TypeError},9957:(t,e,r)=>{var i=Function.prototype.call,n=Object.prototype.hasOwnProperty,s=r(6743);t.exports=s.call(i,n)},9971:(t,e,r)=>{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;if(e.length<=i&&0!==n)return t.left;return 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}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var s=e[i]={id:i,loaded:!1,exports:{}};return t[i].call(s.exports,s,s.exports,r),s.loaded=!0,s.exports}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})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var i={};r.r(i),r.d(i,{ACTIONS:()=>Yt,CONNECTION_ID:()=>Gt,DESTROY_TIMEOUT:()=>ee,EVENTS:()=>Jt,EVENT_IDS:()=>Xt,EVENT_NAMES:()=>Qt,IPV4_RE:()=>Kt,IPV6_RE:()=>Vt,REMOVE_IPV4_MAPPED_IPV6_RE:()=>Zt,REQUEST_TIMEOUT:()=>te,querystringParse:()=>ie,querystringStringify:()=>ne,toUInt32:()=>re});var n=r(7007);function s(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function o(t,e){let r,i="",n=0,s=-1,o=0;for(let a=0;a<=t.length;++a){if(a2){const t=i.lastIndexOf("/");if(t!==i.length-1){-1===t?(i="",n=0):(i=i.slice(0,t),n=i.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}function a(t){if(s(t),0===t.length)return".";const 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}function h(){if(0===arguments.length)return".";let t;for(let e=0;e0&&(void 0===t?t=r:t+="/"+r)}return void 0===t?".":a(t)}r(717);const u="/";var f=r(988),l=r(1467),c=r(8444),d=r(7266);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("|"));function m(t){return p.test(t)}function g(t){return!m(t)}var y=r(405),b=r(8190),v=r(9596),w=r(9639),_=(r(3468),r(5185)),M=r(3519);function S(t){return"."!==t[0]}function k(t,e,r){_.stat(t,((i,n)=>{if(i)return r(i);n.isDirectory()?_.readdir(t,((i,n)=>{if(i)return r(i);b(n.filter(S).filter(g).map((r=>i=>{k(h(t,r),e,i)})),r)})):n.isFile()&&e(t,r)}))}function E(t,e,r){k(t,x,((i,n)=>{if(i)return r(i);n=Array.isArray(n)?n.flat(1/0):[n],t=a(t),e&&(t=t.slice(0,t.lastIndexOf(u)+1)),t[t.length-1]!==u&&(t+=u),n.forEach((e=>{e.getStream=function(t){return()=>_.createReadStream(t)}(e.path),e.path=e.path.replace(t,"").split(u)})),r(null,n)}))}function x(t,e){e=M(e),_.stat(t,((r,i)=>{if(r)return e(r);const n={length:i.size,path:t};e(null,n)}))}const A=[["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"]];const I=Symbol("itemPath");function T(t,e,r){var i;if(i=t,"undefined"!=typeof FileList&&i 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=>R(t)&&"string"==typeof t.path?t.path:t))).length||"string"==typeof t[0]||t[0].name||(t[0].name=e.name);let n=null;t.forEach(((e,r)=>{if("string"==typeof e)return;let i=e.fullPath||e.name;i||(i=`Unknown File ${r+1}`,e.unknownName=!0),e[I]=i.split("/"),e[I][0]||e[I].shift(),e[I].length<2?n=null:0===r&&t.length>1?n=e[I][0]:e[I][0]!==n&&(n=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]&&m(e)}(t[I])))),n&&t.forEach((t=>{const e=(ArrayBuffer.isView(t)||O(t))&&!t[I];"string"==typeof t||e||t[I].shift()})),!e.name&&n&&(e.name=n),e.name||t.some((t=>"string"==typeof t?(e.name=function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');s(t);let r,i=0,n=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let s=e.length-1,a=-1;for(r=t.length-1;r>=0;--r){const h=t.charCodeAt(r);if(47===h){if(!o){i=r+1;break}}else-1===a&&(o=!1,a=r+1),s>=0&&(h===e.charCodeAt(s)?-1==--s&&(n=r):(s=-1,n=a))}return i===n?n=a:-1===n&&(n=t.length),t.slice(i,n)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!o){i=r+1;break}}else-1===n&&(o=!1,n=r+1);return-1===n?"":t.slice(i,n)}(t),!0):!t.unknownName&&(e.name=t[I][t[I].length-1],!0))),e.name||(e.name=`Unnamed Torrent ${Date.now()}`),e.maxPieceLength||(e.maxPieceLength=4194304);const o=t.reduce(((t,e)=>t+Number("string"==typeof e)),0);let a=1===t.length;function h(){b(t.map((t=>e=>{const r={};if(R(t))r.getStream=t.stream(),r.length=t.size;else if(ArrayBuffer.isView(t))r.getStream=[t],r.length=t.length;else{if(!O(t)){if("string"==typeof t){0;return void E(t,o>1||a,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[I],e(null,r)})),((t,e)=>{if(t)return r(t);e=e.flat(),r(null,e,a)}))}1===t.length&&"string"==typeof t[0]?d(t[0],((t,e)=>{if(t)return r(t);a=e,h()})):v(h)}const P=5;function C(t,e){return t+e.length}function R(t){return"undefined"!=typeof Blob&&t instanceof Blob}function O(t){return"object"==typeof t&&null!=t&&"function"==typeof t.pipe}const B=function(t,e,r){"function"==typeof e&&([e,r]=[r,e]),T(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(A));"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(C,0),o=e.pieceLength||Math.min(c(s),e.maxPieceLength);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(y(h),e,{zeroPadding:!1});try{for await(const t of p)await new Promise((e=>{o+=t.length;const i=c;++c,++f{s[i]=h,--f,a+=t.length,u&&u(a,r),e(),d&&0===f&&n(null,(0,w.fk)(s.join("")),o)}))}));if(0===f)return n(null,(0,w.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)}))};var L=r(7833),N=r(9971),j=r(4988),U=r(7180),q=r(8454),D=r(3209),H=r(5307),F=r(1565),z=r(8287).Buffer,$=r(717);const W=L("bittorrent-dht"),K=3e5;class V extends n.EventEmitter{constructor(t={}){super(),this._tables=new q({maxAge:K,max:t.maxTables||1e3}),this._values=new q(t.maxValues||1e3),this._peers=H({maxAge:t.maxAge||0,maxSize:t.maxPeers||1e4}),this._secrets=null,this._hash=t.hash||G,this._hashLength=this._hash(z.from("")).length,this._rpc=t.krpc||j(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()}),K),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=U((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})})),$.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=tt(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(tt(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&&z.isBuffer(n.r.id)&&n.r.id.length===r._hashLength?z.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(Q),values:e}}put(t,e){(z.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&&!z.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=Z);const r=!!t.k,i="string"==typeof t.v?z.from(t.v):t.v,n=r?this._hash(t.salt?z.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(X(o.a)):z.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=tt(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=Y(this._rpc.id,null,s),$.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;e.salt&&(o.salt=z.from(e.salt));if(a){if(!i||!o.sig||!o.k)return!0;if(!i(o.sig,X(o),o.k))return!0;n(o.salt?z.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=tt(t),r||(r=Z);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=tt(t),e||(e=Z);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=z.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,Y(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?z.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,X(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 $.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 N({localNodeId:t,numberOfNodesPerKBucket:this._rpc.k});this._rpc.closest(t,e,(function(e,i){if(!e.r)return!0;e.r.token&&e.r.id&&z.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}));return!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(!W.enabled)return;const t=[].slice.call(arguments);t[0]=`[${this.nodeId.toString("hex").substring(0,7)}] ${t[0]}`;for(let e=1;e{throw new Error("global fetch is not available!")}),st=[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 ot=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,w.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)};function at(t){return t.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))}),[])}const ht=function(t){const e={},r=t.split("magnet:?")[1];let i;if((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=at(decodeURIComponent(n).split(","))),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,w.V5)(ot(i[1])):(i=t.match(/^urn:btmh:1220(.{64})/))&&(e.infoHashV2=i[1].toLowerCase())}))}if(e.xs){(Array.isArray(e.xs)?e.xs:[e.xs]).forEach((t=>{(i=t.match(/^urn:btpk:(.{64})/))&&(e.publicKey=i[1].toLowerCase())}))}return e.infoHash&&(e.infoHashBuffer=(0,w.fk)(e.infoHash)),e.infoHashV2&&(e.infoHashV2Buffer=(0,w.fk)(e.infoHashV2)),e.publicKey&&(e.publicKeyBuffer=(0,w.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 ut(t){if("string"==typeof t&&/^(stream-)?magnet:/.test(t)){const e=ht(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 ht(`magnet:?xt=urn:btih:${t}`);if(ArrayBuffer.isView(t)&&20===t.length)return ht(`magnet:?xt=urn:btih:${(0,w.V5)(t)}`);if(ArrayBuffer.isView(t))return await async function(t){ArrayBuffer.isView(t)&&(t=f.A.decode(t));ct(t.info,"info"),ct(t.info["name.utf-8"]||t.info.name,"info.name"),ct(t.info["piece length"],"info['piece length']"),ct(t.info.pieces,"info.pieces"),t.info.files?t.info.files.forEach((t=>{ct("number"==typeof t.length,"info.files[0].length"),ct(t["path.utf-8"]||t.path,"info.files[0].path")})):ct("number"==typeof t.info.length,"info.length");const e={info:t.info,infoBuffer:f.A.encode(t.info),name:(0,w.dU)(t.info["name.utf-8"]||t.info.name),announce:[]};e.infoHashBuffer=await(0,w.tW)(e.infoBuffer),e.infoHash=(0,w.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,w.dU)(t["created by"]));ArrayBuffer.isView(t.comment)&&(e.comment=(0,w.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,w.dU)(t))}))})):t.announce&&e.announce.push((0,w.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,w.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,w.dU)(t):t));return{path:h.apply(null,[u].concat(n)).slice(1),name:n[n.length-1],length:t.length,offset:r.slice(0,i).reduce(lt,0)}})),e.length=r.reduce(lt,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(n=t,"undefined"!=typeof Blob&&n instanceof Blob)try{s(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 nt(t,{headers:{"user-agent":"WebTorrent (https://webtorrent.io)"},signal:AbortSignal.timeout(3e4),...e});s(new Uint8Array(await r.arrayBuffer()))}catch(t){return r(new Error(`Error downloading torrent: ${t.message}`))}else"function"==typeof it.readFile&&"string"==typeof t?it.readFile(t,((t,e)=>{if(t)return r(new Error("Invalid torrent identifier"));s(e)})):v((()=>{r(new Error("Invalid torrent identifier"))}));var n;async function s(t){try{i=await ut(t)}catch(t){return r(t)}i&&i.infoHash?r(null,i):r(new Error("Invalid torrent identifier"))}}function lt(t,e){return t+e.length}function ct(t,e){if(!t)throw new Error(`Torrent is missing required field: ${e}`)}const dt=ut,pt=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,w.V5)(t.infoHashBuffer)}`),t.infoHash&&e.add(`urn:btih:${t.infoHash}`),t.infoHashV2Buffer&&e.add(t.xt=`urn:btmh:1220${(0,w.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,w.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},mt="undefined"!=typeof window?window:self,gt=mt.RTCPeerConnection||mt.mozRTCPeerConnection||mt.webkitRTCPeerConnection,yt=mt.RTCSessionDescription||mt.mozRTCSessionDescription||mt.webkitRTCSessionDescription,bt=mt.RTCIceCandidate||mt.mozRTCIceCandidate||mt.webkitRTCIceCandidate;mt.RTCIceTransport,mt.RTCDataChannel,mt.RTCSctpTransport,mt.RTCDtlsTransport,mt.RTCCertificate,mt.MediaStream,mt.MediaStreamTrack,mt.MediaStreamTrackEvent,mt.RTCPeerConnectionIceEvent,mt.RTCDataChannelEvent,mt.RTCTrackEvent,mt.RTCError,mt.RTCErrorEvent,mt.RTCRtpTransceiver,mt.RTCRtpReceiver,mt.RTCRtpSender;var vt=r(8179),wt=r(6310);const _t=L("simple-peer"),Mt=65536;function St(t){return t.replace(/a=ice-options:trickle\s\n/g,"")}class kt extends vt.Duplex{_pc;constructor(t){if(super(t=Object.assign({allowHalfOpen:!1},t)),this.__objectMode=!!t.objectMode,this._id=(0,w.V5)((0,w.po)(4)).slice(0,7),this._debug("new peer %o",t),this.channelName=t.initiator?t.channelName||(0,w.V5)((0,w.po)(20)):null,this.initiator=t.initiator||!1,this.channelConfig=t.channelConfig||kt.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},kt.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,!gt)throw"undefined"==typeof window?wt(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):wt(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 gt(this.config)}catch(t){return void this.__destroy(wt(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(wt(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 wt(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 yt(t)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((t=>{this._addIceCandidate(t)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((t=>{this.__destroy(wt(t,"ERR_SET_REMOTE_DESCRIPTION"))})),t.sdp||t.candidate||t.renegotiate||t.transceiverRequest||this.__destroy(wt(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(t){const e=new bt(t);this._pc.addIceCandidate(e).catch((t=>{var r;!e.address||e.address.endsWith(".local")?(r="Ignoring unsupported ICE candidate.",console.warn(r)):this.__destroy(wt(t,"ERR_ADD_ICE_CANDIDATE"))}))}send(t){if(!this._destroying){if(this.destroyed)throw wt(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(t)}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,queueMicrotask((()=>{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 wt(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(wt(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=Mt),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(wt(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(wt(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(t)}catch(t){return this.__destroy(wt(t,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>Mt?(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=St(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(wt(t,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((t=>{this.__destroy(wt(t,"ERR_CREATE_OFFER"))}))}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then((t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=St(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(wt(t,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((t=>{this.__destroy(wt(t,"ERR_CREATE_ANSWER"))}))}_onConnectionStateChange(){this.destroyed||this._destroying||"failed"===this._pc.connectionState&&this.__destroy(wt(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(wt(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.__destroy(wt(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(wt(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>Mt||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,w.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],_t.apply(null,t)}}kt.WEBRTC_SUPPORT=!!gt,kt.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},kt.channelConfig={};const Et=kt;var xt=r(1035),At=r(7541),It=r(3278),Tt=r(8957),Pt=r(5658),Ct=r(4343);const Rt=L("webtorrent:conn-pool");class Ot{constructor(t){Rt("create pool (port %s)",t.torrentPort),this._client=t,this._pendingConns=new Set,this._onTCPConnectionBound=t=>{this._onConnection(t,"tcp")},this._onUTPConnectionBound=t=>{this._onConnection(t,"utp")},this._onListening=()=>{this._client._onListening()},this._onTCPError=t=>{this._client._destroy(t)},this._onUTPError=t=>{this._client.utp=!1,this._client.emit("error",t),this._client.listening||this._onListening()},this.tcpServer=Tt.createServer(),this.tcpServer.on("connection",this._onTCPConnectionBound),this.tcpServer.on("error",this._onTCPError),this.tcpServer.listen(t.torrentPort,(()=>{Rt("creating tcpServer in port %s",this.tcpServer.address().port),this._client.utp?(this.utpServer=Ct.createServer(),this.utpServer.on("connection",this._onUTPConnectionBound),this.utpServer.on("listening",this._onListening),this.utpServer.on("error",this._onUTPError),Rt("creating utpServer in port %s",this.tcpServer.address().port),this.utpServer.listen(this.tcpServer.address().port)):this._onListening()}))}destroy(t){if(Rt("destroy conn pool"),this.utpServer&&(this.utpServer.removeListener("connection",this._onUTPConnectionBound),this.utpServer.removeListener("listening",this._onListening),this.utpServer.removeListener("error",this._onUTPError)),this.tcpServer.removeListener("connection",this._onTCPConnectionBound),this.tcpServer.removeListener("error",this._onTCPError),this._pendingConns.forEach((t=>{t.on("error",Bt),t.destroy()})),this.utpServer)try{this.utpServer.close(t)}catch(e){t&&v(t)}try{this.tcpServer.close(t)}catch(e){t&&v(t)}this.tcpServer=null,this.utpServer=null,this._client=null,this._pendingConns=null}_onConnection(t,e){const r=this;if(!t.remoteAddress)return t.on("error",Bt),void t.destroy();r._pendingConns.add(t),t.once("close",o);const i="utp"===e?Pt.default.createUTPIncomingPeer(t,this._client.throttleGroups):Pt.default.createTCPIncomingPeer(t,this._client.throttleGroups),n=i.wire;async function s(t,e){o();const n=await r._client.get(t);if(n)i.swarm||(i.swarm=n,n._addIncomingPeer(i)),i.onHandshake(t,e);else{const e=new Error(`Unexpected info hash ${t} from incoming peer ${i.id}`);i.destroy(e)}}function o(){t.removeListener("close",o),n.removeListener("handshake",s),r._pendingConns&&r._pendingConns.delete(t)}n.once("pe3",(async function(t){const e=await r._client._getByHash(t);e?(i.swarm=e,e._addIncomingPeer(i),i.onPe3(t)):i.destroy(new Error(`Unexpected info hash hash ${t} from incoming peer ${i.id}`))})),n.once("handshake",s)}}function Bt(){}Ot.UTP_SUPPORT=Object.keys(Ct).length>0;var Lt=r(6686),Nt=r(6889);const jt=/^\[?([^\]]+)]?:(\d+)$/;let Ut=new Map;function qt(t){if(1e5===Ut.size&&Ut.clear(),!Ut.has(t)){const e=jt.exec(t);if(!e)throw new Error(`invalid addr: ${t}`);Ut.set(t,[e[1],Number(e[2])])}return Ut.get(t)}var Dt=r(3033),Ht=r(4497);async function*Ft(t,e={}){if(t?.[Symbol.asyncIterator])return void(yield*t[Symbol.asyncIterator](e.offset));if(!t?.get)throw new Error("First argument must be an abstract-chunk-store compliant store");const r=e.chunkLength||t.chunkLength;if(!r)throw new Error("missing required `chunkLength` property");let i=e.length||t.length;if(!Number.isFinite(i))throw new Error("missing required `length` property");const n=e.offset||0,s=(e,r,i)=>new 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))}async function zt(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,r)=>{s++<=n&&e(),t.put(o++,u,(t=>{if(t)return r(t);--s,e(),h&&0===s&&a()}))}));0!==s&&(h=new Promise((t=>{a=t})),await h)}var $t=r(4018),Wt=r(7186);const Kt=/^[\d.]+$/,Vt=/^[\da-fA-F:]+$/,Zt=/^::ffff:/,Gt=(0,w.xW)([re(1047),re(655366528)]),Yt={CONNECT:0,ANNOUNCE:1,SCRAPE:2,ERROR:3},Jt={update:0,completed:1,started:2,stopped:3,paused:4},Xt={0:"update",1:"completed",2:"started",3:"stopped",4:"paused"},Qt={update:"update",completed:"complete",started:"start",stopped:"stop",paused:"pause"},te=15e3,ee=1e3;function re(t){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t),e}const ie=t=>Wt.parse(t,null,null,{decodeURIComponent:unescape}),ne=t=>{let e=Wt.stringify(t,null,null,{encodeURIComponent:escape});return e=e.replace(/[@*/+]/g,(t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)),e},se={DEFAULT_ANNOUNCE_PEERS:50,MAX_ANNOUNCE_PEERS:82,parseUrl:t=>{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},...i};var oe=r(1314);const ae=class extends n{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())}};var he=r(2085),ue=r(8287).Buffer;const fe=L("bittorrent-tracker:http-tracker"),le=/\/(announce)[^/]*$/;class ce extends ae{constructor(t,e){super(t,e),fe("new http tracker %s",e),this.scrapeUrl=null;const r=this.announceUrl.match(le);if(r){const t=this.announceUrl.slice(0,r.index),e=this.announceUrl.slice(r.index+9);this.scrapeUrl=`${t}/scrape${e}`}this.cleanupFns=[],this.maybeDestroyCleanup=null}announce(t){if(this.destroyed)return;const e=Object.assign({},t,{compact:null==t.compact?1:t.compact,info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,port:this.client._port});0===e.left||e.left||(e.left=16384),this._trackerId&&(e.trackerid=this._trackerId),this._request(this.announceUrl,e,((t,e)=>{if(t)return this.client.emit("warning",t);this._onAnnounceResponse(e)}))}scrape(t){if(this.destroyed)return;if(!this.scrapeUrl)return void this.client.emit("error",new Error(`scrape not supported ${this.announceUrl}`));const e={info_hash:Array.isArray(t.infoHash)&&t.infoHash.length>0?t.infoHash.map((t=>(0,w.Ht)(t))):t.infoHash&&(0,w.Ht)(t.infoHash)||this.client._infoHashBinary};this._request(this.scrapeUrl,e,((t,e)=>{if(t)return this.client.emit("warning",t);this._onScrapeResponse(e)}))}destroy(t){const e=this;if(this.destroyed)return t(null);let r;if(this.destroyed=!0,clearInterval(this.interval),0===this.cleanupFns.length)return i();function i(){r&&(clearTimeout(r),r=null),e.maybeDestroyCleanup=null,e.cleanupFns.slice(0).forEach((t=>{t()})),e.cleanupFns=[],t(null)}r=setTimeout(i,se.DESTROY_TIMEOUT),this.maybeDestroyCleanup=()=>{0===this.cleanupFns.length&&i()}}async _request(t,e,r){const i=new URL(t+(-1===t.indexOf("?")?"?":"&")+se.querystringStringify(e));let n;this.client._proxyOpts&&(n="https:"===i.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!n&&this.client._proxyOpts.socksProxy&&(n=this.client._proxyOpts.socksProxy));const s=()=>{a.signal.aborted||(oe(this.cleanupFns,this.cleanupFns.indexOf(s)),a.abort(),a=null),this.maybeDestroyCleanup&&this.maybeDestroyCleanup()};let o;this.cleanupFns.push(s);let a=function(t){const e=new AbortController;return setTimeout((()=>{e.abort()}),t).unref?.(),e}(se.REQUEST_TIMEOUT);try{o=await nt(i.toString(),{agent:n,signal:a.signal,dispatcher:n,headers:{"user-agent":this.client._userAgent||""}}),o.body.on&&o.body.on("error",r)}catch(t){if(t)return r(t)}let h=new Uint8Array(await o.arrayBuffer());if(s(),this.destroyed)return;if(200!==o.status)return r(new Error(`Non-200 response code ${o.status} from ${this.announceUrl}`));if(!h||0===h.length)return r(new Error(`Invalid tracker response from${this.announceUrl}`));try{h=f.A.decode(h)}catch(t){return r(new Error(`Error decoding tracker response: ${t.message}`))}const u=h["failure reason"]&&(0,w.dU)(h["failure reason"]);if(u)return fe(`failure from ${t} (${u})`),r(new Error(u));const l=h["warning message"]&&(0,w.dU)(h["warning message"]);l&&(fe(`warning from ${t} (${l})`),this.client.emit("warning",new Error(l))),fe(`response from ${t}`),r(null,h)}_onAnnounceResponse(t){const e=t.interval||t["min interval"];e&&this.setInterval(1e3*e);const r=t["tracker id"];r&&(this._trackerId=r);const i=Object.assign({},t,{announce:this.announceUrl,infoHash:(0,w.HB)(t.info_hash||String(t.info_hash))});let n;if(this.client.emit("update",i),ArrayBuffer.isView(t.peers)){try{n=he.multi(ue.from(t.peers))}catch(t){return this.client.emit("warning",t)}n.forEach((t=>{this.client.emit("peer",t)}))}else Array.isArray(t.peers)&&t.peers.forEach((t=>{this.client.emit("peer",`${t.ip}:${t.port}`)}));if(ArrayBuffer.isView(t.peers6)){try{n=he.multi6(ue.from(t.peers6))}catch(t){return this.client.emit("warning",t)}n.forEach((t=>{this.client.emit("peer",t)}))}else Array.isArray(t.peers6)&&t.peers6.forEach((t=>{const e=/^\[/.test(t.ip)||!/:/.test(t.ip)?t.ip:`[${t.ip}]`;this.client.emit("peer",`${e}:${t.port}`)}))}_onScrapeResponse(t){t=t.files||t.host||{};const e=Object.keys(t);0!==e.length?e.forEach((e=>{const r=20!==e.length?(0,w.V5)((0,w.L0)(e)):(0,w.HB)(e),i=Object.assign(t[e],{announce:this.announceUrl,infoHash:r});this.client.emit("scrape",i)})):this.client.emit("warning",new Error("invalid scrape response"))}}ce.prototype.DEFAULT_ANNOUNCE_INTERVAL=18e5;const de=ce;var pe=r(7861),me=r(1220);const ge=L("bittorrent-tracker:udp-tracker");class ye extends ae{constructor(t,e){super(t,e),ge("new udp tracker %s",e),this.cleanupFns=[],this.maybeDestroyCleanup=null}announce(t){this.destroyed||this._request(t)}scrape(t){this.destroyed||(t._scrape=!0,this._request(t))}destroy(t){const e=this;if(this.destroyed)return t(null);let r;if(this.destroyed=!0,clearInterval(this.interval),0===this.cleanupFns.length)return i();function i(){r&&(clearTimeout(r),r=null),e.maybeDestroyCleanup=null,e.cleanupFns.slice(0).forEach((t=>{t()})),e.cleanupFns=[],t(null)}r=setTimeout(i,se.DESTROY_TIMEOUT),this.maybeDestroyCleanup=()=>{0===this.cleanupFns.length&&i()}}_request(t){const e=this;t||(t={});let r,i,n,s,{hostname:o,port:a}=se.parseUrl(this.announceUrl);""===a&&(a=80);let h=be();const u=this.client._proxyOpts&&(f=this.client._proxyOpts.socksProxy,JSON.parse(JSON.stringify(f)));var f;function l(e,o,a){if(e)return d(e);i=o,n=pe.createSocket("udp4"),s=a,r=setTimeout((()=>{"stopped"===t.event?c():d(new Error(`tracker request timed out (${t.event})`)),r=null}),se.REQUEST_TIMEOUT),r.unref&&r.unref(),m((0,w.xW)([se.CONNECTION_ID,se.toUInt32(se.ACTIONS.CONNECT),h]),s),n.once("error",d),n.on("message",p)}function c(){if(r&&(clearTimeout(r),r=null),n){oe(e.cleanupFns,e.cleanupFns.indexOf(c)),n.removeListener("error",d),n.removeListener("message",p),n.on("error",Me);try{n.close()}catch(t){}if(n=null,i){try{i.close()}catch(t){}i=null}}e.maybeDestroyCleanup&&e.maybeDestroyCleanup()}function d(t){if(c(),!e.destroyed){try{t.message&&(t.message+=` (${e.announceUrl})`)}catch(t){}e.client.emit("warning",t)}}function p(r){i&&(r=r.slice(10));const n=new DataView(h.buffer);if(r.length<8||r.readUInt32BE(4)!==n.getUint32(0))return d(new Error("tracker sent invalid transaction id"));const o=r.readUInt32BE(0);switch(ge("UDP response %s, action %s",e.announceUrl,o),o){case 0:if(r.length<16)return d(new Error("invalid udp handshake"));t._scrape?function(r){h=be();const i=Array.isArray(t.infoHash)&&t.infoHash.length>0?(0,w.xW)(t.infoHash):t.infoHash||e.client._infoHashBuffer;m((0,w.xW)([r,se.toUInt32(se.ACTIONS.SCRAPE),h,i]),s)}(r.slice(8,16)):function(t,r){h=be(),m((0,w.xW)([t,se.toUInt32(se.ACTIONS.ANNOUNCE),h,e.client._infoHashBuffer,e.client._peerIdBuffer,_e(r.downloaded),null!=r.left?_e(r.left):(0,w.fk)("ffffffffffffffff"),_e(r.uploaded),se.toUInt32(se.EVENTS[r.event]||0),se.toUInt32(0),se.toUInt32(0),se.toUInt32(r.numwant),ve(e.client._port)]),s)}(r.slice(8,16),t);break;case 1:{if(c(),e.destroyed)return;if(r.length<20)return d(new Error("invalid announce message"));const t=r.readUInt32BE(8);let i;t&&e.setInterval(1e3*t),e.client.emit("update",{announce:e.announceUrl,complete:r.readUInt32BE(16),incomplete:r.readUInt32BE(12)});try{i=he.multi(r.slice(20))}catch(t){return e.client.emit("warning",t)}i.forEach((t=>{e.client.emit("peer",t)}));break}case 2:{if(c(),e.destroyed)return;if(r.length<20||(r.length-8)%12!=0)return d(new Error("invalid scrape message"));const i=Array.isArray(t.infoHash)&&t.infoHash.length>0?t.infoHash.map((t=>t.toString("hex"))):[t.infoHash&&t.infoHash.toString("hex")||e.client.infoHash];for(let t=0,n=(r.length-8)/12;twe||"string"==typeof t){const e=new Uint8Array(8);return new DataView(e.buffer).setBigUint64(0,BigInt(t)),e}return(0,w.xW)([new Uint8Array(4),se.toUInt32(t)])}function Me(){}const Se=ye;var ke=r(1591);const Ee=L("simple-websocket"),xe="function"!=typeof ke?WebSocket:ke;class Ae extends vt.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,w.V5)((0,w.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===xe.OPEN;else{this.url=t.url;try{this._ws="function"==typeof ke?new xe(t.url,{...t,encoding:void 0}):new xe(t.url)}catch(t){return void v((()=>this.destroy(t)))}}this._ws.binaryType="arraybuffer",t.socket&&this.connected?v((()=>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===xe.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 ke&&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 ke&&(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,w.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],Ee.apply(null,t)}}Ae.WEBSOCKET_SUPPORT=!!xe;const Ie=L("bittorrent-tracker:websocket-tracker"),Te={};class Pe extends ae{constructor(t,e){super(t,e),Ie("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,w.Ht)(t))):t.infoHash&&(0,w.Ht)(t.infoHash)||this.client._infoHashBinary};this._send(e)}destroy(t=Ce){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,Te[this.announceUrl]&&(Te[this.announceUrl].consumers-=1),Te[this.announceUrl].consumers>0)return t();let e,r=Te[this.announceUrl];if(delete Te[this.announceUrl],r.on("error",Ce),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,se.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=Te[this.announceUrl],this.socket)Te[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=Te[this.announceUrl]=new Ae({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,w.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 Ie("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,(0,w.HB)(t.info_hash),this.client.infoHash);if(t.peer_id&&t.peer_id===this.client._peerIdBinary)return;Ie("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,w.HB)(t.info_hash)});this.client.emit("update",e)}let s;if(t.offer&&t.peer_id&&(Ie("creating peer (from remote offer)"),s=this._createPeer(),s.id=(0,w.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,w.HB)(t.offer_id);s=this.peers[e],s?(s.id=(0,w.HB)(t.peer_id),this.client.emit("peer",s),s.signal(t.answer),clearTimeout(s.trackerTimeout),s.trackerTimeout=null,delete this.peers[e]):Ie(`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,w.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(),Ie("reconnecting socket in %s ms",t)}_send(t){if(this.destroyed)return;this.expectingResponse=!0;const e=JSON.stringify(t);Ie("send %s",e),this.socket.send(e)}_generateOffers(t,e){const r=this,i=[];Ie("generating %s offers",t);for(let e=0;e{i.push({offer:e,offer_id:(0,w.Ht)(t)}),s()})),e.trackerTimeout=setTimeout((()=>{Ie("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&&(Ie("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 Et(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 Ce(){}Pe.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,Pe._socketPool=Te;const Re=Pe;var Oe=r(717);const Be=L("bittorrent-tracker:client");class Le extends n{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(!Oe.browser&&!t.port)throw new Error("Option `port` is required");this.peerId="string"==typeof t.peerId?t.peerId:(0,w.V5)(t.peerId),this._peerIdBuffer=(0,w.fk)(this.peerId),this._peerIdBinary=(0,w.Ht)(this.peerId),this.infoHash="string"==typeof t.infoHash?t.infoHash.toLowerCase():(0,w.V5)(t.infoHash),this._infoHashBuffer=(0,w.fk)(this.infoHash),this._infoHashBinary=(0,w.Ht)(this.infoHash),Be("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,w.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||Et.WEBRTC_SUPPORT),i=t=>{v((()=>{this.emit("warning",t)}))};this._trackers=e.map((t=>{let e;try{e=se.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 de?"udp:"===s&&"function"==typeof Se?new Se(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 Re(this,t):new de(this,t)})).filter(Boolean)}start(t){(t=this._defaultAnnounceOpts(t)).event="started",Be("send `start` %o",t),this._announce(t),this._trackers.forEach((t=>{t.setInterval()}))}stop(t){(t=this._defaultAnnounceOpts(t)).event="stopped",Be("send `stop` %o",t),this._announce(t)}complete(t){t||(t={}),(t=this._defaultAnnounceOpts(t)).event="completed",Be("send `complete` %o",t),this._announce(t)}update(t){(t=this._defaultAnnounceOpts(t)).event&&delete t.event,Be("send `update` %o",t),this._announce(t)}_announce(t){this._trackers.forEach((e=>{e.announce(t)}))}scrape(t){Be("send `scrape`"),t||(t={}),this._trackers.forEach((e=>{e.scrape(t)}))}setInterval(t){Be("setInterval %d",t),this._trackers.forEach((e=>{e.setInterval(t)}))}destroy(t){if(this.destroyed)return;this.destroyed=!0,Be("destroy");const e=this._trackers.map((t=>e=>{t.destroy(e)}));b(e,t),this._trackers=[],this._getAnnounceOpts=null}_defaultAnnounceOpts(t={}){return null==t.numwant&&(t.numwant=se.DEFAULT_ANNOUNCE_PEERS),null==t.uploaded&&(t.uploaded=0),null==t.downloaded&&(t.downloaded=0),this._getAnnounceOpts&&(t=Object.assign({},t,this._getAnnounceOpts())),t}}Le.scrape=(t,e)=>{if(e=M(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,w.L0)("01234567890123456789"),port:6881}),i=new Le(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 Ne=Le;r(7936);const je=L("bittorrent-lsd"),Ue="239.192.152.143",qe=6771;class De extends n.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(!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="string"==typeof t.port?t.port:t.port.toString(),this.cookie=`bittorrent-lsd-${this.peerId}`,this.destroyed=!1,this.annouceIntervalId=null,this.server=pe.createSocket({type:"udp4",reuseAddr:!0});this.server.on("listening",(()=>{je("listening");try{this.server.addMembership(Ue)}catch(t){this.emit("warning",t)}})),this.server.on("message",((t,e)=>{je("message",t.toString(),`${e.address}:${e.port}`);const r=this._parseAnnounce(t.toString());null!==r&&r.cookie!==this.cookie&&r.infoHash.forEach((t=>{this.emit("peer",`${e.address}:${r.port}`,t)}))})),this.server.on("error",(t=>{this.emit("error",t)}))}_parseAnnounce(t){je("parse announce",t);const e=t.split("\r\n");if("BT-SEARCH * HTTP/1.1"!==e[0])return this.emit("warning","Invalid LSD announce (header)"),null;const r=e[1].split("Host: ")[1];if(!(t=>/^(239.192.152.143|\[ff15::efc0:988f]):6771$/.test(t))(r))return this.emit("warning","Invalid LSD announce (host)"),null;const i=e[2].split("Port: ")[1];if(!(t=>/^\d+$/.test(t))(i))return this.emit("warning","Invalid LSD announce (port)"),null;const n=e.filter((t=>t.includes("Infohash: "))).map((t=>t.split("Infohash: ")[1])).filter((t=>(t=>/^[0-9a-fA-F]{40}$/.test(t))(t)));if(0===n.length)return this.emit("warning","Invalid LSD announce (infoHash)"),null;return{host:r,port:i,infoHash:n,cookie:e.filter((t=>t.includes("cookie: "))).map((t=>t.split("cookie: ")[1])).reduce(((t,e)=>e),null)}}destroy(t){this.destroyed||(this.destroyed=!0,je("destroy"),clearInterval(this.annouceIntervalId),this.server.close(t))}start(){je("start"),this.server.bind(qe),this._announce(),this.annouceIntervalId=setInterval((()=>{this._announce()}),3e5)}_announce(){je("send announce");const t=`BT-SEARCH * HTTP/1.1\r\nHost: ${`${Ue}:6771`}\r\nPort: ${this.port}\r\nInfohash: ${this.infoHash}\r\ncookie: ${this.cookie}\r\n\r\n\r\n`;this.server.send(t,qe,Ue)}}const He=De;var Fe=r(717);const ze=L("torrent-discovery");class $e extends n.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(!Fe.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 et(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 et?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 He?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)}))),b(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 Ne(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||(ze("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,(t=>{this._dhtAnnouncing=!1,ze("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 He(t);return e.on("warning",this._onWarning),e.on("error",this._onError),e.on("peer",this._onLSDPeer),e.start(),e}}const We=$e;var Ke=r(4862),Ve=r(3714);const Ze=L("lt_donthave"),Ge=()=>{class t extends n.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)&&(Ze("got donthave %d",e),this._wire.peerPieces.set(e,!1),this.emit("donthave",e),this._failRequests(e))}donthave(t){if(!this._peerSupports)return;Ze("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 n.EventEmitter{constructor(e){super(),this._wire=e,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new Dt.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>er||!this._fetching||(this.metadata.set(e,t*er),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 ir=r(640),nr=r(8287).Buffer;const sr=t=>("string"==typeof t&&(t=[t]),nr.concat(t.map((t=>{const e=qt(t);if(2!==e.length)throw new Error("invalid address format, expecting: 10.10.10.5:128");const r=ir.parse(e[0]),i=nr.from(r.toByteArray()),n=e[1],s=nr.allocUnsafe(2);return s.writeUInt16BE(n,0),nr.concat([i,s])}))));var or=r(8287).Buffer;const ar={prefersEncryption:1,isSender:2,supportsUtp:4,supportsUtHolepunch:8,isReachable:16},hr=()=>{class t extends n.EventEmitter{constructor(t){super(),this._wire=t,this._intervalId=null,this._lastMessageTimestamp=0,this.reset()}start(){clearInterval(this._intervalId),this._intervalId=setInterval((()=>this._sendMessage()),65e3),this._intervalId.unref&&this._intervalId.unref()}stop(){clearInterval(this._intervalId),this._intervalId=null}reset(){this._remoteAddedPeers={},this._remoteDroppedPeers={},this._localAddedPeers={},this._localDroppedPeers={},this.stop()}addPeer(t,e={}){this._addPeer(t,this._encodeFlags(e),4)}addPeer6(t,e={}){this._addPeer(t,this._encodeFlags(e),6)}_addPeer(t,e,r){t.includes(":")&&(t in this._remoteAddedPeers||(t in this._localDroppedPeers&&delete this._localDroppedPeers[t],this._localAddedPeers[t]={ip:r,flags:e}))}dropPeer(t){this._dropPeer(t,4)}dropPeer6(t){this._dropPeer(t,6)}_dropPeer(t,e){t.includes(":")&&(t in this._remoteDroppedPeers||(t in this._localAddedPeers&&delete this._localAddedPeers[t],this._localDroppedPeers[t]={ip:e}))}onExtendedHandshake(t){if(!t.m||!t.m.ut_pex)return this.emit("warning",new Error("Peer does not support ut_pex"))}onMessage(t){const e=Date.now();if(e-this._lastMessageTimestamp<6e4)return this.reset(),this._wire.destroy(),this.emit("warning",new Error("Peer disconnected for sending PEX messages too frequently"));let r;this._lastMessageTimestamp=e;try{r=f.A.decode(t),r.added&&he.multi(or.from(r.added)).forEach(((t,e)=>{if(delete this._remoteDroppedPeers[t],!(t in this._remoteAddedPeers)){const i=r["added.f"][e];this._remoteAddedPeers[t]={ip:4,flags:i},this.emit("peer",t,this._decodeFlags(i))}})),r.added6&&he.multi6(or.from(r.added6)).forEach(((t,e)=>{if(delete this._remoteDroppedPeers[t],!(t in this._remoteAddedPeers)){const i=r["added6.f"][e];this._remoteAddedPeers[t]={ip:6,flags:i},this.emit("peer",t,this._decodeFlags(i))}})),r.dropped&&he.multi(or.from(r.dropped)).forEach((t=>{delete this._remoteAddedPeers[t],t in this._remoteDroppedPeers||(this._remoteDroppedPeers[t]={ip:4},this.emit("dropped",t))})),r.dropped6&&he.multi6(or.from(r.dropped6)).forEach((t=>{delete this._remoteAddedPeers[t],t in this._remoteDroppedPeers||(this._remoteDroppedPeers[t]={ip:6},this.emit("dropped",t))}))}catch(t){}}_decodeFlags(t){return{prefersEncryption:!!(t&ar.prefersEncryption),isSender:!!(t&ar.isSender),supportsUtp:!!(t&ar.supportsUtp),supportsUtHolepunch:!!(t&ar.supportsUtHolepunch),isReachable:!!(t&ar.isReachable)}}_encodeFlags(t){return Object.keys(t).reduce(((e,r)=>!0===t[r]?e|ar[r]:e),0)}_sendMessage(){const t=Object.keys(this._localAddedPeers).slice(0,50),e=Object.keys(this._localDroppedPeers).slice(0,50),r=(t,e)=>4===t[e].ip,i=(t,e)=>6===t[e].ip,n=(t,e)=>t[e].flags,s=sr(t.filter((t=>r(this._localAddedPeers,t)))),o=sr(t.filter((t=>i(this._localAddedPeers,t)))),a=sr(e.filter((t=>r(this._localDroppedPeers,t)))),h=sr(e.filter((t=>i(this._localDroppedPeers,t)))),u=or.from(t.filter((t=>r(this._localAddedPeers,t))).map((t=>n(this._localAddedPeers,t)))),f=or.from(t.filter((t=>i(this._localAddedPeers,t))).map((t=>n(this._localAddedPeers,t))));t.forEach((t=>delete this._localAddedPeers[t])),e.forEach((t=>delete this._localDroppedPeers[t])),this._wire.extended("ut_pex",{added:s,"added.f":u,dropped:a,added6:o,"added6.f":f,dropped6:h})}}return t.prototype.name="ut_pex",t};var ur=r(1133);const fr=L("webtorrent:file-iterator");class lr extends n{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,1,null,!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}):(fr("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 cr extends n{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=ur.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)}[Symbol.asyncIterator](t={}){if(0===this.length)return async function*(){}();const{start:e=0}=t??{},r=t?.end&&t.end{this._iterators.delete(i)})),i}createReadStream(t){const e=this[Symbol.asyncIterator](t),r=vt.Readable.from(e);return this._fileStreams.add(r),r.once("close",(()=>{this._fileStreams.delete(r)})),r}async arrayBuffer(t={}){const{start:e=0}=t,r=t?.end&&t.end{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()}}class dr{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,w.tW)(t,"hex");if(this.destroyed)return;this.handshake(e,i);const n=this._torrent.pieces.length,s=new Dt.A(n);for(let t=0;t<=n;t++)s.set(t,!0);this.bitfield(s)})),this.once("interested",(()=>{gr("interested"),this.unchoke()})),this.on("uninterested",(()=>{gr("uninterested")})),this.on("choke",(()=>{gr("choke")})),this.on("unchoke",(()=>{gr("unchoke")})),this.on("bitfield",(()=>{gr("bitfield")})),this.lt_donthave.on("donthave",(()=>{gr("donthave")})),this.on("request",((t,e,r,i)=>{gr("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=M(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})=>{gr("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",s,t,e,r,i,n);const o=await nt(s,{cache:"no-store",method:"GET",headers:{"Cache-Control":"no-store","user-agent":`WebTorrent/${mr} (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 gr("Got data of length %d",a.length),a})))}catch(t){return i(t)}i(null,(0,w.xW)(h))}destroy(){super.destroy(),this._torrent=null}}class br{_items=[];remove(t){for(let e=0;e=0&&0!==t.from&&i.push(n);const s={...r,from:t.to+1};s.to-s.from>=0&&i.push(s),this._items.splice(e,1,...i),e=e-1+i.length}else Mr(t,r)&&(this._items.splice(e,1),e--)}}insert(t){if(t.from>t.to)throw new Error("Invalid interval");if(!t.isStreamSelection){const{notify:e}=t,r=[];for(const e of this._items)e.notify&&Sr(t,e)&&r.push(e.notify);r.length>0&&(t.notify=()=>{r.forEach((t=>t())),e?.()}),this.remove(t)}this._items.push(t)}sort(t=(t,e)=>t.from-e.from){this._items.sort(t)}get length(){return this._items.length}get(t){return this._items[t]}swap(t,e){const r=this._items[t];this._items[t]=this._items[e],this._items[e]=r}clear(){this._items.length=0}*[Symbol.iterator](){for(let t=0;t{this._items.splice(t,1),t--},yield e,delete e.remove}}}function vr(t,e){return t.from<=e.to&&t.from>e.from&&t.to>e.to}function wr(t,e){return t.to>=e.from&&t.to=e.from&&t.to<=e.to&&i=e.to}const Sr=(t,e)=>()=>vr(t,e)||wr(t,e)||_r(t,e)||Mr(t,e);var kr=r(717);const Er=L("webtorrent:torrent"),xr=5e3,Ar=3*Xe.BLOCK_LENGTH,Ir=kr.browser?$t().length:2,Tr=[1e3,5e3,15e3],Pr=`WebTorrent/${mr} (https://webtorrent.io)`,Cr=(globalThis.navigator?.storage?.getDirectory&&globalThis.FileSystemFileHandle,kr.browser,Ke);let Rr;try{Rr=h(Lt.statSync("/tmp")&&"/tmp","webtorrent")}catch(t){Rr=h("function"==typeof Nt.tmpdir?Nt.tmpdir():"/","webtorrent")}const Or="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback&&window.requestIdleCallback;class Br extends n{constructor(t,e,r){super(),this._debugId="unknown infohash",this.client=e,this.announce=r.announce,this.urlList=r.urlList,this.path=r.path||Rr,this.addUID=r.addUID||!1,this.rootDir=r.rootDir||null,this.skipVerify=!!r.skipVerify,this._startupBitfield=r.bitfield,this._store=r.store||Cr,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.alwaysChokeSeeders=r.alwaysChokeSeeders??!0,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._startAsDeselected=r.deselect||!1,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=new br,this._critical=[],this.wires=[],this._queue=[],this._peers={},this._peersLength=0,this.received=0,this.uploaded=0,this._downloadSpeed=xt(),this._uploadSpeed=xt(),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)}))):ft(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,w.V5)(t.infoHash).substring(0,7),void 0!==this.private&&(t.private=this.private),Array.isArray(this.announce)&&(t.announce=t.announce.concat(this.announce)),this.client.tracker&&Array.isArray(this.client.tracker.announce)&&!t.private&&(t.announce=t.announce.concat(this.client.tracker.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=pt(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,w.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,Pt.default.SOURCE_MANUAL))),this.discovery=new We({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:t,port:this.client.torrentPort,userAgent:Pr,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),this.client.seedOutgoingConnections||!this.done?this.addPeer(t,e):this._debug("discovery ignoring peer %s: torrent is done and seedOutgoingConnections is false",t)})),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={[Pt.default.SOURCE_TRACKER]:{enabled:!!this.client.tracker,numPeers:0},[Pt.default.SOURCE_DHT]:{enabled:!!this.client.dht,numPeers:0},[Pt.default.SOURCE_LSD]:{enabled:!!this.client.lsd,numPeers:0},[Pt.default.SOURCE_UT_PEX]:{enabled:this.client.utPex&&!0,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":Pr},signal:r};let s,o,a;try{s=await nt(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 dt(o)}catch(t){}if(!a)return t.emit("warning",new Error(`got invalid torrent file from xs param: ${e}`)),i(null);if(a.infoHash!==t.infoHash)return t.emit("warning",new Error(`got torrent file with incorrect info hash from xs param: ${e}`)),i(null);t._onMetadata(a),i(null)}(e,i)}));b(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 dt(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 dr(this),this.files=this.files.map((t=>new cr(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 Ke)&&(r=new Ht(r,{max:this._storeCacheSlots})),this.store=new Ve(r),this.so&&!this._startAsDeselected?this.files.forEach(((t,e)=>{this.so.includes(e)&&this.files[e].select()})):0===this.pieces.length||this._startAsDeselected||this.select(0,this.pieces.length-1,0),this._hashes=this.pieces,this._hasStartupBitfield=this._startupBitfield&&this._startupBitfield.length===Math.ceil(this.pieces.length/8)&&!this.skipVerify,this.bitfield=new Dt.A(this._hasStartupBitfield?new Uint8Array(this._startupBitfield):this.pieces.length),this._reservations=this._hasStartupBitfield?this.pieces.map(((t,e)=>this.bitfield.get(e)?null:[])):this.pieces.map((()=>[])),this.pieces=this.pieces.map(((t,e)=>{if(this._hasStartupBitfield&&this.bitfield.get(e))return null;const r=e===this.pieces.length-1?this.lastPieceLength:this.pieceLength;return new Xe(r)})),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===Ke?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=[];Ye(this.files.map(((t,r)=>i=>{const n=this.addUID?h(this.name+" - "+this.infoHash.slice(0,8)):h(this.path,t.path);Lt.stat(n,((t,n)=>{if(t&&"ENOENT"!==t.code)return i(t);e[r]=n&&n.mtime.getTime(),i(null)}))})),Ir,(r=>{this._debug("done getting file modtimes"),t(r,e)}))}_verifyPiece(t,e){if(this.destroyed)return e(new Error("torrent is destroyed"));const r={};t===this.pieces.length-1&&(r.length=this.lastPieceLength),this.store.get(t,r,(async(r,i)=>{if(this.destroyed)return e(new Error("torrent is destroyed"));if(r)return v((()=>e(null,!1)));const n=await(0,w.tW)(i,"hex");if(this.destroyed)return e(new Error("torrent is destroyed"));e(null,n===this._hashes[t])}))}_verifyPiecesUsingBitfield(t){const e=new Set,r=new Map;for(const t of this.files){let i=2,n=null;for(let e=t._startPiece;e<=t._endPiece;++e)this.bitfield.get(e)&&(i&&(n=e,i--),r.has(e)||r.set(e,[]),r.get(e).push(t));null!==n&&e.add(n)}this._verifyPiecesUsingHash([...e],(i=>{if(i)return t(i);const n=new Set;for(const t of e)if(!this.bitfield.get(t)){const e=r.get(t);for(const t of e)n.add(t)}if(n.size){const e=[];for(const t of n)for(let r=t._startPiece;r<=t._endPiece;++r)-1===e.indexOf(r)&&e.push(r);return this._verifyPiecesUsingHash(e,t)}t(null)}))}_verifyPiecesUsingHash(t,e){Ye(t.map(((t,e)=>r=>{const i=Number.isInteger(t)?t:e;this._verifyPiece(i,((t,e)=>{if(t)return r(t);e?(this._debug("piece verified %s",i),this._markVerified(i)):(this._markUnverified(i),this._debug("piece invalid %s",i)),r(null)}))})),Ir,e)}_verifyPieces(t){if(this._hasStartupBitfield)return this._verifyPiecesUsingBitfield(t);this._verifyPiecesUsingHash(this.pieces,t)}rescanFiles(t){if(this.destroyed)throw new Error("torrent is destroyed");t||(t=Nr),this._verifyPiecesUsingHash(this.pieces,(e=>{if(e)return this._destroy(e),t(e);this._checkDone(),t(null)}))}_markAllVerified(){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),this._selections.clear(),clearInterval(this._rechokeIntervalId),clearInterval(this._noPeersIntervalId),this._xsRequestsController?.abort(),this._rarityMap&&this._rarityMap.destroy();for(const t in this._peers)this.removePeer(t);for(const t of this.files)t instanceof cr&&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)}))}b(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,this._queue=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("string"==typeof t){let e;try{e=qt(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(this.client.blocked&&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?Pt.default.createUTPOutgoingPeer(t,this,this.client.throttleGroups,r):Pt.default.createTCPOutgoingPeer(t,this,this.client.throttleGroups,r):Pt.default.createWebRTCPeer(t,this,this.client.throttleGroups,r),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 yr(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=Pt.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=0,e=this.pieces.length-1,r,i,n=!1){if(this.destroyed)throw new Error("torrent is destroyed");if(t<0||ee.priority-t.priority)),this._updateSelections()}select(t,e,r,i){this._select(t,e,r,i,!1)}_deselect(t,e,r=!1){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("deselect %s-%s",t,e),this._selections.remove({from:t,to:e,isStreamSelection:r}),this._updateSelections()}deselect(t,e){this._deselect(t,e,!1)}critical(t,e){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("critical %s-%s",t,e);for(let r=t;r<=e;++r)this._critical[r]=!0;this._updateSelections()}_onWire(t,e){if(this._debug("got wire %s (%s)",t._debugId,e||"Unknown"),this.wires.push(t),e){const r=qt(e);t.remoteAddress=r[0],t.remotePort=r[1]}this.client.dht&&this.client.dht.listening&&t.on("port",(r=>{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(rr(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&&!this.private&&(t.use(hr()),t.ut_pex.on("peer",(t=>{this.client.seedOutgoingConnections||!this.done?(this._debug("ut_pex: got peer: %s (from %s)",t,e),this.addPeer(t,Pt.default.SOURCE_UT_PEX)):this._debug("ut_pex ignoring peer %s: torrent is done and seedOutgoingConnections is false",t)})),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(Ge()),this.emit("wire",t,e),this.ready&&v((()=>{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,xr),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,this.alwaysChokeSeeders&&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,xr),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,xr),e.unref&&e.unref()),t.isSeeder=!1,n()}_updateSelections(){this.ready&&!this.destroyed&&(v((()=>{this._gcSelections()})),this._updateInterest(),this._update())}_gcSelections(){for(const t of this._selections){const e=t.offset;for(;this.bitfield.get(t.from+t.offset)&&t.from+t.offsetthis._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=Qe(this.wires);let e;for(;e=t();)this._updateWire(e)}_updateWire(t){if(t.destroyed)return!1;const e=this,r=Lr(t,.5);if(t.requests.length>=r)return;const i=Lr(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>Ar)return()=>!0;const i=Math.max(1,t.requests.length)*Xe.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=Ar||(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(){v((()=>{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,w.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(),d())}))):(i.pieces[e]=new Xe(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}`)}}));const t=this.files.every((t=>t.done));return!this.done&&t?(this.done=!0,this._debug(`torrent done: ${this.infoHash}`),this.emit("done"),this.destroyed||this.discovery.complete()):this.done&&!t&&(this.done=!1,this.discovery.tracker?.start()),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=Nr);try{await zt(this.store,y(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]}`,Er(...t)}_drain(){if(this._debug("_drain numConns %s maxConns %s",this._numConns,this.client.maxConns),"function"!=typeof Tt.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=qt(t.addr),r={host:e[0],port:e[1]};this.client.utp&&t.type===Pt.default.TYPE_UTP_OUTGOING?t.conn=Ct.connect(r.port,r.host):t.conn=Tt.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>=Tr.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,Tr.length);return}const e=Tr[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=qt(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=qt(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 Lr(t,e){let r=2+Math.ceil(e*t.downloadSpeed()/Xe.BLOCK_LENGTH);if(t.peerExtendedHandshake){const e=t.peerExtendedHandshake.reqq;"number"==typeof e&&e>0&&(r=Math.min(r,e))}return r}function Nr(){}var jr=r(2195),Ur=r(580),qr=r(815),Dr=r(2878);class Hr{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 ${Ur(t.name)}\n \n (${Ur(t.length)} bytes)\n
  • `)).join("
    ");return t.status=200,t.headers["Content-Type"]="text/html",t.body=$r("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=$r("405 - Method Not Allowed","

    405 - Method Not Allowed

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

    404 - Not Found

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

    ${Ur(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''${Wr(t.name)}`,r.body="DOWNLOAD"):r.headers["Content-Disposition"]=`inline; filename*=UTF-8''${Wr(t.name)}`;let i=Dr(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=vt.Readable.from(s||n);let a=null;t.emit("stream",{stream:o,req:e,file:t},(t=>{a=qr(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(Hr.serve404Page(i));if("OPTIONS"===t.method)return this.isOriginAllowed(t)?e(Hr.serveOptionsRequest(t,i)):e(Hr.serveMethodNotAllowed(i));const n=async()=>{this.pendingReady.delete(n);const t=await s();e(t)},s=async()=>{if(""===r)return Hr.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 Hr.serve404Page(i);if(!n)return Hr.serveTorrentPage(s,i,this.pathname);const o=s.files.find((t=>t.path.replace(/\\/g,"/")===n));return o?Hr.serveFile(o,t,i):Hr.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(Hr.serveMethodNotAllowed(i))}close(t=()=>{}){this.closed=!0,this.pendingReady.forEach((t=>{this.client.removeListener("ready",t)})),this.pendingReady.clear(),v(t)}destroy(t=()=>{}){this.closed?v(t):this.close(t),this.client=null}}class Fr extends Hr{constructor(t,e){super(t,e),this.server=jr.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?qr(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 zr extends Hr{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 $r(t,e){return`\n \n \n \n \n ${t}\n \n \n ${e}\n \n \n `}function Wr(t){return encodeURIComponent(t).replace(/['()]/g,escape).replace(/\*/g,"%2A").replace(/%(?:7C|60|5E)/g,unescape)}const Kr=L("webtorrent"),Vr=mr.replace(/\d*./g,(t=>("0"+t%100).slice(-2))).slice(0,4),Zr=`-WW${Vr}-`;class Gr extends n{constructor(t={}){super(),"string"==typeof t.peerId?this.peerId=t.peerId:ArrayBuffer.isView(t.peerId)?this.peerId=(0,w.V5)(t.peerId):this.peerId=(0,w.V5)((0,w.L0)(Zr+(0,w.NJ)((0,w.po)(9)))),this.peerIdBuffer=(0,w.fk)(this.peerId),"string"==typeof t.nodeId?this.nodeId=t.nodeId:ArrayBuffer.isView(t.nodeId)?this.nodeId=(0,w.V5)(t.nodeId):this.nodeId=(0,w.V5)((0,w.po)(20)),this.nodeIdBuffer=(0,w.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=Gr.UTP_SUPPORT&&!1!==t.utp,this.seedOutgoingConnections=t.seedOutgoingConnections??!0,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 It&&(this.natTraversal=new It({enableUPNP:this.natUpnp,enablePMP:this.natPmp,upnpPermanentFallback:"permanent"===t.natUpnp})),!0===t.secure&&Promise.resolve().then(r.bind(r,5658)).then((({enableSecure:t})=>t())),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new At.ThrottleGroup({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new At.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 Ot?this._connPool=new Ot(this):v((()=>{this._onListening()})),this._downloadSpeed=xt(),this._uploadSpeed=xt(),!1!==t.dht&&"function"==typeof et?(this.dht=new et(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=>{Kr("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 rt&&null!=t.blocklist?rt(t.blocklist,{headers:{"user-agent":`WebTorrent/${mr} (https://webtorrent.io)`}},((t,r)=>{if(t)return console.error(`Failed to load blocklist: ${t.message}`);this.blocked=r,e()})):v(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 zr(this,t),this._server}return this._server=new Fr(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 Br){if(this.torrents.includes(t))return t}else{const e=this.torrents;let r;try{r=await dt(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 Br(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)})),this.emit("add",s),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=function(t){if(s(t),0===t.length)return".";let e=t.charCodeAt(0);const r=47===e;let i=-1,n=!0;for(let r=t.length-1;r>=1;--r)if(e=t.charCodeAt(r),47===e){if(!n){i=r;break}}else n=!1;return-1===i?r?"/":".":r&&1===i?"//":t.slice(0,i)}(t)),e.createdBy||(e.createdBy=`WebTorrent/${Vr}`);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(a,r)}];this.dht&&r.push((e=>{t.once("dhtAnnounce",e)})),b(r,(e=>{if(!this.destroyed)return e?t._destroy(e):void n(t)}))}));let a;var h;return h=t,"undefined"!=typeof FileList&&h instanceof FileList?t=Array.from(t):Array.isArray(t)||(t=[t]),b(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,w.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]),T(t,e=e?Object.assign({},e):{},r)}(i,e,((t,n)=>{if(!this.destroyed){if(t)return o._destroy(t);a=n.map((t=>t.getStream)),B(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)return;if("function"==typeof e)return this._remove(t,null,e);const i=this.torrents.indexOf(t);-1!==i&&(this.torrents.splice(i,1),t.destroy(e,r),this.dht&&this.dht._tables.remove(t.infoHash),this.emit("remove",t))}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()))})),b(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=>{Kr("error mapping WebTorrent port via UPnP/PMP: %o",t)})))}this.emit("listening")}_debug(){const t=[].slice.call(arguments);t[0]=`[${this._debugId}] ${t[0]}`,Kr(...t)}async _getByHash(t){for(const e of this.torrents)if(e.infoHashHash||(e.infoHashHash=await(0,w.tW)((0,w.fk)("72657132"+e.infoHash),"hex")),t===e.infoHashHash)return e;return null}}Gr.WEBRTC_SUPPORT=Et.WEBRTC_SUPPORT,Gr.UTP_SUPPORT=Ot.UTP_SUPPORT,Gr.VERSION=mr;export{Gr as default}; +var t={20:(t,e,r)=>{var i=r(2861).Buffer,n=r(7108),s=r(96),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}},76:t=>{t.exports=Function.prototype.call},82:(t,e,r)=>{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;"seqof"===t?t="seq":"setof"===t&&(t="set");if(a.tagByName.hasOwnProperty(t))n=a.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return i.error("Unknown tag: "+t);n=t}if(n>=31)return i.error("Multi-octet tag encoding unsupported");e||(n|=32);return n|=a.tagClassByName[r||"universal"]<<6,n}(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--){o=t[i];for(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=r(717),n=r(8310);"disable"===i.env.READABLE_STREAM&&n?(t.exports=n,(e=t.exports=n.Readable).Readable=n.Readable,e.Writable=n.Writable,e.Duplex=n.Duplex,e.Transform=n.Transform,e.PassThrough=n.PassThrough,e.Stream=n):((e=t.exports=r(206)).Stream=n||e,e.Readable=e,e.Writable=r(7314),e.Duplex=r(6248),e.Transform=r(1816),e.PassThrough=r(5242))},113:t=>{const e={};function r(t,r,i){i||(i=Error);class n extends i{constructor(t,e,i){super(function(t,e,i){return"string"==typeof r?r:r(t,e,i)}(t,e,i))}}n.prototype.name=i.name,n.prototype.code=t,e[t]=n}function i(t,e){if(Array.isArray(t)){const r=t.length;return t=t.map((t=>String(t))),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:2===r?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}return`of ${e} ${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){let n;var s,o;let a;if("string"==typeof e&&(s="not ",e.substr(!o||o<0?0:+o,s.length)===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-e.length,r)===e}(t," argument"))a=`The ${t} ${n} ${i(e,"type")}`;else{const r=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a=`The "${t}" ${r} ${n} ${i(e,"type")}`}return a+=". Received type "+typeof r,a}),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},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())}},206:(t,e,r)=>{var i=r(717),n=r(3225);t.exports=v;var s,o=r(2240);v.ReadableState=b;r(7007).EventEmitter;var a=function(t,e){return t.listeners(e).length},h=r(1862),u=r(4116).Buffer,f=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l=Object.create(r(5622));l.inherits=r(6698);var c=r(537),d=void 0;d=c&&c.debuglog?c.debuglog("stream"):function(){};var p,m=r(672),g=r(6278);l.inherits(v,h);var y=["error","close","destroy","pause","resume"];function b(t,e){t=t||{};var i=e instanceof(s=s||r(6248));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(6427).I),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function v(t){if(s=s||r(6248),!(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;null===e?(o.reading=!1,function(t,e){if(e.ended)return;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,k(t)}(t,o)):(n||(s=function(t,e){var r;i=e,u.isBuffer(i)||i instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return 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):x(t,o)):_(t,o,e,!1))):i||(o.reading=!1));return 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 k(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(E,t):E(t))}function E(t){d("emit readable"),t.emit("readable"),P(t)}function x(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(A,t,e))}function A(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;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;i.data.copy(r),t-=i.data.length;for(;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);return 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(O,e,t))}function O(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function B(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):k(this),null;if(0===(t=S(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?C(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?f:v;function u(e,i){d("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),t.removeListener("close",y),t.removeListener("finish",b),t.removeListener("drain",l),t.removeListener("error",g),t.removeListener("unpipe",u),r.removeListener("end",f),r.removeListener("end",v),r.removeListener("data",m),c=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function f(){d("onend"),t.end()}s.endEmitted?n.nextTick(h):r.once("end",h),t.on("unpipe",u);var l=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",l);var c=!1;var p=!1;function m(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==B(s.pipes,t))&&!c&&(d("false write response, pause",s.awaitDrain),s.awaitDrain++,p=!0),r.pause())}function g(e){d("onerror",e),v(),t.removeListener("error",g),0===a(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",b),v()}function b(){d("onfinish"),t.removeListener("close",y),v()}function v(){d("unpipe"),r.unpipe(t)}return r.on("data",m),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",g),t.once("close",y),t.once("finish",b),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{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)&&(s(e.length===2*t.encodingLength,"Signature has invalid size"),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},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}},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{var i=r(8276);t.exports=function(t){return(new i).update(t).digest()}},345:(t,e,r)=>{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),i&&o(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}()},370:(t,e,r)=>{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()}},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},405:t=>{t.exports=async function*(t){for(let e of t)"function"==typeof e&&(e=e()),yield*e}},414:t=>{t.exports=Math.round},453:(t,e,r)=>{var i,n=r(9612),s=r(9383),o=r(1237),a=r(9290),h=r(9538),u=r(8068),f=r(9675),l=r(5345),c=r(9133),d=r(8968),p=r(6188),m=r(8002),g=r(5880),y=r(414),b=r(3093),v=Function,w=function(t){try{return v('"use strict"; return ('+t+").constructor;")()}catch(t){}},_=r(5795),M=r(655),S=function(){throw new f},k=_?function(){try{return S}catch(t){try{return _(arguments,"callee").get}catch(t){return S}}}():S,E=r(4039)(),x=r(3628),A=r(1064),I=r(8648),T=r(1002),P=r(76),C={},R="undefined"!=typeof Uint8Array&&x?x(Uint8Array):i,O={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":E&&x?x([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":C,"%AsyncGenerator%":C,"%AsyncGeneratorFunction%":C,"%AsyncIteratorPrototype%":C,"%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%":s,"%eval%":eval,"%EvalError%":o,"%Float16Array%":"undefined"==typeof Float16Array?i:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":C,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":E&&x?x(x([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&E&&x?x((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":n,"%Object.getOwnPropertyDescriptor%":_,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":a,"%ReferenceError%":h,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&E&&x?x((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":E&&x?x(""[Symbol.iterator]()):i,"%Symbol%":E?Symbol:i,"%SyntaxError%":u,"%ThrowTypeError%":k,"%TypedArray%":R,"%TypeError%":f,"%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%":l,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet,"%Function.prototype.call%":P,"%Function.prototype.apply%":T,"%Object.defineProperty%":M,"%Object.getPrototypeOf%":A,"%Math.abs%":c,"%Math.floor%":d,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":g,"%Math.round%":y,"%Math.sign%":b,"%Reflect.getPrototypeOf%":I};if(x)try{null.error}catch(t){var B=x(x(t));O["%Error.prototype%"]=B}var L=function t(e){var r;if("%AsyncFunction%"===e)r=w("async function () {}");else if("%GeneratorFunction%"===e)r=w("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=w("async function* () {}");else if("%AsyncGenerator%"===e){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&x&&(r=x(n.prototype))}return O[e]=r,r},N={__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"]},j=r(6743),U=r(9957),q=j.call(P,Array.prototype.concat),D=j.call(T,Array.prototype.splice),H=j.call(P,String.prototype.replace),F=j.call(P,String.prototype.slice),z=j.call(P,RegExp.prototype.exec),$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,W=/\\(\\)?/g,K=function(t,e){var r,i=t;if(U(N,i)&&(i="%"+(r=N[i])[0]+"%"),U(O,i)){var n=O[i];if(n===C&&(n=L(i)),void 0===n&&!e)throw new f("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new u("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new f("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new f('"allowMissing" argument must be a boolean');if(null===z(/^%?[^%]*%?$/,t))throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=F(t,0,1),r=F(t,-1);if("%"===e&&"%"!==r)throw new u("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new u("invalid intrinsic syntax, expected opening `%`");var i=[];return H(t,$,(function(t,e,r,n){i[i.length]=r?H(n,W,"$1"):e||t})),i}(t),i=r.length>0?r[0]:"",n=K("%"+i+"%",e),s=n.name,o=n.value,a=!1,h=n.alias;h&&(i=h[0],D(r,q([0,1],h)));for(var l=1,c=!0;l=r.length){var g=_(o,d);o=(c=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:o[d]}else c=U(o,d),o=o[d];c&&!a&&(O[s]=o)}}return o}},462:(t,e,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},480:(t,e,r)=>{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]})},507:(t,e,r)=>{var i=r(453),n=r(6556),s=r(8859),o=r(9675),a=i("%Map%",!0),h=n("Map.prototype.get",!0),u=n("Map.prototype.set",!0),f=n("Map.prototype.has",!0),l=n("Map.prototype.delete",!0),c=n("Map.prototype.size",!0);t.exports=!!a&&function(){var t,e={assert:function(t){if(!e.has(t))throw new o("Side channel does not contain "+s(t))},delete:function(e){if(t){var r=l(t,e);return 0===c(t)&&(t=void 0),r}return!1},get:function(e){if(t)return h(t,e)},has:function(e){return!!t&&f(t,e)},set:function(e,r){t||(t=new a),u(t,e,r)}};return 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},537:(t,e,r)=>{var i=r(717),n=/%[sdj%]/g;e.format=function(t){if(!y(t)){for(var e=[],r=0;r=s)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}})),h=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&e._extend(i,r),b(i.showHidden)&&(i.showHidden=!1),b(i.depth)&&(i.depth=2),b(i.colors)&&(i.colors=!1),b(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=h),f(i,t,i.depth)}function h(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function u(t,e){return t}function f(t,r,i){if(t.customInspect&&r&&S(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return y(n)||(n=f(t,n,i)),n}var s=function(t,e){if(b(e))return t.stylize("undefined","undefined");if(y(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(g(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(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)),M(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return l(r);if(0===o.length){if(S(r)){var h=r.name?": "+r.name:"";return t.stylize("[Function"+h+"]","special")}if(v(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(_(r))return t.stylize(Date.prototype.toString.call(r),"date");if(M(r))return l(r)}var u,w="",k=!1,E=["{","}"];(d(r)&&(k=!0,E=["[","]"]),S(r))&&(w=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(w=" "+RegExp.prototype.toString.call(r)),_(r)&&(w=" "+Date.prototype.toUTCString.call(r)),M(r)&&(w=" "+l(r)),0!==o.length||k&&0!=r.length?i<0?v(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),u=k?function(t,e,r,i,n){for(var s=[],o=0,a=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(i>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(u,w,E)):E[0]+w+E[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function c(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")),A(i,n)||(o="["+n+"]"),a||(t.seen.indexOf(h.value)<0?(a=m(r)?f(t,h.value,null):f(t,h.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),b(o)){if(s&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function d(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return"number"==typeof t}function y(t){return"string"==typeof t}function b(t){return void 0===t}function v(t){return w(t)&&"[object RegExp]"===k(t)}function w(t){return"object"==typeof t&&null!==t}function _(t){return w(t)&&"[object Date]"===k(t)}function M(t){return w(t)&&("[object Error]"===k(t)||t instanceof Error)}function S(t){return"function"==typeof t}function k(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(b(s)&&(s=i.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(s)){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=a,a.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]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=g,e.isString=y,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=b,e.isRegExp=v,e.isObject=w,e.isDate=_,e.isError=M,e.isFunction=S,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(2503);var x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){var t,r;console.log("%s - %s",(t=new Date,r=[E(t.getHours()),E(t.getMinutes()),E(t.getSeconds())].join(":"),[t.getDate(),x[t.getMonth()],r].join(" ")),e.format.apply(e,arguments))},e.inherits=r(6622),e._extend=function(t,e){if(!e||!w(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t}},580:t=>{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=0;)n++;if("::"===t.substr(0,2)&&n--,"::"===t.substr(-2,2)&&n--,n>e)return null;for(i=e-n,r=":";i--;)r+="0:";return":"===(t=t.replace("::",r))[0]&&(t=t.slice(1)),":"===t[t.length-1]&&(t=t.slice(0,-1)),{parts:e=function(){const e=t.split(":"),r=[];for(let t=0;t0;){if(n=r-i,n<0&&(n=0),t[s]>>n!=e[s]>>n)return!1;i-=r,s+=1}return!0}function l(t){if(s.test(t))return parseInt(t,16);if("0"===t[0]&&!isNaN(parseInt(t[1],10))){if(n.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function c(t,e){for(;t.length=0;i-=1){if(n=this.octets[i],!(n in r))return null;if(s=r[n],e&&0!==s)return null;8!==s&&(e=!0),t+=s}return 32-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),d.IPv4.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[];let s=0;for(;s<4;)n.push(parseInt(r[s],10)|255^parseInt(i[s],10)),s++;return new this(n)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(t){return null!==this.parser(t)},d.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(t){return!1}},d.IPv4.isValidCIDR=function(t){try{return this.parseCIDR(t),!0}catch(t){return!1}},d.IPv4.isValidFourPartDecimal=function(t){return!(!d.IPv4.isValid(t)||!t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(t){let e,r,i,n,s;try{for(e=this.parseCIDR(t),i=e[0].toByteArray(),s=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[],r=0;r<4;)n.push(parseInt(i[r],10)&parseInt(s[r],10)),r++;return new this(n)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(t){const e=this.parser(t);if(null===e)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(e)},d.IPv4.parseCIDR=function(t){let e;if(e=t.match(/^(.+)\/(\d+)$/)){const t=parseInt(e[2]);if(t>=0&&t<=32){const r=[this.parse(e[1]),t];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(t){let e,r,n;if(e=t.match(i.fourOctet))return function(){const t=e.slice(1,6),i=[];for(let e=0;e4294967295||n<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(n>>e&255);return t}().reverse()}return(e=t.match(i.twoOctet))?function(){const t=e.slice(1,4),r=[];if(n=l(t[1]),n>16777215||n<0)throw new Error("ipaddr: address outside defined range");return r.push(l(t[0])),r.push(n>>16&255),r.push(n>>8&255),r.push(255&n),r}():(e=t.match(i.threeOctet))?function(){const t=e.slice(1,5),r=[];if(n=l(t[2]),n>65535||n<0)throw new Error("ipaddr: address outside defined range");return r.push(l(t[0])),r.push(l(t[1])),r.push(n>>8&255),r.push(255&n),r}():null},d.IPv4.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>32)throw new Error("ipaddr: invalid IPv4 prefix length");const e=[0,0,0,0];let r=0;const i=Math.floor(t/8);for(;r=0;s-=1){if(i=this.parts[s],!(i in r))return null;if(n=r[i],e&&0!==n)return null;16!==n&&(e=!0),t+=n}return 128-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){let t;const e=[],r=this.parts;for(let i=0;i>8),e.push(255&t);return e},t.prototype.toFixedLengthString=function(){const t=function(){const t=[];for(let e=0;e>8,255&e,r>>8,255&r])},t.prototype.toNormalizedString=function(){const t=function(){const t=[];for(let e=0;en&&(i=r.index,n=r[0].length);return n<0?e:`${e.substring(0,i)}::${e.substring(i+n)}`},t.prototype.toString=function(){return this.toRFC5952String()},t}(),d.IPv6.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[];let s=0;for(;s<16;)n.push(parseInt(r[s],10)|255^parseInt(i[s],10)),s++;return new this(n)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.isIPv6=function(t){return null!==this.parser(t)},d.IPv6.isValid=function(t){if("string"==typeof t&&-1===t.indexOf(":"))return!1;try{const e=this.parser(t);return new this(e.parts,e.zoneId),!0}catch(t){return!1}},d.IPv6.isValidCIDR=function(t){if("string"==typeof t&&-1===t.indexOf(":"))return!1;try{return this.parseCIDR(t),!0}catch(t){return!1}},d.IPv6.networkAddressFromCIDR=function(t){let e,r,i,n,s;try{for(e=this.parseCIDR(t),i=e[0].toByteArray(),s=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[],r=0;r<16;)n.push(parseInt(i[r],10)&parseInt(s[r],10)),r++;return new this(n)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.parse=function(t){const e=this.parser(t);if(null===e.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(e.parts,e.zoneId)},d.IPv6.parseCIDR=function(t){let e,r,i;if((r=t.match(/^(.+)\/(\d+)$/))&&(e=parseInt(r[2]),e>=0&&e<=128))return i=[this.parse(r[1]),e],Object.defineProperty(i,"toString",{value:function(){return this.join("/")}}),i;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(t){let e,r,i,n,s,o;if(i=t.match(h.deprecatedTransitional))return this.parser(`::ffff:${i[1]}`);if(h.native.test(t))return u(t,8);if((i=t.match(h.transitional))&&(o=i[6]||"",e=i[1],i[1].endsWith("::")||(e=e.slice(0,-1)),e=u(e+o,6),e.parts)){for(s=[parseInt(i[2]),parseInt(i[3]),parseInt(i[4]),parseInt(i[5])],r=0;r128)throw new Error("ipaddr: invalid IPv6 prefix length");const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const i=Math.floor(t/8);for(;r{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},655:t=>{var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}t.exports=e},672:(t,e,r)=>{var i=r(4116).Buffer,n=r(537);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,s=i.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=s,n=a,e.copy(r,n),a+=o.data.length,o=o.next;return s},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})},681:(t,e,r)=>{var i={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20},n=r(3507),s=r(2861).Buffer,o=r(4196),a=r(2455),h=r(3382);t.exports=function(t,e,r,u,f){o(r,u),t=h(t,a,"Password"),e=h(e,a,"Salt"),f=f||"sha1";var l=s.allocUnsafe(u),c=s.allocUnsafe(e.length+4);e.copy(c,0,0,e.length);for(var d=0,p=i[f],m=Math.ceil(u/p),g=1;g<=m;g++){c.writeUInt32BE(g,e.length);for(var y=n(f,t).update(c).digest(),b=y,v=1;v{r.r(e),r.d(e,{addListener:()=>c,argv:()=>a,binding:()=>k,browser:()=>s,chdir:()=>E,cwd:()=>M,emit:()=>y,env:()=>o,listeners:()=>_,nextTick:()=>w,off:()=>p,on:()=>l,once:()=>d,prependListener:()=>b,prependOnceListener:()=>v,removeAllListeners:()=>g,removeListener:()=>m,title:()=>n,umask:()=>S,version:()=>h,versions:()=>u});var i=r(9596);const n="browser",s=!0,o={},a=[],h="",u={};function f(){}const l=f,c=f,d=f,p=f,m=f,g=f,y=f,b=f,v=f,w=(t,...e)=>i((()=>t(...e))),_=t=>[],M=()=>"/",S=()=>0,k=t=>{throw new Error("process.binding is not supported")},E=t=>{throw new Error("process.chdir is not supported")}},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{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,e){let r=0,i=0,n=-1,s=0;for(;r"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){e.save(t),e.namespaces=t,e.names=[],e.skips=[];const r=("string"==typeof t?t:"").trim().replace(" ",",").split(",").filter(Boolean);for(const t of r)"-"===t[0]?e.skips.push(t.slice(1)):e.names.push(t)},e.enabled=function(t){for(const r of e.skips)if(n(t,r))return!1;for(const r of e.names)if(n(t,r))return!0;return!1},e.humanize=r(6585),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((r=>{e[r]=t[r]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let r=0;for(let e=0;e{var i,n=r(717),s=r(3519),o=r(6611);try{i=r(2376)}catch(t){}var a=function(){},h=/^v?\.0/.test(n.version),u=function(t){return"function"==typeof t},f=function(t,e,r,n){n=s(n);var f=!1;t.on("close",(function(){f=!0})),o(t,{readable:e,writable:r},(function(t){if(t)return n(t);f=!0,n()}));var l=!1;return function(e){if(!f&&!l)return l=!0,function(t){return!!h&&!!i&&(t instanceof(i.ReadStream||a)||t instanceof(i.WriteStream||a))&&u(t.close)}(t)?t.close(a):function(t){return t.setHeader&&u(t.abort)}(t)?t.abort():u(t.destroy)?t.destroy():void n(e||new Error("stream was destroyed"))}},l=function(t){t()},c=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(n,s){var o=s0,(function(e){t||(t=e),e&&i.forEach(l),o||(i.forEach(l),r(t))}))}));return e.reduce(c)}},894:(t,e,r)=>{var i=e;i.base=r(6677),i.short=r(9188),i.mont=r(370),i.edwards=r(1298)},920:(t,e,r)=>{var i=r(9675),n=r(8859),s=r(4803),o=r(507),a=r(2271)||o||s;t.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new i("Side channel does not contain "+n(t))},delete:function(e){return!!t&&t.delete(e)},get:function(e){return t&&t.get(e)},has:function(e){return!!t&&t.has(e)},set:function(e,r){t||(t=a()),t.set(e,r)}};return e}},975:t=>{var e=function(){function t(t,e,r){this.name=t,this.max=e,this.constructor=null!=r?r:function(){},this.list=[]}return t.prototype.alloc=function(){return this.list.length?this.list.shift():this.constructor.apply(this,arguments)},t.prototype.free=function(t){return this.list.length{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())}c.bytes=0,c.position=0,c.data=null,c.encoding=null,c.next=function(){switch(c.data[c.position]){case 100:return c.dictionary();case 108:return c.list();case 105:return c.integer();default:return c.buffer()}},c.find=function(t){let e=c.position;const r=c.data.length,i=c.data;for(;e{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){if(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)}},1002:t=>{t.exports=Function.prototype.apply},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{var i=r(9612);t.exports=i.getPrototypeOf||null},1093:t=>{var e=Object.prototype.toString;t.exports=function(t){var r=e.call(t),i="[object Arguments]"===r;return i||(i="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),i}},1133:(t,e,r)=>{let i=r(8673);t.exports=new i(r(8446))},1137:(t,e,r)=>{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())}))},1158:function(t,e,r){!function(t,e){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(8287).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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},1189:(t,e,r)=>{var i=Array.prototype.slice,n=r(1093),s=Object.keys,o=s?function(t){return s(t)}:r(8875),a=Object.keys;o.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return n(t)?a(i.call(t)):a(t)})}else Object.keys=o;return Object.keys||o},t.exports=o},1200:(t,e,r)=>{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,r){return this.ec.verify(t,e,this,void 0,r)},s.prototype.inspect=function(){return""}},1220:()=>{},1237:t=>{t.exports=EvalError},1241:(t,e,r)=>{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)}},1298:(t,e,r)=>{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},1314:t=>{t.exports=function(t,e){if(e>=t.length||e<0)return;var r=t.pop();if(e{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{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(var i 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 n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var s=Object.getOwnPropertyDescriptor(t,e);if(42!==s.value||!0!==s.enumerable)return!1}return!0}},1416:(t,e,r)=>{t.exports=r(8310)},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))}},1514:(t,e,r)=>{var i=r(8403);t.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),r={},i=0;i{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(5488);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\nwe accept pull requests\nhttps://github.com/browserify/crypto-browserify")},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}},1591:t=>{t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},1630:t=>{function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,r,i,n){r=r||"&",i=i||"=";var s={};if("string"!=typeof t||0===t.length)return s;var o=/\+/g;t=t.split(r);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var h=t.length;a>0&&h>a&&(h=a);for(var u=0;u=0?(f=p.substr(0,m),l=p.substr(m+1)):(f=p,l=""),c=decodeURIComponent(f),d=decodeURIComponent(l),e(s,c)?Array.isArray(s[c])?s[c].push(d):s[c]=[s[c],d]:s[c]=d}return s}},1636:t=>{t.exports={rE:"6.6.1"}},1672:(t,e,r)=>{var i=r(717);t.exports=function(t,e){var r=0,n=[],s=!0;function o(t){function r(){e&&e(t,n)}s?i.nextTick(r):r()}t.length>0?t[0]((function e(i,s){n.push(s),++r>=t.length||i?o(i):t[r](e)})):o(null);s=!1}},1678:(t,e,r)=>{const i=r(537),n=r(8957),s=r(5905).HTTPParser,o=r(4529).ok,a=r(2728),h=a.parsers,u=a.freeParser,f=a.debug,l=a.CRLF,c=a.continueExpression,d=a.chunkExpression,p=a.httpSocketSetup,m=r(8419).OutgoingMessage,g=e.STATUS_CODES={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},y=0|s.kOnExecute;function b(t){m.call(this),"HEAD"===t.method&&(this._hasBody=!1),this.sendDate=!0,(t.httpVersionMajor<1||t.httpVersionMinor<1)&&(this.useChunkedEncodingByDefault=d.test(t.headers.te),this.shouldKeepAlive=!1)}function v(){this._httpMessage&&this._httpMessage.emit("close")}function w(t){if(!(this instanceof w))return new w(t);n.Server.call(this,{allowHalfOpen:!0}),t&&this.addListener("request",t),this.httpAllowHalfOpen=!1,this.addListener("connection",_),this.timeout=12e4,this._pendingResponseData=0}function _(t){var e=this,r=[],i=[],n=0;function a(e){if(n+=e,t._paused&&n=t._writableState.highWaterMark)&&(t._paused=!0,t.pause())}var u=new b(s);u._onPendingData=a,u.shouldKeepAlive=h,t._httpMessage?r.push(u):u.assignSocket(t);u.on("finish",(function(){o(0===i.length||i[0]===s),i.shift(),s._consuming||s._readableState.resumeScheduled||s._dump();if(u.detachSocket(t),u._last)t.destroySoon();else{var e=r.shift();e&&e.assignSocket(t)}})),void 0!==s.headers.expect&&1==s.httpVersionMajor&&1==s.httpVersionMinor?c.test(s.headers.expect)?(u._expect_continue=!0,e.listenerCount("checkContinue")>0?e.emit("checkContinue",s,u):(u.writeContinue(),e.emit("request",s,u))):e.listenerCount("checkExpectation")>0?e.emit("checkExpectation",s,u):(u.writeHead(417),u.end()):e.emit("request",s,u);return!1},t.on("end",x),t.on("data",w),t.on("resume",M),t.on("pause",S),t.on("drain",A),t.on=E;var g=t._handle&&t._handle._externalStream;function v(t){this.removeListener("error",v),this.on("error",(()=>{})),e.emit("clientError",t,this)||this.destroy(t)}function w(e){o(!t._paused),f("SERVER socketOnData %d",e.length),_(m.execute(e),e)}function _(r,i){if(r instanceof Error)f("parse error"),v.call(t,r);else if(m.incoming&&m.incoming.upgrade){var n=r,s=m.incoming;f("SERVER upgrade or connect",s.method),i||(i=m.getCurrentBuffer()),t.removeListener("data",w),t.removeListener("end",x),t.removeListener("close",d),k(m,t),m.finish(),u(m,s,null),m=null;var o="CONNECT"===s.method?"connect":"upgrade";if(e.listenerCount(o)>0){f("SERVER have listener for %s",o);var a=i.slice(n,i.length);t._readableState.flowing=null,e.emit(o,s,t,a)}else t.destroy()}t._paused&&t.parser&&(f("pause parser"),t.parser.pause())}function x(){var t=this,i=m.finish();if(i instanceof Error)return f("parse error"),void v.call(t,i);e.httpAllowHalfOpen?r.length?r[r.length-1]._last=!0:t._httpMessage?t._httpMessage._last=!0:t.writable&&t.end():(l(),t.writable&&t.end())}function A(){var e=n>t._writableState.highWaterMark;t._paused&&!e&&(t._paused=!1,t.parser&&t.parser.resume(),t.resume())}g&&(m._consumed=!0,m.consume(g)),g=null,m[y]=function(e,r){t._unrefTimer(),f("SERVER socketOnParserExecute %d",e),_(e,void 0)},t._paused=!1}function M(){this._paused?this.pause():this._handle&&!this._handle.reading&&(this._handle.reading=!0,this._handle.readStart())}function S(){this._handle&&this._handle.reading&&(this._handle.reading=!1,this._handle.readStop())}function k(t,e){e._handle&&(t._consumed&&t.unconsume(e._handle._externalStream),t._consumed=!1,e.removeListener("pause",S),e.removeListener("resume",M))}function E(t,e){var r=n.Socket.prototype.on.call(this,t,e);return this.parser?("data"!==t&&"readable"!==t||k(this.parser,this),r):(this.on=n.Socket.prototype.on,r)}i.inherits(b,m),b.prototype._finish=function(){m.prototype._finish.call(this)},e.ServerResponse=b,b.prototype.statusCode=200,b.prototype.statusMessage=void 0,b.prototype.assignSocket=function(t){o(!t._httpMessage),t._httpMessage=this,t.on("close",v),this.socket=t,this.connection=t,this.emit("socket",t),this._flush()},b.prototype.detachSocket=function(t){o(t._httpMessage===this),t.removeListener("close",v),t._httpMessage=null,this.socket=this.connection=null},b.prototype.writeContinue=function(t){this._writeRaw("HTTP/1.1 100 Continue"+l+l,"ascii",t),this._sent100=!0},b.prototype._implicitHeader=function(){this.writeHead(this.statusCode)},b.prototype.writeHead=function(t,e,r){var i;if("string"==typeof e?this.statusMessage=e:(this.statusMessage=this.statusMessage||g[t]||"unknown",r=e),this.statusCode=t,this._headers){if(r)for(var n=Object.keys(r),s=0;s999)throw new RangeError(`Invalid status code: ${t}`);var a="HTTP/1.1 "+t.toString()+" "+this.statusMessage+l;(204===t||304===t||100<=t&&t<=199)&&(this._hasBody=!1),this._expect_continue&&!this._sent100&&(this.shouldKeepAlive=!1),this._storeHeader(a,i)},b.prototype.writeHeader=function(){this.writeHead.apply(this,arguments)},i.inherits(w,n.Server),w.prototype.setTimeout=function(t,e){return this.timeout=t,e&&this.on("timeout",e),this},e.Server=w,e._connectionListener=_},1800:(t,e,r)=>{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{t.exports=o;var i=r(6248),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{},1862:(t,e,r)=>{t.exports=r(8310)},1911:(t,e,r)=>{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")}},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{t.exports=function(t,e){for(var r=t.length,i=-1;++i{t.exports={wait:function(t){return new Promise((e=>setTimeout(e,t)))}}},2085:(t,e,r)=>{var i=r(640),n=function(t){switch(t.length){case 6:return t[0]+"."+t[1]+"."+t[2]+"."+t[3]+":"+t.readUInt16BE(4);case 18:for(var e=[],r=0;r<8;r++)e.push(t.readUInt16BE(2*r).toString(16));return"["+i.parse(e.join(":")).toString()+"]:"+t.readUInt16BE(16);default:throw new Error("Invalid Compact IP/PORT, It should contain 6 or 18 bytes")}};n.multi=function(t){if(t.length%6!=0)throw new Error("buf length isn't multiple of compact IP/PORTs (6 bytes)");for(var e=[],r=0;r<=t.length-1;r+=6)e.push(n(t.slice(r,r+6)));return e},n.multi6=function(t){if(t.length%18!=0)throw new Error("buf length isn't multiple of compact IP6/PORTs (18 bytes)");for(var e=[],r=0;r<=t.length-1;r+=18)e.push(n(t.slice(r,r+18)));return e},t.exports=n},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)},2195:(t,e,r)=>{const i=r(537),n=i,s=r(7007);e.IncomingMessage=r(3989).IncomingMessage;const o=r(2728);e.METHODS=o.methods.slice().sort(),e.OutgoingMessage=r(8419).OutgoingMessage;const a=r(1678);e.ServerResponse=a.ServerResponse,e.STATUS_CODES=a.STATUS_CODES;const h=r(8748),u=e.Agent=h.Agent;e.globalAgent=h.globalAgent;const f=r(5930),l=e.ClientRequest=f.ClientRequest;e.request=function(t,e){return new l(t,e)},e.get=function(t,r){var i=e.request(t,r);return i.end(),i},e._connectionListener=a._connectionListener;const c=e.Server=a.Server;function d(t,e){if(!(this instanceof d))return new d(t,e);s.call(this),e=e||"localhost",t=t||80,this.host=e,this.port=t,this.agent=new u({host:e,port:t,maxSockets:1})}e.createServer=function(t){return new c(t)},i.inherits(d,s),d.prototype.request=function(t,e,r){var i=this,n={};n.host=i.host,n.port=i.port,"/"===t[0]&&(r=e,e=t,t="GET"),n.method=t,n.path=e,n.headers=r,n.agent=i.agent;var s=new l(n);return s.on("error",(function(t){i.emit("error",t)})),s.on("socket",(function(t){t.on("end",(function(){if(i._decoder){var t=i._decoder.end();t&&i.emit("data",t)}i.emit("end")}))})),s},e.Client=n.deprecate(d,"http.Client is deprecated."),e.createClient=n.deprecate((function(t,e){return new d(t,e)}),"http.createClient is deprecated. Use http.request instead.")},2211:(t,e,r)=>{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)}},2240:t=>{var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},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{var i=r(453),n=r(6556),s=r(8859),o=r(507),a=r(9675),h=i("%WeakMap%",!0),u=n("WeakMap.prototype.get",!0),f=n("WeakMap.prototype.set",!0),l=n("WeakMap.prototype.has",!0),c=n("WeakMap.prototype.delete",!0);t.exports=h?function(){var t,e,r={assert:function(t){if(!r.has(t))throw new a("Side channel does not contain "+s(t))},delete:function(r){if(h&&r&&("object"==typeof r||"function"==typeof r)){if(t)return c(t,r)}else if(o&&e)return e.delete(r);return!1},get:function(r){return h&&r&&("object"==typeof r||"function"==typeof r)&&t?u(t,r):e&&e.get(r)},has:function(r){return h&&r&&("object"==typeof r||"function"==typeof r)&&t?l(t,r):!!e&&e.has(r)},set:function(r,i){h&&r&&("object"==typeof r||"function"==typeof r)?(t||(t=new h),f(t,r,i)):o&&(e||(e=o()),e.set(r,i))}};return r}:o},2287:(t,e,r)=>{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=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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},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{},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}},2455:(t,e,r)=>{var i,n=r(717);if(globalThis.process&&globalThis.process.browser)i="utf-8";else if(globalThis.process&&globalThis.process.version){i=parseInt(n.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else i="utf-8";t.exports=i},2503:(t,e,r)=>{var i=r(8287).Buffer;t.exports=function(t){return t instanceof i}},2509:function(t,e,r){!function(t,e){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(8287).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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},2632:(t,e)=>{e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},2642:(t,e,r)=>{var i=r(7720),n=Object.prototype.hasOwnProperty,s=Array.isArray,o={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:i.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},a=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},h=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},u=function(t,e,r,i){if(t){var s=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(s),u=a?s.slice(0,a.index):s,f=[];if(u){if(!r.plainObjects&&n.call(Object.prototype,u)&&!r.allowPrototypes)return;f.push(u)}for(var l=0;r.depth>0&&null!==(a=o.exec(s))&&l=0;--s){var o,a=t[s];if("[]"===a&&r.parseArrays)o=r.allowEmptyArrays&&(""===n||r.strictNullHandling&&null===n)?[]:[].concat(n);else{o=r.plainObjects?Object.create(null):{};var u="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,f=r.decodeDotInKeys?u.replace(/%2E/g,"."):u,l=parseInt(f,10);r.parseArrays||""!==f?!isNaN(l)&&a!==f&&String(l)===f&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[])[l]=n:"__proto__"!==f&&(o[f]=n):o={0:n}}n=o}return n}(f,e,r,i)}};t.exports=function(t,e){var r=function(t){if(!t)return o;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?o.charset:t.charset,r=void 0===t.duplicates?o.duplicates:t.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||o.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:o.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:o.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:o.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:o.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:o.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:o.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:o.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:o.decoder,delimiter:"string"==typeof t.delimiter||i.isRegExp(t.delimiter)?t.delimiter:o.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:o.depth,duplicates:r,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:o.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:o.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:o.plainObjects,strictDepth:"boolean"==typeof t.strictDepth?!!t.strictDepth:o.strictDepth,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:o.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var f="string"==typeof t?function(t,e){var r={__proto__:null},u=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;u=u.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var f,l=e.parameterLimit===1/0?void 0:e.parameterLimit,c=u.split(e.delimiter,l),d=-1,p=e.charset;if(e.charsetSentinel)for(f=0;f-1&&(g=s(g)?[g]:g);var w=n.call(r,m);w&&"combine"===e.duplicates?r[m]=i.combine(r[m],g):w&&"last"!==e.duplicates||(r[m]=g)}return r}(t,r):t,l=r.plainObjects?Object.create(null):{},c=Object.keys(f),d=0;d{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{const i=r(5905),n=i.methods,s=i.HTTPParser,o=r(975).FreeList,a=r(3989),h=a.IncomingMessage,u=a.readStart,f=a.readStop,l=r(537).debuglog("http");e.debug=l,e.CRLF="\r\n",e.chunkExpression=/chunk/i,e.continueExpression=/100-continue/i,e.methods=n;const c=0|s.kOnHeaders,d=0|s.kOnHeadersComplete,p=0|s.kOnBody,m=0|s.kOnMessageComplete,g=0|s.kOnExecute;function y(t,e){(this.maxHeaderPairs<=0||this._headers.length0&&(c=Math.min(c,l.maxHeaderPairs)),l.incoming._addHeaderLines(r,c),"number"==typeof i?l.incoming.method=n[i]:(l.incoming.statusCode=o,l.incoming.statusMessage=a),!u||null===l.outgoing||void 0!==l.outgoing._headers.upgrade&&/(^|\W)upgrade(\W|$)/i.test(l.outgoing._headers.connection)||(u=!1),l.incoming.upgrade=u;var d=0;return u||(d=l.onIncoming(l.incoming,f)),"number"!=typeof d?d?1:0:d}function v(t,e,r){var i=this.incoming;if(i){var n=i.socket;if(r>0&&!i._dumped){var s=t.slice(e,e+r);i.push(s)||f(n)}}}function w(){var t=this,e=t.incoming;if(e){e.complete=!0;var r=t._headers;r&&(t.incoming._addHeaderLines(r,r.length),t._headers=[],t._url=""),e.push(null)}u(t.socket)}var _=new o("parsers",1e3,(function(){var t=new s(s.REQUEST);return t._headers=[],t._url="",t._consumed=!1,t.socket=null,t.incoming=null,t.outgoing=null,t[c]=y,t[d]=b,t[p]=v,t[m]=w,t[g]=null,t}));function M(){this._httpMessage&&this._httpMessage.emit("drain")}function S(t){return t>=94&&t<=122||(t>=65&&t<=90||(45===t||(t>=48&&t<=57||34!==t&&40!==t&&41!==t&&44!==t&&(t>=33&&t<=46||(124===t||126===t)))))}e.parsers=_,e.freeParser=function(t,e,r){t&&(t._headers=[],t.onIncoming=null,t._consumed&&t.unconsume(),t._consumed=!1,t.socket&&(t.socket.parser=null),t.socket=null,t.incoming=null,t.outgoing=null,t[g]=null,!1===_.free(t)&&t.close(),t=null),e&&(e.parser=null),r&&(r.parser=null)},e.httpSocketSetup=function(t){t.removeListener("drain",M),t.on("drain",M)},e._checkIsHttpToken=function(t){if("string"!=typeof t||0===t.length)return!1;if(!S(t.charCodeAt(0)))return!1;const e=t.length;if(e>1){if(!S(t.charCodeAt(1)))return!1;if(e>2){if(!S(t.charCodeAt(2)))return!1;if(e>3){if(!S(t.charCodeAt(3)))return!1;for(var r=4;r255||127===e)return!0;if(t.length<2)return!1;if((e=t.charCodeAt(1))<=31&&9!==e||e>255||127===e)return!0;if(t.length<3)return!1;if((e=t.charCodeAt(2))<=31&&9!==e||e>255||127===e)return!0;for(var r=3;r255||127===e)return!0;return!1}},2791:function(t,e,r){var i=r(717);!function(t){if(!t.setImmediate){var e,r,n,s,o,a=1,h={},u=!1,f=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?e=function(t){i.nextTick((function(){d(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((n=new MessageChannel).port1.onmessage=function(t){d(t.data)},e=function(t){n.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(r=f.documentElement,e=function(t){var e=f.createElement("script");e.onreadystatechange=function(){d(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):e=function(t){setTimeout(d,0,t)}:(s="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&d(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),e=function(e){t.postMessage(s+e,"*")}),l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var r=new Array(arguments.length-1),i=0;i=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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},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)},2808:(t,e,r)=>{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{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},2853:(t,e,r)=>{var i=e;i.der=r(2010),i.pem=r(8903)},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)}},2878:t=>{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})}if(u.length<1)return-1;return 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}},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)}},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,S=0|this._dl,k=0|this._el,E=0|this._fl,x=0|this._gl,A=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],C=d(T,P),R=p(P,T),O=m(T=e[I-4],P=e[I-4+1]),B=g(P,T),L=e[I-14],N=e[I-14+1],j=e[I-32],U=e[I-32+1],q=R+N|0,D=C+L+y(q,R)|0;D=(D=D+O+y(q=q+B|0,B)|0)+j+y(q=q+U|0,U)|0,e[I]=D,e[I+1]=q}for(var H=0;H<160;H+=2){D=e[H],q=e[H+1];var F=f(r,i,n),z=f(w,_,M),$=l(r,w),W=l(w,r),K=c(a,k),V=c(k,a),Z=o[H],G=o[H+1],Y=u(a,h,b),J=u(k,E,x),X=A+V|0,Q=v+K+y(X,A)|0;Q=(Q=(Q=Q+Y+y(X=X+J|0,J)|0)+Z+y(X=X+G|0,G)|0)+D+y(X=X+q|0,q)|0;var tt=W+z|0,et=$+F+y(tt,W)|0;v=b,A=x,b=h,x=E,h=a,E=k,a=s+Q+y(k=S+X|0,S)|0,s=n,S=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+S|0,this._el=this._el+k|0,this._fl=this._fl+E|0,this._gl=this._gl+x|0,this._hl=this._hl+A|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,S)|0,this._eh=this._eh+a+y(this._el,k)|0,this._fh=this._fh+h+y(this._fl,E)|0,this._gh=this._gh+b+y(this._gl,x)|0,this._hh=this._hh+v+y(this._hl,A)|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},2951:t=>{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"}}')},2955:(t,e,r)=>{var i,n=r(717);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,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");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(6238),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((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}},s(i,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}},3033:(t,e,r)=>{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{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{var i=r(717),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},3085:(t,e,r)=>{var i=r(717);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()}},3093:(t,e,r)=>{var i=r(4459);t.exports=function(t){return i(t)||0===t?t:t<0?-1:1}},3126:(t,e,r)=>{var i=r(6743),n=r(9675),s=r(76),o=r(3144);t.exports=function(t){if(t.length<1||"function"!=typeof t[0])throw new n("a function is required");return o(i,s,t)}},3141:(t,e,r)=>{var i=r(2861).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){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)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 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}},3144:(t,e,r)=>{var i=r(6743),n=r(1002),s=r(76),o=r(7119);t.exports=o||i.call(s,n)},3208:()=>{},3209:(t,e,r)=>{var i=r(717),n=65536,s=4294967295;var o=r(2861).Buffer,a=globalThis.crypto||globalThis.msCrypto;a&&a.getRandomValues?t.exports=function(t,e){if(t>s)throw new RangeError("requested too many random bytes");var r=o.allocUnsafe(t);if(t>0)if(t>n)for(var h=0;h{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"}}')},3225:(t,e,r)=>{var i=r(717);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{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"}}')},3278:()=>{},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)}},3382:(t,e,r)=>{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")}},3389:(t,e,r)=>{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{"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})}))},3507:(t,e,r)=>{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{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})}))},3549:()=>{},3600:(t,e,r)=>{t.exports=n;var i=r(4610);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)}},3628:(t,e,r)=>{var i=r(8648),n=r(1064),s=r(7176);t.exports=i?function(t){return i(t)}:n?function(t){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("getProto: not an object");return n(t)}:s?function(t){return s(t)}:null},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)}}},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},3832:(t,e,r)=>{var i,n,s=r(2861).Buffer,o=r(4196),a=r(2455),h=r(681),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)}))}},3917:(t,e,r)=>{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{const i=r(537),n=r(8310);function s(t){t&&!t._paused&&t.readable&&t.resume()}function o(t){n.Readable.call(this),this._readableState.readingMore=!0,this.socket=t,this.connection=t,this.httpVersionMajor=null,this.httpVersionMinor=null,this.httpVersion=null,this.complete=!1,this.headers={},this.rawHeaders=[],this.trailers={},this.rawTrailers=[],this.readable=!0,this.upgrade=null,this.url="",this.method=null,this.statusCode=null,this.statusMessage=null,this.client=t,this._consuming=!1,this._dumped=!1}e.readStart=s,e.readStop=function(t){t&&t.pause()},i.inherits(o,n.Readable),e.IncomingMessage=o,o.prototype.setTimeout=function(t,e){return e&&this.on("timeout",e),this.socket.setTimeout(t),this},o.prototype.read=function(t){return this._consuming||(this._readableState.readingMore=!1),this._consuming=!0,this.read=n.Readable.prototype.read,this.read(t)},o.prototype._read=function(t){this.socket.readable&&s(this.socket)},o.prototype.destroy=function(t){this.socket&&this.socket.destroy(t)},o.prototype._addHeaderLines=function(t,e){if(t&&t.length){var r,i;this.complete?(r=this.rawTrailers,i=this.trailers):(r=this.rawHeaders,i=this.headers);for(var n=0;n{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"]]}}},4018:t=>{t.exports=function(){for(var t=navigator.hardwareConcurrency||1,e=[],r=0;r{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())))}},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())}},4101:(t,e,r)=>{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}}},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},4116:(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)}},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")}},4343:()=>{},4367:(t,e)=>{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}},4459:t=>{t.exports=Number.isNaN||function(t){return t!=t}},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)}}},4529:(t,e,r)=>{var i=r(1514)();function n(t,e){if(t===e)return 0;for(var r=t.length,i=e.length,n=0,s=Math.min(r,i);n=0;u--)if(f[u]!==l[u])return!1;for(u=f.length-1;u>=0;u--)if(!v(t[a=f[u]],e[a],r,i))return!1;return!0}(t,e,r,i))}return r?t===e:t==e}function w(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function M(t,e,r,i){var n;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(t){var e;try{t()}catch(t){e=t}return e}(e),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!n&&y(n,r,"Missing expected exception"+i);var s="string"==typeof i,a=!t&&n&&!r;if((!t&&o.isError(n)&&s&&_(n,r)||a)&&y(n,r,"Got unwanted exception"+i),t&&n&&r&&!_(n,r)||!t&&n)throw n}c.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return m(g(t.actual),128)+" "+t.operator+" "+m(g(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,n=p(e),s=i.indexOf("\n"+n);if(s>=0){var o=i.indexOf("\n",s+1);i=i.substring(o+1)}this.stack=i}}},o.inherits(c.AssertionError,Error),c.fail=y,c.ok=b,c.equal=function(t,e,r){t!=e&&y(t,e,r,"==",c.equal)},c.notEqual=function(t,e,r){t==e&&y(t,e,r,"!=",c.notEqual)},c.deepEqual=function(t,e,r){v(t,e,!1)||y(t,e,r,"deepEqual",c.deepEqual)},c.deepStrictEqual=function(t,e,r){v(t,e,!0)||y(t,e,r,"deepStrictEqual",c.deepStrictEqual)},c.notDeepEqual=function(t,e,r){v(t,e,!1)&&y(t,e,r,"notDeepEqual",c.notDeepEqual)},c.notDeepStrictEqual=function t(e,r,i){v(e,r,!0)&&y(e,r,i,"notDeepStrictEqual",t)},c.strictEqual=function(t,e,r){t!==e&&y(t,e,r,"===",c.strictEqual)},c.notStrictEqual=function(t,e,r){t===e&&y(t,e,r,"!==",c.notStrictEqual)},c.throws=function(t,e,r){M(!0,t,e,r)},c.doesNotThrow=function(t,e,r){M(!1,t,e,r)},c.ifError=function(t){if(t)throw t},c.strict=i((function t(e,r){e||y(e,!0,r,"==",t)}),c,{equal:c.strictEqual,deepEqual:c.deepStrictEqual,notEqual:c.notStrictEqual,notDeepEqual:c.notDeepStrictEqual}),c.strict.strict=c.strict;var S=Object.keys||function(t){var e=[];for(var r in t)a.call(t,r)&&e.push(r);return e}},4589:t=>{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"}')},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)},4610:(t,e,r)=>{t.exports=f;var i=r(113).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(5382);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{const i=r(7042);t.exports=class{constructor(t){this.encoding=t}get remaining(){return 0}decode(t){return i.toString(t,this.encoding)}flush(){return""}}},4643:t=>{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)}}},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=e;i.der=r(82),i.pem=r(735)},4729:(t,e,r)=>{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)};var o="undefined"!=typeof Uint8Array,a="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(i.prototype instanceof Uint8Array||i.TYPED_ARRAY_SUPPORT);s.prototype.update=function(t,e){if(this._finalized)throw new Error("Digest already called");t=function(t,e){if(t instanceof i)return t;if("string"==typeof t)return i.from(t,e);if(a&&ArrayBuffer.isView(t)){if(0===t.byteLength)return i.alloc(0);var r=i.from(t.buffer,t.byteOffset,t.byteLength);if(r.byteLength===t.byteLength)return r}if(o&&t instanceof Uint8Array)return i.from(t);if(i.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return i.from(t);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(t,e);for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var s=this._blockOffset;s0;++h)this._length[h]+=u,(u=this._length[h]/4294967296|0)>0&&(this._length[h]-=4294967296*u);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},4765:t=>{var e=String.prototype.replace,r=/%20/g,i="RFC1738",n="RFC3986";t.exports={default:n,formatters:{RFC1738:function(t){return e.call(t,r,"+")},RFC3986:function(t){return String(t)}},RFC1738:i,RFC3986:n}},4803:(t,e,r)=>{var i=r(8859),n=r(9675),s=function(t,e,r){for(var i,n=t;null!=(i=n.next);n=i)if(i.key===e)return n.next=i.next,r||(i.next=t.next,t.next=i),i};t.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new n("Side channel does not contain "+i(t))},delete:function(e){var r=t&&t.next,i=function(t,e){if(t)return s(t,e,!0)}(t,e);return i&&r&&r===i&&(t=void 0),!!i},get:function(e){return function(t,e){if(t){var r=s(t,e);return r&&r.value}}(t,e)},has:function(e){return function(t,e){return!!t&&!!s(t,e)}(t,e)},set:function(e,r){t||(t={next:void 0}),function(t,e,r){var i=s(t,e);i?i.value=r:t.next={key:e,next:t.next,value:r}}(t,e,r)}};return e}},4847:(t,e,r)=>{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),m=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);return 0===m.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{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)))}},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}}},4988:(t,e,r)=>{var i=r(717),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{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{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)}}},5185:()=>{},5221:(t,e,r)=>{const{isIPv4:i,isIPv6:n}=r(8957);e.lookup=function t(e,r,s){if("function"==typeof r)return t(e,null,r);chrome.dns.resolve(e,(t=>{if(0!==t.resultCode)return s(new Error("DNS lookup error: "+chrome.runtime.lastError.message));const e=t.address,r=i(e)?4:n(e)?6:0;s(null,e,r)}))}},5242:(t,e,r)=>{t.exports=s;var i=r(1816),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)}},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(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},5291:(t,e,r)=>{var i=r(113).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}}},5307:(t,e,r)=>{const i=r(7042);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}},5335:(t,e,r)=>{const i=r(4611),n=r(6045);t.exports=class{constructor(t="utf8"){switch(this.encoding=function(t){switch(t=t.toLowerCase()){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:throw new Error("Unknown encoding: "+t)}}(t),this.encoding){case"utf8":this.decoder=new n;break;case"utf16le":case"base64":throw new Error("Unsupported encoding: "+this.encoding);default:this.decoder=new i(this.encoding)}}get remaining(){return this.decoder.remaining}push(t){return"string"==typeof t?t:this.decoder.decode(t)}write(t){return this.push(t)}end(t){let e="";return t&&(e=this.push(t)),e+=this.decoder.flush(),e}}},5345:t=>{t.exports=URIError},5359:(t,e,r)=>{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{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;Array.isArray(t)?(n=[],o=s=t.length):(a=Object.keys(t),n={},o=s=a.length);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{var i=r(8636),n=r(2642),s=r(4765);t.exports={formats:s,parse:n,stringify:i}},5380:(t,e,r)=>{var i=r(8287).Buffer,n=r(4934),s=r(3241),o=r(4910);var 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)))}},5382:(t,e,r)=>{var i=r(717),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=f;var s=r(5412),o=r(6708);r(6698)(f,s);for(var a=n(o.prototype),h=0;h{var i,n=r(717);t.exports=E,E.ReadableState=k;r(7007).EventEmitter;var s=function(t,e){return t.listeners(e).length},o=r(1416),a=r(8287).Buffer,h=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var u,f=r(537);u=f&&f.debuglog?f.debuglog("stream"):function(){};var l,c,d,p=r(345),m=r(5896),g=r(5291).getHighWaterMark,y=r(113).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)(E,o);var M=m.errorOrDestroy,S=["error","close","destroy","pause","resume"];function k(t,e,n){i=i||r(5382),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 E(t){if(i=i||r(5382),!(this instanceof E))return new E(t);var e=this instanceof i;this._readableState=new k(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function x(t,e,r,i,n){u("readableAddChunk",e);var s,o=t._readableState;if(null===e)o.reading=!1,function(t,e){if(u("onEofChunk"),e.ended)return;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,C(t)))}(t,o);else if(n||(s=function(t,e){var r;i=e,a.isBuffer(i)||i instanceof h||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e));var i;return r}(o,e)),s)M(t,s);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)o.endEmitted?M(t,new _):A(t,o,e,!0);else if(o.ended)M(t,new v);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?A(t,o,e,!1):R(t,o)):A(t,o,e,!1)}else i||(o.reading=!1,R(t,o));return!o.ended&&(o.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;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(C,t))}function C(t){var e=t._readableState;u("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,j(t)}function R(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(O,t,e))}function O(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function L(t){u("readable nexttick read 0"),t.read(0)}function N(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(u("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;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(D,e,t))}function D(t,e){if(u("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 H(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?q(this):P(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&q(this),null;var i,n=e.needReadable;return u("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},E.prototype._read=function(t){M(this,new w("_read()"))},E.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,u("pipe count=%d opts=%j",i.pipesCount,e);var o=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?h:g;function a(e,n){u("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",a),r.removeListener("end",h),r.removeListener("end",g),r.removeListener("data",c),l=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function h(){u("onend"),t.end()}i.endEmitted?n.nextTick(o):r.once("end",o),t.on("unpipe",a);var f=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,j(t))}}(r);t.on("drain",f);var l=!1;function c(e){u("ondata");var n=t.write(e);u("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==H(i.pipes,t))&&!l&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function d(e){u("onerror",e),g(),t.removeListener("error",d),0===s(t,"error")&&M(t,e)}function p(){t.removeListener("finish",m),g()}function m(){u("onfinish"),t.removeListener("close",p),g()}function g(){u("unpipe"),r.unpipe(t)}return r.on("data",c),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",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),i.flowing||(u("pipe resume"),r.resume()),t},E.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,u("on readable",i.length,i.reading),i.length?P(this):i.reading||n.nextTick(L,this))),r},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(t,e){var r=o.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(B,this),r},E.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(B,this),e},E.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(N,t,e))}(this,t)),t.paused=!1,this},E.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(u("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){(u("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{var i=r(717),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},5488:(t,e,r)=>{var i=r(1565),n=r(4196),s=r(2455),o=r(3382);i.pbkdf2Sync&&-1!==i.pbkdf2Sync.toString().indexOf("keylen, digest")?(e.pbkdf2Sync=function(t,e,r,a,h){return n(r,a),t=o(t,s,"Password"),e=o(e,s,"Salt"),h=h||"sha1",i.pbkdf2Sync(t,e,r,a,h)},e.pbkdf2=function(t,e,r,a,h,u){if(n(r,a),t=o(t,s,"Password"),e=o(e,s,"Salt"),"function"==typeof h&&(u=h,h="sha1"),"function"!=typeof u)throw new Error("No callback provided to pbkdf2");return i.pbkdf2(t,e,r,a,h,u)}):(e.pbkdf2Sync=r(681),e.pbkdf2=r(3832))},5579:t=>{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"}')},5622:(t,e,r)=>{var i=r(8287).Buffer;function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(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]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(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=i.isBuffer},5658:(t,e,r)=>{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);const t={webrtc:25e3,tcpOutgoing:5e3,utpOutgoing:5e3};this.connectTimeout=setTimeout((()=>{this.destroy(new Error("connect timeout"))}),t[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,i=null)=>{const n=new g(t.id,"webrtc");if(n.conn=t,n.swarm=e,n.throttleGroups=r,n.source=i,n.conn.connected)n.onConnect();else{const t=()=>{n.conn.removeListener("connect",e),n.conn.removeListener("error",r)},e=()=>{t(),n.onConnect()},r=e=>{t(),n.destroy(e)};n.conn.once("connect",e),n.conn.once("error",r),n.startConnectTimeout()}return n},g.createTCPIncomingPeer=(t,e)=>g._createIncomingPeer(t,h,e),g.createUTPIncomingPeer=(t,e)=>g._createIncomingPeer(t,f,e),g.createTCPOutgoingPeer=(t,e,r,i)=>g._createOutgoingPeer(t,e,u,r,i),g.createUTPOutgoingPeer=(t,e,r,i)=>g._createOutgoingPeer(t,e,l,r,i),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,n=null)=>{const s=new g(t,r);return s.addr=t,s.swarm=e,s.throttleGroups=i,s.source=n,s},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}},5715:(t,e,r)=>{t.exports=r(2951)},5795:(t,e,r)=>{var i=r(6549);if(i)try{i([],"length")}catch(t){i=null}t.exports=i},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{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]}}},5880:t=>{t.exports=Math.pow},5892:(t,e,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},5896:(t,e,r)=>{var i=r(717);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)}}},5905:(t,e,r)=>{var i=r(4529);function n(t){i.ok(t===n.REQUEST||t===n.RESPONSE),this.type=t,this.state=t+"_LINE",this.info={headers:[],upgrade:!1},this.trailers=[],this.line="",this.isChunked=!1,this.connection="",this.headerSize=0,this.body_bytes=null,this.isUserCall=!1,this.hadError=!1}e.HTTPParser=n,n.encoding="ascii",n.maxHeaderSize=81920,n.REQUEST="REQUEST",n.RESPONSE="RESPONSE";var s=n.kOnHeaders=0,o=n.kOnHeadersComplete=1,a=n.kOnBody=2,h=n.kOnMessageComplete=3;n.prototype[s]=n.prototype[o]=n.prototype[a]=n.prototype[h]=function(){};var u=!0;Object.defineProperty(n,"kOnExecute",{get:function(){return u=!1,4}});var f=e.methods=n.methods=["DELETE","GET","HEAD","POST","PUT","CONNECT","OPTIONS","TRACE","COPY","LOCK","MKCOL","MOVE","PROPFIND","PROPPATCH","SEARCH","UNLOCK","BIND","REBIND","UNBIND","ACL","REPORT","MKACTIVITY","CHECKOUT","MERGE","M-SEARCH","NOTIFY","SUBSCRIBE","UNSUBSCRIBE","PATCH","PURGE","MKCALENDAR","LINK","UNLINK"],l=f.indexOf("CONNECT");n.prototype.reinitialize=n,n.prototype.close=n.prototype.pause=n.prototype.resume=n.prototype.free=function(){},n.prototype._compatMode0_11=!1,n.prototype.getAsyncId=function(){return 0};var c={REQUEST_LINE:!0,RESPONSE_LINE:!0,HEADER:!0};n.prototype.execute=function(t,e,r){if(!(this instanceof n))throw new TypeError("not a HTTPParser");e=e||0,r="number"==typeof r?r:t.length,this.chunk=t,this.offset=e;var i=this.end=e+r;try{for(;this.offsetn.maxHeaderSize)?new Error("max header size exceeded"):r};var d={REQUEST_LINE:!0,RESPONSE_LINE:!0,BODY_RAW:!0};n.prototype.finish=function(){if(!this.hadError)return d[this.state]?void("BODY_RAW"===this.state&&this.userCall()(this[h]())):new Error("invalid state for EOF")},n.prototype.consume=n.prototype.unconsume=n.prototype.getCurrentBuffer=function(){},n.prototype.userCall=function(){this.isUserCall=!0;var t=this;return function(e){return t.isUserCall=!1,e}},n.prototype.nextRequest=function(){this.userCall()(this[h]()),this.reinitialize(this.type)},n.prototype.consumeLine=function(){for(var t=this.end,e=this.chunk,r=this.offset;r0&&this.info.versionMinor>0){if(-1!==this.connection.indexOf("close"))return!1}else if(-1===this.connection.indexOf("keep-alive"))return!1;return!(null===this.body_bytes&&!this.isChunked)},n.prototype.HEADER=function(){var t=this.consumeLine();if(void 0!==t){var e=this.info;if(t)this.parseHeader(t,e.headers);else{for(var r,i,s=e.headers,a=!1,h=!1,f=0;f{var i=r(717);const n=r(537),s=r(8957),o=r(8835),a=r(5905).HTTPParser,h=r(4529).ok,u=r(2728),f=u.httpSocketSetup,l=u.parsers,c=u.freeParser,d=u.debug,p=r(8419).OutgoingMessage,m=r(8748),g=r(8287).Buffer;function y(t,e){var r=this;if(p.call(r),"string"==typeof t){if(!(t=o.parse(t)).hostname)throw new Error("Unable to determine the domain name")}else t=n._extend({},t);var a=t.agent,h=t._defaultAgent||m.globalAgent;!1===a?a=new h.constructor:null==a&&"function"!=typeof t.createConnection&&(a=h),r.agent=a;var f=t.protocol||h.protocol,l=h.protocol;if(r.agent&&r.agent.protocol&&(l=r.agent.protocol),t.path&&/ /.test(t.path))throw new TypeError("Request path contains unescaped characters");if(f!==l)throw new Error('Protocol "'+f+'" not supported. Expected "'+l+'"');const c=t.defaultPort||r.agent&&r.agent.defaultPort;var y=t.port=t.port||c||80,b=t.host=t.hostname||t.host||"localhost";if(void 0===t.setHost)var v=!0;r.socketPath=t.socketPath;var w=r.method=(t.method||"GET").toUpperCase();if(!u._checkIsHttpToken(w))throw new TypeError("Method must be a valid HTTP token");if(r.path=t.path||"/",e&&r.once("response",e),!Array.isArray(t.headers)){if(t.headers)for(var _=Object.keys(t.headers),M=0,S=_.length;M0?(r.upgradeOrConnect=!0,e.emit("agentRemove"),e.removeListener("close",w),e.removeListener("error",_),e._readableState.flowing=null,r.emit(u,o,e,a),r.emit("close")):e.destroy(),c(i,r,e)}else i.incoming&&i.incoming.complete&&100!==i.incoming.statusCode&&(e.removeListener("data",k),e.removeListener("end",S),c(i,r,e))}function E(t,e){var r=this.socket,i=r._httpMessage;if(i.domain&&!t.domain&&(d('setting "res.domain"'),t.domain=i.domain),d("AGENT incoming response!"),!i.res){if(i.res=t,"CONNECT"===i.method)return t.upgrade=!0,2;var n="HEAD"===i.method;return d("AGENT isHeadResponse",n),100===t.statusCode?(delete i.res,i.emit("continue"),!0):(!i.shouldKeepAlive||e||i.upgradeOrConnect||(i.shouldKeepAlive=!1),i.res=t,t.req=i,t.on("end",A),i.on("prefinish",I),i.emit("response",t)||t._dump(),n)}r.destroy()}function x(t,e){var r=e.socket;e.shouldKeepAlive?(d("AGENT socket keep-alive"),e.timeoutCb&&(r.setTimeout(0,e.timeoutCb),e.timeoutCb=null),r.removeListener("close",w),r.removeListener("error",_),r.once("error",M),i.nextTick(T,r)):(r.writable&&(d("AGENT socket.destroySoon()"),r.destroySoon()),h(!r.writable))}function A(){const t=this.req;t._ended=!0,t.shouldKeepAlive&&!t.finished||x(0,t)}function I(){const t=this;this.res;t.shouldKeepAlive&&t._ended&&x(0,t)}function T(t){t.emit("free")}function P(t,e){t.aborted?e.emit("free"):function(t,e){var r=l.alloc();t.socket=e,t.connection=e,r.reinitialize(a.RESPONSE),r.socket=e,r.incoming=null,r.outgoing=t,t.parser=r,e.parser=r,e._httpMessage=t,f(e),"number"==typeof t.maxHeadersCount?r.maxHeaderPairs=t.maxHeadersCount<<1:r.maxHeaderPairs=2e3,r.onIncoming=E,e.removeListener("error",M),e.on("error",_),e.on("data",k),e.on("end",S),e.on("close",w),t.emit("socket",e)}(t,e)}n.inherits(y,p),e.ClientRequest=y,y.prototype.aborted=void 0,y.prototype._finish=function(){p.prototype._finish.call(this)},y.prototype._implicitHeader=function(){this._storeHeader(this.method+" "+this.path+" HTTP/1.1\r\n",this._renderHeaders())},y.prototype.abort=function(){void 0===this.aborted&&i.nextTick(b,this),this.aborted=Date.now(),this.res?this.res._dump():this.once("response",(function(t){t._dump()})),this.socket&&this.socket.destroy()},y.prototype.onSocket=function(t){i.nextTick(P,this,t)},y.prototype._deferToConnect=function(t,e,r){var i=this;function n(){t&&i.socket[t].apply(i.socket,e),"function"==typeof r&&r()}var s=function(){i.socket.writable?n():i.socket.once("connect",n)};i.socket?s():i.once("socket",s)},y.prototype.setTimeout=function(t,e){e&&this.once("timeout",e);var r=this;function i(){r.emit("timeout")}if(this.socket&&this.socket.writable)return this.timeoutCb&&this.socket.setTimeout(0,this.timeoutCb),this.timeoutCb=i,this.socket.setTimeout(t,i),this;if(this.timeoutCb=i,this.socket){var n=this.socket;return this.socket.once("connect",(function(){n.setTimeout(t,i)})),this}return this.once("socket",(function(e){e.setTimeout(t,i)})),this},y.prototype.setNoDelay=function(){const t=arguments.length,e=new Array(t);for(var r=0;r{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,S=0|this._d,k=0|this._e,E=0;E<80;E+=1){var x,A;E<16?(x=m(r,i,n,s,d,t[a[E]],l[0],u[E]),A=v(w,_,M,S,k,t[h[E]],c[0],f[E])):E<32?(x=g(r,i,n,s,d,t[a[E]],l[1],u[E]),A=b(w,_,M,S,k,t[h[E]],c[1],f[E])):E<48?(x=y(r,i,n,s,d,t[a[E]],l[2],u[E]),A=y(w,_,M,S,k,t[h[E]],c[2],f[E])):E<64?(x=b(r,i,n,s,d,t[a[E]],l[3],u[E]),A=g(w,_,M,S,k,t[h[E]],c[3],f[E])):(x=v(r,i,n,s,d,t[a[E]],l[4],u[E]),A=m(w,_,M,S,k,t[h[E]],c[4],f[E])),r=d,d=s,s=p(n,10),n=i,i=x,w=k,k=S,S=p(M,10),M=_,_=A}var I=this._b+n+S|0;this._b=this._c+s+k|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},6045:(t,e,r)=>{const i=r(7042);t.exports=class{constructor(){this.codePoint=0,this.bytesSeen=0,this.bytesNeeded=0,this.lowerBoundary=128,this.upperBoundary=191}get remaining(){return this.bytesSeen}decode(t){if(0===this.bytesNeeded){let e=!0;for(let r=Math.max(0,t.byteLength-4),i=t.byteLength;rthis.upperBoundary?(this.codePoint=0,this.bytesNeeded=0,this.bytesSeen=0,this.lowerBoundary=128,this.upperBoundary=191,e+="�"):(this.lowerBoundary=128,this.upperBoundary=191,this.codePoint=this.codePoint<<6|63&i,this.bytesSeen++,this.bytesSeen===this.bytesNeeded&&(e+=String.fromCodePoint(this.codePoint),this.codePoint=0,this.bytesNeeded=0,this.bytesSeen=0)):i<=127?e+=String.fromCharCode(i):(this.bytesSeen=1,i>=194&&i<=223?(this.bytesNeeded=2,this.codePoint=31&i):i>=224&&i<=239?(224===i?this.lowerBoundary=160:237===i&&(this.upperBoundary=159),this.bytesNeeded=3,this.codePoint=15&i):i>=240&&i<=244?(240===i&&(this.lowerBoundary=144),244===i&&(this.upperBoundary=143),this.bytesNeeded=4,this.codePoint=7&i):e+="�")}return e}flush(){const t=this.bytesNeeded>0?"�":"";return this.codePoint=0,this.bytesNeeded=0,this.bytesSeen=0,this.lowerBoundary=128,this.upperBoundary=191,t}}},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}}},6166:(t,e,r)=>{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{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);var a="undefined"!=typeof Uint8Array,h="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(i.prototype instanceof Uint8Array||i.TYPED_ARRAY_SUPPORT);o.prototype.update=function(t,e,r){var n=function(t,e){if(t instanceof i)return t;if("string"==typeof t)return i.from(t,e);if(h&&ArrayBuffer.isView(t)){if(0===t.byteLength)return i.alloc(0);var r=i.from(t.buffer,t.byteOffset,t.byteLength);if(r.byteLength===t.byteLength)return r}if(a&&t instanceof Uint8Array)return i.from(t);if(i.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return i.from(t);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(t,e),s=this._update(n);return this.hashMode?this:(r&&(s=this._toString(s,r)),s)},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},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");var r=-1;for(;++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},6188:t=>{t.exports=Math.max},6225:(t,e,r)=>{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}},6229:(t,e,r)=>{e.sha1=r(3917),e.sha224=r(7714),e.sha256=r(2287),e.sha384=r(1911),e.sha512=r(7766)},6238:(t,e,r)=>{var i=r(113).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{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(206),a=r(7314);s.inherits(l,o);for(var h=n(a.prototype),u=0;u{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)}}},6310:t=>{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(){};n.prototype=Object.create(Object.getPrototypeOf(t));return e(new n,i)}}},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}},6413:(t,e,r)=>{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},6427:(t,e,r)=>{var i=r(8393).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){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)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 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}},6458:(t,e,r)=>{r.d(e,{A:()=>P});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)("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]),S=new Uint8Array([0,0,0,0,0,0,0,0]),k=new Uint8Array([0,0,1,2]),E=new Uint8Array([0,0,0,2]);function x(t,e){for(let r=t.length;r--;)t[r]^=e[r];return t}class A{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=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=x(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(S),s.set(k,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(S),i.set(E,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 A(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 A(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(S);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=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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},6532:(t,e,r)=>{function i(t,e,r,i,n,s,o){try{var a=t[s](o),h=a.value}catch(t){return void r(t)}a.done?e(h):Promise.resolve(h).then(i,n)}function n(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 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,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");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(113).F.ERR_INVALID_ARG_TYPE;t.exports=function(t,e,r){var a;if(e&&"function"==typeof e.next)a=e;else if(e&&e[Symbol.asyncIterator])a=e[Symbol.asyncIterator]();else{if(!e||!e[Symbol.iterator])throw new o("iterable",["Iterable"],e);a=e[Symbol.iterator]()}var h=new t(function(t){for(var e=1;e{t.exports=Object.getOwnPropertyDescriptor},6556:(t,e,r)=>{var i=r(453),n=r(3126),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}},6585:t=>{var e=1e3,r=60*e,i=60*r,n=24*i,s=7*n,o=365.25*n;function a(t,e,r,i){var n=e>=1.5*r;return Math.round(t/r)+" "+i+(n?"s":"")}t.exports=function(t,h){h=h||{};var u=typeof t;if("string"===u&&t.length>0)return function(t){if((t=String(t)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!a)return;var h=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*s;case"days":case"day":case"d":return h*n;case"hours":case"hour":case"hrs":case"hr":case"h":return h*i;case"minutes":case"minute":case"mins":case"min":case"m":return h*r;case"seconds":case"second":case"secs":case"sec":case"s":return h*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}(t);if("number"===u&&isFinite(t))return h.long?function(t){var s=Math.abs(t);if(s>=n)return a(t,s,n,"day");if(s>=i)return a(t,s,i,"hour");if(s>=r)return a(t,s,r,"minute");if(s>=e)return a(t,s,e,"second");return t+" ms"}(t):function(t){var s=Math.abs(t);if(s>=n)return Math.round(t/n)+"d";if(s>=i)return Math.round(t/i)+"h";if(s>=r)return Math.round(t/r)+"m";if(s>=e)return Math.round(t/e)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},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{var i=r(717),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)?f&&!a&&(t.on("end",c),t.on("close",c)):(t.on("complete",d),t.on("abort",y),t.req?v():t.on("request",v)),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},6622:t=>{"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},6661:(t,e,r)=>{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},6677:(t,e,r)=>{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 k=0;a>=0;){var E=!0;for(h=0;h=0&&k++,M=M.dblp(k),a<0)break;for(h=0;h0?u=l[h][x-1>>1]:x<0&&(u=l[h][-x-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{},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}}},6708:(t,e,r)=>{var i,n=r(717);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=E,E.WritableState=k;var o={deprecate:r(4643)},a=r(1416),h=r(8287).Buffer,u=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var f,l=r(5896),c=r(5291).getHighWaterMark,d=r(113).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 S(){}function k(t,e,o){i=i||r(5382),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(C,t,e),t._writableState.errorEmitted=!0,M(t,i)):(s(i),t._writableState.errorEmitted=!0,M(t,i),C(t,e))}(t,r,i,e,s);else{var o=T(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),i?n.nextTick(A,t,r,o,s):A(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 E(t){var e=this instanceof(i=i||r(5382));if(!e&&!f.call(E,this))return new E(t);this._writableState=new k(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)),a.call(this)}function x(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 A(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),C(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,x(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(x(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"),C(t,e)}))}function C(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)(E,a),k.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(k.prototype,"buffer",{get:o.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]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(t){return!!f.call(this,t)||this===E&&(t&&t._writableState instanceof k)}})):f=function(t){return t instanceof this},E.prototype.pipe=function(){M(this,new y)},E.prototype.write=function(t,e,r){var i,s=this._writableState,o=!1,a=!s.objectMode&&(i=t,h.isBuffer(i)||i instanceof u);return a&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=s.defaultEncoding),"function"!=typeof r&&(r=S),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){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,r));return e}(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var a=e.objectMode?1:i.length;e.length+=a;var u=e.length-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(t,e,r){r(new m("_write()"))},E.prototype._writev=null,E.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,C(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),E.prototype.destroy=l.destroy,E.prototype._undestroy=l.undestroy,E.prototype._destroy=function(t,e){e(t)}},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},6729:(t,e,r)=>{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)},6743:(t,e,r)=>{var i=r(9353);t.exports=Function.prototype.bind||i},6784:(t,e,r)=>{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,S=0;S<80;S++){var k=o(s(h(r,l(S,i,n,u),t[p[S]+e],c(S)),g[S]),f);r=f,f=u,u=s(n,10),n=i,i=k,k=o(s(h(b,l(79-S,v,w,_),t[m[S]+e],d(S)),y[S]),M),b=M,M=_,_=s(w,10),w=v,v=k}k=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]=k},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]},6814:(t,e,r)=>{var i=r(8287).Buffer;const{digitCount:n,getType:s}=r(7972);function o(t){if(null==t)return 0;const e=s(t);switch(e){case"buffer":return n(t.length)+1+t.length;case"arraybufferview":return function(t){const e=t.byteLength-t.byteOffset;return n(e)+1+e}(t);case"string":return function(t){const e=i.byteLength(t);return n(e)+1+e}(t);case"array":case"set":return function(t){let e=2;for(const r of t)e+=o(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{t.exports=r(8330).version},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{},6975:(t,e,r)=>{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(717);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){void 0===e&&(e=0);if(!(a.isBuffer(t)||t instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');l(e,t.length),void 0===r&&(r=t.length-e);return c(r,e,t.length),d(t,e,r)}):(e.randomFill=n,e.randomFillSync=n)},7007:t=>{var e=Object.create||function(t){var e=function(){};return e.prototype=t,new e},r=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},i=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function n(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=e(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0;var s,o=10;try{var a={};Object.defineProperty&&Object.defineProperty(a,"x",{value:0}),s=0===a.x}catch(t){s=!1}function h(t){return void 0===t._maxListeners?n.defaultMaxListeners:t._maxListeners}function u(t,r,i,n){var s,o,a;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",r,i.listener?i.listener:i),o=t._events),a=o[r]):(o=t._events=e(null),t._eventsCount=0),a){if("function"==typeof a?a=o[r]=n?[i,a]:[a,i]:n?a.unshift(i):a.push(i),!a.warned&&(s=h(t))&&s>0&&a.length>s){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(r)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=t,u.type=r,u.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else a=o[r]=i,++t._eventsCount;return t}function f(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var h=new Error('Unhandled "error" event. ('+e+")");throw h.context=e,h}if(!(r=o[t]))return!1;var u="function"==typeof r;switch(i=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var i=t.length,n=p(t,i),s=0;s=0;o--)if(i[o]===r||i[o].listener===r){a=i[o].listener,s=o;break}if(s<0)return this;0===s?i.shift():function(t,e){for(var r=e,i=r+1,n=t.length;i=0;s--)this.removeListener(t,i[s]);return this},n.prototype.listeners=function(t){return c(this,t,!0)},n.prototype.rawListeners=function(t){return c(this,t,!1)},n.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},n.prototype.listenerCount=d,n.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},7011:(t,e,r)=>{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")}},7042:(t,e,r)=>{var i=r(8287).Buffer;function n(t){return i.isBuffer(t)?t:i.from(t.buffer,t.byteOffset,t.byteLength)}t.exports={isBuffer:function(t){return i.isBuffer(t)||t instanceof Uint8Array},isEncoding:function(t){return i.isEncoding(t)},alloc:function(t,e,r){return i.alloc(t,e,r)},allocUnsafe:function(t){return i.allocUnsafe(t)},allocUnsafeSlow:function(t){return i.allocUnsafeSlow(t)},byteLength:function(t,e){return i.byteLength(t,e)},compare:function(t,e){return i.compare(t,e)},concat:function(t,e){return i.concat(t,e)},copy:function(t,e,r,i,s){return n(t).copy(e,r,i,s)},equals:function(t,e){return n(t).equals(e)},fill:function(t,e,r,i,s){return n(t).fill(e,r,i,s)},from:function(t,e,r){return i.from(t,e,r)},includes:function(t,e,r,i){return n(t).includes(e,r,i)},indexOf:function(t,e,r,i){return n(t).indexOf(e,r,i)},lastIndexOf:function(t,e,r,i){return n(t).lastIndexOf(e,r,i)},swap16:function(t){return n(t).swap16()},swap32:function(t){return n(t).swap32()},swap64:function(t){return n(t).swap64()},toBuffer:n,toString:function(t,e,r,i){return n(t).toString(e,r,i)},write:function(t,e,r,i,s){return n(t).write(e,r,i,s)},writeDoubleLE:function(t,e,r){return n(t).writeDoubleLE(e,r)},writeFloatLE:function(t,e,r){return n(t).writeFloatLE(e,r)},writeUInt32LE:function(t,e,r){return n(t).writeUInt32LE(e,r)},writeInt32LE:function(t,e,r){return n(t).writeInt32LE(e,r)},readDoubleLE:function(t,e){return n(t).readDoubleLE(e)},readFloatLE:function(t,e){return n(t).readFloatLE(e)},readUInt32LE:function(t,e){return n(t).readUInt32LE(e)},readInt32LE:function(t,e){return n(t).readInt32LE(e)},writeDoubleBE:function(t,e,r){return n(t).writeDoubleBE(e,r)},writeFloatBE:function(t,e,r){return n(t).writeFloatBE(e,r)},writeUInt32BE:function(t,e,r){return n(t).writeUInt32BE(e,r)},writeInt32BE:function(t,e,r){return n(t).writeInt32BE(e,r)},readDoubleBE:function(t,e){return n(t).readDoubleBE(e)},readFloatBE:function(t,e){return n(t).readFloatBE(e)},readUInt32BE:function(t,e){return n(t).readUInt32BE(e)},readInt32BE:function(t,e){return n(t).readInt32BE(e)}}},7103:function(t,e,r){var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function s(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new s(n.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new s(n.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(2791),e.setImmediate="undefined"!=typeof self&&self.setImmediate||"undefined"!=typeof globalThis&&globalThis.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||"undefined"!=typeof globalThis&&globalThis.clearImmediate||this&&this.clearImmediate},7108:(t,e,r)=>{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))}},7119:t=>{t.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},7168:(t,e,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)}},7176:(t,e,r)=>{var i,n=r(3126),s=r(5795);try{i=[].__proto__===Array.prototype}catch(t){if(!t||"object"!=typeof t||!("code"in t)||"ERR_PROTO_ACCESS"!==t.code)throw t}var o=!!i&&s&&s(Object.prototype,"__proto__"),a=Object,h=a.getPrototypeOf;t.exports=o&&"function"==typeof o.get?n([o.get]):"function"==typeof h&&function(t){return h(null==t?t:a(t))}},7180:t=>{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.decode=e.parse=r(1630),e.encode=e.stringify=r(9106)},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}},7266:(t,e,r)=>{var i=r(3549);function n(t){return i.existsSync(t)&&i.statSync(t).isFile()}t.exports=function(t,e){if(!e)return n(t);i.stat(t,(function(t,r){return t?e(t):e(null,r.isFile())}))},t.exports.sync=n},7314:(t,e,r)=>{var i=r(717),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;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),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={deprecate:r(4643)},f=r(1862),l=r(4116).Buffer,c=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var d,p=r(6278);function m(){}function g(t,e){o=o||r(6248),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(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(s(i),t._writableState.errorEmitted=!0,t.emit("error",i),S(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(6248),!(d.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)),f.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(),S(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"),S(t,e)}))}function S(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,f),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:u.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]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===y&&(t&&t._writableState instanceof g)}})):d=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,l.isBuffer(i)||i instanceof c);return a&&!l.isBuffer(t)&&(t=function(t){return l.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){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,r));return 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,S(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)}},7332:(t,e,r)=>{var i=r(9404),n=r(3209),s=r(2861).Buffer;function o(t){var e,r=t.modulus.byteLength();do{e=new i(n(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(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),n=e.modulus.byteLength(),a=new i(t).mul(r.blinder).umod(e.modulus),h=a.toRed(i.mont(e.prime1)),u=a.toRed(i.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(s,"be",n)}a.getr=o,t.exports=a},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));var n=-1;for(;++n=e.length){s++;break}var o=e.slice(2,n-1);("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&s++;o.length<8&&s++;if(s)throw new Error("decryption error");return e.slice(n)}(0,c,r);if(3===l)return c;throw new Error("unknown padding")}},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)}},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}}},7426:(t,e,r)=>{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}},7447:(t,e,r)=>{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,r){var n;if(i.isBN(t)||"number"==typeof t)n=(t=new i(t,16)).byteLength();else if("object"==typeof t)n=t.length,t=new i(t,16);else{var s=t.toString();n=s.length+1>>>1,t=new i(s,16)}"number"!=typeof r&&(r=8*n);var o=r-this.n.bitLength();return o>0&&(t=t.ushrn(o)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},l.prototype.sign=function(t,e,r,s){if("object"==typeof r&&(s=r,r=null),s||(s={}),"string"!=typeof t&&"number"!=typeof t&&!i.isBN(t)){h("object"==typeof t&&t&&"number"==typeof t.length,"Expected message to be an array-like, a hex string, or a BN instance"),h(t.length>>>0===t.length);for(var o=0;o=0)){var g=this.g.mul(m);if(!g.isInfinity()){var y=g.getX(),b=y.umod(this.n);if(0!==b.cmpn(0)){var v=m.invm(this.n).mul(b.mul(e.getPrivate()).iadd(t));if(0!==(v=v.umod(this.n)).cmpn(0)){var w=(g.getY().isOdd()?1:0)|(0!==y.cmp(b)?2:0);return s.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),w^=1),new f({r:b,s:v,recoveryParam:w})}}}}}},l.prototype.verify=function(t,e,r,i,n){n||(n={}),t=this._truncateToN(t,!1,n.msgBitLength),r=this.keyFromPublic(r,i);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")}},7526:(t,e)=>{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;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);return 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));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]+"="));return 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},7541:(t,e,r)=>{const i=r(8765),n=r(8499);t.exports={Throttle:i,ThrottleGroup:n}},7558:(t,e,r)=>{var i=r(8287).Buffer,n=r(7861),s=r(8394),o=r(8957).isIP,a=r(5221),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)return;if(!r.port)return;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)return;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)}))}},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)},7626:(t,e)=>{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(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")}},7720:(t,e,r)=>{var i=r(4765),n=Object.prototype.hasOwnProperty,s=Array.isArray,o=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),a=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},i=0;i1;){var e=t.pop(),r=e.obj[e.prop];if(s(r)){for(var i=[],n=0;n=h?a.slice(f,f+h):a,c=[],d=0;d=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||s===i.RFC1738&&(40===p||41===p)?c[c.length]=l.charAt(d):p<128?c[c.length]=o[p]:p<2048?c[c.length]=o[192|p>>6]+o[128|63&p]:p<55296||p>=57344?c[c.length]=o[224|p>>12]+o[128|p>>6&63]+o[128|63&p]:(d+=1,p=65536+((1023&p)<<10|1023&l.charCodeAt(d)),c[c.length]=o[240|p>>18]+o[128|p>>12&63]+o[128|p>>6&63]+o[128|63&p])}u+=c.join("")}return u},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(s(t)){for(var r=[],i=0;i{var i;var n=r(113).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)}},7766:(t,e,r)=>{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 S(t,e,r,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function k(t,e){var r=o(t,e,28)^o(e,t,2)^o(e,t,7);return r<0&&(r+=4294967296),r}function E(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function x(t,e){var r=o(t,e,14)^o(t,e,18)^o(e,t,9);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 I(t,e){var r=o(t,e,1)^o(t,e,8)^h(t,e,7);return r<0&&(r+=4294967296),r}function T(t,e){var r=a(t,e,1)^a(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function P(t,e){var r=o(t,e,19)^o(e,t,29)^h(t,e,6);return r<0&&(r+=4294967296),r}function C(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{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},7833:(t,e,r)=>{var i=r(717);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){}!t&&void 0!==i&&"env"in i&&(t=i.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return"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&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[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}}},7861:(t,e,r)=>{var i=r(8287).Buffer;e.Socket=u;var n=r(7007).EventEmitter,s=r(6698),o=r(1672),a=0,h={};function u(t,e){var r=this;if(n.call(r),"string"==typeof t&&(t={type:t}),"udp4"!==t.type)throw new Error("Bad socket type specified. Valid types are: udp4");"function"==typeof e&&r.on("message",e),r._destroyed=!1,r._bindState=a,r._bindTasks=[]}"object"==typeof chrome&&"object"==typeof chrome.runtime&&"string"==typeof chrome.runtime.id&&"object"==typeof chrome.sockets&&"object"==typeof chrome.sockets.udp&&(chrome.sockets.udp.onReceive.addListener((function(t){t.socketId in h?h[t.socketId]._onReceive(t):console.error("Unknown socket id: "+t.socketId)})),chrome.sockets.udp.onReceiveError.addListener((function(t){t.socketId in h?h[t.socketId]._onReceiveError(t.resultCode):console.error("Unknown socket id: "+t.socketId)}))),e.createSocket=function(t,e){return new u(t,e)},s(u,n),u.prototype.bind=function(t,e,r){var i=this;if("function"==typeof e&&(r=e,e=void 0),e||(e="0.0.0.0"),t||(t=0),i._bindState!==a)throw new Error("Socket is already bound");i._bindState=1,"function"==typeof r&&i.once("listening",r),chrome.sockets.udp.create((function(r){i.id=r.socketId,h[i.id]=i;var n=i._bindTasks.map((function(t){return t.fn}));o(n,(function(r){if(r)return i.emit("error",r);chrome.sockets.udp.bind(i.id,e,t,(function(t){t<0?i.emit("error",new Error("Socket "+i.id+" failed to bind. "+chrome.runtime.lastError.message)):chrome.sockets.udp.getInfo(i.id,(function(t){t.localPort&&t.localAddress?(i._port=t.localPort,i._address=t.localAddress,i._bindState=2,i.emit("listening"),i._bindTasks.map((function(t){t.callback()}))):i.emit("error",new Error("Cannot get local port/address for Socket "+i.id))}))}))}))}))},u.prototype._onReceive=function(t){var e=i.from(new Uint8Array(t.data)),r={address:t.remoteAddress,family:"IPv4",port:t.remotePort,size:e.length};this.emit("message",e,r)},u.prototype._onReceiveError=function(t){this.emit("error",new Error("Socket "+this.id+" receive error "+t))},u.prototype.send=function(t,e,r,n,s,o){var h,u=this;if(s||n&&"function"!=typeof n?t=function(t,e,r){if("string"==typeof t)t=i.from(t);else if(!(t instanceof i))throw new TypeError("First argument must be a buffer or string");e>>>=0,r>>>=0;var n=t.buffer;(t.byteOffset||t.byteLength!==n.byteLength)&&(n=n.slice(t.byteOffset,t.byteOffset+t.byteLength));(e||r!==t.length)&&(n=n.slice(e,r));return i.from(n)}(t,e,r):(o=n,n=e,s=r),Array.isArray(t)){if(!(h=function(t){for(var e=new Array(t.length),r=0,n=t.length;r>>=0)||n>65535)throw new RangeError("Port should be > 0 and < 65536");if("function"!=typeof o&&(o=function(){}),u._bindState===a&&u.bind(0),2!==u._bindState)return u._sendQueue||(u._sendQueue=[],u.once("listening",(function(){for(var t=0;t{},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},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}},8002:t=>{t.exports=Math.min},8068:t=>{t.exports=SyntaxError},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}}},8093:(t,e,r)=>{t.exports=r(537).inspect},8170:(t,e,r)=>{var i=r(1137),n=r(5579),s=r(4101),o=r(1241),a=r(5488),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},8179:(t,e,r)=>{const{EventEmitter:i}=r(7007),n=new Error("Stream was destroyed"),s=new Error("Premature close"),o=r(6080),a=r(5335),h=536870911,u=1^h,f=2^h,l=32,c=64,d=128,p=256,m=1024,g=2048,y=4096,b=8192,v=16384,w=32768,_=131072,M=131328,S=16^h,k=536805375,E=768^h,x=536838143,A=536739839,I=1<<18,T=2<<18,P=4<<18,C=8<<18,R=16<<18,O=32<<18,B=64<<18,L=128<<18,N=256<<18,j=512<<18,U=1024<<18,q=535822335,D=503316479,H=268435455,F=262160,z=536608751,$=8404992,W=14,K=15,V=8405006,Z=33587200,G=33587215,Y=2359296,J=270794767,X=Symbol.asyncIterator||Symbol("asyncIterator");class Q{constructor(t,{highWaterMark:e=16384,map:r=null,mapWritable:i,byteLength:n,byteLengthWritable:s}={}){this.stream=t,this.queue=new o,this.highWaterMark=e,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=s||n||St,this.map=i||r,this.afterWrite=ot.bind(this),this.afterUpdateNextTick=ut.bind(this)}get ended(){return!!(this.stream._duplexState&O)}push(t){return!(142606350&this.stream._duplexState)&&(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||St,this.map=i||r,this.pipeTo=null,this.afterRead=at.bind(this),this.afterUpdateNextTick=ht.bind(this)}get ended(){return!!(this.stream._duplexState&v)}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 rt(this.stream,t,e),e&&this.stream.on("error",kt),Mt(t))t._writableState.pipeline=this.pipeline,e&&t.on("error",kt),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",it.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=536805311&e._duplexState|1024,!1):null!==this.map&&null===(t=this.map(t))?(e._duplexState&=k,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 ot(t){const e=this.stream;t&&e.destroy(t),e._duplexState&=469499903,null!==this.drains&&function(t){for(let e=0;e0)?null:r(i)},this}_read(t){t(null)}pipe(t,e){return this._readableState.updateNextTick(),this._readableState.pipe(t,e),t}read(){return this._readableState.updateNextTick(),this._readableState.read()}push(t){return this._readableState.updateNextTickIfOpen(),this._readableState.push(t)}unshift(t){return this._readableState.updateNextTickIfOpen(),this._readableState.unshift(t)}resume(){return this._duplexState|=M,this._readableState.updateNextTick(),this}pause(){return this._duplexState&=!1===this._readableState.readAhead?536739583:536870655,this}static _fromAsyncIterator(t,e){let r;const i=new pt({...e,read(e){t.next().then(n).then(e.bind(null,null)).catch(e)},predestroy(){r=t.return()},destroy(t){if(!r)return t(null);r.then(t.bind(null,null)).catch(t)}});return i;function n(t){t.done?i.push(null):i.push(t.value)}}static from(t,e){if(Mt(r=t)&&r.readable)return t;var r;if(t[X])return this._fromAsyncIterator(t[X](),e);Array.isArray(t)||(t=void 0===t?[]:[t]);let i=0;return new pt({...e,read(e){this.push(i===t.length?null:t[i++]),e(null)}})}static isBackpressured(t){return!!(17422&t._duplexState)||t._readableState.buffered>=t._readableState.highWaterMark}static isPaused(t){return!(t._duplexState&p)}[X](){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)})),{[X](){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&v?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 mt extends dt{constructor(t){super(t),this._duplexState|=16385,this._writableState=new Q(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())}cork(){this._duplexState|=U}uncork(){this._duplexState&=H,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!==mt.prototype._writev&&r._writev!==gt.prototype._writev?Math.min(1,e.queue.length):e.queue.length)+(t._duplexState&N?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 gt extends pt{constructor(t){super(t),this._duplexState=1|this._duplexState&_,this._writableState=new Q(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final))}cork(){this._duplexState|=U}uncork(){this._duplexState&=H,this._writableState.updateNextTick()}_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 yt extends gt{constructor(t){super(t),this._transformState=new et(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(bt.bind(this))}}function bt(t,e){const r=this._transformState.afterFinal;if(t)return r(t);null!=e&&this.push(e),this.push(null),r(null)}function vt(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=Mt(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(){if(e&&t._readableState&&!t._readableState.ended)return i(s);if(r&&t._writableState&&!t._writableState.ended)return i(s)}))}function u(t){if(t&&!a){a=t;for(const e of r)e.destroy(t)}}}function wt(t){return t}function _t(t){return!!t._readableState||!!t._writableState}function Mt(t){return"number"==typeof t._duplexState&&_t(t)}function St(t){return function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.byteLength}(t)?t.byteLength:1024}function kt(){}function Et(){this.destroy(new Error("Stream aborted."))}t.exports={pipeline:vt,pipelinePromise:function(...t){return new Promise(((e,r)=>vt(...t,(t=>{if(t)return r(t);e()}))))},isStream:_t,isStreamx:Mt,isEnded:function(t){return!!t._readableState&&t._readableState.ended},isFinished:function(t){return!!t._writableState&&t._writableState.ended},isDisturbed:function(t){return!!(1&~t._duplexState)||!!(t._duplexState&Z)},getStreamError:function(t,e={}){const r=t._readableState&&t._readableState.error||t._writableState&&t._writableState.error;return e.all||r!==n?r:null},Stream:dt,Writable:mt,Readable:pt,Duplex:gt,Transform:yt,PassThrough:class extends yt{}}},8190:(t,e,r)=>{t.exports=function(t,e){let r,n,s,o=!0;Array.isArray(t)?(r=[],n=t.length):(s=Object.keys(t),r={},n=s.length);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)}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)},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{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},8287:(t,e,r)=>{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){+t!=t&&(t=0);return 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){"string"==typeof e&&""!==e||(e="utf8");if(!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);n!==r&&(i=i.slice(0,n));return 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}if(void 0!==t.length)return"number"!=typeof t.length||Y(t.length)?a(0):c(t);if("Buffer"===t.type&&Array.isArray(t.data))return c(t.data)}(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 K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(n)return i?-1:K(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 x(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(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),Y(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 E(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function x(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<=A)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 S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(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 A=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 O(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 B(t,e,r,i,n){F(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 L(t,e,r,i,n){F(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 N(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 j(t,e,r,i,s){return e=+e,r>>>=0,s||N(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||N(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||$(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||$(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||$(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||$(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){if(t=+t,e>>>=0,r>>>=0,!i){O(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){O(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||O(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||O(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||O(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||O(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||O(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 B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),h.prototype.writeBigUInt64BE=X((function(t,e=0){return L(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);O(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);O(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||O(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||O(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||O(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||O(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||O(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 B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeBigInt64BE=X((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},h.prototype.writeFloatBE=function(t,e,r){return j(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 F(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]||$(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 $(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=H(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=H(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function K(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 V(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(W,"")).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 Y(t){return t!=t}const J=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")}},8310:(t,e,r)=>{t.exports=n;var i=r(7007).EventEmitter;function n(){i.call(this)}r(6698)(n,i),n.Readable=r(5412),n.Writable=r(6708),n.Duplex=r(5382),n.Transform=r(4610),n.PassThrough=r(3600),n.finished=r(6238),n.pipeline=r(7758),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}},8330:t=>{t.exports={version:"2.6.2"}},8393:(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)}},8394:(t,e,r)=>{const i=t.exports;i.encode=r(8746),i.decode=r(4662),i.byteLength=i.encodingLength=r(6814)},8403:(t,e,r)=>{var i=r(1189),n=r(1333)(),s=r(6556),o=r(9612),a=s("Array.prototype.push"),h=s("Object.prototype.propertyIsEnumerable"),u=n?o.getOwnPropertySymbols:null;t.exports=function(t,e){if(null==t)throw new TypeError("target must be an object");var r=o(t);if(1===arguments.length)return r;for(var s=1;s{var i=r(717);const n=r(4529).ok,s=r(8310),o=r(7103),a=r(537),h=a,u=r(8287).Buffer,f=r(2728),l=f.CRLF,c=f.chunkExpression,d=f.debug,p=/^Connection$/i,m=/^Transfer-Encoding$/i,g=/close/i,y=/^Content-Length$/i,b=/^Date$/i,v=/^Expect$/i,w=/^Trailer$/i,_={connection:!0,"content-length":!0,"transfer-encoding":!0,date:!0};var M;function S(){if(!M){var t=new Date;M=t.toUTCString(),o.enroll(S,1e3-t.getMilliseconds()),o._unrefActive(S)}return M}function k(){s.call(this),this.output=[],this.outputEncodings=[],this.outputCallbacks=[],this.outputSize=0,this.writable=!0,this._last=!1,this.chunkedEncoding=!1,this.shouldKeepAlive=!0,this.useChunkedEncodingByDefault=!0,this.sendDate=!1,this._removedHeader={},this._contentLength=null,this._hasBody=!0,this._trailer="",this.finished=!1,this._headerSent=!1,this.socket=null,this.connection=null,this._header=null,this._headers=null,this._headerNames={},this._onPendingData=null}function E(t,e,r,i){if(!f._checkIsHttpToken(r))throw new TypeError('Header name must be a valid HTTP Token ["'+r+'"]');if(!0===f._checkInvalidHeaderChar(i))throw new TypeError("The header content contains invalid characters");e.messageHeader+=r+": "+I(i)+l,p.test(r)?(e.sentConnectionHeader=!0,g.test(i)?t._last=!0:t.shouldKeepAlive=!0):m.test(r)?(e.sentTransferEncodingHeader=!0,c.test(i)&&(t.chunkedEncoding=!0)):y.test(r)?e.sentContentLengthHeader=!0:b.test(r)?e.sentDateHeader=!0:v.test(r)?e.sentExpect=!0:w.test(r)&&(e.sentTrailer=!0)}function x(t,e,r){t.emit("error",e),r&&r(e)}function A(t){t.uncork()}function I(t){return/[\r\n]/.test(t)?t.replace(/[\r\n]+[ \t]*/g,""):t}S._onTimeout=function(){M=void 0},a.inherits(k,s),e.OutgoingMessage=k,k.prototype.setTimeout=function(t,e){return e&&this.on("timeout",e),this.socket?this.socket.setTimeout(t):this.once("socket",(function(e){e.setTimeout(t)})),this},k.prototype.destroy=function(t){this.socket?this.socket.destroy(t):this.once("socket",(function(e){e.destroy(t)}))},k.prototype._send=function(t,e,r){return this._headerSent||("string"==typeof t&&"hex"!==e&&"base64"!==e?t=this._header+t:(this.output.unshift(this._header),this.outputEncodings.unshift("binary"),this.outputCallbacks.unshift(null),this.outputSize+=this._header.length,"function"==typeof this._onPendingData&&this._onPendingData(this._header.length)),this._headerSent=!0),this._writeRaw(t,e,r)},k.prototype._writeRaw=function(t,e,r){"function"==typeof e&&(r=e,e=null);var n=this.connection;if(n&&n._httpMessage===this&&n.writable&&!n.destroyed){if(this.output.length>0)this._flushOutput(n);else if(0===t.length)return"function"==typeof r&&i.nextTick(r),!0;return n.write(t,e,r)}return(!n||!n.destroyed)&&this._buffer(t,e,r)},k.prototype._buffer=function(t,e,r){return this.output.push(t),this.outputEncodings.push(e),this.outputCallbacks.push(r),this.outputSize+=t.length,"function"==typeof this._onPendingData&&this._onPendingData(t.length),!1},k.prototype._storeHeader=function(t,e){var r={sentConnectionHeader:!1,sentContentLengthHeader:!1,sentTransferEncodingHeader:!1,sentDateHeader:!1,sentExpect:!1,sentTrailer:!1,messageHeader:t};if(e)for(var i,n,s=Object.keys(e),o=Array.isArray(e),a=0,h=s.length;a{this.emit("finish")};return i=this._hasBody&&this.chunkedEncoding?this._send("0\r\n"+this._trailer+"\r\n","binary",n):this._send("","binary",n),this.connection&&t&&this.connection.uncork(),this.finished=!0,d("outgoing message end."),0===this.output.length&&this.connection&&this.connection._httpMessage===this&&this._finish(),i},k.prototype._finish=function(){n(this.connection),this.emit("prefinish")},k.prototype._flush=function(){var t,e=this.socket;e&&e.writable&&(t=this._flushOutput(e),this.finished?this._finish():t&&this.emit("drain"))},k.prototype._flushOutput=function(t){var e,r=this.output.length;if(r<=0)return e;var i=this.output,n=this.outputEncodings,s=this.outputCallbacks;t.cork();for(var o=0;o{t.exports=function(t){return Math.max(16384,1<{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"]}},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})}}},8490:function(t,e,r){!function(t,e){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(8287).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,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[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=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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 S(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 S(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 k(t){S.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},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.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},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.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)},k.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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},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)}}},8545:(t,e,r)=>{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;if(0===t[e.place])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;if(128&t[r.place])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;if(128&t[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)}},8636:(t,e,r)=>{var i=r(920),n=r(7720),s=r(4765),o=Object.prototype.hasOwnProperty,a={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},h=Array.isArray,u=Array.prototype.push,f=function(t,e){u.apply(t,h(e)?e:[e])},l=Date.prototype.toISOString,c=s.default,d={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:n.encode,encodeValuesOnly:!1,format:c,formatter:s.formatters[c],indices:!1,serializeDate:function(t){return l.call(t)},skipNulls:!1,strictNullHandling:!1},p={},m=function t(e,r,s,o,a,u,l,c,m,g,y,b,v,w,_,M,S,k){for(var E,x=e,A=k,I=0,T=!1;void 0!==(A=A.get(p))&&!T;){var P=A.get(e);if(I+=1,void 0!==P){if(P===I)throw new RangeError("Cyclic object value");T=!0}void 0===A.get(p)&&(I=0)}if("function"==typeof g?x=g(r,x):x instanceof Date?x=v(x):"comma"===s&&h(x)&&(x=n.maybeMap(x,(function(t){return t instanceof Date?v(t):t}))),null===x){if(u)return m&&!M?m(r,d.encoder,S,"key",w):r;x=""}if("string"==typeof(E=x)||"number"==typeof E||"boolean"==typeof E||"symbol"==typeof E||"bigint"==typeof E||n.isBuffer(x))return m?[_(M?r:m(r,d.encoder,S,"key",w))+"="+_(m(x,d.encoder,S,"value",w))]:[_(r)+"="+_(String(x))];var C,R=[];if(void 0===x)return R;if("comma"===s&&h(x))M&&m&&(x=n.maybeMap(x,m)),C=[{value:x.length>0?x.join(",")||null:void 0}];else if(h(g))C=g;else{var O=Object.keys(x);C=y?O.sort(y):O}var B=c?r.replace(/\./g,"%2E"):r,L=o&&h(x)&&1===x.length?B+"[]":B;if(a&&h(x)&&0===x.length)return L+"[]";for(var N=0;N0?w+v:""}},8648:t=>{t.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null},8650:(t,e,r)=>{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){if(t=a(t),(e=this.makeSignature(e)).S().gte(e.eddsa.curve.n)||e.S().isNeg())return!1;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{function e(){this._types=Object.create(null),this._extensions=Object.create(null);for(let t=0;t{function e(t){return parseInt(t,10)===t}function r(t){function r(e){if(void 0===e){e=new Array(t);for(var r=0;r{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(717);const n=r(8957),s=r(537),o=r(7007),a=s.debuglog("http");function h(t){if(!(this instanceof h))return new h(t);o.call(this);var e=this;e.defaultPort=80,e.protocol="http:",e.options=s._extend({},t),e.options.path=null,e.requests={},e.sockets={},e.freeSockets={},e.keepAliveMsecs=e.options.keepAliveMsecs||1e3,e.keepAlive=e.options.keepAlive||!1,e.maxSockets=e.options.maxSockets||h.defaultMaxSockets,e.maxFreeSockets=e.options.maxFreeSockets||256,e.on("free",(function(t,r){var i=e.getName(r);if(a("agent.on(free)",i),t.writable&&e.requests[i]&&e.requests[i].length)e.requests[i].shift().onSocket(t),0===e.requests[i].length&&delete e.requests[i];else{var n=t._httpMessage;if(n&&n.shouldKeepAlive&&t.writable&&e.keepAlive){var s=e.freeSockets[i],o=s?s.length:0,h=o;e.sockets[i]&&(h+=e.sockets[i].length),h>e.maxSockets||o>=e.maxFreeSockets?t.destroy():(s=s||[],e.freeSockets[i]=s,t.setKeepAlive(!0,e.keepAliveMsecs),t.unref(),t._httpMessage=null,e.removeSocket(t,r),s.push(t))}else t.destroy()}}))}s.inherits(h,o),e.Agent=h,h.defaultMaxSockets=1/0,h.prototype.createConnection=n.createConnection,h.prototype.getName=function(t){var e=t.host||"localhost";return e+=":",t.port&&(e+=t.port),e+=":",t.localAddress&&(e+=t.localAddress),4!==t.family&&6!==t.family||(e+=":"+t.family),e},h.prototype.addRequest=function(t,e){"string"==typeof e&&(e={host:e,port:arguments[2],localAddress:arguments[3]}),e=s._extend({},e),e=s._extend(e,this.options);var r=this.getName(e);this.sockets[r]||(this.sockets[r]=[]);var n=this.freeSockets[r]?this.freeSockets[r].length:0,o=n+this.sockets[r].length;if(n){var h=this.freeSockets[r].shift();a("have free socket"),this.freeSockets[r].length||delete this.freeSockets[r],h.ref(),t.onSocket(h),this.sockets[r].push(h)}else o{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)},8835:(t,e,r)=>{var i=r(9655);function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var s=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,h=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(h),f=["%","/","?",";","#"].concat(u),l=["/","?","#"],c=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=r(5373);function b(t,e,r){if(t&&"object"==typeof t&&t instanceof n)return t;var i=new n;return i.parse(t,e,r),i}n.prototype.parse=function(t,e,r){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),o=-1!==n&&n127?R+="x":R+=C[O];if(!R.match(c)){var L=T.slice(0,x),N=T.slice(x+1),j=C.match(d);j&&(L.push(j[1]),N.unshift(j[2])),N.length&&(b="/"+N.join(".")+b),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=i.toASCII(this.hostname));var U=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+U,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!p[_])for(x=0,P=u.length;x0)&&r.host.split("@"))&&(r.auth=I.shift(),r.hostname=I.shift(),r.host=r.hostname);return r.search=t.search,r.query=t.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!M.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var k=M.slice(-1)[0],E=(r.host||t.host||M.length>1)&&("."===k||".."===k)||""===k,x=0,A=M.length;A>=0;A--)"."===(k=M[A])?M.splice(A,1):".."===k?(M.splice(A,1),x++):x&&(M.splice(A,1),x--);if(!w&&!_)for(;x--;x)M.unshift("..");!w||""===M[0]||M[0]&&"/"===M[0].charAt(0)||M.unshift(""),E&&"/"!==M.join("/").substr(-1)&&M.push("");var I,T=""===M[0]||M[0]&&"/"===M[0].charAt(0);S&&(r.hostname=T?"":M.length?M.shift():"",r.host=r.hostname,(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.hostname=I.shift(),r.host=r.hostname));return(w=w||r.host&&M.length)&&!T&&M.unshift(""),M.length>0?r.pathname=M.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=o.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)},e.parse=b,e.resolve=function(t,e){return b(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?b(t,!1,!0).resolveObject(e):e},e.format=function(t){return"string"==typeof t&&(t=b(t)),t instanceof n?t.format():n.prototype.format.call(t)},e.Url=n},8859:(t,e,r)=>{var i="function"==typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,s=i&&n&&"function"==typeof n.get?n.get:null,o=i&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,h=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=a&&h&&"function"==typeof h.get?h.get:null,f=a&&Set.prototype.forEach,l="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,c="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,m=Object.prototype.toString,g=Function.prototype.toString,y=String.prototype.match,b=String.prototype.slice,v=String.prototype.replace,w=String.prototype.toUpperCase,_=String.prototype.toLowerCase,M=RegExp.prototype.test,S=Array.prototype.concat,k=Array.prototype.join,E=Array.prototype.slice,x=Math.floor,A="function"==typeof BigInt?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,P="function"==typeof Symbol&&"object"==typeof Symbol.iterator,C="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===P||"symbol")?Symbol.toStringTag:null,R=Object.prototype.propertyIsEnumerable,O=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function B(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||M.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var i=t<0?-x(-t):x(t);if(i!==t){var n=String(i),s=b.call(e,n.length+1);return v.call(n,r,"$&_")+"."+v.call(v.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(e,r,"$&_")}var L=r(8093),N=L.custom,j=W(N)?N:null,U={__proto__:null,double:'"',single:"'"},q={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function D(t,e,r){var i=r.quoteStyle||e,n=U[i];return n+t+n}function H(t){return v.call(String(t),/"/g,""")}function F(t){return!C||!("object"==typeof t&&(C in t||void 0!==t[C]))}function z(t){return"[object Array]"===Z(t)&&F(t)}function $(t){return"[object RegExp]"===Z(t)&&F(t)}function W(t){if(P)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!T)return!1;try{return T.call(t),!0}catch(t){}return!1}t.exports=function t(e,r,i,n){var a=r||{};if(V(a,"quoteStyle")&&!V(U,a.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(V(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var h=!V(a,"customInspect")||a.customInspect;if("boolean"!=typeof h&&"symbol"!==h)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(V(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(V(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var m=a.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return Y(e,a);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var w=String(e);return m?B(e,w):w}if("bigint"==typeof e){var M=String(e)+"n";return m?B(e,M):M}var x=void 0===a.depth?5:a.depth;if(void 0===i&&(i=0),i>=x&&x>0&&"object"==typeof e)return z(e)?"[Array]":"[Object]";var I=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=k.call(Array(t.indent+1)," ")}return{base:r,prev:k.call(Array(e+1),r)}}(a,i);if(void 0===n)n=[];else if(G(n,e)>=0)return"[Circular]";function N(e,r,s){if(r&&(n=E.call(n)).push(r),s){var o={depth:a.depth};return V(a,"quoteStyle")&&(o.quoteStyle=a.quoteStyle),t(e,o,i+1,n)}return t(e,a,i+1,n)}if("function"==typeof e&&!$(e)){var q=function(t){if(t.name)return t.name;var e=y.call(g.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),K=rt(e,N);return"[Function"+(q?": "+q:" (anonymous)")+"]"+(K.length>0?" { "+k.call(K,", ")+" }":"")}if(W(e)){var J=P?v.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):T.call(e);return"object"!=typeof e||P?J:X(J)}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var it="<"+_.call(String(e.nodeName)),nt=e.attributes||[],st=0;st"}if(z(e)){if(0===e.length)return"[]";var ot=rt(e,N);return I&&!function(t){for(var e=0;e=0)return!1;return!0}(ot)?"["+et(ot,I)+"]":"[ "+k.call(ot,", ")+" ]"}if(function(t){return"[object Error]"===Z(t)&&F(t)}(e)){var at=rt(e,N);return"cause"in Error.prototype||!("cause"in e)||R.call(e,"cause")?0===at.length?"["+String(e)+"]":"{ ["+String(e)+"] "+k.call(at,", ")+" }":"{ ["+String(e)+"] "+k.call(S.call("[cause]: "+N(e.cause),at),", ")+" }"}if("object"==typeof e&&h){if(j&&"function"==typeof e[j]&&L)return L(e,{depth:x-i});if("symbol"!==h&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!s||!t||"object"!=typeof t)return!1;try{s.call(t);try{u.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var ht=[];return o&&o.call(e,(function(t,r){ht.push(N(r,e,!0)+" => "+N(t,e))})),tt("Map",s.call(e),ht,I)}if(function(t){if(!u||!t||"object"!=typeof t)return!1;try{u.call(t);try{s.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var ut=[];return f&&f.call(e,(function(t){ut.push(N(t,e))})),tt("Set",u.call(e),ut,I)}if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{l.call(t,l);try{c.call(t,c)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return Q("WeakMap");if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t,c);try{l.call(t,l)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return Q("WeakSet");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{return d.call(t),!0}catch(t){}return!1}(e))return Q("WeakRef");if(function(t){return"[object Number]"===Z(t)&&F(t)}(e))return X(N(Number(e)));if(function(t){if(!t||"object"!=typeof t||!A)return!1;try{return A.call(t),!0}catch(t){}return!1}(e))return X(N(A.call(e)));if(function(t){return"[object Boolean]"===Z(t)&&F(t)}(e))return X(p.call(e));if(function(t){return"[object String]"===Z(t)&&F(t)}(e))return X(N(String(e)));if("undefined"!=typeof window&&e===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&e===globalThis||"undefined"!=typeof globalThis&&e===globalThis)return"{ [object globalThis] }";if(!function(t){return"[object Date]"===Z(t)&&F(t)}(e)&&!$(e)){var ft=rt(e,N),lt=O?O(e)===Object.prototype:e instanceof Object||e.constructor===Object,ct=e instanceof Object?"":"null prototype",dt=!lt&&C&&Object(e)===e&&C in e?b.call(Z(e),8,-1):ct?"Object":"",pt=(lt||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(dt||ct?"["+k.call(S.call([],dt||[],ct||[]),": ")+"] ":"");return 0===ft.length?pt+"{}":I?pt+"{"+et(ft,I)+"}":pt+"{ "+k.call(ft,", ")+" }"}return String(e)};var K=Object.prototype.hasOwnProperty||function(t){return t in this};function V(t,e){return K.call(t,e)}function Z(t){return m.call(t)}function G(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return Y(b.call(t,0,e.maxStringLength),e)+i}var n=q[e.quoteStyle||"single"];return n.lastIndex=0,D(v.call(v.call(t,n,"\\$1"),/[\x00-\x1f]/g,J),"single",e)}function J(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+w.call(e.toString(16))}function X(t){return"Object("+t+")"}function Q(t){return t+" { ? }"}function tt(t,e,r,i){return t+" ("+e+") {"+(i?et(r,i):k.call(r,", "))+"}"}function et(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+k.call(t,","+r)+"\n"+e.prev}function rt(t,e){var r=z(t),i=[];if(r){i.length=t.length;for(var n=0;n{var i;if(!Object.keys){var n=Object.prototype.hasOwnProperty,s=Object.prototype.toString,o=r(1093),a=Object.prototype.propertyIsEnumerable,h=!a.call({toString:null},"toString"),u=a.call((function(){}),"prototype"),f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!c["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{l(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();i=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===s.call(t),i=o(t),a=e&&"[object String]"===s.call(t),c=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=u&&r;if(a&&t.length>0&&!n.call(t,0))for(var m=0;m0)for(var g=0;g{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");i=r?l.alloc(o-s-3,255):function(t){var e,r=l.allocUnsafe(t),i=0,s=n(2*t),o=0;for(;i=0)throw new Error("data too long for modulus")}return r?f(d,p):u(d,p)}},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(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{var i,n,s=r(717),o=r(7007),a=r(6698),h=r(8310),u=r(537).deprecate,f=r(7103),l=r(8287).Buffer,c={},d={};function p(t,e){if(!(this instanceof p))return new p(t,e);if(o.call(this),"function"==typeof t)e=t,t={},this.on("connection",e);else{if(null!=t&&"object"!=typeof t)throw new TypeError("options must be an object");t=t||{},"function"==typeof e&&this.on("connection",e)}this._connections=0,Object.defineProperty(this,"connections",{get:u((()=>this._connections),"Server.connections property is deprecated. Use Server.getConnections method instead."),set:u((t=>this._connections=t),"Server.connections property is deprecated."),configurable:!0,enumerable:!1}),this.id=null,this.connecting=!1,this.allowHalfOpen=t.allowHalfOpen||!1,this.pauseOnConnect=!!t.pauseOnConnect,this._address=null,this._host=null,this._port=null,this._backlog=null}function m(t){t.id||t.connecting||t._connections||t.emit("close")}function g(t){if(!(this instanceof g))return new g(t);if("number"==typeof t?t={fd:t}:void 0===t&&(t={}),t.handle)throw new Error("handle is not supported in Chrome Apps.");if(void 0!==t.fd)throw new Error("fd is not supported in Chrome Apps.");t.decodeStrings=!0,t.objectMode=!1,h.Duplex.call(this,t),this.destroyed=!1,this._hadError=!1,this.id=null,this._parent=null,this._host=null,this._port=null,this._pendingData=null,this.ondata=null,this.onend=null,this._init(),this._reset(),this.allowHalfOpen=t.allowHalfOpen||!1,this.on("finish",this.destroy),t.server&&(this.server=this._server=t.server,this.id=t.id,d[this.id]=this,t.pauseOnCreate&&(this._readableState.flowing=!1),this.connecting=!0,this.writable=!0,this._onConnect())}"object"==typeof chrome&&"object"==typeof chrome.runtime&&"string"==typeof chrome.runtime.id&&"object"==typeof chrome.sockets&&"object"==typeof chrome.sockets.tcpServer&&"object"==typeof chrome.sockets.tcp&&(chrome.sockets.tcpServer.onAccept.addListener((function(t){t.socketId in c?c[t.socketId]._onAccept(t.clientSocketId):console.error("Unknown server socket id: "+t.socketId)})),chrome.sockets.tcpServer.onAcceptError.addListener((function(t){t.socketId in c?c[t.socketId]._onAcceptError(t.resultCode):console.error("Unknown server socket id: "+t.socketId)})),chrome.sockets.tcp.onReceive.addListener((function(t){t.socketId in d?d[t.socketId]._onReceive(t.data):console.error("Unknown socket id: "+t.socketId)})),chrome.sockets.tcp.onReceiveError.addListener((function(t){if(t.socketId in d)d[t.socketId]._onReceiveError(t.resultCode);else{if(-100===t.resultCode)return;console.error("Unknown socket id: "+t.socketId)}}))),e.createServer=function(t,e){return new p(t,e)},e.connect=e.createConnection=function(){const t=arguments.length;for(var e=new Array(t),r=0;r=0)throw new Error("fd is not supported in Chrome Apps.");if(n.backlog&&(i=n.backlog),!("number"==typeof n.port||"string"==typeof n.port||void 0===n.port&&"port"in n))throw n.path&&_(n.path)?new Error("Pipes are not supported in Chrome Apps."):new Error("Invalid listen argument: "+n);e=n.host||null,r=n.port}else{if(_(arguments[0]))throw new Error("Pipes are not supported in Chrome Apps.");e=void 0===arguments[1]||"function"==typeof arguments[1]||"number"==typeof arguments[1]?null:arguments[1]}this.id&&this.close(),function(t){if(void 0!==t&&!M(t))throw new RangeError('"port" argument must be >= 0 and < 65536')}(r),this._port=0|r,this._host=e;var s=!this._host;return s&&(this._host="::"),this._backlog="number"==typeof i?i:void 0,this.connecting=!0,chrome.sockets.tcpServer.create((t=>{if(!this.connecting||this.id)return S(),void chrome.sockets.tcpServer.close(t.socketId);if(chrome.runtime.lastError)this.emit("error",new Error(chrome.runtime.lastError.message));else{var e=this.id=t.socketId;c[this.id]=this;var r=()=>chrome.sockets.tcpServer.listen(this.id,this._host,this._port,this._backlog,(t=>{if(this.id===e)return 0!==t&&s?(S(),this._host="0.0.0.0",s=!1,r()):void this._onListen(t);S()}));r()}})),this},p.prototype._onListen=function(t){if(this.connecting=!1,0===t){var e=this.id;chrome.sockets.tcpServer.getInfo(this.id,(t=>{this.id===e?chrome.runtime.lastError?this._onListen(-2):(this._address={port:t.localPort,family:t.localAddress&&-1!==t.localAddress.indexOf(":")?"IPv6":"IPv4",address:t.localAddress},this.emit("listening")):S()}))}else this.emit("error",I(t,"listen",this._host,this._port)),this.id&&(chrome.sockets.tcpServer.close(this.id),delete c[this.id],this.id=null)},p.prototype._onAccept=function(t){if(this.maxConnections&&this._connections>=this.maxConnections)return chrome.sockets.tcp.close(t),void console.warn("Rejected connection - hit `maxConnections` limit");this._connections+=1;var e=new g({server:this,id:t,allowHalfOpen:this.allowHalfOpen,pauseOnCreate:this.pauseOnConnect});e.on("connect",(()=>this.emit("connection",e)))},p.prototype._onAcceptError=function(t){this.emit("error",A(t,"accept")),this.close()},p.prototype.close=function(t){return"function"==typeof t&&(this.id?this.once("close",t):this.once("close",(()=>t(new Error("Not running"))))),this.id&&(chrome.sockets.tcpServer.close(this.id),delete c[this.id],this.id=null),this._address=null,this.connecting=!1,this._emitCloseIfDrained(),this},p.prototype._emitCloseIfDrained=function(){this.id||this.connecting||this._connections||s.nextTick(m,this)},Object.defineProperty(p.prototype,"listening",{get:function(){return!!this._address},configurable:!0,enumerable:!0}),p.prototype.address=function(){return this._address},p.prototype.unref=p.prototype.ref=function(){return this},p.prototype.getConnections=function(t){s.nextTick(t,null,this._connections)},a(g,h.Duplex),e.Socket=g,g.prototype._init=function(){this.bytesRead=0,this._bytesDispatched=0,this.server=null,this._server=null},g.prototype._reset=function(){this.remoteAddress=this.remotePort=this.localAddress=this.localPort=null,this.remoteFamily="IPv4",this.readable=this.writable=!1,this.connecting=!1},g.prototype.connect=function(){const t=arguments.length;for(var e=new Array(t),r=0;r= 0 and < 65536: '+this._port)}return this._port|=0,this._init(),this._unrefTimer(),"function"==typeof n&&this.once("connect",n),chrome.sockets.tcp.create((t=>{if(!this.connecting||this.id)return S(),void chrome.sockets.tcp.close(t.socketId);chrome.runtime.lastError?this.destroy(new Error(chrome.runtime.lastError.message)):(this.id=t.socketId,d[this.id]=this,chrome.sockets.tcp.setPaused(this.id,!0),chrome.sockets.tcp.connect(this.id,this._host,this._port,(e=>{this.id===t.socketId?0===e?(this._unrefTimer(),this._onConnect()):this.destroy(I(e,"connect",this._host,this._port)):S()})))})),this},g.prototype._onConnect=function(){var t=this.id;chrome.sockets.tcp.getInfo(this.id,(e=>{this.id===t?chrome.runtime.lastError?this.destroy(new Error(chrome.runtime.lastError.message)):(this.remoteAddress=e.peerAddress,this.remoteFamily=e.peerAddress&&-1!==e.peerAddress.indexOf(":")?"IPv6":"IPv4",this.remotePort=e.peerPort,this.localAddress=e.localAddress,this.localPort=e.localPort,this.connecting=!1,this.readable=!0,this.emit("connect"),this.isPaused()||this.read(0)):S()}))},Object.defineProperty(g.prototype,"bufferSize",{get:function(){if(this.id){var t=this._writableState.length;return this._pendingData&&(t+=this._pendingData.length),t}}}),g.prototype.end=function(t,e){h.Duplex.prototype.end.call(this,t,e),this.writable=!1},g.prototype._write=function(t,e,r){if(r||(r=()=>{}),this.connecting)return this._pendingData=t,void this.once("connect",(()=>this._write(t,e,r)));if(this._pendingData=null,this.id){var i=t.buffer;t.byteLength!==i.byteLength&&(i=i.slice(t.byteOffset,t.byteOffset+t.byteLength));var n=this.id;chrome.sockets.tcp.send(this.id,i,(t=>{this.id===n?t.resultCode<0?this._destroy(I(t.resultCode,"write",this.remoteAddress,this.remotePort),r):(this._unrefTimer(),r(null)):S()})),this._bytesDispatched+=t.length}else r(new Error("This socket is closed"))},g.prototype._read=function(t){if(!this.connecting&&this.id){chrome.sockets.tcp.setPaused(this.id,!1);var e=this.id;chrome.sockets.tcp.getInfo(this.id,(t=>{this.id===e?!chrome.runtime.lastError&&t.connected||this._onReceiveError(-15):S()}))}else this.once("connect",(()=>this._read(t)))},g.prototype._onReceive=function(t){var e=l.from(t),r=this.bytesRead;this.bytesRead+=e.length,this._unrefTimer(),this.ondata&&(console.error("socket.ondata = func is non-standard, use socket.on('data', func)"),this.ondata(e,r,this.bytesRead)),this.push(e)||chrome.sockets.tcp.setPaused(this.id,!0)},g.prototype._onReceiveError=function(t){-100===t?(this.onend&&(console.error("socket.onend = func is non-standard, use socket.on('end', func)"),this.once("end",this.onend)),this.push(null),this.destroy()):t<0&&this.destroy(A(t,"read"))},i="bytesWritten",n=function(){if(this.id)return this._bytesDispatched+this.bufferSize},Object.defineProperty(g.prototype,i,{configurable:!1,enumerable:!0,get:n}),g.prototype.destroy=function(t){this._destroy(t)},g.prototype._destroy=function(t,e){var r=()=>{e&&e(t),t&&!this._writableState.errorEmitted&&(s.nextTick(E,this,t),this._writableState.errorEmitted=!0)};if(this.destroyed)r();else{this._server&&(this._server._connections-=1,this._server._emitCloseIfDrained&&this._server._emitCloseIfDrained()),this._reset();for(var i=this;null!==i;i=i._parent)f.unenroll(i);this.destroyed=!0,this.id&&(delete d[this.id],chrome.sockets.tcp.close(this.id,(()=>{this.destroyed&&this.emit("close",!!t)})),this.id=null),r()}},g.prototype.destroySoon=function(){this.writable&&this.end(),this._writableState.finished&&this.destroy()},g.prototype.setTimeout=function(t,e){return 0===t?(f.unenroll(this),e&&this.removeListener("timeout",e)):(f.enroll(this,t),f._unrefActive(this),e&&this.once("timeout",e)),this},g.prototype._onTimeout=function(){this.emit("timeout")},g.prototype._unrefTimer=function(){for(var t=this;null!==t;t=t._parent)f._unrefActive(t)},g.prototype.setNoDelay=function(t,e){return this.id?(t=void 0===t||!!t,chrome.sockets.tcp.setNoDelay(this.id,t,k(e)),this):(this.once("connect",(()=>this.setNoDelay(t,e))),this)},g.prototype.setKeepAlive=function(t,e,r){return this.id?(chrome.sockets.tcp.setKeepAlive(this.id,!!t,~~(e/1e3),k(r)),this):(this.once("connect",(()=>this.setKeepAlive(t,e,r))),this)},g.prototype.address=function(){return{address:this.localAddress,port:this.localPort,family:this.localAddress&&-1!==this.localAddress.indexOf(":")?"IPv6":"IPv4"}},Object.defineProperty(g.prototype,"_connecting",{get:function(){return this.connecting}}),Object.defineProperty(g.prototype,"readyState",{get:function(){return this.connecting?"opening":this.readable&&this.writable?"open":"closed"}}),g.prototype.unref=g.prototype.ref=function(){return this};var y=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,b=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;function v(t){var e={};if(null!==t[0]&&"object"==typeof t[0])e=t[0];else{if(_(t[0]))throw new Error("Pipes are not supported in Chrome Apps.");e.port=t[0],"string"==typeof t[1]&&(e.host=t[1])}var r=t[t.length-1];return"function"==typeof r?[e,r]:[e]}function w(t){return(t=Number(t))>=0&&t}function _(t){return"string"==typeof t&&!1===w(t)}function M(t){return!("number"!=typeof t&&"string"!=typeof t||"string"==typeof t&&0===t.trim().length)&&(+t==+t>>>0&&t<=65535)}function S(){chrome.runtime.lastError}function k(t){return()=>{var e;chrome.runtime.lastError&&(console.error(chrome.runtime.lastError.message),e=new Error(chrome.runtime.lastError.message)),t&&t(e)}}function E(t,e){t.emit("error",e)}e.isIPv4=y.test.bind(y),e.isIPv6=b.test.bind(b),e.isIP=function(t){return e.isIPv4(t)?4:e.isIPv6(t)?6:0};var x={"-10":"EACCES","-22":"EACCES","-138":"EACCES","-147":"EADDRINUSE","-108":"EADDRNOTAVAIL","-103":"ECONNABORTED","-102":"ECONNREFUSED","-101":"ECONNRESET","-16":"EEXIST","-8":"EFBIG","-109":"EHOSTUNREACH","-4":"EINVAL","-23":"EISCONN","-6":"ENOENT","-13":"ENOMEM","-106":"ENONET","-18":"ENOSPC","-11":"ENOSYS","-15":"ENOTCONN","-105":"ENOTFOUND","-118":"ETIMEDOUT","-100":"EOF"};function A(t,e,r){var i=x[t]||"UNKNOWN",n=e+" "+t+" "+r;chrome.runtime.lastError&&(n+=" "+chrome.runtime.lastError.message),n+=" (mapped uv code: "+i+")";var s=new Error(n);return s.code=s.errno=i,s.syscall=e,s}function I(t,e,r,i,n){var s;s=i&&i>0?r+":"+i:r,n&&(s+=" - Local ("+n+")");var o=A(t,e,s);return o.address=r,i&&(o.port=i),o}},8968:t=>{t.exports=Math.floor},9106:t=>{var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,r,i,n){return r=r||"&",i=i||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(n){var s=encodeURIComponent(e(n))+i;return Array.isArray(t[n])?t[n].map((function(t){return s+encodeURIComponent(e(t))})).join(r):s+encodeURIComponent(e(t[n]))})).filter(Boolean).join(r):n?encodeURIComponent(e(n))+i+encodeURIComponent(e(t)):""}},9133:t=>{t.exports=Math.abs},9188:(t,e,r)=>{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)}},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}},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())}},9290:t=>{t.exports=RangeError},9353:t=>{var e=Object.prototype.toString,r=Math.max,i=function(t,e){for(var r=[],i=0;i{t.exports=Error},9404:function(t,e,r){!function(t,e){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(8287).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];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)};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.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],S=8191&M,k=M>>>13,E=0|o[5],x=8191&E,A=E>>>13,I=0|o[6],T=8191&I,P=I>>>13,C=0|o[7],R=8191&C,O=C>>>13,B=0|o[8],L=8191&B,N=B>>>13,j=0|o[9],U=8191&j,q=j>>>13,D=0|a[0],H=8191&D,F=D>>>13,z=0|a[1],$=8191&z,W=z>>>13,K=0|a[2],V=8191&K,Z=K>>>13,G=0|a[3],Y=8191&G,J=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,H))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,H)|0))<<13)|0;u=((s=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,F))+Math.imul(m,H)|0,s=Math.imul(m,F);var yt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(c,$)|0))<<13)|0;u=((s=s+Math.imul(c,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,H),n=(n=Math.imul(y,F))+Math.imul(b,H)|0,s=Math.imul(b,F),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,W)|0;var bt=(u+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,V)|0))<<13)|0;u=((s=s+Math.imul(c,Z)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,H),n=(n=Math.imul(w,F))+Math.imul(_,H)|0,s=Math.imul(_,F),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,Z)|0;var vt=(u+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;u=((s=s+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,H),n=(n=Math.imul(S,F))+Math.imul(k,H)|0,s=Math.imul(k,F),i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,J)|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(x,H),n=(n=Math.imul(x,F))+Math.imul(A,H)|0,s=Math.imul(A,F),i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,J)|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(T,H),n=(n=Math.imul(T,F))+Math.imul(P,H)|0,s=Math.imul(P,F),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(A,$)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,J)|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,H),n=(n=Math.imul(R,F))+Math.imul(O,H)|0,s=Math.imul(O,F),i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|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 St=(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)+(St>>>26)|0,St&=67108863,i=Math.imul(L,H),n=(n=Math.imul(L,F))+Math.imul(N,H)|0,s=Math.imul(N,F),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,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 kt=(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)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,H),n=(n=Math.imul(U,F))+Math.imul(q,H)|0,s=Math.imul(q,F),i=i+Math.imul(L,$)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(P,Y)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,s=s+Math.imul(k,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 Et=(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)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,W))+Math.imul(q,$)|0,s=Math.imul(q,W),i=i+Math.imul(L,V)|0,n=(n=n+Math.imul(L,Z)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(A,rt)|0,s=s+Math.imul(A,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(k,st)|0,s=s+Math.imul(k,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 xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(q,V)|0,s=Math.imul(q,Z),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,ht)|0,s=s+Math.imul(k,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 At=(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)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(q,Y)|0,s=Math.imul(q,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(T,st)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(A,ht)|0,s=s+Math.imul(A,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,s=s+Math.imul(k,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(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(P,ht)|0,s=s+Math.imul(P,ut)|0,i=i+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,ct)|0;var Tt=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((s=s+Math.imul(k,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=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(L,st)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(O,ht)|0,s=s+Math.imul(O,ut)|0,i=i+Math.imul(T,lt)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(P,lt)|0,s=s+Math.imul(P,ct)|0;var Pt=(u+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=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(L,ht)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(N,ht)|0,s=s+Math.imul(N,ut)|0,i=i+Math.imul(R,lt)|0,n=(n=n+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,s=s+Math.imul(O,ct)|0;var Ct=(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=((s=s+Math.imul(P,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=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(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(N,lt)|0,s=s+Math.imul(N,ct)|0;var Rt=(u+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((s=s+Math.imul(O,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 Ot=(u+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=kt,h[9]=Et,h[10]=xt,h[11]=At,h[12]=It,h[13]=Tt,h[14]=Pt,h[15]=Ct,h[16]=Rt,h[17]=Ot,h[18]=Bt,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 x(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 S(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(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 A(t){x.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 S;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return w[t]=e,e},x.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},x.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")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(f(t,t.umod(this.m)._forceRed(this)),t)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.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)},x.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},x.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)},x.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},x.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},x.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.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},x.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},x.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new A(t)},n(A,x),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.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)},A.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)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9439:(t,e,r)=>{e.RateLimiter=r(3065),e.TokenBucket=r(5472)},9538:t=>{t.exports=ReferenceError},9560:(t,e,r)=>{e.utils=r(7626),e.Cipher=r(2808),e.DES=r(2211),e.CBC=r(3389),e.EDE=r(5279)},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)))},9612:t=>{t.exports=Object},9639:(t,e,r)=>{r.d(e,{NJ:()=>y,V5:()=>o,dU:()=>p,HB:()=>b,xW:()=>h,LC:()=>u,tW:()=>k,fk:()=>a,Ht:()=>v,po:()=>E,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)=>{if(!e)return d.decode(t);return new TextDecoder(e).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?S[e](i):i},E=t=>{const e=new Uint8Array(t);return _.getRandomValues(e)}},9655:function(t,e,r){var i;t=r.nmd(t),function(){e&&e.nodeType,t&&t.nodeType;var n="object"==typeof globalThis&&globalThis;n.global!==n&&n.window!==n&&n.self;var s,o=2147483647,a=36,h=/^xn--/,u=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},c=Math.floor,d=String.fromCharCode;function p(t){throw new RangeError(l[t])}function m(t,e){for(var r=t.length,i=[];r--;)i[r]=e(t[r]);return i}function g(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+m((t=t.replace(f,".")).split("."),e).join(".")}function y(t){for(var e,r,i=[],n=0,s=t.length;n=55296&&e<=56319&&n65535&&(e+=d((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=d(t)})).join("")}function v(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function w(t,e,r){var i=0;for(t=r?c(t/700):t>>1,t+=c(t/e);t>455;i+=a)t=c(t/35);return c(i+36*t/(t+38))}function _(t){var e,r,i,n,s,h,u,f,l,d,m,g=[],y=t.length,v=0,_=128,M=72;for((r=t.lastIndexOf("-"))<0&&(r=0),i=0;i=128&&p("not-basic"),g.push(t.charCodeAt(i));for(n=r>0?r+1:0;n=y&&p("invalid-input"),((f=(m=t.charCodeAt(n++))-48<10?m-22:m-65<26?m-65:m-97<26?m-97:a)>=a||f>c((o-v)/h))&&p("overflow"),v+=f*h,!(f<(l=u<=M?1:u>=M+26?26:u-M));u+=a)h>c(o/(d=a-l))&&p("overflow"),h*=d;M=w(v-s,e=g.length+1,0==s),c(v/e)>o-_&&p("overflow"),_+=c(v/e),v%=e,g.splice(v++,0,_)}return b(g)}function M(t){var e,r,i,n,s,h,u,f,l,m,g,b,_,M,S,k=[];for(b=(t=y(t)).length,e=128,r=0,s=72,h=0;h=e&&gc((o-r)/(_=i+1))&&p("overflow"),r+=(u-e)*_,e=u,h=0;ho&&p("overflow"),g==e){for(f=r,l=a;!(f<(m=l<=s?1:l>=s+26?26:l-s));l+=a)S=f-m,M=a-m,k.push(d(v(m+S%M,0))),f=c(S/M);k.push(d(v(f,0))),s=w(r,_,i==n),r=0,++i}++r,++e}return k.join("")}s={version:"1.4.1",ucs2:{decode:y,encode:b},decode:_,encode:M,toASCII:function(t){return g(t,(function(t){return u.test(t)?"xn--"+M(t):t}))},toUnicode:function(t){return g(t,(function(t){return h.test(t)?_(t.slice(4).toLowerCase()):t}))}},void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()},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)},9675:t=>{t.exports=TypeError},9957:(t,e,r)=>{var i=Function.prototype.call,n=Object.prototype.hasOwnProperty,s=r(6743);t.exports=s.call(i,n)},9971:(t,e,r)=>{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;if(e.length<=i&&0!==n)return t.left;return 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}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var s=e[i]={id:i,loaded:!1,exports:{}};return t[i].call(s.exports,s,s.exports,r),s.loaded=!0,s.exports}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})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var i={};r.r(i),r.d(i,{ACTIONS:()=>Yt,CONNECTION_ID:()=>Gt,DESTROY_TIMEOUT:()=>ee,EVENTS:()=>Jt,EVENT_IDS:()=>Xt,EVENT_NAMES:()=>Qt,IPV4_RE:()=>Kt,IPV6_RE:()=>Vt,REMOVE_IPV4_MAPPED_IPV6_RE:()=>Zt,REQUEST_TIMEOUT:()=>te,querystringParse:()=>ie,querystringStringify:()=>ne,toUInt32:()=>re});var n=r(7007);function s(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function o(t,e){let r,i="",n=0,s=-1,o=0;for(let a=0;a<=t.length;++a){if(a2){const t=i.lastIndexOf("/");if(t!==i.length-1){-1===t?(i="",n=0):(i=i.slice(0,t),n=i.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}function a(t){if(s(t),0===t.length)return".";const 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}function h(){if(0===arguments.length)return".";let t;for(let e=0;e0&&(void 0===t?t=r:t+="/"+r)}return void 0===t?".":a(t)}r(717);const u="/";var f=r(988),l=r(1467),c=r(8444),d=r(7266);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("|"));function m(t){return p.test(t)}function g(t){return!m(t)}var y=r(405),b=r(8190),v=r(9596),w=r(9639),_=(r(3468),r(5185)),M=r(3519);function S(t){return"."!==t[0]}function k(t,e,r){_.stat(t,((i,n)=>{if(i)return r(i);n.isDirectory()?_.readdir(t,((i,n)=>{if(i)return r(i);b(n.filter(S).filter(g).map((r=>i=>{k(h(t,r),e,i)})),r)})):n.isFile()&&e(t,r)}))}function E(t,e,r){k(t,x,((i,n)=>{if(i)return r(i);n=Array.isArray(n)?n.flat(1/0):[n],t=a(t),e&&(t=t.slice(0,t.lastIndexOf(u)+1)),t[t.length-1]!==u&&(t+=u),n.forEach((e=>{e.getStream=function(t){return()=>_.createReadStream(t)}(e.path),e.path=e.path.replace(t,"").split(u)})),r(null,n)}))}function x(t,e){e=M(e),_.stat(t,((r,i)=>{if(r)return e(r);const n={length:i.size,path:t};e(null,n)}))}const A=[["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"]];const I=Symbol("itemPath");function T(t,e,r){var i;if(i=t,"undefined"!=typeof FileList&&i 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=>R(t)&&"string"==typeof t.path?t.path:t))).length||"string"==typeof t[0]||t[0].name||(t[0].name=e.name);let n=null;t.forEach(((e,r)=>{if("string"==typeof e)return;let i=e.fullPath||e.name;i||(i=`Unknown File ${r+1}`,e.unknownName=!0),e[I]=i.split("/"),e[I][0]||e[I].shift(),e[I].length<2?n=null:0===r&&t.length>1?n=e[I][0]:e[I][0]!==n&&(n=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]&&m(e)}(t[I])))),n&&t.forEach((t=>{const e=(ArrayBuffer.isView(t)||O(t))&&!t[I];"string"==typeof t||e||t[I].shift()})),!e.name&&n&&(e.name=n),e.name||t.some((t=>"string"==typeof t?(e.name=function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');s(t);let r,i=0,n=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let s=e.length-1,a=-1;for(r=t.length-1;r>=0;--r){const h=t.charCodeAt(r);if(47===h){if(!o){i=r+1;break}}else-1===a&&(o=!1,a=r+1),s>=0&&(h===e.charCodeAt(s)?-1==--s&&(n=r):(s=-1,n=a))}return i===n?n=a:-1===n&&(n=t.length),t.slice(i,n)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!o){i=r+1;break}}else-1===n&&(o=!1,n=r+1);return-1===n?"":t.slice(i,n)}(t),!0):!t.unknownName&&(e.name=t[I][t[I].length-1],!0))),e.name||(e.name=`Unnamed Torrent ${Date.now()}`),e.maxPieceLength||(e.maxPieceLength=4194304);const o=t.reduce(((t,e)=>t+Number("string"==typeof e)),0);let a=1===t.length;function h(){b(t.map((t=>e=>{const r={};if(R(t))r.getStream=t.stream(),r.length=t.size;else if(ArrayBuffer.isView(t))r.getStream=[t],r.length=t.length;else{if(!O(t)){if("string"==typeof t){0;return void E(t,o>1||a,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[I],e(null,r)})),((t,e)=>{if(t)return r(t);e=e.flat(),r(null,e,a)}))}1===t.length&&"string"==typeof t[0]?d(t[0],((t,e)=>{if(t)return r(t);a=e,h()})):v(h)}const P=5;function C(t,e){return t+e.length}function R(t){return"undefined"!=typeof Blob&&t instanceof Blob}function O(t){return"object"==typeof t&&null!=t&&"function"==typeof t.pipe}const B=function(t,e,r){"function"==typeof e&&([e,r]=[r,e]),T(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(A));"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(C,0),o=e.pieceLength||Math.min(c(s),e.maxPieceLength);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(y(h),e,{zeroPadding:!1});try{for await(const t of p)await new Promise((e=>{o+=t.length;const i=c;++c,++f{s[i]=h,--f,a+=t.length,u&&u(a,r),e(),d&&0===f&&n(null,(0,w.fk)(s.join("")),o)}))}));if(0===f)return n(null,(0,w.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)}))};var L=r(7833),N=r(9971),j=r(4988),U=r(7180),q=r(8454),D=r(3209),H=r(5307),F=r(1565),z=r(8287).Buffer,$=r(717);const W=L("bittorrent-dht"),K=3e5;class V extends n.EventEmitter{constructor(t={}){super(),this._tables=new q({maxAge:K,max:t.maxTables||1e3}),this._values=new q(t.maxValues||1e3),this._peers=H({maxAge:t.maxAge||0,maxSize:t.maxPeers||1e4}),this._secrets=null,this._hash=t.hash||G,this._hashLength=this._hash(z.from("")).length,this._rpc=t.krpc||j(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()}),K),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=U((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})})),$.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=tt(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(tt(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&&z.isBuffer(n.r.id)&&n.r.id.length===r._hashLength?z.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(Q),values:e}}put(t,e){(z.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&&!z.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=Z);const r=!!t.k,i="string"==typeof t.v?z.from(t.v):t.v,n=r?this._hash(t.salt?z.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(X(o.a)):z.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=tt(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=Y(this._rpc.id,null,s),$.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;e.salt&&(o.salt=z.from(e.salt));if(a){if(!i||!o.sig||!o.k)return!0;if(!i(o.sig,X(o),o.k))return!0;n(o.salt?z.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=tt(t),r||(r=Z);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=tt(t),e||(e=Z);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=z.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,Y(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?z.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,X(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 $.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 N({localNodeId:t,numberOfNodesPerKBucket:this._rpc.k});this._rpc.closest(t,e,(function(e,i){if(!e.r)return!0;e.r.token&&e.r.id&&z.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}));return!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(!W.enabled)return;const t=[].slice.call(arguments);t[0]=`[${this.nodeId.toString("hex").substring(0,7)}] ${t[0]}`;for(let e=1;e{throw new Error("global fetch is not available!")}),st=[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 ot=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,w.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)};function at(t){return t.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))}),[])}const ht=function(t){const e={},r=t.split("magnet:?")[1];let i;if((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=at(decodeURIComponent(n).split(","))),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,w.V5)(ot(i[1])):(i=t.match(/^urn:btmh:1220(.{64})/))&&(e.infoHashV2=i[1].toLowerCase())}))}if(e.xs){(Array.isArray(e.xs)?e.xs:[e.xs]).forEach((t=>{(i=t.match(/^urn:btpk:(.{64})/))&&(e.publicKey=i[1].toLowerCase())}))}return e.infoHash&&(e.infoHashBuffer=(0,w.fk)(e.infoHash)),e.infoHashV2&&(e.infoHashV2Buffer=(0,w.fk)(e.infoHashV2)),e.publicKey&&(e.publicKeyBuffer=(0,w.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 ut(t){if("string"==typeof t&&/^(stream-)?magnet:/.test(t)){const e=ht(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 ht(`magnet:?xt=urn:btih:${t}`);if(ArrayBuffer.isView(t)&&20===t.length)return ht(`magnet:?xt=urn:btih:${(0,w.V5)(t)}`);if(ArrayBuffer.isView(t))return await async function(t){ArrayBuffer.isView(t)&&(t=f.A.decode(t));ct(t.info,"info"),ct(t.info["name.utf-8"]||t.info.name,"info.name"),ct(t.info["piece length"],"info['piece length']"),ct(t.info.pieces,"info.pieces"),t.info.files?t.info.files.forEach((t=>{ct("number"==typeof t.length,"info.files[0].length"),ct(t["path.utf-8"]||t.path,"info.files[0].path")})):ct("number"==typeof t.info.length,"info.length");const e={info:t.info,infoBuffer:f.A.encode(t.info),name:(0,w.dU)(t.info["name.utf-8"]||t.info.name),announce:[]};e.infoHashBuffer=await(0,w.tW)(e.infoBuffer),e.infoHash=(0,w.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,w.dU)(t["created by"]));ArrayBuffer.isView(t.comment)&&(e.comment=(0,w.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,w.dU)(t))}))})):t.announce&&e.announce.push((0,w.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,w.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,w.dU)(t):t));return{path:h.apply(null,[u].concat(n)).slice(1),name:n[n.length-1],length:t.length,offset:r.slice(0,i).reduce(lt,0)}})),e.length=r.reduce(lt,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(n=t,"undefined"!=typeof Blob&&n instanceof Blob)try{s(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 nt(t,{headers:{"user-agent":"WebTorrent (https://webtorrent.io)"},signal:AbortSignal.timeout(3e4),...e});s(new Uint8Array(await r.arrayBuffer()))}catch(t){return r(new Error(`Error downloading torrent: ${t.message}`))}else"function"==typeof it.readFile&&"string"==typeof t?it.readFile(t,((t,e)=>{if(t)return r(new Error("Invalid torrent identifier"));s(e)})):v((()=>{r(new Error("Invalid torrent identifier"))}));var n;async function s(t){try{i=await ut(t)}catch(t){return r(t)}i&&i.infoHash?r(null,i):r(new Error("Invalid torrent identifier"))}}function lt(t,e){return t+e.length}function ct(t,e){if(!t)throw new Error(`Torrent is missing required field: ${e}`)}const dt=ut,pt=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,w.V5)(t.infoHashBuffer)}`),t.infoHash&&e.add(`urn:btih:${t.infoHash}`),t.infoHashV2Buffer&&e.add(t.xt=`urn:btmh:1220${(0,w.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,w.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},mt="undefined"!=typeof window?window:self,gt=mt.RTCPeerConnection||mt.mozRTCPeerConnection||mt.webkitRTCPeerConnection,yt=mt.RTCSessionDescription||mt.mozRTCSessionDescription||mt.webkitRTCSessionDescription,bt=mt.RTCIceCandidate||mt.mozRTCIceCandidate||mt.webkitRTCIceCandidate;mt.RTCIceTransport,mt.RTCDataChannel,mt.RTCSctpTransport,mt.RTCDtlsTransport,mt.RTCCertificate,mt.MediaStream,mt.MediaStreamTrack,mt.MediaStreamTrackEvent,mt.RTCPeerConnectionIceEvent,mt.RTCDataChannelEvent,mt.RTCTrackEvent,mt.RTCError,mt.RTCErrorEvent,mt.RTCRtpTransceiver,mt.RTCRtpReceiver,mt.RTCRtpSender;var vt=r(8179),wt=r(6310);const _t=L("simple-peer"),Mt=65536;function St(t){return t.replace(/a=ice-options:trickle\s\n/g,"")}class kt extends vt.Duplex{_pc;constructor(t){if(super(t=Object.assign({allowHalfOpen:!1},t)),this.__objectMode=!!t.objectMode,this._id=(0,w.V5)((0,w.po)(4)).slice(0,7),this._debug("new peer %o",t),this.channelName=t.initiator?t.channelName||(0,w.V5)((0,w.po)(20)):null,this.initiator=t.initiator||!1,this.channelConfig=t.channelConfig||kt.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},kt.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,!gt)throw"undefined"==typeof window?wt(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):wt(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 gt(this.config)}catch(t){return void this.__destroy(wt(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(wt(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 wt(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 yt(t)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((t=>{this._addIceCandidate(t)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((t=>{this.__destroy(wt(t,"ERR_SET_REMOTE_DESCRIPTION"))})),t.sdp||t.candidate||t.renegotiate||t.transceiverRequest||this.__destroy(wt(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(t){const e=new bt(t);this._pc.addIceCandidate(e).catch((t=>{var r;!e.address||e.address.endsWith(".local")?(r="Ignoring unsupported ICE candidate.",console.warn(r)):this.__destroy(wt(t,"ERR_ADD_ICE_CANDIDATE"))}))}send(t){if(!this._destroying){if(this.destroyed)throw wt(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(t)}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,queueMicrotask((()=>{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 wt(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(wt(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=Mt),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(wt(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(wt(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(t)}catch(t){return this.__destroy(wt(t,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>Mt?(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=St(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(wt(t,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((t=>{this.__destroy(wt(t,"ERR_CREATE_OFFER"))}))}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then((t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=St(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(wt(t,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((t=>{this.__destroy(wt(t,"ERR_CREATE_ANSWER"))}))}_onConnectionStateChange(){this.destroyed||this._destroying||"failed"===this._pc.connectionState&&this.__destroy(wt(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(wt(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.__destroy(wt(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(wt(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>Mt||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,w.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],_t.apply(null,t)}}kt.WEBRTC_SUPPORT=!!gt,kt.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},kt.channelConfig={};const Et=kt;var xt=r(1035),At=r(7541),It=r(3278),Tt=r(8957),Pt=r(5658),Ct=r(4343);const Rt=L("webtorrent:conn-pool");class Ot{constructor(t){Rt("create pool (port %s)",t.torrentPort),this._client=t,this._pendingConns=new Set,this._onTCPConnectionBound=t=>{this._onConnection(t,"tcp")},this._onUTPConnectionBound=t=>{this._onConnection(t,"utp")},this._onListening=()=>{this._client._onListening()},this._onTCPError=t=>{this._client._destroy(t)},this._onUTPError=t=>{this._client.utp=!1,this._client.emit("error",t),this._client.listening||this._onListening()},this.tcpServer=Tt.createServer(),this.tcpServer.on("connection",this._onTCPConnectionBound),this.tcpServer.on("error",this._onTCPError),this.tcpServer.listen(t.torrentPort,(()=>{Rt("creating tcpServer in port %s",this.tcpServer.address().port),this._client.utp?(this.utpServer=Ct.createServer(),this.utpServer.on("connection",this._onUTPConnectionBound),this.utpServer.on("listening",this._onListening),this.utpServer.on("error",this._onUTPError),Rt("creating utpServer in port %s",this.tcpServer.address().port),this.utpServer.listen(this.tcpServer.address().port)):this._onListening()}))}destroy(t){if(Rt("destroy conn pool"),this.utpServer&&(this.utpServer.removeListener("connection",this._onUTPConnectionBound),this.utpServer.removeListener("listening",this._onListening),this.utpServer.removeListener("error",this._onUTPError)),this.tcpServer.removeListener("connection",this._onTCPConnectionBound),this.tcpServer.removeListener("error",this._onTCPError),this._pendingConns.forEach((t=>{t.on("error",Bt),t.destroy()})),this.utpServer)try{this.utpServer.close(t)}catch(e){t&&v(t)}try{this.tcpServer.close(t)}catch(e){t&&v(t)}this.tcpServer=null,this.utpServer=null,this._client=null,this._pendingConns=null}_onConnection(t,e){const r=this;if(!t.remoteAddress)return t.on("error",Bt),void t.destroy();r._pendingConns.add(t),t.once("close",o);const i="utp"===e?Pt.default.createUTPIncomingPeer(t,this._client.throttleGroups):Pt.default.createTCPIncomingPeer(t,this._client.throttleGroups),n=i.wire;async function s(t,e){o();const n=await r._client.get(t);if(n)i.swarm||(i.swarm=n,n._addIncomingPeer(i)),i.onHandshake(t,e);else{const e=new Error(`Unexpected info hash ${t} from incoming peer ${i.id}`);i.destroy(e)}}function o(){t.removeListener("close",o),n.removeListener("handshake",s),r._pendingConns&&r._pendingConns.delete(t)}n.once("pe3",(async function(t){const e=await r._client._getByHash(t);e?(i.swarm=e,e._addIncomingPeer(i),i.onPe3(t)):i.destroy(new Error(`Unexpected info hash hash ${t} from incoming peer ${i.id}`))})),n.once("handshake",s)}}function Bt(){}Ot.UTP_SUPPORT=Object.keys(Ct).length>0;var Lt=r(6686),Nt=r(6889);const jt=/^\[?([^\]]+)]?:(\d+)$/;let Ut=new Map;function qt(t){if(1e5===Ut.size&&Ut.clear(),!Ut.has(t)){const e=jt.exec(t);if(!e)throw new Error(`invalid addr: ${t}`);Ut.set(t,[e[1],Number(e[2])])}return Ut.get(t)}var Dt=r(3033),Ht=r(4497);async function*Ft(t,e={}){if(t?.[Symbol.asyncIterator])return void(yield*t[Symbol.asyncIterator](e.offset));if(!t?.get)throw new Error("First argument must be an abstract-chunk-store compliant store");const r=e.chunkLength||t.chunkLength;if(!r)throw new Error("missing required `chunkLength` property");let i=e.length||t.length;if(!Number.isFinite(i))throw new Error("missing required `length` property");const n=e.offset||0,s=(e,r,i)=>new 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))}async function zt(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,r)=>{s++<=n&&e(),t.put(o++,u,(t=>{if(t)return r(t);--s,e(),h&&0===s&&a()}))}));0!==s&&(h=new Promise((t=>{a=t})),await h)}var $t=r(4018),Wt=r(7186);const Kt=/^[\d.]+$/,Vt=/^[\da-fA-F:]+$/,Zt=/^::ffff:/,Gt=(0,w.xW)([re(1047),re(655366528)]),Yt={CONNECT:0,ANNOUNCE:1,SCRAPE:2,ERROR:3},Jt={update:0,completed:1,started:2,stopped:3,paused:4},Xt={0:"update",1:"completed",2:"started",3:"stopped",4:"paused"},Qt={update:"update",completed:"complete",started:"start",stopped:"stop",paused:"pause"},te=15e3,ee=1e3;function re(t){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t),e}const ie=t=>Wt.parse(t,null,null,{decodeURIComponent:unescape}),ne=t=>{let e=Wt.stringify(t,null,null,{encodeURIComponent:escape});return e=e.replace(/[@*/+]/g,(t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)),e},se={DEFAULT_ANNOUNCE_PEERS:50,MAX_ANNOUNCE_PEERS:82,parseUrl:t=>{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},...i};var oe=r(1314);const ae=class extends n{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())}};var he=r(2085),ue=r(8287).Buffer;const fe=L("bittorrent-tracker:http-tracker"),le=/\/(announce)[^/]*$/;class ce extends ae{constructor(t,e){super(t,e),fe("new http tracker %s",e),this.scrapeUrl=null;const r=this.announceUrl.match(le);if(r){const t=this.announceUrl.slice(0,r.index),e=this.announceUrl.slice(r.index+9);this.scrapeUrl=`${t}/scrape${e}`}this.cleanupFns=[],this.maybeDestroyCleanup=null}announce(t){if(this.destroyed)return;const e=Object.assign({},t,{compact:null==t.compact?1:t.compact,info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,port:this.client._port});0===e.left||e.left||(e.left=16384),this._trackerId&&(e.trackerid=this._trackerId),this._request(this.announceUrl,e,((t,e)=>{if(t)return this.client.emit("warning",t);this._onAnnounceResponse(e)}))}scrape(t){if(this.destroyed)return;if(!this.scrapeUrl)return void this.client.emit("error",new Error(`scrape not supported ${this.announceUrl}`));const e={info_hash:Array.isArray(t.infoHash)&&t.infoHash.length>0?t.infoHash.map((t=>(0,w.Ht)(t))):t.infoHash&&(0,w.Ht)(t.infoHash)||this.client._infoHashBinary};this._request(this.scrapeUrl,e,((t,e)=>{if(t)return this.client.emit("warning",t);this._onScrapeResponse(e)}))}destroy(t){const e=this;if(this.destroyed)return t(null);let r;if(this.destroyed=!0,clearInterval(this.interval),0===this.cleanupFns.length)return i();function i(){r&&(clearTimeout(r),r=null),e.maybeDestroyCleanup=null,e.cleanupFns.slice(0).forEach((t=>{t()})),e.cleanupFns=[],t(null)}r=setTimeout(i,se.DESTROY_TIMEOUT),this.maybeDestroyCleanup=()=>{0===this.cleanupFns.length&&i()}}async _request(t,e,r){const i=new URL(t+(-1===t.indexOf("?")?"?":"&")+se.querystringStringify(e));let n;this.client._proxyOpts&&(n="https:"===i.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!n&&this.client._proxyOpts.socksProxy&&(n=this.client._proxyOpts.socksProxy));const s=()=>{a.signal.aborted||(oe(this.cleanupFns,this.cleanupFns.indexOf(s)),a.abort(),a=null),this.maybeDestroyCleanup&&this.maybeDestroyCleanup()};let o;this.cleanupFns.push(s);let a=function(t){const e=new AbortController;return setTimeout((()=>{e.abort()}),t).unref?.(),e}(se.REQUEST_TIMEOUT);try{o=await nt(i.toString(),{agent:n,signal:a.signal,dispatcher:n,headers:{"user-agent":this.client._userAgent||""}}),o.body.on&&o.body.on("error",r)}catch(t){if(t)return r(t)}let h=new Uint8Array(await o.arrayBuffer());if(s(),this.destroyed)return;if(200!==o.status)return r(new Error(`Non-200 response code ${o.status} from ${this.announceUrl}`));if(!h||0===h.length)return r(new Error(`Invalid tracker response from${this.announceUrl}`));try{h=f.A.decode(h)}catch(t){return r(new Error(`Error decoding tracker response: ${t.message}`))}const u=h["failure reason"]&&(0,w.dU)(h["failure reason"]);if(u)return fe(`failure from ${t} (${u})`),r(new Error(u));const l=h["warning message"]&&(0,w.dU)(h["warning message"]);l&&(fe(`warning from ${t} (${l})`),this.client.emit("warning",new Error(l))),fe(`response from ${t}`),r(null,h)}_onAnnounceResponse(t){const e=t.interval||t["min interval"];e&&this.setInterval(1e3*e);const r=t["tracker id"];r&&(this._trackerId=r);const i=Object.assign({},t,{announce:this.announceUrl,infoHash:(0,w.HB)(t.info_hash||String(t.info_hash))});let n;if(this.client.emit("update",i),ArrayBuffer.isView(t.peers)){try{n=he.multi(ue.from(t.peers))}catch(t){return this.client.emit("warning",t)}n.forEach((t=>{this.client.emit("peer",t)}))}else Array.isArray(t.peers)&&t.peers.forEach((t=>{this.client.emit("peer",`${t.ip}:${t.port}`)}));if(ArrayBuffer.isView(t.peers6)){try{n=he.multi6(ue.from(t.peers6))}catch(t){return this.client.emit("warning",t)}n.forEach((t=>{this.client.emit("peer",t)}))}else Array.isArray(t.peers6)&&t.peers6.forEach((t=>{const e=/^\[/.test(t.ip)||!/:/.test(t.ip)?t.ip:`[${t.ip}]`;this.client.emit("peer",`${e}:${t.port}`)}))}_onScrapeResponse(t){t=t.files||t.host||{};const e=Object.keys(t);0!==e.length?e.forEach((e=>{const r=20!==e.length?(0,w.V5)((0,w.L0)(e)):(0,w.HB)(e),i=Object.assign(t[e],{announce:this.announceUrl,infoHash:r});this.client.emit("scrape",i)})):this.client.emit("warning",new Error("invalid scrape response"))}}ce.prototype.DEFAULT_ANNOUNCE_INTERVAL=18e5;const de=ce;var pe=r(7861),me=r(1220);const ge=L("bittorrent-tracker:udp-tracker");class ye extends ae{constructor(t,e){super(t,e),ge("new udp tracker %s",e),this.cleanupFns=[],this.maybeDestroyCleanup=null}announce(t){this.destroyed||this._request(t)}scrape(t){this.destroyed||(t._scrape=!0,this._request(t))}destroy(t){const e=this;if(this.destroyed)return t(null);let r;if(this.destroyed=!0,clearInterval(this.interval),0===this.cleanupFns.length)return i();function i(){r&&(clearTimeout(r),r=null),e.maybeDestroyCleanup=null,e.cleanupFns.slice(0).forEach((t=>{t()})),e.cleanupFns=[],t(null)}r=setTimeout(i,se.DESTROY_TIMEOUT),this.maybeDestroyCleanup=()=>{0===this.cleanupFns.length&&i()}}_request(t){const e=this;t||(t={});let r,i,n,s,{hostname:o,port:a}=se.parseUrl(this.announceUrl);""===a&&(a=80);let h=be();const u=this.client._proxyOpts&&(f=this.client._proxyOpts.socksProxy,JSON.parse(JSON.stringify(f)));var f;function l(e,o,a){if(e)return d(e);i=o,n=pe.createSocket("udp4"),s=a,r=setTimeout((()=>{"stopped"===t.event?c():d(new Error(`tracker request timed out (${t.event})`)),r=null}),se.REQUEST_TIMEOUT),r.unref&&r.unref(),m((0,w.xW)([se.CONNECTION_ID,se.toUInt32(se.ACTIONS.CONNECT),h]),s),n.once("error",d),n.on("message",p)}function c(){if(r&&(clearTimeout(r),r=null),n){oe(e.cleanupFns,e.cleanupFns.indexOf(c)),n.removeListener("error",d),n.removeListener("message",p),n.on("error",Me);try{n.close()}catch(t){}if(n=null,i){try{i.close()}catch(t){}i=null}}e.maybeDestroyCleanup&&e.maybeDestroyCleanup()}function d(t){if(c(),!e.destroyed){try{t.message&&(t.message+=` (${e.announceUrl})`)}catch(t){}e.client.emit("warning",t)}}function p(r){i&&(r=r.slice(10));const n=new DataView(h.buffer);if(r.length<8||r.readUInt32BE(4)!==n.getUint32(0))return d(new Error("tracker sent invalid transaction id"));const o=r.readUInt32BE(0);switch(ge("UDP response %s, action %s",e.announceUrl,o),o){case 0:if(r.length<16)return d(new Error("invalid udp handshake"));t._scrape?function(r){h=be();const i=Array.isArray(t.infoHash)&&t.infoHash.length>0?(0,w.xW)(t.infoHash):t.infoHash||e.client._infoHashBuffer;m((0,w.xW)([r,se.toUInt32(se.ACTIONS.SCRAPE),h,i]),s)}(r.slice(8,16)):function(t,r){h=be(),m((0,w.xW)([t,se.toUInt32(se.ACTIONS.ANNOUNCE),h,e.client._infoHashBuffer,e.client._peerIdBuffer,_e(r.downloaded),null!=r.left?_e(r.left):(0,w.fk)("ffffffffffffffff"),_e(r.uploaded),se.toUInt32(se.EVENTS[r.event]||0),se.toUInt32(0),se.toUInt32(0),se.toUInt32(r.numwant),ve(e.client._port)]),s)}(r.slice(8,16),t);break;case 1:{if(c(),e.destroyed)return;if(r.length<20)return d(new Error("invalid announce message"));const t=r.readUInt32BE(8);let i;t&&e.setInterval(1e3*t),e.client.emit("update",{announce:e.announceUrl,complete:r.readUInt32BE(16),incomplete:r.readUInt32BE(12)});try{i=he.multi(r.slice(20))}catch(t){return e.client.emit("warning",t)}i.forEach((t=>{e.client.emit("peer",t)}));break}case 2:{if(c(),e.destroyed)return;if(r.length<20||(r.length-8)%12!=0)return d(new Error("invalid scrape message"));const i=Array.isArray(t.infoHash)&&t.infoHash.length>0?t.infoHash.map((t=>t.toString("hex"))):[t.infoHash&&t.infoHash.toString("hex")||e.client.infoHash];for(let t=0,n=(r.length-8)/12;twe||"string"==typeof t){const e=new Uint8Array(8);return new DataView(e.buffer).setBigUint64(0,BigInt(t)),e}return(0,w.xW)([new Uint8Array(4),se.toUInt32(t)])}function Me(){}const Se=ye;var ke=r(1591);const Ee=L("simple-websocket"),xe="function"!=typeof ke?WebSocket:ke;class Ae extends vt.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,w.V5)((0,w.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===xe.OPEN;else{this.url=t.url;try{this._ws="function"==typeof ke?new xe(t.url,{...t,encoding:void 0}):new xe(t.url)}catch(t){return void v((()=>this.destroy(t)))}}this._ws.binaryType="arraybuffer",t.socket&&this.connected?v((()=>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===xe.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 ke&&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 ke&&(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,w.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],Ee.apply(null,t)}}Ae.WEBSOCKET_SUPPORT=!!xe;const Ie=L("bittorrent-tracker:websocket-tracker"),Te={};class Pe extends ae{constructor(t,e){super(t,e),Ie("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,w.Ht)(t))):t.infoHash&&(0,w.Ht)(t.infoHash)||this.client._infoHashBinary};this._send(e)}destroy(t=Ce){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,Te[this.announceUrl]&&(Te[this.announceUrl].consumers-=1),Te[this.announceUrl].consumers>0)return t();let e,r=Te[this.announceUrl];if(delete Te[this.announceUrl],r.on("error",Ce),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,se.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=Te[this.announceUrl],this.socket)Te[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=Te[this.announceUrl]=new Ae({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,w.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 Ie("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,(0,w.HB)(t.info_hash),this.client.infoHash);if(t.peer_id&&t.peer_id===this.client._peerIdBinary)return;Ie("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,w.HB)(t.info_hash)});this.client.emit("update",e)}let s;if(t.offer&&t.peer_id&&(Ie("creating peer (from remote offer)"),s=this._createPeer(),s.id=(0,w.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,w.HB)(t.offer_id);s=this.peers[e],s?(s.id=(0,w.HB)(t.peer_id),this.client.emit("peer",s),s.signal(t.answer),clearTimeout(s.trackerTimeout),s.trackerTimeout=null,delete this.peers[e]):Ie(`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,w.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(),Ie("reconnecting socket in %s ms",t)}_send(t){if(this.destroyed)return;this.expectingResponse=!0;const e=JSON.stringify(t);Ie("send %s",e),this.socket.send(e)}_generateOffers(t,e){const r=this,i=[];Ie("generating %s offers",t);for(let e=0;e{i.push({offer:e,offer_id:(0,w.Ht)(t)}),s()})),e.trackerTimeout=setTimeout((()=>{Ie("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&&(Ie("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 Et(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 Ce(){}Pe.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,Pe._socketPool=Te;const Re=Pe;var Oe=r(717);const Be=L("bittorrent-tracker:client");class Le extends n{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(!Oe.browser&&!t.port)throw new Error("Option `port` is required");this.peerId="string"==typeof t.peerId?t.peerId:(0,w.V5)(t.peerId),this._peerIdBuffer=(0,w.fk)(this.peerId),this._peerIdBinary=(0,w.Ht)(this.peerId),this.infoHash="string"==typeof t.infoHash?t.infoHash.toLowerCase():(0,w.V5)(t.infoHash),this._infoHashBuffer=(0,w.fk)(this.infoHash),this._infoHashBinary=(0,w.Ht)(this.infoHash),Be("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,w.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||Et.WEBRTC_SUPPORT),i=t=>{v((()=>{this.emit("warning",t)}))};this._trackers=e.map((t=>{let e;try{e=se.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 de?"udp:"===s&&"function"==typeof Se?new Se(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 Re(this,t):new de(this,t)})).filter(Boolean)}start(t){(t=this._defaultAnnounceOpts(t)).event="started",Be("send `start` %o",t),this._announce(t),this._trackers.forEach((t=>{t.setInterval()}))}stop(t){(t=this._defaultAnnounceOpts(t)).event="stopped",Be("send `stop` %o",t),this._announce(t)}complete(t){t||(t={}),(t=this._defaultAnnounceOpts(t)).event="completed",Be("send `complete` %o",t),this._announce(t)}update(t){(t=this._defaultAnnounceOpts(t)).event&&delete t.event,Be("send `update` %o",t),this._announce(t)}_announce(t){this._trackers.forEach((e=>{e.announce(t)}))}scrape(t){Be("send `scrape`"),t||(t={}),this._trackers.forEach((e=>{e.scrape(t)}))}setInterval(t){Be("setInterval %d",t),this._trackers.forEach((e=>{e.setInterval(t)}))}destroy(t){if(this.destroyed)return;this.destroyed=!0,Be("destroy");const e=this._trackers.map((t=>e=>{t.destroy(e)}));b(e,t),this._trackers=[],this._getAnnounceOpts=null}_defaultAnnounceOpts(t={}){return null==t.numwant&&(t.numwant=se.DEFAULT_ANNOUNCE_PEERS),null==t.uploaded&&(t.uploaded=0),null==t.downloaded&&(t.downloaded=0),this._getAnnounceOpts&&(t=Object.assign({},t,this._getAnnounceOpts())),t}}Le.scrape=(t,e)=>{if(e=M(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,w.L0)("01234567890123456789"),port:6881}),i=new Le(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 Ne=Le;r(7936);const je=L("bittorrent-lsd"),Ue="239.192.152.143",qe=6771;class De extends n.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(!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="string"==typeof t.port?t.port:t.port.toString(),this.cookie=`bittorrent-lsd-${this.peerId}`,this.destroyed=!1,this.annouceIntervalId=null,this.server=pe.createSocket({type:"udp4",reuseAddr:!0});this.server.on("listening",(()=>{je("listening");try{this.server.addMembership(Ue)}catch(t){this.emit("warning",t)}})),this.server.on("message",((t,e)=>{je("message",t.toString(),`${e.address}:${e.port}`);const r=this._parseAnnounce(t.toString());null!==r&&r.cookie!==this.cookie&&r.infoHash.forEach((t=>{this.emit("peer",`${e.address}:${r.port}`,t)}))})),this.server.on("error",(t=>{this.emit("error",t)}))}_parseAnnounce(t){je("parse announce",t);const e=t.split("\r\n");if("BT-SEARCH * HTTP/1.1"!==e[0])return this.emit("warning","Invalid LSD announce (header)"),null;const r=e[1].split("Host: ")[1];if(!(t=>/^(239.192.152.143|\[ff15::efc0:988f]):6771$/.test(t))(r))return this.emit("warning","Invalid LSD announce (host)"),null;const i=e[2].split("Port: ")[1];if(!(t=>/^\d+$/.test(t))(i))return this.emit("warning","Invalid LSD announce (port)"),null;const n=e.filter((t=>t.includes("Infohash: "))).map((t=>t.split("Infohash: ")[1])).filter((t=>(t=>/^[0-9a-fA-F]{40}$/.test(t))(t)));if(0===n.length)return this.emit("warning","Invalid LSD announce (infoHash)"),null;return{host:r,port:i,infoHash:n,cookie:e.filter((t=>t.includes("cookie: "))).map((t=>t.split("cookie: ")[1])).reduce(((t,e)=>e),null)}}destroy(t){this.destroyed||(this.destroyed=!0,je("destroy"),clearInterval(this.annouceIntervalId),this.server.close(t))}start(){je("start"),this.server.bind(qe),this._announce(),this.annouceIntervalId=setInterval((()=>{this._announce()}),3e5)}_announce(){je("send announce");const t=`BT-SEARCH * HTTP/1.1\r\nHost: ${`${Ue}:6771`}\r\nPort: ${this.port}\r\nInfohash: ${this.infoHash}\r\ncookie: ${this.cookie}\r\n\r\n\r\n`;this.server.send(t,qe,Ue)}}const He=De;var Fe=r(717);const ze=L("torrent-discovery");class $e extends n.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(!Fe.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 et(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 et?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 He?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)}))),b(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 Ne(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||(ze("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,(t=>{this._dhtAnnouncing=!1,ze("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 He(t);return e.on("warning",this._onWarning),e.on("error",this._onError),e.on("peer",this._onLSDPeer),e.start(),e}}const We=$e;var Ke=r(4862),Ve=r(3714);const Ze=L("lt_donthave"),Ge=()=>{class t extends n.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)&&(Ze("got donthave %d",e),this._wire.peerPieces.set(e,!1),this.emit("donthave",e),this._failRequests(e))}donthave(t){if(!this._peerSupports)return;Ze("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 n.EventEmitter{constructor(e){super(),this._wire=e,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new Dt.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>er||!this._fetching||(this.metadata.set(e,t*er),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 ir=r(640),nr=r(8287).Buffer;const sr=t=>("string"==typeof t&&(t=[t]),nr.concat(t.map((t=>{const e=qt(t);if(2!==e.length)throw new Error("invalid address format, expecting: 10.10.10.5:128");const r=ir.parse(e[0]),i=nr.from(r.toByteArray()),n=e[1],s=nr.allocUnsafe(2);return s.writeUInt16BE(n,0),nr.concat([i,s])}))));var or=r(8287).Buffer;const ar={prefersEncryption:1,isSender:2,supportsUtp:4,supportsUtHolepunch:8,isReachable:16},hr=()=>{class t extends n.EventEmitter{constructor(t){super(),this._wire=t,this._intervalId=null,this._lastMessageTimestamp=0,this.reset()}start(){clearInterval(this._intervalId),this._intervalId=setInterval((()=>this._sendMessage()),65e3),this._intervalId.unref&&this._intervalId.unref()}stop(){clearInterval(this._intervalId),this._intervalId=null}reset(){this._remoteAddedPeers={},this._remoteDroppedPeers={},this._localAddedPeers={},this._localDroppedPeers={},this.stop()}addPeer(t,e={}){this._addPeer(t,this._encodeFlags(e),4)}addPeer6(t,e={}){this._addPeer(t,this._encodeFlags(e),6)}_addPeer(t,e,r){t.includes(":")&&(t in this._remoteAddedPeers||(t in this._localDroppedPeers&&delete this._localDroppedPeers[t],this._localAddedPeers[t]={ip:r,flags:e}))}dropPeer(t){this._dropPeer(t,4)}dropPeer6(t){this._dropPeer(t,6)}_dropPeer(t,e){t.includes(":")&&(t in this._remoteDroppedPeers||(t in this._localAddedPeers&&delete this._localAddedPeers[t],this._localDroppedPeers[t]={ip:e}))}onExtendedHandshake(t){if(!t.m||!t.m.ut_pex)return this.emit("warning",new Error("Peer does not support ut_pex"))}onMessage(t){const e=Date.now();if(e-this._lastMessageTimestamp<6e4)return this.reset(),this._wire.destroy(),this.emit("warning",new Error("Peer disconnected for sending PEX messages too frequently"));let r;this._lastMessageTimestamp=e;try{r=f.A.decode(t),r.added&&he.multi(or.from(r.added)).forEach(((t,e)=>{if(delete this._remoteDroppedPeers[t],!(t in this._remoteAddedPeers)){const i=r["added.f"][e];this._remoteAddedPeers[t]={ip:4,flags:i},this.emit("peer",t,this._decodeFlags(i))}})),r.added6&&he.multi6(or.from(r.added6)).forEach(((t,e)=>{if(delete this._remoteDroppedPeers[t],!(t in this._remoteAddedPeers)){const i=r["added6.f"][e];this._remoteAddedPeers[t]={ip:6,flags:i},this.emit("peer",t,this._decodeFlags(i))}})),r.dropped&&he.multi(or.from(r.dropped)).forEach((t=>{delete this._remoteAddedPeers[t],t in this._remoteDroppedPeers||(this._remoteDroppedPeers[t]={ip:4},this.emit("dropped",t))})),r.dropped6&&he.multi6(or.from(r.dropped6)).forEach((t=>{delete this._remoteAddedPeers[t],t in this._remoteDroppedPeers||(this._remoteDroppedPeers[t]={ip:6},this.emit("dropped",t))}))}catch(t){}}_decodeFlags(t){return{prefersEncryption:!!(t&ar.prefersEncryption),isSender:!!(t&ar.isSender),supportsUtp:!!(t&ar.supportsUtp),supportsUtHolepunch:!!(t&ar.supportsUtHolepunch),isReachable:!!(t&ar.isReachable)}}_encodeFlags(t){return Object.keys(t).reduce(((e,r)=>!0===t[r]?e|ar[r]:e),0)}_sendMessage(){const t=Object.keys(this._localAddedPeers).slice(0,50),e=Object.keys(this._localDroppedPeers).slice(0,50),r=(t,e)=>4===t[e].ip,i=(t,e)=>6===t[e].ip,n=(t,e)=>t[e].flags,s=sr(t.filter((t=>r(this._localAddedPeers,t)))),o=sr(t.filter((t=>i(this._localAddedPeers,t)))),a=sr(e.filter((t=>r(this._localDroppedPeers,t)))),h=sr(e.filter((t=>i(this._localDroppedPeers,t)))),u=or.from(t.filter((t=>r(this._localAddedPeers,t))).map((t=>n(this._localAddedPeers,t)))),f=or.from(t.filter((t=>i(this._localAddedPeers,t))).map((t=>n(this._localAddedPeers,t))));t.forEach((t=>delete this._localAddedPeers[t])),e.forEach((t=>delete this._localDroppedPeers[t])),this._wire.extended("ut_pex",{added:s,"added.f":u,dropped:a,added6:o,"added6.f":f,dropped6:h})}}return t.prototype.name="ut_pex",t};var ur=r(1133);const fr=L("webtorrent:file-iterator");class lr extends n{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,1,null,!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}):(fr("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 cr extends n{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=ur.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)}[Symbol.asyncIterator](t={}){if(0===this.length)return async function*(){}();const{start:e=0}=t??{},r=t?.end&&t.end{this._iterators.delete(i)})),i}createReadStream(t){const e=this[Symbol.asyncIterator](t),r=vt.Readable.from(e);return this._fileStreams.add(r),r.once("close",(()=>{this._fileStreams.delete(r)})),r}async arrayBuffer(t={}){const{start:e=0}=t,r=t?.end&&t.end{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()}}class dr{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,w.tW)(t,"hex");if(this.destroyed)return;this.handshake(e,i);const n=this._torrent.pieces.length,s=new Dt.A(n);for(let t=0;t<=n;t++)s.set(t,!0);this.bitfield(s)})),this.once("interested",(()=>{gr("interested"),this.unchoke()})),this.on("uninterested",(()=>{gr("uninterested")})),this.on("choke",(()=>{gr("choke")})),this.on("unchoke",(()=>{gr("unchoke")})),this.on("bitfield",(()=>{gr("bitfield")})),this.lt_donthave.on("donthave",(()=>{gr("donthave")})),this.on("request",((t,e,r,i)=>{gr("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=M(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})=>{gr("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",s,t,e,r,i,n);const o=await nt(s,{cache:"no-store",method:"GET",headers:{"Cache-Control":"no-store","user-agent":`WebTorrent/${mr} (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 gr("Got data of length %d",a.length),a})))}catch(t){return i(t)}i(null,(0,w.xW)(h))}destroy(){super.destroy(),this._torrent=null}}class br{_items=[];remove(t){for(let e=0;e=0&&0!==t.from&&i.push(n);const s={...r,from:t.to+1};s.to-s.from>=0&&i.push(s),this._items.splice(e,1,...i),e=e-1+i.length}else Mr(t,r)&&(this._items.splice(e,1),e--)}}insert(t){if(t.from>t.to)throw new Error("Invalid interval");if(!t.isStreamSelection){const{notify:e}=t,r=[];for(const e of this._items)e.notify&&Sr(t,e)&&r.push(e.notify);r.length>0&&(t.notify=()=>{r.forEach((t=>t())),e?.()}),this.remove(t)}this._items.push(t)}sort(t=(t,e)=>t.from-e.from){this._items.sort(t)}get length(){return this._items.length}get(t){return this._items[t]}swap(t,e){const r=this._items[t];this._items[t]=this._items[e],this._items[e]=r}clear(){this._items.length=0}*[Symbol.iterator](){for(let t=0;t{this._items.splice(t,1),t--},yield e,delete e.remove}}}function vr(t,e){return t.from<=e.to&&t.from>e.from&&t.to>e.to}function wr(t,e){return t.to>=e.from&&t.to=e.from&&t.to<=e.to&&i=e.to}const Sr=(t,e)=>()=>vr(t,e)||wr(t,e)||_r(t,e)||Mr(t,e);var kr=r(717);const Er=L("webtorrent:torrent"),xr=5e3,Ar=3*Xe.BLOCK_LENGTH,Ir=kr.browser?$t().length:2,Tr=[1e3,5e3,15e3],Pr=`WebTorrent/${mr} (https://webtorrent.io)`,Cr=(globalThis.navigator?.storage?.getDirectory&&globalThis.FileSystemFileHandle,kr.browser,Ke);let Rr;try{Rr=h(Lt.statSync("/tmp")&&"/tmp","webtorrent")}catch(t){Rr=h("function"==typeof Nt.tmpdir?Nt.tmpdir():"/","webtorrent")}const Or="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback&&window.requestIdleCallback;class Br extends n{constructor(t,e,r){super(),this._debugId="unknown infohash",this.client=e,this.announce=r.announce,this.urlList=r.urlList,this.path=r.path||Rr,this.addUID=r.addUID||!1,this.rootDir=r.rootDir||null,this.skipVerify=!!r.skipVerify,this._startupBitfield=r.bitfield,this._store=r.store||Cr,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.alwaysChokeSeeders=r.alwaysChokeSeeders??!0,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._startAsDeselected=r.deselect||!1,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=new br,this._critical=[],this.wires=[],this._queue=[],this._peers={},this._peersLength=0,this.received=0,this.uploaded=0,this._downloadSpeed=xt(),this._uploadSpeed=xt(),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)}))):ft(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,w.V5)(t.infoHash).substring(0,7),void 0!==this.private&&(t.private=this.private),Array.isArray(this.announce)&&(t.announce=t.announce.concat(this.announce)),this.client.tracker&&Array.isArray(this.client.tracker.announce)&&!t.private&&(t.announce=t.announce.concat(this.client.tracker.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=pt(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,w.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,Pt.default.SOURCE_MANUAL))),this.discovery=new We({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:t,port:this.client.torrentPort,userAgent:Pr,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),this.client.seedOutgoingConnections||!this.done?this.addPeer(t,e):this._debug("discovery ignoring peer %s: torrent is done and seedOutgoingConnections is false",t)})),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={[Pt.default.SOURCE_TRACKER]:{enabled:!!this.client.tracker,numPeers:0},[Pt.default.SOURCE_DHT]:{enabled:!!this.client.dht,numPeers:0},[Pt.default.SOURCE_LSD]:{enabled:!!this.client.lsd,numPeers:0},[Pt.default.SOURCE_UT_PEX]:{enabled:this.client.utPex&&!0,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":Pr},signal:r};let s,o,a;try{s=await nt(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 dt(o)}catch(t){}if(!a)return t.emit("warning",new Error(`got invalid torrent file from xs param: ${e}`)),i(null);if(a.infoHash!==t.infoHash)return t.emit("warning",new Error(`got torrent file with incorrect info hash from xs param: ${e}`)),i(null);t._onMetadata(a),i(null)}(e,i)}));b(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 dt(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 dr(this),this.files=this.files.map((t=>new cr(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 Ke)&&(r=new Ht(r,{max:this._storeCacheSlots})),this.store=new Ve(r),this.so&&!this._startAsDeselected?this.files.forEach(((t,e)=>{this.so.includes(e)&&this.files[e].select()})):0===this.pieces.length||this._startAsDeselected||this.select(0,this.pieces.length-1,0),this._hashes=this.pieces,this._hasStartupBitfield=this._startupBitfield&&this._startupBitfield.length===Math.ceil(this.pieces.length/8)&&!this.skipVerify,this.bitfield=new Dt.A(this._hasStartupBitfield?new Uint8Array(this._startupBitfield):this.pieces.length),this._reservations=this._hasStartupBitfield?this.pieces.map(((t,e)=>this.bitfield.get(e)?null:[])):this.pieces.map((()=>[])),this.pieces=this.pieces.map(((t,e)=>{if(this._hasStartupBitfield&&this.bitfield.get(e))return null;const r=e===this.pieces.length-1?this.lastPieceLength:this.pieceLength;return new Xe(r)})),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===Ke?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=[];Ye(this.files.map(((t,r)=>i=>{const n=this.addUID?h(this.name+" - "+this.infoHash.slice(0,8)):h(this.path,t.path);Lt.stat(n,((t,n)=>{if(t&&"ENOENT"!==t.code)return i(t);e[r]=n&&n.mtime.getTime(),i(null)}))})),Ir,(r=>{this._debug("done getting file modtimes"),t(r,e)}))}_verifyPiece(t,e){if(this.destroyed)return e(new Error("torrent is destroyed"));const r={};t===this.pieces.length-1&&(r.length=this.lastPieceLength),this.store.get(t,r,(async(r,i)=>{if(this.destroyed)return e(new Error("torrent is destroyed"));if(r)return v((()=>e(null,!1)));const n=await(0,w.tW)(i,"hex");if(this.destroyed)return e(new Error("torrent is destroyed"));e(null,n===this._hashes[t])}))}_verifyPiecesUsingBitfield(t){const e=new Set,r=new Map;for(const t of this.files){let i=2,n=null;for(let e=t._startPiece;e<=t._endPiece;++e)this.bitfield.get(e)&&(i&&(n=e,i--),r.has(e)||r.set(e,[]),r.get(e).push(t));null!==n&&e.add(n)}this._verifyPiecesUsingHash([...e],(i=>{if(i)return t(i);const n=new Set;for(const t of e)if(!this.bitfield.get(t)){const e=r.get(t);for(const t of e)n.add(t)}if(n.size){const e=[];for(const t of n)for(let r=t._startPiece;r<=t._endPiece;++r)-1===e.indexOf(r)&&e.push(r);return this._verifyPiecesUsingHash(e,t)}t(null)}))}_verifyPiecesUsingHash(t,e){Ye(t.map(((t,e)=>r=>{const i=Number.isInteger(t)?t:e;this._verifyPiece(i,((t,e)=>{if(t)return r(t);e?(this._debug("piece verified %s",i),this._markVerified(i)):(this._markUnverified(i),this._debug("piece invalid %s",i)),r(null)}))})),Ir,e)}_verifyPieces(t){if(this._hasStartupBitfield)return this._verifyPiecesUsingBitfield(t);this._verifyPiecesUsingHash(this.pieces,t)}rescanFiles(t){if(this.destroyed)throw new Error("torrent is destroyed");t||(t=Nr),this._verifyPiecesUsingHash(this.pieces,(e=>{if(e)return this._destroy(e),t(e);this._checkDone(),t(null)}))}_markAllVerified(){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),this._selections.clear(),clearInterval(this._rechokeIntervalId),clearInterval(this._noPeersIntervalId),this._xsRequestsController?.abort(),this._rarityMap&&this._rarityMap.destroy();for(const t in this._peers)this.removePeer(t);for(const t of this.files)t instanceof cr&&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)}))}b(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,this._queue=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("string"==typeof t){let e;try{e=qt(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(this.client.blocked&&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?Pt.default.createUTPOutgoingPeer(t,this,this.client.throttleGroups,r):Pt.default.createTCPOutgoingPeer(t,this,this.client.throttleGroups,r):Pt.default.createWebRTCPeer(t,this,this.client.throttleGroups,r),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 yr(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=Pt.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=0,e=this.pieces.length-1,r,i,n=!1){if(this.destroyed)throw new Error("torrent is destroyed");if(t<0||ee.priority-t.priority)),this._updateSelections()}select(t,e,r,i){this._select(t,e,r,i,!1)}_deselect(t,e,r=!1){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("deselect %s-%s",t,e),this._selections.remove({from:t,to:e,isStreamSelection:r}),this._updateSelections()}deselect(t,e){this._deselect(t,e,!1)}critical(t,e){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("critical %s-%s",t,e);for(let r=t;r<=e;++r)this._critical[r]=!0;this._updateSelections()}_onWire(t,e){if(this._debug("got wire %s (%s)",t._debugId,e||"Unknown"),this.wires.push(t),e){const r=qt(e);t.remoteAddress=r[0],t.remotePort=r[1]}this.client.dht&&this.client.dht.listening&&t.on("port",(r=>{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(rr(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&&!this.private&&(t.use(hr()),t.ut_pex.on("peer",(t=>{this.client.seedOutgoingConnections||!this.done?(this._debug("ut_pex: got peer: %s (from %s)",t,e),this.addPeer(t,Pt.default.SOURCE_UT_PEX)):this._debug("ut_pex ignoring peer %s: torrent is done and seedOutgoingConnections is false",t)})),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(Ge()),this.emit("wire",t,e),this.ready&&v((()=>{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,xr),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,this.alwaysChokeSeeders&&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,xr),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,xr),e.unref&&e.unref()),t.isSeeder=!1,n()}_updateSelections(){this.ready&&!this.destroyed&&(v((()=>{this._gcSelections()})),this._updateInterest(),this._update())}_gcSelections(){for(const t of this._selections){const e=t.offset;for(;this.bitfield.get(t.from+t.offset)&&t.from+t.offsetthis._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=Qe(this.wires);let e;for(;e=t();)this._updateWire(e)}_updateWire(t){if(t.destroyed)return!1;const e=this,r=Lr(t,.5);if(t.requests.length>=r)return;const i=Lr(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>Ar)return()=>!0;const i=Math.max(1,t.requests.length)*Xe.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=Ar||(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(){v((()=>{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,w.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(),d())}))):(i.pieces[e]=new Xe(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}`)}}));const t=this.files.every((t=>t.done));return!this.done&&t?(this.done=!0,this._debug(`torrent done: ${this.infoHash}`),this.emit("done"),this.destroyed||this.discovery.complete()):this.done&&!t&&(this.done=!1,this.discovery.tracker?.start()),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=Nr);try{await zt(this.store,y(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]}`,Er(...t)}_drain(){if(this._debug("_drain numConns %s maxConns %s",this._numConns,this.client.maxConns),"function"!=typeof Tt.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=qt(t.addr),r={host:e[0],port:e[1]};this.client.utp&&t.type===Pt.default.TYPE_UTP_OUTGOING?t.conn=Ct.connect(r.port,r.host):t.conn=Tt.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>=Tr.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,Tr.length);return}const e=Tr[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=qt(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=qt(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 Lr(t,e){let r=2+Math.ceil(e*t.downloadSpeed()/Xe.BLOCK_LENGTH);if(t.peerExtendedHandshake){const e=t.peerExtendedHandshake.reqq;"number"==typeof e&&e>0&&(r=Math.min(r,e))}return r}function Nr(){}var jr=r(2195),Ur=r(580),qr=r(815),Dr=r(2878);class Hr{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 ${Ur(t.name)}\n \n (${Ur(t.length)} bytes)\n
  • `)).join("
    ");return t.status=200,t.headers["Content-Type"]="text/html",t.body=$r("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=$r("405 - Method Not Allowed","

    405 - Method Not Allowed

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

    404 - Not Found

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

    ${Ur(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''${Wr(t.name)}`,r.body="DOWNLOAD"):r.headers["Content-Disposition"]=`inline; filename*=UTF-8''${Wr(t.name)}`;let i=Dr(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=vt.Readable.from(s||n);let a=null;t.emit("stream",{stream:o,req:e,file:t},(t=>{a=qr(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(Hr.serve404Page(i));if("OPTIONS"===t.method)return this.isOriginAllowed(t)?e(Hr.serveOptionsRequest(t,i)):e(Hr.serveMethodNotAllowed(i));const n=async()=>{this.pendingReady.delete(n);const t=await s();e(t)},s=async()=>{if(""===r)return Hr.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 Hr.serve404Page(i);if(!n)return Hr.serveTorrentPage(s,i,this.pathname);const o=s.files.find((t=>t.path.replace(/\\/g,"/")===n));return o?Hr.serveFile(o,t,i):Hr.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(Hr.serveMethodNotAllowed(i))}close(t=()=>{}){this.closed=!0,this.pendingReady.forEach((t=>{this.client.removeListener("ready",t)})),this.pendingReady.clear(),v(t)}destroy(t=()=>{}){this.closed?v(t):this.close(t),this.client=null}}class Fr extends Hr{constructor(t,e){super(t,e),this.server=jr.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?qr(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 zr extends Hr{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 $r(t,e){return`\n \n \n \n \n ${t}\n \n \n ${e}\n \n \n `}function Wr(t){return encodeURIComponent(t).replace(/['()]/g,escape).replace(/\*/g,"%2A").replace(/%(?:7C|60|5E)/g,unescape)}const Kr=L("webtorrent"),Vr=mr.replace(/\d*./g,(t=>("0"+t%100).slice(-2))).slice(0,4),Zr=`-WW${Vr}-`;class Gr extends n{constructor(t={}){super(),"string"==typeof t.peerId?this.peerId=t.peerId:ArrayBuffer.isView(t.peerId)?this.peerId=(0,w.V5)(t.peerId):this.peerId=(0,w.V5)((0,w.L0)(Zr+(0,w.NJ)((0,w.po)(9)))),this.peerIdBuffer=(0,w.fk)(this.peerId),"string"==typeof t.nodeId?this.nodeId=t.nodeId:ArrayBuffer.isView(t.nodeId)?this.nodeId=(0,w.V5)(t.nodeId):this.nodeId=(0,w.V5)((0,w.po)(20)),this.nodeIdBuffer=(0,w.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=Gr.UTP_SUPPORT&&!1!==t.utp,this.seedOutgoingConnections=t.seedOutgoingConnections??!0,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 It&&(this.natTraversal=new It({enableUPNP:this.natUpnp,enablePMP:this.natPmp,upnpPermanentFallback:"permanent"===t.natUpnp})),!0===t.secure&&Promise.resolve().then(r.bind(r,5658)).then((({enableSecure:t})=>t())),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new At.ThrottleGroup({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new At.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 Ot?this._connPool=new Ot(this):v((()=>{this._onListening()})),this._downloadSpeed=xt(),this._uploadSpeed=xt(),!1!==t.dht&&"function"==typeof et?(this.dht=new et(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=>{Kr("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 rt&&null!=t.blocklist?rt(t.blocklist,{headers:{"user-agent":`WebTorrent/${mr} (https://webtorrent.io)`}},((t,r)=>{if(t)return console.error(`Failed to load blocklist: ${t.message}`);this.blocked=r,e()})):v(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 zr(this,t),this._server}return this._server=new Fr(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 Br){if(this.torrents.includes(t))return t}else{const e=this.torrents;let r;try{r=await dt(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 Br(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)})),this.emit("add",s),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=function(t){if(s(t),0===t.length)return".";let e=t.charCodeAt(0);const r=47===e;let i=-1,n=!0;for(let r=t.length-1;r>=1;--r)if(e=t.charCodeAt(r),47===e){if(!n){i=r;break}}else n=!1;return-1===i?r?"/":".":r&&1===i?"//":t.slice(0,i)}(t)),e.createdBy||(e.createdBy=`WebTorrent/${Vr}`);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(a,r)}];this.dht&&r.push((e=>{t.once("dhtAnnounce",e)})),b(r,(e=>{if(!this.destroyed)return e?t._destroy(e):void n(t)}))}));let a;var h;return h=t,"undefined"!=typeof FileList&&h instanceof FileList?t=Array.from(t):Array.isArray(t)||(t=[t]),b(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,w.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]),T(t,e=e?Object.assign({},e):{},r)}(i,e,((t,n)=>{if(!this.destroyed){if(t)return o._destroy(t);a=n.map((t=>t.getStream)),B(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)return;if("function"==typeof e)return this._remove(t,null,e);const i=this.torrents.indexOf(t);-1!==i&&(this.torrents.splice(i,1),t.destroy(e,r),this.dht&&this.dht._tables.remove(t.infoHash),this.emit("remove",t))}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()))})),b(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=>{Kr("error mapping WebTorrent port via UPnP/PMP: %o",t)})))}this.emit("listening")}_debug(){const t=[].slice.call(arguments);t[0]=`[${this._debugId}] ${t[0]}`,Kr(...t)}async _getByHash(t){for(const e of this.torrents)if(e.infoHashHash||(e.infoHashHash=await(0,w.tW)((0,w.fk)("72657132"+e.infoHash),"hex")),t===e.infoHashHash)return e;return null}}Gr.WEBRTC_SUPPORT=Et.WEBRTC_SUPPORT,Gr.UTP_SUPPORT=Ot.UTP_SUPPORT,Gr.VERSION=mr;export{Gr as default}; //# sourceMappingURL=webtorrent.chromeapp.js.map \ No newline at end of file diff --git a/dist/webtorrent.min.js b/dist/webtorrent.min.js index 7bc3af2d81..bda6e79886 100644 --- a/dist/webtorrent.min.js +++ b/dist/webtorrent.min.js @@ -1,2 +1,2 @@ -var e,t,s={61:()=>{},405:e=>{e.exports=async function*(e){for(let t of e)"function"==typeof t&&(t=t()),yield*t}},580:e=>{var t=/["'&<>]/;e.exports=function(e){var s,i=""+e,n=t.exec(i);if(!n)return i;var r="",o=0,a=0;for(o=n.index;o{s.r(t),s.d(t,{addListener:()=>u,argv:()=>a,binding:()=>S,browser:()=>r,chdir:()=>E,cwd:()=>k,emit:()=>g,env:()=>o,listeners:()=>v,nextTick:()=>b,off:()=>f,on:()=>d,once:()=>p,prependListener:()=>y,prependOnceListener:()=>w,removeAllListeners:()=>_,removeListener:()=>m,title:()=>n,umask:()=>x,version:()=>h,versions:()=>l});var i=s(9596);const n="browser",r=!0,o={},a=[],h="",l={};function c(){}const d=c,u=c,p=c,f=c,m=c,_=c,g=c,y=c,w=c,b=(e,...t)=>i((()=>e(...t))),v=e=>[],k=()=>"/",x=()=>0,S=e=>{throw new Error("process.binding is not supported")},E=e=>{throw new Error("process.chdir is not supported")}},736:(e,t,s)=>{e.exports=function(e){function t(e){let s,n,r,o=null;function a(...e){if(!a.enabled)return;const i=a,n=Number(new Date),r=n-(s||n);i.diff=r,i.prev=s,i.curr=n,s=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((s,n)=>{if("%%"===s)return"%";o++;const r=t.formatters[n];if("function"==typeof r){const t=e[o];s=r.call(i,t),e.splice(o,1),o--}return s})),t.formatArgs.call(i,e);(i.log||t.log).apply(i,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=i,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==t.namespaces&&(n=t.namespaces,r=t.enabled(e)),r),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function i(e,s){const i=t(this.namespace+(void 0===s?":":s)+e);return i.log=this.log,i}function n(e,t){let s=0,i=0,n=-1,r=0;for(;s"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const s=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of s)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const s of t.skips)if(n(e,s))return!1;for(const s of t.names)if(n(e,s))return!0;return!1},t.humanize=s(6585),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((s=>{t[s]=e[s]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let s=0;for(let t=0;t{var i,n=s(717),r=s(3519),o=s(6611);try{i=s(2376)}catch(e){}var a=function(){},h=/^v?\.0/.test(n.version),l=function(e){return"function"==typeof e},c=function(e,t,s,n){n=r(n);var c=!1;e.on("close",(function(){c=!0})),o(e,{readable:t,writable:s},(function(e){if(e)return n(e);c=!0,n()}));var d=!1;return function(t){if(!c&&!d)return d=!0,function(e){return!!h&&!!i&&(e instanceof(i.ReadStream||a)||e instanceof(i.WriteStream||a))&&l(e.close)}(e)?e.close(a):function(e){return e.setHeader&&l(e.abort)}(e)?e.abort():l(e.destroy)?e.destroy():void n(t||new Error("stream was destroyed"))}},d=function(e){e()},u=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),s=l(t[t.length-1]||a)&&t.pop()||a;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var i=t.map((function(n,r){var o=r0,(function(t){e||(e=t),t&&i.forEach(d),o||(i.forEach(d),s(e))}))}));return t.reduce(u)}},826:()=>{},988:(e,t,s)=>{s.d(t,{A:()=>f});var i=s(9639);function n(e){const t=e<0?1:0;return e=Math.abs(Number(e||1)),Math.floor(Math.log10(e))+1+t}function r(e){return ArrayBuffer.isView(e)?"arraybufferview":Array.isArray(e)?"array":e instanceof Number?"number":e instanceof Boolean?"boolean":e instanceof Set?"set":e instanceof Map?"map":e instanceof String?"string":e instanceof ArrayBuffer?"arraybuffer":typeof e}function o(e,t,s){const n=[];let r=null;return o._encode(n,e),r=(0,i.xW)(n),o.bytes=r.length,ArrayBuffer.isView(t)?(t.set(r,s),t):r}o.bytes=-1,o._floatConversionDetected=!1,o._encode=function(e,t){if(null!=t)switch(r(t)){case"object":o.dict(e,t);break;case"map":o.dictMap(e,t);break;case"array":o.list(e,t);break;case"set":o.listSet(e,t);break;case"string":o.string(e,t);break;case"number":case"boolean":o.number(e,t);break;case"arraybufferview":o.buffer(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength));break;case"arraybuffer":o.buffer(e,new Uint8Array(t))}};const a=new Uint8Array([101]),h=new Uint8Array([100]),l=new Uint8Array([108]);o.buffer=function(e,t){e.push((0,i.L0)(t.length+":"),t)},o.string=function(e,t){e.push((0,i.L0)((0,i.L0)(t).byteLength+":"+t))},o.number=function(e,t){if(Number.isInteger(t))return e.push((0,i.L0)("i"+BigInt(t)+"e"));const s=2147483648,n=(t/s|0)*s+(t%s|0);e.push((0,i.L0)("i"+n+"e")),n===t||o._floatConversionDetected||(o._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value "'+t+'":','Bencoding only defines support for integers, value was converted to "'+n+'"'),console.trace())},o.dict=function(e,t){e.push(h);let s,i=0;const n=Object.keys(t).sort(),r=n.length;for(;i=48)i=10*i+(s-48);else if(r!==t||43!==s){if(r!==t||45!==s){if(46===s)break;throw new Error("not a number: buffer["+r+"] = "+s)}n=-1}}return i*n}function u(e,t,s,n){return null==e||0===e.length?null:("number"!=typeof t&&null==n&&(n=t,t=void 0),"number"!=typeof s&&null==n&&(n=s,s=void 0),u.position=0,u.encoding=n||null,u.data=ArrayBuffer.isView(e)?new Uint8Array(e.slice(t,s)):(0,i.L0)(e),u.bytes=u.data.length,u.next())}u.bytes=0,u.position=0,u.data=null,u.encoding=null,u.next=function(){switch(u.data[u.position]){case 100:return u.dictionary();case 108:return u.list();case 105:return u.integer();default:return u.buffer()}},u.find=function(e){let t=u.position;const s=u.data.length,i=u.data;for(;t{function t(e){return(+Date.now()-e)/100&65535}e.exports=function(e){const s=+Date.now(),i=10*(e||5),n=[0];let r=1,o=t(s)-1&65535;return function(e){const a=t(s);let h=a-o&65535;for(h>i&&(h=i),o=a;h--;)r===i&&(r=0),n[r]=n[0===r?i-1:r-1],r++;e&&(n[r-1]+=e);const l=n[r-1],c=n.length{let i=s(8673);e.exports=new i(s(8446))},1314:e=>{e.exports=function(e,t){if(t>=e.length||t<0)return;var s=e.pop();if(t{function t(e,t){if("string"==typeof e[0])return e.join("");if("number"==typeof e[0])return new Uint8Array(e);const s=new Uint8Array(t);let i=0;for(let t=0,n=e.length;t=s){const e=t(o,a);let i=0;for(;a>=s;)yield e.slice(i,i+s),a-=s,i+=s;o=[e.slice(i,e.length)]}a&&(yield t(o,r?s:a))}},1551:()=>{},1827:()=>{},2072:e=>{e.exports={wait:function(e){return new Promise((t=>setTimeout(t,e)))}}},2123:()=>{},2376:()=>{},2532:()=>{},2701:()=>{},2799:()=>{},2878:e=>{function t(e,t){return{start:e.start,end:e.end,index:t}}function s(e){return{start:e.start,end:e.end}}function i(e,t){return e.index-t.index}function n(e,t){return e.start-t.start}e.exports=function(e,r,o){if("string"!=typeof r)throw new TypeError("argument str must be a string");var a=r.indexOf("=");if(-1===a)return-2;var h=r.slice(a+1).split(","),l=[];l.type=r.slice(0,a);for(var c=0;ce-1&&(p=e-1),isNaN(u)||isNaN(p)||u>p||u<0||l.push({start:u,end:p})}if(l.length<1)return-1;return o&&o.combine?function(e){for(var r=e.map(t).sort(n),o=0,a=1;al.end+1?r[++o]=h:h.end>l.end&&(l.end=h.end,l.index=Math.min(l.index,h.index))}r.length=o+1;var c=r.sort(i).map(s);return c.type=e.type,c}(l):l}},3033:(e,t,s)=>{function i(e){return(e>>3)+Number(e%8!=0)}s.d(t,{A:()=>n});class n{get length(){return this.buffer.length<<3}constructor(e=0,t){const s=null==t?void 0:t.grow;this.grow=s?Number.isFinite(s)?i(s):s:0,this.buffer="number"==typeof e?new Uint8Array(i(e)):e}get(e){const t=e>>3;return t>e%8)}set(e,t=!0){const s=e>>3;if(t){if(s>=this.buffer.length){const e=Math.max(s+1,Math.min(2*this.buffer.length,this.grow));if(e<=this.grow){const t=new Uint8Array(e);t.set(this.buffer),this.buffer=t}}this.buffer[s]|=128>>e%8}else s>e%8))}setAll(e,t=0){const s=Math.min(i(t+e.length),this.grow);if(this.buffer.length>3,r=128>>t%8;for(let t=0;t=this.buffer.length)break;r=128}else r>>=1}forEach(e,t=0,s=8*this.buffer.length){let i=t>>3,n=128>>t%8;for(let r=t;r>=1}isEmpty(){for(let e=0;e{var i=s(717),n=s(5472),r=s(3085),o=function(e,t,s){this.tokenBucket=new n(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=r(),this.tokensThisInterval=0,this.fireImmediately=s};o.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,t){if(e>this.tokenBucket.bucketSize)return i.nextTick(t.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var s=this,n=r();if((n=this.tokenBucket.interval)&&(this.curIntervalStart=n,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)i.nextTick(t.bind(null,null,-1));else{var o=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-n);setTimeout((function(){s.tokenBucket.removeTokens(e,a)}),o)}return!1}return this.tokenBucket.removeTokens(e,a);function a(i,n){if(i)return t(i,null);s.tokensThisInterval+=e,t(null,n)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=r();if((t=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var s=this.tokenBucket.tryRemoveTokens(e);return s&&(this.tokensThisInterval+=e),s},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},e.exports=o},3085:(e,t,s)=>{var i=s(717);e.exports=function(){if(void 0!==i&&i.hrtime){var e=i.hrtime(),t=e[0],s=e[1];return 1e3*t+Math.floor(s/1e6)}return(new Date).getTime()}},3198:e=>{e.exports=class{constructor(e){this.decoder=new TextDecoder("utf16le"===e?"utf16-le":e)}get remaining(){return-1}decode(e){return this.decoder.decode(e,{stream:!0})}flush(){return this.decoder.decode(new Uint8Array(0))}}},3208:()=>{},3278:()=>{},3468:()=>{"undefined"!=typeof ReadableStream&&(ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=function({preventCancel:e}={}){const t=this.getReader(),s=this;let i=t.read();return{next(){const e=i;return i=t.read(),e},return:async n=>(await i,t.releaseLock(),e||s.cancel(),{done:!0,value:n}),async throw(e){throw await this.return(),e},[Symbol.asyncIterator](){return this}}}),ReadableStream.prototype.getIterator||(ReadableStream.prototype.getIterator=function({preventCancel:e}={}){return this[Symbol.asyncIterator]({preventCancel:e})}))},3519:(e,t,s)=>{var i=s(6587);function n(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function r(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},s=e.name||"Function wrapped with `once`";return t.onceError=s+" shouldn't be called more than once",t.called=!1,t}e.exports=i(n),e.exports.strict=i(r),n.proto=n((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return r(this)},configurable:!0})}))},3714:(e,t,s)=>{const i=s(9596);e.exports=class{constructor(e){if(this.store=e,this.chunkLength=e.chunkLength,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.mem=[]}put(e,t,s=()=>{}){this.mem[e]=t,this.store.put(e,t,(t=>{this.mem[e]=null,s(t)}))}get(e,t,s=()=>{}){if("function"==typeof t)return this.get(e,null,t);let n=this.mem[e];if(!n)return this.store.get(e,t,s);t||(t={});const r=t.offset||0,o=t.length||n.length-r;0===r&&o===n.length||(n=n.slice(r,o+r)),i((()=>s(null,n)))}close(e=()=>{}){this.store.close(e)}destroy(e=()=>{}){this.store.destroy(e)}}},3970:()=>{},4018:e=>{e.exports=function(){for(var e=navigator.hardwareConcurrency||1,t=[],s=0;s{},4343:()=>{},4497:(e,t,s)=>{const i=s(8454),n=s(9596);e.exports=class{constructor(e,t){if(this.store=e,this.chunkLength=e.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(t)}put(e,t,s=()=>{}){if(!this.cache)return n((()=>s(new Error("CacheStore closed"))));this.cache.remove(e),this.store.put(e,t,s)}get(e,t,s=()=>{}){if("function"==typeof t)return this.get(e,null,t);if(!this.cache)return n((()=>s(new Error("CacheStore closed"))));t||(t={});let i=this.cache.get(e);if(i){const e=t.offset||0,r=t.length||i.length-e;return 0===e&&r===i.length||(i=i.slice(e,r+e)),n((()=>s(null,i)))}let r=this.inProgressGets.get(e);const o=!!r;r||(r=[],this.inProgressGets.set(e,r)),r.push({opts:t,cb:s}),o||this.store.get(e,((t,s)=>{t||null==this.cache||this.cache.set(e,s);const i=this.inProgressGets.get(e);this.inProgressGets.delete(e);for(const{opts:e,cb:n}of i)if(t)n(t);else{const t=e.offset||0,i=e.length||s.length-t;let r=s;0===t&&i===s.length||(r=s.slice(t,i+t)),n(null,r)}}))}close(e=()=>{}){if(!this.cache)return n((()=>e(new Error("CacheStore closed"))));this.cache=null,this.store.close(e)}destroy(e=()=>{}){if(!this.cache)return n((()=>e(new Error("CacheStore closed"))));this.cache=null,this.store.destroy(e)}}},4862:(e,t,s)=>{e.exports=n;const i=s(9596);function n(e,t){if(!(this instanceof n))return new n(e,t);if(t||(t={}),this.chunkLength=Number(e),!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=Number(t.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(e,t,s=()=>{}){if(this.closed)return i((()=>s(new Error("Storage is closed"))));const n=e===this.lastChunkIndex;return n&&t.length!==this.lastChunkLength?i((()=>s(new Error("Last chunk length must be "+this.lastChunkLength)))):n||t.length===this.chunkLength?(this.chunks[e]=t,void i((()=>s(null)))):i((()=>s(new Error("Chunk length must be "+this.chunkLength))))},n.prototype.get=function(e,t,s=()=>{}){if("function"==typeof t)return this.get(e,null,t);if(this.closed)return i((()=>s(new Error("Storage is closed"))));let n=this.chunks[e];if(!n){const e=new Error("Chunk not found");return e.notFound=!0,i((()=>s(e)))}t||(t={});const r=t.offset||0,o=t.length||n.length-r;0===r&&o===n.length||(n=n.slice(r,o+r)),i((()=>s(null,n)))},n.prototype.close=n.prototype.destroy=function(e=()=>{}){if(this.closed)return i((()=>e(new Error("Storage is closed"))));this.closed=!0,this.chunks=null,i((()=>e(null)))}},5335:(e,t,s)=>{const i=s(3198),n=s(3198);e.exports=class{constructor(e="utf8"){switch(this.encoding=function(e){switch(e=e.toLowerCase()){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:throw new Error("Unknown encoding: "+e)}}(e),this.encoding){case"utf8":this.decoder=new n;break;case"utf16le":case"base64":throw new Error("Unsupported encoding: "+this.encoding);default:this.decoder=new i(this.encoding)}}get remaining(){return this.decoder.remaining}push(e){return"string"==typeof e?e:this.decoder.decode(e)}write(e){return this.push(e)}end(e){let t="";return e&&(t=this.push(e)),t+=this.decoder.flush(),t}}},5372:(e,t,s)=>{e.exports=function(e,t,s){if("number"!=typeof t)throw new Error("second argument must be a Number");let n,r,o,a,h,l,c=!0;Array.isArray(e)?(n=[],o=r=e.length):(a=Object.keys(e),n={},o=r=a.length);function d(e){function t(){s&&s(e,n),s=null}c?i(t):t()}function u(t,s,i){if(n[t]=i,s&&(h=!0),0==--o||s)d(s);else if(!h&&l{var i=s(717),n=function(e,t,s,i){if(this.bucketSize=e,this.tokensPerInterval=t,"string"==typeof s)switch(s){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 "+s)}else this.interval=s;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(e,t){var s=this;return this.bucketSize?e>this.bucketSize?(i.nextTick(t.bind(null,"Requested tokens "+e+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),e>this.content?n():this.parentBucket?this.parentBucket.removeTokens(e,(function(i,r){return i?t(i,null):e>s.content?n():(s.content-=e,void t(null,Math.min(r,s.content)))})):(this.content-=e,i.nextTick(t.bind(null,null,this.content)),!0)):(i.nextTick(t.bind(null,null,e,Number.POSITIVE_INFINITY)),!0);function n(){var i=Math.ceil((e-s.content)*(s.interval/s.tokensPerInterval));return setTimeout((function(){s.removeTokens(e,t)}),i),!1}},tryRemoveTokens:function(e){return!this.bucketSize||!(e>this.bucketSize)&&(this.drip(),!(e>this.content)&&(!(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))&&(this.content-=e,!0)))},drip:function(){if(this.tokensPerInterval){var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var s=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+s,this.bucketSize)}else this.content=this.bucketSize}},e.exports=n},5658:(e,t,s)=>{s.r(t),s.d(t,{default:()=>_,enableSecure:()=>m});var i=s(7007),n=s(8179),r=s(1314),o=s(7833),a=s(6458);const h="tcpIncoming",l="tcpOutgoing",c="utpIncoming",d="utpOutgoing",u="webSeed",p=o("webtorrent:peer");let f=!1;const m=()=>{f=!0};class _ extends i{constructor(e,t){super(),this.id=e,this.type=t,p("new %s Peer %s",t,e),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,p("Peer %s connected",this.id),clearTimeout(this.connectTimeout);const e=this.conn;e.once("end",(()=>{this.destroy()})),e.once("close",(()=>{this.destroy()})),e.once("finish",(()=>{this.destroy()})),e.once("error",(e=>{this.destroy(e)}));const t=this.wire=new a.A(this.type,this.retries,f);t.once("end",(()=>{this.destroy()})),t.once("close",(()=>{this.destroy()})),t.once("finish",(()=>{this.destroy()})),t.once("error",(e=>{this.destroy(e)})),t.once("pe1",(()=>{this.onPe1()})),t.once("pe2",(()=>{this.onPe2()})),t.once("pe3",(()=>{this.onPe3()})),t.once("pe4",(()=>{this.onPe4()})),t.once("handshake",((e,t)=>{this.onHandshake(e,t)})),this.startHandshakeTimeout(),this.setThrottlePipes(),this.swarm&&("tcpOutgoing"===this.type?f&&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(e){this.swarm&&(this.swarm.infoHashHash!==e&&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 e=this;(0,n.pipeline)(this.conn,this.throttleGroups.down.throttle(),new n.Transform({transform(t,s){e.emit("download",t.length),e.destroyed||s(null,t)}}),this.wire,this.throttleGroups.up.throttle(),new n.Transform({transform(t,s){e.emit("upload",t.length),e.destroyed||s(null,t)}}),this.conn)}onHandshake(e,t){if(!this.swarm)return;if(this.destroyed)return;if(this.swarm.destroyed)return this.destroy(new Error("swarm already destroyed"));if(e!==this.swarm.infoHash)return this.destroy(new Error("unexpected handshake info hash for this swarm"));if(t===this.swarm.peerId)return this.destroy(new Error("refusing to connect to ourselves"));p("Peer %s got handshake %s",this.id,e),clearTimeout(this.handshakeTimeout),this.retries=0;let s=this.addr;!s&&this.conn.remoteAddress&&this.conn.remotePort&&(s=`${this.conn.remoteAddress}:${this.conn.remotePort}`),this.swarm._onWire(this.wire,s),this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}handshake(){const e={dht:!this.swarm.private&&!!this.swarm.client.dht,fast:!0};this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,e),this.sentHandshake=!0}startConnectTimeout(){clearTimeout(this.connectTimeout);const e={webrtc:25e3,tcpOutgoing:5e3,utpOutgoing:5e3};this.connectTimeout=setTimeout((()=>{this.destroy(new Error("connect timeout"))}),e[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(e){if(this.destroyed)return;this.destroyed=!0,this.connected=!1,p("destroy %s %s (error: %s)",this.type,this.id,e&&(e.message||e)),clearTimeout(this.connectTimeout),clearTimeout(this.handshakeTimeout);const t=this.swarm,s=this.conn,i=this.wire;this.swarm=null,this.conn=null,this.wire=null,t&&i&&r(t.wires,t.wires.indexOf(i)),s&&(s.on("error",(()=>{})),s.destroy()),i&&i.destroy(),t&&t.removePeer(this.id)}}_.TYPE_TCP_INCOMING=h,_.TYPE_TCP_OUTGOING=l,_.TYPE_UTP_INCOMING=c,_.TYPE_UTP_OUTGOING=d,_.TYPE_WEBRTC="webrtc",_.TYPE_WEBSEED=u,_.SOURCE_MANUAL="manual",_.SOURCE_TRACKER="tracker",_.SOURCE_DHT="dht",_.SOURCE_LSD="lsd",_.SOURCE_UT_PEX="ut_pex",_.createWebRTCPeer=(e,t,s,i=null)=>{const n=new _(e.id,"webrtc");if(n.conn=e,n.swarm=t,n.throttleGroups=s,n.source=i,n.conn.connected)n.onConnect();else{const e=()=>{n.conn.removeListener("connect",t),n.conn.removeListener("error",s)},t=()=>{e(),n.onConnect()},s=t=>{e(),n.destroy(t)};n.conn.once("connect",t),n.conn.once("error",s),n.startConnectTimeout()}return n},_.createTCPIncomingPeer=(e,t)=>_._createIncomingPeer(e,h,t),_.createUTPIncomingPeer=(e,t)=>_._createIncomingPeer(e,c,t),_.createTCPOutgoingPeer=(e,t,s,i)=>_._createOutgoingPeer(e,t,l,s,i),_.createUTPOutgoingPeer=(e,t,s,i)=>_._createOutgoingPeer(e,t,d,s,i),_._createIncomingPeer=(e,t,s)=>{const i=`${e.remoteAddress}:${e.remotePort}`,n=new _(i,t);return n.conn=e,n.addr=i,n.throttleGroups=s,n.onConnect(),n},_._createOutgoingPeer=(e,t,s,i,n=null)=>{const r=new _(e,s);return r.addr=e,r.swarm=t,r.throttleGroups=i,r.source=n,r},_.createWebSeedPeer=(e,t,s,i)=>{const n=new _(t,u);return n.swarm=s,n.conn=e,n.throttleGroups=i,n.onConnect(),n}},5809:e=>{e.exports=class{constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-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(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},6080:(e,t,s)=>{const i=s(5809);e.exports=class{constructor(e){this.hwm=e||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(e){if(this.length++,!this.head.push(e)){const t=this.head;this.head=t.next=new i(2*this.head.buffer.length),this.head.push(e)}}shift(){0!==this.length&&this.length--;const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}peek(){const e=this.tail.peek();return void 0===e&&this.tail.next?this.tail.next.peek():e}isEmpty(){return 0===this.length}}},6310:e=>{function t(e,t){for(const s in t)Object.defineProperty(e,s,{value:t[s],enumerable:!0,configurable:!0});return e}e.exports=function(e,s,i){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");i||(i={}),"object"==typeof s&&(i=s,s=""),s&&(i.code=s);try{return t(e,i)}catch(s){i.message=e.message,i.stack=e.stack;const n=function(){};n.prototype=Object.create(Object.getPrototypeOf(e));return t(new n,i)}}},6458:(e,t,s)=>{s.d(t,{A:()=>I});var i=s(988),n=s(3033),r=s(7264),o=s(7833),a=s(8727),h=s(8179),l=s(9639),c=s(1035),d=s(1314);const u=o("bittorrent-protocol"),p=(0,l.L0)("BitTorrent protocol"),f=new Uint8Array([0,0,0,0]),m=new Uint8Array([0,0,0,1,0]),_=new Uint8Array([0,0,0,1,1]),g=new Uint8Array([0,0,0,1,2]),y=new Uint8Array([0,0,0,1,3]),w=[0,0,0,0,0,0,0,0],b=[0,0,0,3,9,0,0],v=new Uint8Array([0,0,0,1,14]),k=new Uint8Array([0,0,0,1,15]),x=new Uint8Array([0,0,0,0,0,0,0,0]),S=new Uint8Array([0,0,1,2]),E=new Uint8Array([0,0,0,2]);function C(e,t){for(let s=e.length;s--;)e[s]^=t[s];return e}class P{constructor(e,t,s,i){this.piece=e,this.offset=t,this.length=s,this.callback=i}}class T{constructor(){this.buffer=new Uint8Array}get(e){return!0}set(e){}}class A extends h.Duplex{constructor(e=null,t=0,s=!1){super(),this._debugId=(0,l.V5)((0,l.po)(4)),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=e,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=c(),this.downloadSpeed=c(),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=s,s?(this._dh=r.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===t?this._parsePe2():this._parseHandshake(null)}setKeepAlive(e){this._debug("setKeepAlive %s",e),clearInterval(this._keepAliveInterval),!1!==e&&(this._keepAliveInterval=setInterval((()=>{this.keepAlive()}),55e3))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._timeoutMs=e,this._timeoutUnref=!!t,this._resetTimeout(!0)}destroy(){if(!this.destroyed)return this._debug("destroy"),this.end(),this}end(e){if(!this.destroyed&&!this.destroying)return this._debug("end"),this._onUninterested(),this._onChoke(),super.end(e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const s=this._nextExt,i=new e(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[s]=t,this._ext[t]=i,this[t]=i,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(f)}sendPe1(){if(this._peEnabled){const e=Math.floor(513*Math.random()),t=(0,l.po)(e);this._push((0,l.xW)([(0,l.fk)(this._myPubKey),t]))}}sendPe2(){const e=Math.floor(513*Math.random()),t=(0,l.po)(e);this._push((0,l.xW)([(0,l.fk)(this._myPubKey),t]))}async sendPe3(e){await this.setEncrypt(this._sharedSecret,e);const t=await(0,l.tW)((0,l.fk)(this._utfToHex("req1")+this._sharedSecret)),s=C(await(0,l.tW)((0,l.fk)(this._utfToHex("req2")+e)),await(0,l.tW)((0,l.fk)(this._utfToHex("req3")+this._sharedSecret))),i=new DataView((0,l.po)(2).buffer).getUint16(0)%512,n=(0,l.po)(i);let r=new Uint8Array(14+i+2);r.set(x),r.set(S,8);const o=new DataView(r.buffer);o.setInt16(12,i),n.copy(r,14),o.setInt16(14+i,0),r=this._encryptHandshake(r),this._push((0,l.xW)([t,s,r]))}async sendPe4(e){await this.setEncrypt(this._sharedSecret,e);const t=new DataView((0,l.po)(2).buffer).getUint16(0)%512,s=(0,l.po)(t);let i=new Uint8Array(14+t);const n=new DataView(i.buffer);i.set(x),i.set(E,8),n.setInt16(12,t),i.set(s,14),i=this._encryptHandshake(i),this._push(i),this._cryptoHandshakeDone=!0,this._debug("completed crypto handshake")}handshake(e,t,s){let i,n;if("string"==typeof e?(e=e.toLowerCase(),i=(0,l.fk)(e)):(i=e,e=(0,l.V5)(i)),"string"==typeof t?n=(0,l.fk)(t):(n=t,t=(0,l.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",e,t,s);const r=new Uint8Array(w);this.extensions={extended:!0,dht:!(!s||!s.dht),fast:!(!s||!s.fast)},r[5]|=16,this.extensions.dht&&(r[7]|=1),this.extensions.fast&&(r[7]|=4),this.extensions.fast&&this.peerExtensions.fast&&(this._debug("fast extension is enabled"),this.hasFast=!0),this._push((0,l.xW)([p,r,i,n])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=Object.assign({},this.extendedHandshake);e.m={};for(const t in this.extendedMapping){const s=this.extendedMapping[t];e.m[s]=Number(t)}this.extended(0,i.A.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking)if(this.amChoking=!0,this._debug("choke"),this._push(m),this.hasFast){let e=0;for(;this.peerRequests.length>e;){const t=this.peerRequests[e];this.allowedFastSet.includes(t.piece)?++e:this.reject(t.piece,t.offset,t.length)}}else for(;this.peerRequests.length;)this.peerRequests.pop()}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(_))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(g))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(y))}have(e){this._debug("have %d",e),this._message(4,[e],null)}bitfield(e){this._debug("bitfield"),ArrayBuffer.isView(e)||(e=e.buffer),this._message(5,[],e)}request(e,t,s,i){return i||(i=()=>{}),this._finished?i(new Error("wire is closed")):!this.peerChoking||this.hasFast&&this.peerAllowedFastSet.includes(e)?(this._debug("request index=%d offset=%d length=%d",e,t,s),this.requests.push(new P(e,t,s,i)),this._timeout||this._resetTimeout(!0),void this._message(6,[e,t,s],null)):i(new Error("peer is choking"))}piece(e,t,s){this._debug("piece index=%d offset=%d",e,t),this._message(7,[e,t],s),this.uploaded+=s.length,this.uploadSpeed(s.length),this.emit("upload",s.length)}cancel(e,t,s){this._debug("cancel index=%d offset=%d length=%d",e,t,s),this._callback(this._pull(this.requests,e,t,s),new Error("request was cancelled"),null),this._message(8,[e,t,s],null)}port(e){this._debug("port %d",e);const t=new Uint8Array(b);new DataView(t.buffer).setUint16(5,e),this._push(t)}suggest(e){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("suggest %d",e),this._message(13,[e],null)}haveAll(){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("have-all"),this._push(v)}haveNone(){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("have-none"),this._push(k)}reject(e,t,s){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("reject index=%d offset=%d length=%d",e,t,s),this._pull(this.peerRequests,e,t,s),this._message(16,[e,t,s],null)}allowedFast(e){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("allowed-fast %d",e),this.allowedFastSet.includes(e)||this.allowedFastSet.push(e),this._message(17,[e],null)}extended(e,t){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"!=typeof e)throw new Error(`Unrecognized extension: ${e}`);{const s=new Uint8Array([e]),n=ArrayBuffer.isView(t)?t:i.A.encode(t);this._message(20,[],(0,l.xW)([s,n]))}}async setEncrypt(e,t){let s,i,n,r;switch(this.type){case"tcpIncoming":s=await(0,l.tW)((0,l.fk)(this._utfToHex("keyB")+e+t)),n=await(0,l.tW)((0,l.fk)(this._utfToHex("keyA")+e+t)),i=[];for(const e of s.values())i.push(e);r=[];for(const e of n.values())r.push(e);this._encryptGenerator=new a(i),this._decryptGenerator=new a(r);break;case"tcpOutgoing":s=await(0,l.tW)((0,l.fk)(this._utfToHex("keyA")+e+t)),n=await(0,l.tW)((0,l.fk)(this._utfToHex("keyB")+e+t)),i=[];for(const e of s.values())i.push(e);r=[];for(const e of n.values())r.push(e);this._encryptGenerator=new a(i),this._decryptGenerator=new a(r);break;default:return!1}for(let e=0;e<1024;e++)this._encryptGenerator.randomByte(),this._decryptGenerator.randomByte();return this._setGenerators=!0,!0}_message(e,t,s){const i=s?s.length:0,n=new Uint8Array(5+4*t.length),r=new DataView(n.buffer);r.setUint32(0,n.length+i-4),n[4]=e;for(let e=0;e{if(n===this._pull(this.peerRequests,e,t,s))return i?(this._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,s,i.message),void(this.hasFast&&this.reject(e,t,s))):void this.piece(e,t,r)},n=new P(e,t,s,i);this.peerRequests.push(n),this.emit("request",e,t,s,i)}_onPiece(e,t,s){this._debug("got piece index=%d offset=%d",e,t),this._callback(this._pull(this.requests,e,t,s.length),null,s),this.downloaded+=s.length,this.downloadSpeed(s.length),this.emit("download",s.length),this.emit("piece",e,t,s)}_onCancel(e,t,s){this._debug("got cancel index=%d offset=%d length=%d",e,t,s),this._pull(this.peerRequests,e,t,s),this.emit("cancel",e,t,s)}_onPort(e){this._debug("got port %d",e),this.emit("port",e)}_onSuggest(e){if(!this.hasFast)return this._debug("Error: got suggest whereas fast extension is disabled"),void this.destroy();this._debug("got suggest %d",e),this.emit("suggest",e)}_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 T,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(e,t,s){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",e,t,s),this._callback(this._pull(this.requests,e,t,s),new Error("request was rejected"),null),this.emit("reject",e,t,s)}_onAllowedFast(e){if(!this.hasFast)return this._debug("Error: got allowed-fast whereas fast extension is disabled"),void this.destroy();this._debug("got allowed-fast %d",e),this.peerAllowedFastSet.includes(e)||this.peerAllowedFastSet.push(e),this.peerAllowedFastSet.length>100&&this.peerAllowedFastSet.shift(),this.emit("allowed-fast",e)}_onExtended(e,t){if(0===e){let e;try{e=i.A.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!e)return;if(this.peerExtendedHandshake=e,"object"==typeof e.m)for(const t in e.m)this.peerExtendedMapping[t]=Number(e.m[t].toString());for(const e in this._ext)this.peerExtendedMapping[e]&&this._ext[e].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(e,t){if(2===this._encryptionMethod&&this._cryptoHandshakeDone&&(e=this._decrypt(e)),this._bufferSize+=e.length,this._buffer.push(e),this._buffer.length>1&&(this._buffer=[(0,l.xW)(this._buffer,this._bufferSize)]),this._cryptoSyncPattern){const t=this._buffer[0].indexOf(this._cryptoSyncPattern);if(-1!==t)this._buffer[0]=this._buffer[0].slice(t+this._cryptoSyncPattern.length),this._bufferSize-=t+this._cryptoSyncPattern.length,this._cryptoSyncPattern=null;else if(this._bufferSize+e.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 e=this._buffer[0];this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[e.slice(this._parserSize)]:[],this._parser(e.slice(0,this._parserSize))}t(null)}_callback(e,t,s){e&&(this._resetTimeout(!this.peerChoking&&!this._finished),e.callback(t,s))}_resetTimeout(e){if(!e||!this._timeoutMs||!this.requests.length)return clearTimeout(this._timeout),this._timeout=null,void(this._timeoutExpiresAt=null);const t=Date.now()+this._timeoutMs;if(this._timeout){if(t-this._timeoutExpiresAt<.05*this._timeoutMs)return;clearTimeout(this._timeout)}this._timeoutExpiresAt=t,this._timeout=setTimeout((()=>this._onTimeout()),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref()}_parse(e,t){this._parserSize=e,this._parser=t}_parseUntil(e,t){this._cryptoSyncPattern=e,this._waitMaxBytes=t}_onMessageLength(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))}_onMessage(e){this._parse(4,this._onMessageLength);const t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e[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(t.getUint32(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(t.getUint32(1),t.getUint32(5),t.getUint32(9));case 7:return this._onPiece(t.getUint32(1),t.getUint32(5),e.slice(9));case 8:return this._onCancel(t.getUint32(1),t.getUint32(5),t.getUint32(9));case 9:return this._onPort(t.getUint16(1));case 13:return this._onSuggest(t.getUint32(1));case 14:return this._onHaveAll();case 15:return this._onHaveNone();case 16:return this._onReject(t.getUint32(1),t.getUint32(5),t.getUint32(9));case 17:return this._onAllowedFast(t.getUint32(1));case 20:return this._onExtended(e[1],e.slice(2));default:return this._debug("got unknown message"),this.emit("unknownmessage",e)}}_determineHandshakeType(){this._parse(1,(e=>{const t=e[0];19===t?this._parse(t+48,this._onHandshakeBuffer):this._parsePe1(e)}))}_parsePe1(e){this._parse(95,(t=>{this._onPe1((0,l.xW)([e,t])),this._parsePe3()}))}_parsePe2(){this._parse(96,(e=>{for(this._onPe2(e);!this._setGenerators;);this._parsePe4()}))}async _parsePe3(){const e=await(0,l.tW)((0,l.fk)(this._utfToHex("req1")+this._sharedSecret));this._parseUntil(e,512),this._parse(20,(e=>{for(this._onPe3(e);!this._setGenerators;);this._parsePe3Encrypted()}))}_parsePe3Encrypted(){this._parse(14,(e=>{const t=this._decryptHandshake(e.slice(0,8)),s=this._decryptHandshake(e.slice(8,12)),i=new DataView(this._decryptHandshake(e.slice(12,14)).buffer).getUint16(0);this._parse(i,(e=>{e=this._decryptHandshake(e),this._parse(2,(i=>{const n=new DataView(this._decryptHandshake(i).buffer).getUint16(0);this._parse(n,(i=>{i=this._decryptHandshake(i),this._onPe3Encrypted(t,s,e,i);const r=n?i[0]:null,o=n?i.slice(1,20):null;19===r&&"BitTorrent protocol"===(0,l.dU)(o)?this._onHandshakeBuffer(i.slice(1)):this._parseHandshake()}))}))}))}))}_parsePe4(){const e=this._decryptHandshake(x);this._parseUntil(e,512),this._parse(6,(e=>{const t=this._decryptHandshake(e.slice(0,4)),s=new DataView(this._decryptHandshake(e.slice(4,6)).buffer).getUint16(0);this._parse(s,(e=>{this._decryptHandshake(e),this._onPe4(t),this._parseHandshake(null)}))}))}_parseHandshake(){this._parse(1,(e=>{const t=e[0];if(19!==t)return this._debug("Error: wire not speaking BitTorrent protocol (%s)",t.toString()),void this.end();this._parse(t+48,this._onHandshakeBuffer)}))}_onHandshakeBuffer(e){const t=e.slice(0,19);if("BitTorrent protocol"!==(0,l.dU)(t))return this._debug("Error: wire not speaking BitTorrent protocol (%s)",(0,l.dU)(t)),void this.end();e=e.slice(19),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),fast:!!(4&e[7]),extended:!!(16&e[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(...e){e[0]=`[${this._debugId}] ${e[0]}`,u(...e)}_pull(e,t,s,i){for(let n=0;n{var t=1e3,s=60*t,i=60*s,n=24*i,r=7*n,o=365.25*n;function a(e,t,s,i){var n=t>=1.5*s;return Math.round(e/s)+" "+i+(n?"s":"")}e.exports=function(e,h){h=h||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var h=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*r;case"days":case"day":case"d":return h*n;case"hours":case"hour":case"hrs":case"hr":case"h":return h*i;case"minutes":case"minute":case"mins":case"min":case"m":return h*s;case"seconds":case"second":case"secs":case"sec":case"s":return h*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}(e);if("number"===l&&isFinite(e))return h.long?function(e){var r=Math.abs(e);if(r>=n)return a(e,r,n,"day");if(r>=i)return a(e,r,i,"hour");if(r>=s)return a(e,r,s,"minute");if(r>=t)return a(e,r,t,"second");return e+" ms"}(e):function(e){var r=Math.abs(e);if(r>=n)return Math.round(e/n)+"d";if(r>=i)return Math.round(e/i)+"h";if(r>=s)return Math.round(e/s)+"m";if(r>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},6587:e=>{e.exports=function e(t,s){if(t&&s)return e(t)(s);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){i[e]=t[e]})),i;function i(){for(var e=new Array(arguments.length),s=0;s{var i=s(717),n=s(3519),r=function(){},o=function(e,t,s){if("function"==typeof t)return o(e,null,t);t||(t={}),s=n(s||r);var a=e._writableState,h=e._readableState,l=t.readable||!1!==t.readable&&e.readable,c=t.writable||!1!==t.writable&&e.writable,d=!1,u=function(){e.writable||p()},p=function(){c=!1,l||s.call(e)},f=function(){l=!1,c||s.call(e)},m=function(t){s.call(e,t?new Error("exited with error code: "+t):null)},_=function(t){s.call(e,t)},g=function(){i.nextTick(y)},y=function(){if(!d)return(!l||h&&h.ended&&!h.destroyed)&&(!c||a&&a.ended&&!a.destroyed)?void 0:s.call(e,new Error("premature close"))},w=function(){e.req.on("finish",p)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?c&&!a&&(e.on("end",u),e.on("close",u)):(e.on("complete",p),e.on("abort",g),e.req?w():e.on("request",w)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",m),e.on("end",f),e.on("finish",p),!1!==t.error&&e.on("error",_),e.on("close",g),function(){d=!0,e.removeListener("complete",p),e.removeListener("abort",g),e.removeListener("request",w),e.req&&e.req.removeListener("finish",p),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",p),e.removeListener("exit",m),e.removeListener("end",f),e.removeListener("error",_),e.removeListener("close",g)}};e.exports=o},6664:()=>{},6686:()=>{},6698:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var s=function(){};s.prototype=t.prototype,e.prototype=new s,e.prototype.constructor=e}}},6819:(e,t,s)=>{e.exports=s(8330).version},6889:()=>{},7007:e=>{var t=Object.create||function(e){var t=function(){};return t.prototype=e,new t},s=Object.keys||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return s},i=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function n(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=t(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0;var r,o=10;try{var a={};Object.defineProperty&&Object.defineProperty(a,"x",{value:0}),r=0===a.x}catch(e){r=!1}function h(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function l(e,s,i,n){var r,o,a;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",s,i.listener?i.listener:i),o=e._events),a=o[s]):(o=e._events=t(null),e._eventsCount=0),a){if("function"==typeof a?a=o[s]=n?[i,a]:[a,i]:n?a.unshift(i):a.push(i),!a.warned&&(r=h(e))&&r>0&&a.length>r){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(s)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=e,l.type=s,l.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else a=o[s]=i,++e._eventsCount;return e}function c(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var h=new Error('Unhandled "error" event. ('+t+")");throw h.context=t,h}if(!(s=o[e]))return!1;var l="function"==typeof s;switch(i=arguments.length){case 1:!function(e,t,s){if(t)e.call(s);else for(var i=e.length,n=f(e,i),r=0;r=0;o--)if(i[o]===s||i[o].listener===s){a=i[o].listener,r=o;break}if(r<0)return this;0===r?i.shift():function(e,t){for(var s=t,i=s+1,n=e.length;i=0;r--)this.removeListener(e,i[r]);return this},n.prototype.listeners=function(e){return u(this,e,!0)},n.prototype.rawListeners=function(e){return u(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},n.prototype.listenerCount=p,n.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},7264:()=>{},7373:e=>{e.exports=function(e){var t=0;return function(){if(t===e.length)return null;var s=e.length-t,i=Math.random()*s|0,n=e[t+i],r=e[t];return e[t]=n,e[t+i]=r,t++,n}}},7541:(e,t,s)=>{const i=s(8765),n=s(8499);e.exports={Throttle:i,ThrottleGroup:n}},7828:()=>{},7833:(e,t,s)=>{var i=s(717);t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;t.splice(1,0,s,"color: inherit");let i=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(n=i))})),t.splice(n,0,s)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==i&&"env"in i&&(e=i.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.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"],t.log=console.debug||console.log||(()=>{}),e.exports=s(736)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},7936:()=>{},8179:(e,t,s)=>{const{EventEmitter:i}=s(7007),n=new Error("Stream was destroyed"),r=new Error("Premature close"),o=s(6080),a=s(5335),h=536870911,l=1^h,c=2^h,d=32,u=64,p=128,f=256,m=1024,_=2048,g=4096,y=8192,w=16384,b=32768,v=131072,k=131328,x=16^h,S=536805375,E=768^h,C=536838143,P=536739839,T=1<<18,A=2<<18,I=4<<18,L=8<<18,O=16<<18,R=32<<18,H=64<<18,N=128<<18,U=256<<18,M=512<<18,F=1024<<18,j=535822335,B=503316479,D=268435455,q=262160,W=536608751,$=8404992,z=14,V=15,G=8405006,K=33587200,Y=33587215,J=2359296,X=270794767,Q=Symbol.asyncIterator||Symbol("asyncIterator");class Z{constructor(e,{highWaterMark:t=16384,map:s=null,mapWritable:i,byteLength:n,byteLengthWritable:r}={}){this.stream=e,this.queue=new o,this.highWaterMark=t,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=r||n||xe,this.map=i||s,this.afterWrite=oe.bind(this),this.afterUpdateNextTick=le.bind(this)}get ended(){return!!(this.stream._duplexState&R)}push(e){return!(142606350&this.stream._duplexState)&&(null!==this.map&&(e=this.map(e)),this.buffered+=this.byteLength(e),this.queue.push(e),this.buffered0,this.error=null,this.pipeline=null,this.byteLength=r||n||xe,this.map=i||s,this.pipeTo=null,this.afterRead=ae.bind(this),this.afterUpdateNextTick=he.bind(this)}get ended(){return!!(this.stream._duplexState&w)}pipe(e,t){if(null!==this.pipeTo)throw new Error("Can only pipe to one destination");if("function"!=typeof t&&(t=null),this.stream._duplexState|=512,this.pipeTo=e,this.pipeline=new se(this.stream,e,t),t&&this.stream.on("error",Se),ke(e))e._writableState.pipeline=this.pipeline,t&&e.on("error",Se),e.on("finish",this.pipeline.finished.bind(this.pipeline));else{const t=this.pipeline.done.bind(this.pipeline,e),s=this.pipeline.done.bind(this.pipeline,e,null);e.on("error",t),e.on("close",s),e.on("finish",this.pipeline.finished.bind(this.pipeline))}e.on("drain",ie.bind(this)),this.stream.emit("piping",e),e.emit("pipe",this.stream)}push(e){const t=this.stream;return null===e?(this.highWaterMark=0,t._duplexState=536805311&t._duplexState|1024,!1):null!==this.map&&null===(e=this.map(e))?(t._duplexState&=S,this.buffered0;)t.push(this.shift());for(let e=0;e0;)i.drains.shift().resolve(!1);null!==i.pipeline&&i.pipeline.done(t,e)}}function oe(e){const t=this.stream;e&&t.destroy(e),t._duplexState&=469499903,null!==this.drains&&function(e){for(let t=0;t0)?null:s(i)},this}_read(e){e(null)}pipe(e,t){return this._readableState.updateNextTick(),this._readableState.pipe(e,t),e}read(){return this._readableState.updateNextTick(),this._readableState.read()}push(e){return this._readableState.updateNextTickIfOpen(),this._readableState.push(e)}unshift(e){return this._readableState.updateNextTickIfOpen(),this._readableState.unshift(e)}resume(){return this._duplexState|=k,this._readableState.updateNextTick(),this}pause(){return this._duplexState&=!1===this._readableState.readAhead?536739583:536870655,this}static _fromAsyncIterator(e,t){let s;const i=new fe({...t,read(t){e.next().then(n).then(t.bind(null,null)).catch(t)},predestroy(){s=e.return()},destroy(e){if(!s)return e(null);s.then(e.bind(null,null)).catch(e)}});return i;function n(e){e.done?i.push(null):i.push(e.value)}}static from(e,t){if(ke(s=e)&&s.readable)return e;var s;if(e[Q])return this._fromAsyncIterator(e[Q](),t);Array.isArray(e)||(e=void 0===e?[]:[e]);let i=0;return new fe({...t,read(t){this.push(i===e.length?null:e[i++]),t(null)}})}static isBackpressured(e){return!!(17422&e._duplexState)||e._readableState.buffered>=e._readableState.highWaterMark}static isPaused(e){return!(e._duplexState&f)}[Q](){const e=this;let t=null,s=null,i=null;return this.on("error",(e=>{t=e})),this.on("readable",(function(){null!==s&&r(e.read())})),this.on("close",(function(){null!==s&&r(null)})),{[Q](){return this},next:()=>new Promise((function(t,n){s=t,i=n;const o=e.read();null!==o?r(o):8&e._duplexState&&r(null)})),return:()=>o(null),throw:e=>o(e)};function r(r){null!==i&&(t?i(t):null!==r||e._duplexState&w?s({value:r,done:null===r}):i(n),i=s=null)}function o(t){return e.destroy(t),new Promise(((s,i)=>{if(8&e._duplexState)return s({value:void 0,done:!0});e.once("close",(function(){t?i(t):s({value:void 0,done:!0})}))}))}}}class me extends pe{constructor(e){super(e),this._duplexState|=16385,this._writableState=new Z(this,e),e&&(e.writev&&(this._writev=e.writev),e.write&&(this._write=e.write),e.final&&(this._final=e.final),e.eagerOpen&&this._writableState.updateNextTick())}cork(){this._duplexState|=F}uncork(){this._duplexState&=D,this._writableState.updateNextTick()}_writev(e,t){t(null)}_write(e,t){this._writableState.autoBatch(e,t)}_final(e){e(null)}static isBackpressured(e){return!!(146800654&e._duplexState)}static drained(e){if(e.destroyed)return Promise.resolve(!1);const t=e._writableState;var s;const i=((s=e)._writev!==me.prototype._writev&&s._writev!==_e.prototype._writev?Math.min(1,t.queue.length):t.queue.length)+(e._duplexState&U?1:0);return 0===i?Promise.resolve(!0):(null===t.drains&&(t.drains=[]),new Promise((e=>{t.drains.push({writes:i,resolve:e})})))}write(e){return this._writableState.updateNextTick(),this._writableState.push(e)}end(e){return this._writableState.updateNextTick(),this._writableState.end(e),this}}class _e extends fe{constructor(e){super(e),this._duplexState=1|this._duplexState&v,this._writableState=new Z(this,e),e&&(e.writev&&(this._writev=e.writev),e.write&&(this._write=e.write),e.final&&(this._final=e.final))}cork(){this._duplexState|=F}uncork(){this._duplexState&=D,this._writableState.updateNextTick()}_writev(e,t){t(null)}_write(e,t){this._writableState.autoBatch(e,t)}_final(e){e(null)}write(e){return this._writableState.updateNextTick(),this._writableState.push(e)}end(e){return this._writableState.updateNextTick(),this._writableState.end(e),this}}class ge extends _e{constructor(e){super(e),this._transformState=new te(this),e&&(e.transform&&(this._transform=e.transform),e.flush&&(this._flush=e.flush))}_write(e,t){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=e:this._transform(e,this._transformState.afterTransform)}_read(e){if(null!==this._transformState.data){const t=this._transformState.data;this._transformState.data=null,e(null),this._transform(t,this._transformState.afterTransform)}else e(null)}destroy(e){super.destroy(e),null!==this._transformState.data&&(this._transformState.data=null,this._transformState.afterTransform())}_transform(e,t){t(null,e)}_flush(e){e(null)}_final(e){this._transformState.afterFinal=e,this._flush(ye.bind(this))}}function ye(e,t){const s=this._transformState.afterFinal;if(e)return s(e);null!=t&&this.push(t),this.push(null),s(null)}function we(e,...t){const s=Array.isArray(e)?[...e,...t]:[e,...t],i=s.length&&"function"==typeof s[s.length-1]?s.pop():null;if(s.length<2)throw new Error("Pipeline requires at least 2 streams");let n=s[0],o=null,a=null;for(let e=1;e1,l),n.pipe(o)),n=o;if(i){let e=!1;const t=ke(o)||!(!o._writableState||!o._writableState.autoDestroy);o.on("error",(e=>{null===a&&(a=e)})),o.on("finish",(()=>{e=!0,t||i(a)})),t&&o.on("close",(()=>i(a||(e?null:r))))}return o;function h(e,t,s,i){e.on("error",i),e.on("close",(function(){if(t&&e._readableState&&!e._readableState.ended)return i(r);if(s&&e._writableState&&!e._writableState.ended)return i(r)}))}function l(e){if(e&&!a){a=e;for(const t of s)t.destroy(e)}}}function be(e){return e}function ve(e){return!!e._readableState||!!e._writableState}function ke(e){return"number"==typeof e._duplexState&&ve(e)}function xe(e){return function(e){return"object"==typeof e&&null!==e&&"number"==typeof e.byteLength}(e)?e.byteLength:1024}function Se(){}function Ee(){this.destroy(new Error("Stream aborted."))}e.exports={pipeline:we,pipelinePromise:function(...e){return new Promise(((t,s)=>we(...e,(e=>{if(e)return s(e);t()}))))},isStream:ve,isStreamx:ke,isEnded:function(e){return!!e._readableState&&e._readableState.ended},isFinished:function(e){return!!e._writableState&&e._writableState.ended},isDisturbed:function(e){return!!(1&~e._duplexState)||!!(e._duplexState&K)},getStreamError:function(e,t={}){const s=e._readableState&&e._readableState.error||e._writableState&&e._writableState.error;return t.all||s!==n?s:null},Stream:pe,Writable:me,Readable:fe,Duplex:_e,Transform:ge,PassThrough:class extends ge{}}},8190:(e,t,s)=>{e.exports=function(e,t){let s,n,r,o=!0;Array.isArray(e)?(s=[],n=e.length):(r=Object.keys(e),s={},n=r.length);function a(e){function n(){t&&t(e,s),t=null}o?i(n):n()}function h(e,t,i){s[e]=i,(0==--n||t)&&a(t)}n?r?r.forEach((function(t){e[t]((function(e,s){h(t,e,s)}))})):e.forEach((function(e,t){e((function(e,s){h(t,e,s)}))})):a(null);o=!1};const i=s(9596)},8271:()=>{},8330:e=>{e.exports={version:"2.6.1"}},8444:e=>{e.exports=function(e){return Math.max(16384,1<{e.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"]}},8454:(e,t,s)=>{var i=s(7007),n=s(6698);function r(e){if(!(this instanceof r))return new r(e);"number"==typeof e&&(e={max:e}),e||(e={}),i.EventEmitter.call(this),this.cache={},this.head=this.tail=null,this.length=0,this.max=e.max||1e3,this.maxAge=e.maxAge||0}e.exports=r,n(r,i.EventEmitter),Object.defineProperty(r.prototype,"keys",{get:function(){return Object.keys(this.cache)}}),r.prototype.clear=function(){this.cache={},this.head=this.tail=null,this.length=0},r.prototype.remove=function(e){if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];return delete this.cache[e],this._unlink(e,t.prev,t.next),t.value}},r.prototype._unlink=function(e,t,s){this.length--,0===this.length?this.head=this.tail=null:this.head===e?(this.head=t,this.cache[this.head].next=null):this.tail===e?(this.tail=s,this.cache[this.tail].prev=null):(this.cache[t].next=s,this.cache[s].prev=t)},r.prototype.peek=function(e){if(this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return t.value}},r.prototype.set=function(e,t){var s;if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){if((s=this.cache[e]).value=t,this.maxAge&&(s.modified=Date.now()),e===this.head)return t;this._unlink(e,s.prev,s.next)}else s={value:t,modified:0,next:null,prev:null},this.maxAge&&(s.modified=Date.now()),this.cache[e]=s,this.length===this.max&&this.evict();return this.length++,s.next=null,s.prev=this.head,this.head&&(this.cache[this.head].next=e),this.head=e,this.tail||(this.tail=e),t},r.prototype._checkAge=function(e,t){return!(this.maxAge&&Date.now()-t.modified>this.maxAge)||(this.remove(e),this.emit("evict",{key:e,value:t.value}),!1)},r.prototype.get=function(e){if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return this.head!==e&&(e===this.tail?(this.tail=t.next,this.cache[this.tail].prev=null):this.cache[t.prev].next=t.next,this.cache[t.next].prev=t.prev,this.cache[this.head].next=e,t.prev=this.head,t.next=null,this.head=e),t.value}},r.prototype.evict=function(){if(this.tail){var e=this.tail,t=this.remove(this.tail);this.emit("evict",{key:e,value:t})}}},8499:(e,t,s)=>{const{TokenBucket:i}=s(9439),n=s(8765);e.exports=class{constructor(e={}){if("object"!=typeof e)throw new Error("Options must be an object");this.throttles=[],this.setEnabled(e.enabled),this.setRate(e.rate,e.chunksize)}getEnabled(){return this._enabled}getRate(){return this.bucket.tokensPerInterval}getChunksize(){return this.chunksize}setEnabled(e=!0){if("boolean"!=typeof e)throw new Error("Enabled must be a boolean");this._enabled=e;for(const t of this.throttles)t.setEnabled(e)}setRate(e,t=null){if(!Number.isInteger(e)||e<0)throw new Error("Rate must be an integer bigger than zero");if(e=parseInt(e),t&&("number"!=typeof t||t<=0))throw new Error("Chunksize must be bigger than zero");if(t=t||Math.max(parseInt(e/10),1),t=parseInt(t),e>0&&t>e)throw new Error("Chunk size must be smaller than rate");this.bucket||(this.bucket=new i(e,e,"second",null)),this.bucket.bucketSize=e,this.bucket.tokensPerInterval=e,this.chunksize=t}setChunksize(e){if(!Number.isInteger(e)||e<=0)throw new Error("Chunk size must be an integer bigger than zero");const t=this.getRate();if(e=parseInt(e),t>0&&e>t)throw new Error("Chunk size must be smaller than rate");this.chunksize=e}throttle(e={}){if("object"!=typeof e)throw new Error("Options must be an object");return new n({...e,group:this})}destroy(){for(const e of this.throttles)e.destroy();this.throttles=[]}_addThrottle(e){if(!(e instanceof n))throw new Error("Throttle must be an instance of Throttle");this.throttles.push(e)}_removeThrottle(e){const t=this.throttles.indexOf(e);t>-1&&this.throttles.splice(t,1)}}},8673:e=>{function t(){this._types=Object.create(null),this._extensions=Object.create(null);for(let e=0;e{function t(e){return parseInt(e,10)===e}function s(e){function s(t){if(void 0===t){t=new Array(e);for(var s=0;s{const{EventEmitter:i}=s(7007),{Transform:n}=s(8179),{wait:r}=s(2072);e.exports=class extends n{constructor(e={}){if(super(),"object"!=typeof e)throw new Error("Options must be an object");const t=Object.assign({},e);if(t.group&&!(t.group instanceof o))throw new Error("Group must be an instanece of ThrottleGroup");t.group||(t.group=new o(t)),this._setEnabled(t.enabled||t.group.enabled),this._group=t.group,this._emitter=new i,this._destroyed=!1,this._group._addThrottle(this)}getEnabled(){return this._enabled}getGroup(){return this._group}_setEnabled(e=!0){if("boolean"!=typeof e)throw new Error("Enabled must be a boolean");this._enabled=e}setEnabled(e){this._setEnabled(e),this._enabled?this._emitter.emit("enabled"):this._emitter.emit("disabled")}_transform(e,t){this._processChunk(e,t)}async _waitForTokens(e){return new Promise(((t,s)=>{let i=!1;const n=this;function r(e){if(n._emitter.removeListener("disabled",r),n._emitter.removeListener("destroyed",r),!i){if(i=!0,e)return s(e);t()}}this._emitter.once("disabled",r),this._emitter.once("destroyed",r),this._group.bucket.removeTokens(e,r)}))}_areBothEnabled(){return this._enabled&&this._group.getEnabled()}async _processChunk(e,t){if(!this._areBothEnabled())return t(null,e);let s=0,i=this._group.getChunksize(),n=e.slice(s,s+i);for(;n.length>0;){if(this._areBothEnabled())try{for(;0===this._group.getRate()&&!this._destroyed&&this._areBothEnabled();)if(await r(1e3),this._destroyed)return;if(this._areBothEnabled()&&!this._group.bucket.tryRemoveTokens(n.length)&&(await this._waitForTokens(n.length),this._destroyed))return}catch(e){return t(e)}this.push(n),s+=i,i=this._areBothEnabled()?this._group.getChunksize():e.length-s,n=e.slice(s,s+i)}return t()}destroy(...e){this._group._removeThrottle(this),this._destroyed=!0,this._emitter.emit("destroyed"),super.destroy(...e)}};const o=s(8499)},8878:()=>{},9439:(e,t,s)=>{t.RateLimiter=s(3065),t.TokenBucket=s(5472)},9596:e=>{let t;e.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:globalThis):e=>(t||(t=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))},9639:(e,t,s)=>{s.d(t,{NJ:()=>g,V5:()=>o,dU:()=>f,HB:()=>y,xW:()=>h,LC:()=>l,tW:()=>S,fk:()=>a,Ht:()=>w,po:()=>E,L0:()=>_});const i="0123456789abcdef",n=[],r=[];for(let e=0;e<256;e++)n[e]=i[e>>4&15]+i[15&e],e<16&&(e<10?r[48+e]=e:r[87+e]=e);const o=e=>{const t=e.length;let s="",i=0;for(;i{const t=e.length>>1,s=t<<1,i=new Uint8Array(t);let n=0,o=0;for(;o{const s=e.length||0;if(!t){let i=s;for(;i--;)t+=e[i].length}const i=new Uint8Array(t);let n=t,r=s;for(;r--;)n-=e[r].length,i.set(e[r],n);return i},l=(e,t)=>{if(e.length!==t.length)return!1;for(let s=e.length;s>-1;s-=1)if(e[s]!==t[s])return!1;return!0};for(var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="undefined"==typeof Uint8Array?[]:new Uint8Array(256),u=0;u<64;u++)d[c.charCodeAt(u)]=u;const p=new TextDecoder,f=(e,t)=>{if(!t)return p.decode(e);return new TextDecoder(t).decode(e)},m=new TextEncoder,_=e=>m.encode(e),g=e=>function(e){var t,s=new Uint8Array(e),i=s.length,n="";for(t=0;t>2],n+=c[(3&s[t])<<4|s[t+1]>>4],n+=c[(15&s[t+1])<<2|s[t+2]>>6],n+=c[63&s[t+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(e),y=e=>{let t,s="",n=0;const r=e.length;for(;n>4]+i[15&t];return s},w=e=>{const t=a(e);if(t.length<=65536)return String.fromCharCode(...t);let s="",i=0;for(;i{if(!k)throw new Error("no web crypto support");"string"==typeof e&&(e=_(e));const i=new Uint8Array(await k.digest(s,e));return t?x[t](i):i},E=e=>{const t=new Uint8Array(e);return v.getRandomValues(t)}}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return s[e](r,r.exports,n),r.exports}t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,n.t=function(s,i){if(1&i&&(s=this(s)),8&i)return s;if("object"==typeof s&&s){if(4&i&&s.__esModule)return s;if(16&i&&"function"==typeof s.then)return s}var r=Object.create(null);n.r(r);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&s;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>o[e]=()=>s[e]));return o.default=()=>s,n.d(r,o),r},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r=n(7007);function o(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function a(e,t){let s,i="",n=0,r=-1,o=0;for(let a=0;a<=e.length;++a){if(a2){const e=i.lastIndexOf("/");if(e!==i.length-1){-1===e?(i="",n=0):(i=i.slice(0,e),n=i.length-1-i.lastIndexOf("/")),r=a,o=0;continue}}else if(2===i.length||1===i.length){i="",n=0,r=a,o=0;continue}t&&(i.length>0?i+="/..":i="..",n=2)}else i.length>0?i+="/"+e.slice(r+1,a):i=e.slice(r+1,a),n=a-r-1;r=a,o=0}else 46===s&&-1!==o?++o:o=-1}return i}function h(){if(0===arguments.length)return".";let e;for(let t=0;t0&&(void 0===e?e=s:e+="/"+s)}return void 0===e?".":function(e){if(o(e),0===e.length)return".";const t=47===e.charCodeAt(0),s=47===e.charCodeAt(e.length-1);return 0!==(e=a(e,!t)).length||t||(e="."),e.length>0&&s&&(e+="/"),t?"/"+e:e}(e)}n(717);const l="/";var c=n(988),d=n(1467),u=n(8444),p=n(2123);const f=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("|"));function m(e){return f.test(e)}var _=n(405),g=n(8190),y=n(9596),w=n(9639),b=(n(3468),n(2532));const v=[["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"]];const k=Symbol("itemPath");function x(e,t,s){var i;if(i=e,"undefined"!=typeof FileList&&i instanceof FileList&&(e=Array.from(e)),Array.isArray(e)||(e=[e]),0===e.length)throw new Error("invalid input type");e.forEach((e=>{if(null==e)throw new Error(`invalid input type: ${e}`)})),1!==(e=e.map((e=>C(e)&&"string"==typeof e.path&&"function"==typeof b?e.path:e))).length||"string"==typeof e[0]||e[0].name||(e[0].name=t.name);let n=null;e.forEach(((t,s)=>{if("string"==typeof t)return;let i=t.fullPath||t.name;i||(i=`Unknown File ${s+1}`,t.unknownName=!0),t[k]=i.split("/"),t[k][0]||t[k].shift(),t[k].length<2?n=null:0===s&&e.length>1?n=t[k][0]:t[k][0]!==n&&(n=null)}));(void 0===t.filterJunkFiles||t.filterJunkFiles)&&(e=e.filter((e=>"string"==typeof e||!function(e){const t=e[e.length-1];return"."===t[0]&&m(t)}(e[k])))),n&&e.forEach((e=>{const t=(ArrayBuffer.isView(e)||P(e))&&!e[k];"string"==typeof e||t||e[k].shift()})),!t.name&&n&&(t.name=n),t.name||e.some((e=>"string"==typeof e?(t.name=function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');o(e);let s,i=0,n=-1,r=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let o=t.length-1,a=-1;for(s=e.length-1;s>=0;--s){const h=e.charCodeAt(s);if(47===h){if(!r){i=s+1;break}}else-1===a&&(r=!1,a=s+1),o>=0&&(h===t.charCodeAt(o)?-1==--o&&(n=s):(o=-1,n=a))}return i===n?n=a:-1===n&&(n=e.length),e.slice(i,n)}for(s=e.length-1;s>=0;--s)if(47===e.charCodeAt(s)){if(!r){i=s+1;break}}else-1===n&&(r=!1,n=s+1);return-1===n?"":e.slice(i,n)}(e),!0):!e.unknownName&&(t.name=e[k][e[k].length-1],!0))),t.name||(t.name=`Unnamed Torrent ${Date.now()}`),t.maxPieceLength||(t.maxPieceLength=4194304);const r=e.reduce(((e,t)=>e+Number("string"==typeof t)),0);let a=1===e.length;if(1===e.length&&"string"==typeof e[0]){if("function"!=typeof b)throw new Error("filesystem paths do not work in the browser");p(e[0],((e,t)=>{if(e)return s(e);a=t,h()}))}else y(h);function h(){g(e.map((e=>t=>{const s={};if(C(e))s.getStream=e.stream(),s.length=e.size;else if(ArrayBuffer.isView(e))s.getStream=[e],s.length=e.length;else{if(!P(e)){if("string"==typeof e){if("function"!=typeof b)throw new Error("filesystem paths do not work in the browser");return void b(e,r>1||a,t)}throw new Error("invalid input type")}s.getStream=async function*(e,t){for await(const s of e)t.length+=s.length,yield s}(e,s),s.length=0}s.path=e[k],t(null,s)})),((e,t)=>{if(e)return s(e);t=t.flat(),s(null,t,a)}))}}const S=5;function E(e,t){return e+t.length}function C(e){return"undefined"!=typeof Blob&&e instanceof Blob}function P(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}const T=function(e,t,s){"function"==typeof t&&([t,s]=[s,t]),x(e,t=t?Object.assign({},t):{},((e,i,n)=>{if(e)return s(e);t.singleFileTorrent=n,function(e,t,s){let i=t.announceList;i||("string"==typeof t.announce?i=[[t.announce]]:Array.isArray(t.announce)&&(i=t.announce.map((e=>[e]))));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((e=>[e])))));void 0===t.announce&&void 0===t.announceList&&(i=i.concat(v));"string"==typeof t.urlList&&(t.urlList=[t.urlList]);const n={info:{name:t.name},"creation date":Math.ceil((Number(t.creationDate)||Date.now())/1e3),encoding:"UTF-8"};0!==i.length&&(n.announce=i[0][0],n["announce-list"]=i);void 0!==t.comment&&(n.comment=t.comment);void 0!==t.createdBy&&(n["created by"]=t.createdBy);void 0!==t.private&&(n.info.private=Number(t.private));void 0!==t.info&&Object.assign(n.info,t.info);void 0!==t.sslCert&&(n.info["ssl-cert"]=t.sslCert);void 0!==t.urlList&&(n["url-list"]=t.urlList);const r=e.reduce(E,0),o=t.pieceLength||Math.min(u(r),t.maxPieceLength);n.info["piece length"]=o,async function(e,t,s,i,n){const r=[];let o=0,a=0;const h=e.map((e=>e.getStream)),l=i.onProgress;let c=0,u=0,p=!1;const f=d(_(h),t,{zeroPadding:!1});try{for await(const e of f)await new Promise((t=>{o+=e.length;const i=u;++u,++c{r[i]=h,--c,a+=e.length,l&&l(a,s),t(),p&&0===c&&n(null,(0,w.fk)(r.join("")),o)}))}));if(0===c)return n(null,(0,w.fk)(r.join("")),o);p=!0}catch(e){n(e)}}(e,o,r,t,((i,r,o)=>{if(i)return s(i);n.info.pieces=r,e.forEach((e=>{delete e.getStream})),t.singleFileTorrent?n.info.length=o:n.info.files=e,s(null,c.A.encode(n))}))}(i,t,s)}))};var A=n(7833),I=n(6664),L=n(1827),O=n(3208);self.Blob,self.File,self.FormData,self.Headers,self.Request,self.Response,self.AbortController,self.AbortSignal;const R=self.fetch||(()=>{throw new Error("global fetch is not available!")}),H=[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 N=function(e){if(!ArrayBuffer.isView(e)&&"string"!=typeof e)throw new TypeError("base32.decode only takes Buffer or string as parameter");let t,s=0,i=0,n=0;ArrayBuffer.isView(e)||(e=(0,w.L0)(e));const r=new Uint8Array(Math.ceil(5*e.length/8));for(let o=0;o>>s,r[n]=t,n++,t=255&i<<8-s)}return r.subarray(0,n)};function U(e){return e.reduce(((e,t,s,i)=>{const n=t.split("-").map((e=>parseInt(e)));return e.concat(((e,t=e)=>Array.from({length:t-e+1},((t,s)=>s+e)))(...n))}),[])}const M=function(e){const t={},s=e.split("magnet:?")[1];let i;if((s&&s.length>=0?s.split("&"):[]).forEach((e=>{const s=e.split("=");if(2!==s.length)return;const i=s[0];let n=s[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=U(decodeURIComponent(n).split(","))),t[i]?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(n)):t[i]=n})),t.xt){(Array.isArray(t.xt)?t.xt:[t.xt]).forEach((e=>{(i=e.match(/^urn:btih:(.{40})/))?t.infoHash=i[1].toLowerCase():(i=e.match(/^urn:btih:(.{32})/))?t.infoHash=(0,w.V5)(N(i[1])):(i=e.match(/^urn:btmh:1220(.{64})/))&&(t.infoHashV2=i[1].toLowerCase())}))}if(t.xs){(Array.isArray(t.xs)?t.xs:[t.xs]).forEach((e=>{(i=e.match(/^urn:btpk:(.{64})/))&&(t.publicKey=i[1].toLowerCase())}))}return t.infoHash&&(t.infoHashBuffer=(0,w.fk)(t.infoHash)),t.infoHashV2&&(t.infoHashV2Buffer=(0,w.fk)(t.infoHashV2)),t.publicKey&&(t.publicKeyBuffer=(0,w.fk)(t.publicKey)),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce=[],("string"==typeof t.tr||Array.isArray(t.tr))&&(t.announce=t.announce.concat(t.tr)),t.urlList=[],("string"==typeof t.as||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),("string"==typeof t.ws||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),t.peerAddresses=[],("string"==typeof t["x.pe"]||Array.isArray(t["x.pe"]))&&(t.peerAddresses=t.peerAddresses.concat(t["x.pe"])),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),t.peerAddresses=Array.from(new Set(t.peerAddresses)),t};async function F(e){if("string"==typeof e&&/^(stream-)?magnet:/.test(e)){const t=M(e);if(!t.infoHash)throw new Error("Invalid torrent identifier");return t}if("string"==typeof e&&(/^[a-f0-9]{40}$/i.test(e)||/^[a-z2-7]{32}$/i.test(e)))return M(`magnet:?xt=urn:btih:${e}`);if(ArrayBuffer.isView(e)&&20===e.length)return M(`magnet:?xt=urn:btih:${(0,w.V5)(e)}`);if(ArrayBuffer.isView(e))return await async function(e){ArrayBuffer.isView(e)&&(e=c.A.decode(e));D(e.info,"info"),D(e.info["name.utf-8"]||e.info.name,"info.name"),D(e.info["piece length"],"info['piece length']"),D(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach((e=>{D("number"==typeof e.length,"info.files[0].length"),D(e["path.utf-8"]||e.path,"info.files[0].path")})):D("number"==typeof e.info.length,"info.length");const t={info:e.info,infoBuffer:c.A.encode(e.info),name:(0,w.dU)(e.info["name.utf-8"]||e.info.name),announce:[]};t.infoHashBuffer=await(0,w.tW)(t.infoBuffer),t.infoHash=(0,w.V5)(t.infoHashBuffer),void 0!==e.info.private&&(t.private=!!e.info.private);e["creation date"]&&(t.created=new Date(1e3*e["creation date"]));e["created by"]&&(t.createdBy=(0,w.dU)(e["created by"]));ArrayBuffer.isView(e.comment)&&(t.comment=(0,w.dU)(e.comment));Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach((e=>{e.forEach((e=>{t.announce.push((0,w.dU)(e))}))})):e.announce&&t.announce.push((0,w.dU)(e.announce));ArrayBuffer.isView(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]);t.urlList=(e["url-list"]||[]).map((e=>(0,w.dU)(e))),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList));const s=e.info.files||[e.info];t.files=s.map(((e,i)=>{const n=[].concat(t.name,e["path.utf-8"]||e.path||[]).map((e=>ArrayBuffer.isView(e)?(0,w.dU)(e):e));return{path:h.apply(null,[l].concat(n)).slice(1),name:n[n.length-1],length:e.length,offset:s.slice(0,i).reduce(B,0)}})),t.length=s.reduce(B,0);const i=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(i.offset+i.length)%t.pieceLength||t.pieceLength,t.pieces=function(e){const t=[];for(let s=0;s{s(null,i)}));else if(n=e,"undefined"!=typeof Blob&&n instanceof Blob)try{r(new Uint8Array(await e.arrayBuffer()))}catch(e){return s(new Error(`Error converting Blob: ${e.message}`))}else if(/^https?:/.test(e))try{const s=await R(e,{headers:{"user-agent":"WebTorrent (https://webtorrent.io)"},signal:AbortSignal.timeout(3e4),...t});r(new Uint8Array(await s.arrayBuffer()))}catch(e){return s(new Error(`Error downloading torrent: ${e.message}`))}else"function"==typeof O.readFile&&"string"==typeof e?O.readFile(e,((e,t)=>{if(e)return s(new Error("Invalid torrent identifier"));r(t)})):y((()=>{s(new Error("Invalid torrent identifier"))}));var n;async function r(e){try{i=await F(e)}catch(e){return s(e)}i&&i.infoHash?s(null,i):s(new Error("Invalid torrent identifier"))}}function B(e,t){return e+t.length}function D(e,t){if(!e)throw new Error(`Torrent is missing required field: ${t}`)}const q=F,W=function(e){e=Object.assign({},e);let t=new Set;e.xt&&"string"==typeof e.xt&&t.add(e.xt),e.xt&&Array.isArray(e.xt)&&(t=new Set(e.xt)),e.infoHashBuffer&&t.add(`urn:btih:${(0,w.V5)(e.infoHashBuffer)}`),e.infoHash&&t.add(`urn:btih:${e.infoHash}`),e.infoHashV2Buffer&&t.add(e.xt=`urn:btmh:1220${(0,w.V5)(e.infoHashV2Buffer)}`),e.infoHashV2&&t.add(`urn:btmh:1220${e.infoHashV2}`);const s=Array.from(t);1===s.length&&(e.xt=s[0]),s.length>1&&(e.xt=s),e.publicKeyBuffer&&(e.xs=`urn:btpk:${(0,w.V5)(e.publicKeyBuffer)}`),e.publicKey&&(e.xs=`urn:btpk:${e.publicKey}`),e.name&&(e.dn=e.name),e.keywords&&(e.kt=e.keywords),e.announce&&(e.tr=e.announce),e.urlList&&(e.ws=e.urlList,delete e.as),e.peerAddresses&&(e["x.pe"]=e.peerAddresses);let i="magnet:?";return Object.keys(e).filter((e=>2===e.length||"x.pe"===e)).forEach(((t,s)=>{const n=Array.isArray(e[t])?e[t]:[e[t]];var r;n.forEach(((e,n)=>{(s>0||n>0)&&("kt"!==t&&"so"!==t||0===n)&&(i+="&"),"dn"===t&&(e=encodeURIComponent(e).replace(/%20/g,"+")),"tr"!==t&&"as"!==t&&"ws"!==t||(e=encodeURIComponent(e)),"xs"!==t||e.startsWith("urn:btpk:")||(e=encodeURIComponent(e)),"kt"===t&&(e=encodeURIComponent(e)),"so"!==t&&(i+="kt"===t&&n>0?`+${e}`:`${t}=${e}`)})),"so"===t&&(i+=`${t}=${r=n,r.reduce(((e,t,s,i)=>(0!==s&&t===i[s-1]+1||e.push([]),e[e.length-1].push(t),e)),[]).map((e=>e.length>1?`${e[0]}-${e[e.length-1]}`:`${e[0]}`))}`)})),i},$="undefined"!=typeof window?window:self,z=$.RTCPeerConnection||$.mozRTCPeerConnection||$.webkitRTCPeerConnection,V=$.RTCSessionDescription||$.mozRTCSessionDescription||$.webkitRTCSessionDescription,G=$.RTCIceCandidate||$.mozRTCIceCandidate||$.webkitRTCIceCandidate;$.RTCIceTransport,$.RTCDataChannel,$.RTCSctpTransport,$.RTCDtlsTransport,$.RTCCertificate,$.MediaStream,$.MediaStreamTrack,$.MediaStreamTrackEvent,$.RTCPeerConnectionIceEvent,$.RTCDataChannelEvent,$.RTCTrackEvent,$.RTCError,$.RTCErrorEvent,$.RTCRtpTransceiver,$.RTCRtpReceiver,$.RTCRtpSender;var K=n(8179),Y=n(6310);const J=A("simple-peer"),X=65536;function Q(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}class Z extends K.Duplex{_pc;constructor(e){if(super(e=Object.assign({allowHalfOpen:!1},e)),this.__objectMode=!!e.objectMode,this._id=(0,w.V5)((0,w.po)(4)).slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||(0,w.V5)((0,w.po)(20)):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||Z.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},Z.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.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,!z)throw"undefined"==typeof window?Y(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):Y(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 z(this.config)}catch(e){return void this.__destroy(Y(e,"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=e=>{this._onIceCandidate(e)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch((e=>{this.__destroy(Y(e,"ERR_PC_PEER_IDENTITY"))})),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},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(e){if(!this._destroying){if(this.destroyed)throw Y(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new V(e)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((e=>{this._addIceCandidate(e)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((e=>{this.__destroy(Y(e,"ERR_SET_REMOTE_DESCRIPTION"))})),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.__destroy(Y(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(e){const t=new G(e);this._pc.addIceCandidate(t).catch((e=>{var s;!t.address||t.address.endsWith(".local")?(s="Ignoring unsupported ICE candidate.",console.warn(s)):this.__destroy(Y(e,"ERR_ADD_ICE_CANDIDATE"))}))}send(e){if(!this._destroying){if(this.destroyed)throw Y(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(e)}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,queueMicrotask((()=>{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 Y(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(e){this._readableState.ended||this.push(null),e(null)}__destroy(e){this.end(),this._destroy((()=>{}),e)}_destroy(e,t){this.destroyed||this._destroying||(this._destroying=!0,this._debug("destroying (error: %s)",t&&(t.message||t)),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(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}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,t&&this.emit("error",t),e()}),0))}_setupData(e){if(!e.channel)return this.__destroy(Y(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=X),this.channelName=this._channel.label,this._channel.onmessage=e=>{this._onChannelMessage(e)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=e=>{const t=e.error instanceof Error?e.error:new Error(`Datachannel error: ${e.message} ${e.filename}:${e.lineno}:${e.colno}`);this.__destroy(Y(t,"ERR_DATA_CHANNEL"))};let t=!1;this._closingInterval=setInterval((()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1}),5e3)}_write(e,t){if(this.destroyed)return t(Y(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(e){return this.__destroy(Y(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>X?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=t):t(null)}else this._debug("write before connect"),this._chunk=e,this._cb=t}_onFinish(){if(this.destroyed)return;const e=()=>{setTimeout((()=>this.__destroy()),1e3)};this._connected?e():this.once("connect",e)}_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((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=Q(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(this.destroyed)return;const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})};this._pc.setLocalDescription(e).then((()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.__destroy(Y(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.__destroy(Y(e,"ERR_CREATE_OFFER"))}))}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=Q(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(this.destroyed)return;const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers?.()};this._pc.setLocalDescription(e).then((()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.__destroy(Y(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.__destroy(Y(e,"ERR_CREATE_ANSWER"))}))}_onConnectionStateChange(){this.destroyed||this._destroying||"failed"===this._pc.connectionState&&this.__destroy(Y(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.__destroy(Y(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.__destroy(Y(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(e){const t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach((t=>{Object.assign(e,t)})),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then((s=>{const i=[];s.forEach((e=>{i.push(t(e))})),e(null,i)}),(t=>e(t))):this._pc.getStats.length>0?this._pc.getStats((s=>{if(this.destroyed)return;const i=[];s.result().forEach((e=>{const s={};e.names().forEach((t=>{s[t]=e.stat(t)})),s.id=e.id,s.type=e.type,s.timestamp=e.timestamp,i.push(t(s))})),e(null,i)}),(t=>e(t))):e(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 e=()=>{this.destroyed||this._destroying||this.getStats(((t,s)=>{if(this.destroyed||this._destroying)return;t&&(s=[]);const i={},n={},r={};let o=!1;s.forEach((e=>{"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(n[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(r[e.id]=e)}));const a=e=>{o=!0;let t=n[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):"string"==typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let s=i[e.remoteCandidateId];s&&(s.ip||s.address)?(this.remoteAddress=s.ip||s.address,this.remotePort=Number(s.port)):s&&s.ipAddress?(this.remoteAddress=s.ipAddress,this.remotePort=Number(s.portNumber)):"string"==typeof e.googRemoteAddress&&(s=e.googRemoteAddress.split(":"),this.remoteAddress=s[0],this.remotePort=Number(s[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(s.forEach((e=>{"transport"===e.type&&e.selectedCandidatePairId&&a(r[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&a(e)})),o||Object.keys(r).length&&!Object.keys(n).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.__destroy(Y(t,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(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(e,100)}))};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>X||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach((e=>{this._pc.removeTrack(e),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(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer?t=new Uint8Array(t):!1===this.__objectMode&&(t=(0,w.L0)(t)),this.push(t)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const e=this._cb;this._cb=null,e(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 e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],J.apply(null,e)}}Z.WEBRTC_SUPPORT=!!z,Z.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},Z.channelConfig={};const ee=Z;var te=n(1035),se=n(7541),ie=n(3278),ne=n(8271),re=n(6686),oe=n(7828),ae=n(6889);const he=/^\[?([^\]]+)]?:(\d+)$/;let le=new Map;function ce(e){if(1e5===le.size&&le.clear(),!le.has(e)){const t=he.exec(e);if(!t)throw new Error(`invalid addr: ${e}`);le.set(e,[t[1],Number(t[2])])}return le.get(e)}var de=n(3033),ue=n(4497);async function*pe(e,t={}){if(e?.[Symbol.asyncIterator])return void(yield*e[Symbol.asyncIterator](t.offset));if(!e?.get)throw new Error("First argument must be an abstract-chunk-store compliant store");const s=t.chunkLength||e.chunkLength;if(!s)throw new Error("missing required `chunkLength` property");let i=t.length||e.length;if(!Number.isFinite(i))throw new Error("missing required `length` property");const n=t.offset||0,r=(t,s,i)=>new Promise(((n,r)=>{e.get(t,{offset:i,length:s},((e,t)=>{e&&r(e),n(t)}))}));let o=Math.floor(n/s);const a=n%s;if(n){const e=Math.min(i,s-a);i-=e,yield r(o++,e,a)}for(let e=i;e>0;++o,e-=s)yield r(o,Math.min(e,s))}async function fe(e,t,s={}){if(!e?.put)throw new Error("First argument must be an abstract-chunk-store compliant store");const i=s.chunkLength||e.chunkLength;if(!i)throw new Error("missing required `chunkLength` property");const n=s.storeMaxOutstandingPuts||16;let r=0,o=0,a=()=>{},h=!1;for await(const l of d(t,i,{zeroPadding:s.zeroPadding||!1}))await new Promise(((t,s)=>{r++<=n&&t(),e.put(o++,l,(e=>{if(e)return s(e);--r,t(),h&&0===r&&a()}))}));0!==r&&(h=new Promise((e=>{a=e})),await h)}var me=n(4018),_e=n(3970),ge=n(3519),ye=n(1551);const we={DEFAULT_ANNOUNCE_PEERS:50,MAX_ANNOUNCE_PEERS:82,parseUrl:e=>{const t=new URL(e.replace(/^udp:/,"http:"));return e.match(/^udp:/)&&Object.defineProperties(t,{href:{value:t.href.replace(/^http/,"udp")},protocol:{value:t.protocol.replace(/^http/,"udp")},origin:{value:t.origin.replace(/^http/,"udp")}}),t},...n.t(ye,2)};var be=n(826),ve=n(61),ke=n(2701);const xe=A("simple-websocket"),Se="function"!=typeof ke?WebSocket:ke;class Ee extends K.Duplex{constructor(e={}){if("string"==typeof e&&(e={url:e}),super(e=Object.assign({allowHalfOpen:!1},e)),this.__objectMode=!!e.objectMode,null!=e.objectMode&&delete e.objectMode,null==e.url&&null==e.socket)throw new Error("Missing required `url` or `socket` option");if(null!=e.url&&null!=e.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(this._id=(0,w.V5)((0,w.po)(4)).slice(0,7),this._debug("new websocket: %o",e),this.connected=!1,this._chunk=null,this._cb=null,this._interval=null,e.socket)this.url=e.socket.url,this._ws=e.socket,this.connected=e.socket.readyState===Se.OPEN;else{this.url=e.url;try{this._ws="function"==typeof ke?new Se(e.url,{...e,encoding:void 0}):new Se(e.url)}catch(e){return void y((()=>this.destroy(e)))}}this._ws.binaryType="arraybuffer",e.socket&&this.connected?y((()=>this._handleOpen())):this._ws.onopen=()=>this._handleOpen(),this._ws.onmessage=e=>this._handleMessage(e),this._ws.onclose=()=>this._handleClose(),this._ws.onerror=e=>this._handleError(e),this._handleFinishBound=()=>this._handleFinish(),this.once("finish",this._handleFinishBound)}send(e){this._ws.send(e)}_final(e){this._readableState.ended||this.push(null),e(null)}_destroy(e){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,t=()=>{e.onclose=null};if(e.readyState===Se.CLOSED)t();else try{e.onclose=t,e.close()}catch(e){t()}e.onopen=null,e.onmessage=null,e.onerror=()=>{}}this._ws=null,e()}}_write(e,t){if(this.destroyed)return t(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof ke&&this._ws.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=t):t(null)}else this._debug("write before connect"),this._chunk=e,this._cb=t}_handleOpen(){if(!this.connected&&!this.destroyed){if(this.connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(e)}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(null)}"function"!=typeof ke&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}}_handleMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=new Uint8Array(t)),!1===this.__objectMode&&(t=(0,w.L0)(t)),this.push(t)}_handleClose(){this.destroyed||(this._debug("on close"),this.destroy())}_handleError(e){this.destroy(new Error(`Error connecting to ${this.url}`))}_handleFinish(){if(this.destroyed)return;const e=()=>{setTimeout((()=>this.destroy()),1e3)};this.connected?e():this.once("connect",e)}_onInterval(){if(!this._cb||!this._ws||this._ws.bufferedAmount>65536)return;this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);const e=this._cb;this._cb=null,e(null)}_debug(){const e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],xe.apply(null,e)}}Ee.WEBSOCKET_SUPPORT=!!Se;const Ce=class extends r{constructor(e,t){super(),this.client=e,this.announceUrl=t,this.interval=null,this.destroyed=!1}setInterval(e){null==e&&(e=this.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(this.interval),e&&(this.interval=setInterval((()=>{this.announce(this.client._defaultAnnounceOpts())}),e),this.interval.unref&&this.interval.unref())}},Pe=A("bittorrent-tracker:websocket-tracker"),Te={};class Ae extends Ce{constructor(e,t){super(e,t),Pe("new websocket tracker %s",t),this.peers={},this.socket=null,this.reconnecting=!1,this.retries=0,this.reconnectTimer=null,this.expectingResponse=!1,this._openSocket()}announce(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.announce(e)}));const t=Object.assign({},e,{action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(t.trackerid=this._trackerId),"stopped"===e.event||"completed"===e.event)this._send(t);else{const s=Math.min(e.numwant,5);this._generateOffers(s,(e=>{t.numwant=s,t.offers=e,this._send(t)}))}}scrape(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.scrape(e)}));const t={action:"scrape",info_hash:Array.isArray(e.infoHash)&&e.infoHash.length>0?e.infoHash.map((e=>(0,w.Ht)(e))):e.infoHash&&(0,w.Ht)(e.infoHash)||this.client._infoHashBinary};this._send(t)}destroy(e=Ie){if(this.destroyed)return e(null);this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer);for(const e in this.peers){const t=this.peers[e];clearTimeout(t.trackerTimeout),t.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,Te[this.announceUrl]&&(Te[this.announceUrl].consumers-=1),Te[this.announceUrl].consumers>0)return e();let t,s=Te[this.announceUrl];if(delete Te[this.announceUrl],s.on("error",Ie),s.once("close",e),!this.expectingResponse)return i();function i(){t&&(clearTimeout(t),t=null),s.removeListener("data",i),s.destroy(),s=null}t=setTimeout(i,we.DESTROY_TIMEOUT),s.once("data",i)}_openSocket(){if(this.destroyed=!1,this.peers||(this.peers={}),this._onSocketConnectBound=()=>{this._onSocketConnect()},this._onSocketErrorBound=e=>{this._onSocketError(e)},this._onSocketDataBound=e=>{this._onSocketData(e)},this._onSocketCloseBound=()=>{this._onSocketClose()},this.socket=Te[this.announceUrl],this.socket)Te[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound();else{const e=new URL(this.announceUrl);let t;this.client._proxyOpts&&(t="wss:"===e.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!t&&this.client._proxyOpts.socksProxy&&(t=this.client._proxyOpts.socksProxy)),this.socket=Te[this.announceUrl]=new Ee({url:this.announceUrl,agent:t}),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(e){if(!this.destroyed){this.expectingResponse=!1;try{e=JSON.parse((0,w.dU)(e))}catch(e){return void this.client.emit("warning",new Error("Invalid tracker response"))}"announce"===e.action?this._onAnnounceResponse(e):"scrape"===e.action?this._onScrapeResponse(e):this._onSocketError(new Error(`invalid action in WS response: ${e.action}`))}}_onAnnounceResponse(e){if(e.info_hash!==this.client._infoHashBinary)return void Pe("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,(0,w.HB)(e.info_hash),this.client.infoHash);if(e.peer_id&&e.peer_id===this.client._peerIdBinary)return;Pe("received %s from %s for %s",JSON.stringify(e),this.announceUrl,this.client.infoHash);const t=e["failure reason"];if(t)return this.client.emit("warning",new Error(t));const s=e["warning message"];s&&this.client.emit("warning",new Error(s));const i=e.interval||e["min interval"];i&&this.setInterval(1e3*i);const n=e["tracker id"];if(n&&(this._trackerId=n),null!=e.complete){const t=Object.assign({},e,{announce:this.announceUrl,infoHash:(0,w.HB)(e.info_hash)});this.client.emit("update",t)}let r;if(e.offer&&e.peer_id&&(Pe("creating peer (from remote offer)"),r=this._createPeer(),r.id=(0,w.HB)(e.peer_id),r.once("signal",(t=>{const s={action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,to_peer_id:e.peer_id,answer:t,offer_id:e.offer_id};this._trackerId&&(s.trackerid=this._trackerId),this._send(s)})),this.client.emit("peer",r),r.signal(e.offer)),e.answer&&e.peer_id){const t=(0,w.HB)(e.offer_id);r=this.peers[t],r?(r.id=(0,w.HB)(e.peer_id),this.client.emit("peer",r),r.signal(e.answer),clearTimeout(r.trackerTimeout),r.trackerTimeout=null,delete this.peers[t]):Pe(`got unexpected answer: ${JSON.stringify(e.answer)}`)}}_onScrapeResponse(e){e=e.files||{};const t=Object.keys(e);0!==t.length?t.forEach((t=>{const s=Object.assign(e[t],{announce:this.announceUrl,infoHash:(0,w.HB)(t)});this.client.emit("scrape",s)})):this.client.emit("warning",new Error("invalid scrape response"))}_onSocketClose(){this.destroyed||(this.destroy(),this._startReconnectTimer())}_onSocketError(e){this.destroyed||(this.destroy(),this.client.emit("warning",e),this._startReconnectTimer())}_startReconnectTimer(){const e=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()}),e),this.reconnectTimer.unref&&this.reconnectTimer.unref(),Pe("reconnecting socket in %s ms",e)}_send(e){if(this.destroyed)return;this.expectingResponse=!0;const t=JSON.stringify(e);Pe("send %s",t),this.socket.send(t)}_generateOffers(e,t){const s=this,i=[];Pe("generating %s offers",e);for(let t=0;t{i.push({offer:t,offer_id:(0,w.Ht)(e)}),r()})),t.trackerTimeout=setTimeout((()=>{Pe("tracker timeout: destroying peer"),t.trackerTimeout=null,delete s.peers[e],t.destroy()}),5e4),t.trackerTimeout.unref&&t.trackerTimeout.unref()}function r(){i.length===e&&(Pe("generated %s offers",e),t(i))}r()}_createPeer(e){const t=this;e=Object.assign({trickle:!1,config:t.client._rtcConfig,wrtc:t.client._wrtc},e);const s=new ee(e);return s.once("error",i),s.once("connect",(function e(){s.removeListener("error",i),s.removeListener("connect",e)})),s;function i(e){t.client.emit("warning",new Error(`Connection error: ${e.message}`)),s.destroy()}}}function Ie(){}Ae.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,Ae._socketPool=Te;const Le=Ae;var Oe=n(717);const Re=A("bittorrent-tracker:client");class He extends r{constructor(e={}){if(super(),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");if(!Oe.browser&&!e.port)throw new Error("Option `port` is required");this.peerId="string"==typeof e.peerId?e.peerId:(0,w.V5)(e.peerId),this._peerIdBuffer=(0,w.fk)(this.peerId),this._peerIdBinary=(0,w.Ht)(this.peerId),this.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():(0,w.V5)(e.infoHash),this._infoHashBuffer=(0,w.fk)(this.infoHash),this._infoHashBinary=(0,w.Ht)(this.infoHash),Re("new client %s",this.infoHash),this.destroyed=!1,this._port=e.port,this._getAnnounceOpts=e.getAnnounceOpts,this._rtcConfig=e.rtcConfig,this._userAgent=e.userAgent,this._proxyOpts=e.proxyOpts,this._wrtc="function"==typeof e.wrtc?e.wrtc():e.wrtc;let t="string"==typeof e.announce?[e.announce]:null==e.announce?[]:e.announce;t=t.map((e=>(ArrayBuffer.isView(e)&&(e=(0,w.dU)(e)),"/"===e[e.length-1]&&(e=e.substring(0,e.length-1)),e))),t=Array.from(new Set(t));const s=!1!==this._wrtc&&(!!this._wrtc||ee.WEBRTC_SUPPORT),i=e=>{y((()=>{this.emit("warning",e)}))};this._trackers=t.map((e=>{let t;try{t=we.parseUrl(e)}catch(t){return i(new Error(`Invalid tracker URL: ${e}`)),null}const n=t.port;if(n<0||n>65535)return i(new Error(`Invalid tracker port: ${e}`)),null;const r=t.protocol;return"http:"!==r&&"https:"!==r||"function"!=typeof be?"udp:"===r&&"function"==typeof ve?new ve(this,e):"ws:"!==r&&"wss:"!==r||!s||"ws:"===r&&"undefined"!=typeof window&&"https:"===window.location.protocol?(i(new Error(`Unsupported tracker protocol: ${e}`)),null):new Le(this,e):new be(this,e)})).filter(Boolean)}start(e){(e=this._defaultAnnounceOpts(e)).event="started",Re("send `start` %o",e),this._announce(e),this._trackers.forEach((e=>{e.setInterval()}))}stop(e){(e=this._defaultAnnounceOpts(e)).event="stopped",Re("send `stop` %o",e),this._announce(e)}complete(e){e||(e={}),(e=this._defaultAnnounceOpts(e)).event="completed",Re("send `complete` %o",e),this._announce(e)}update(e){(e=this._defaultAnnounceOpts(e)).event&&delete e.event,Re("send `update` %o",e),this._announce(e)}_announce(e){this._trackers.forEach((t=>{t.announce(e)}))}scrape(e){Re("send `scrape`"),e||(e={}),this._trackers.forEach((t=>{t.scrape(e)}))}setInterval(e){Re("setInterval %d",e),this._trackers.forEach((t=>{t.setInterval(e)}))}destroy(e){if(this.destroyed)return;this.destroyed=!0,Re("destroy");const t=this._trackers.map((e=>t=>{e.destroy(t)}));g(t,e),this._trackers=[],this._getAnnounceOpts=null}_defaultAnnounceOpts(e={}){return null==e.numwant&&(e.numwant=we.DEFAULT_ANNOUNCE_PEERS),null==e.uploaded&&(e.uploaded=0),null==e.downloaded&&(e.downloaded=0),this._getAnnounceOpts&&(e=Object.assign({},e,this._getAnnounceOpts())),e}}He.scrape=(e,t)=>{if(t=ge(t),!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");const s=Object.assign({},e,{infoHash:Array.isArray(e.infoHash)?e.infoHash[0]:e.infoHash,peerId:(0,w.L0)("01234567890123456789"),port:6881}),i=new He(s);i.once("error",t),i.once("warning",t);let n=Array.isArray(e.infoHash)?e.infoHash.length:1;const r={};return i.on("scrape",(e=>{if(n-=1,r[e.infoHash]=e,0===n){i.destroy();const e=Object.keys(r);1===e.length?t(null,r[e[0]]):t(null,r)}})),i.scrape({infoHash:e.infoHash}),i};const Ne=He;n(7936);var Ue=n(2799),Me=n(717);const Fe=A("torrent-discovery");class je extends r.EventEmitter{constructor(e){if(super(),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!Me.browser&&!e.port)throw new Error("Option `port` is required");this.peerId="string"==typeof e.peerId?e.peerId:e.peerId.toString("hex"),this.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():e.infoHash.toString("hex"),this._port=e.port,this._userAgent=e.userAgent,this.destroyed=!1,this._announce=e.announce||[],this._intervalMs=e.intervalMs||9e5,this._trackerOpts=null,this._dhtAnnouncing=!1,this._dhtTimeout=!1,this._internalDHT=!1,this._onWarning=e=>{this.emit("warning",e)},this._onError=e=>{this.emit("error",e)},this._onDHTPeer=(e,t)=>{t.toString("hex")===this.infoHash&&this.emit("peer",`${e.host}:${e.port}`,"dht")},this._onTrackerPeer=e=>{this.emit("peer",e,"tracker")},this._onTrackerAnnounce=()=>{this.emit("trackerAnnounce")},this._onLSDPeer=(e,t)=>{this.emit("peer",e,"lsd")};const t=(e,t)=>{const s=new _e.Client(t);return s.on("warning",this._onWarning),s.on("error",this._onError),s.listen(e),this._internalDHT=!0,s};!1===e.tracker?this.tracker=null:e.tracker&&"object"==typeof e.tracker?(this._trackerOpts=Object.assign({},e.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),!1===e.dht||"function"!=typeof _e.Client?this.dht=null:e.dht&&"function"==typeof e.dht.addNode?this.dht=e.dht:e.dht&&"object"==typeof e.dht?this.dht=t(e.dhtPort,e.dht):this.dht=t(e.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce()),!1===e.lsd||"function"!=typeof Ue?this.lsd=null:this.lsd=this._createLSD()}updatePort(e){e!==this._port&&(this._port=e,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy((()=>{this.tracker=this._createTracker()}))))}complete(e){this.tracker&&this.tracker.complete(e)}destroy(e){if(this.destroyed)return;this.destroyed=!0,clearTimeout(this._dhtTimeout);const t=[];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),t.push((e=>{this.tracker.destroy(e)}))),this.dht&&this.dht.removeListener("peer",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener("warning",this._onWarning),this.dht.removeListener("error",this._onError),t.push((e=>{this.dht.destroy(e)}))),this.lsd&&(this.lsd.removeListener("warning",this._onWarning),this.lsd.removeListener("error",this._onError),this.lsd.removeListener("peer",this._onLSDPeer),t.push((e=>{this.lsd.destroy(e)}))),g(t,e),this.dht=null,this.tracker=null,this.lsd=null,this._announce=null}_createTracker(){const e=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),t=new Ne(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onTrackerPeer),t.on("update",this._onTrackerAnnounce),t.setInterval(this._intervalMs),t.start(),t}_dhtAnnounce(){this._dhtAnnouncing||(Fe("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,(e=>{this._dhtAnnouncing=!1,Fe("dht announce complete"),e&&this.emit("warning",e),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 e=Object.assign({},{infoHash:this.infoHash,peerId:this.peerId,port:this._port}),t=new Ue(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onLSDPeer),t.start(),t}}const Be=je;const De=["seeking position failed.","InvalidStateError"],qe=["A requested file or directory could not be found at the time an operation was processed.","NotFoundError"],We=e=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${e}`,"SyntaxError"];class $e extends WritableStream{constructor(e){super(e),Object.setPrototypeOf(this,FileSystemWritableFileStream.prototype),this._closed=!1}async close(){this._closed=!0;const e=this.getWriter(),t=e.close();return e.releaseLock(),t}seek(e){return this.write({type:"seek",position:e})}truncate(e){return this.write({type:"truncate",size:e})}write(e){if(this._closed)return Promise.reject(new TypeError("Cannot write to a CLOSED writable stream"));const t=this.getWriter(),s=t.write(e);return t.releaseLock(),s}}if(Object.defineProperty($e.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties($e.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}}),!globalThis.FileSystemFileHandle||globalThis.FileSystemFileHandle.prototype.createWritable||globalThis.FileSystemWritableFileStream||(globalThis.FileSystemWritableFileStream=$e),globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable){const e=new WeakMap;let t;const s=()=>{let e,t;onmessage=async s=>{const i=s.ports[0],n=s.data;switch(n.type){case"open":{const s=n.name;let i=await navigator.storage.getDirectory();for(const e of n.path)i=await i.getDirectoryHandle(e);e=await i.getFileHandle(s),t=await e.createSyncAccessHandle();break}case"write":t.write(n.data,{at:n.position}),t.flush();break;case"truncate":t.truncate(n.size);break;case"abort":case"close":t.close()}i.postMessage(0)}};globalThis.FileSystemFileHandle.prototype.createWritable=async function(i){if(!t){const e=`(${s.toString()})()`,i=new Blob([e],{type:"text/javascript"});t=URL.createObjectURL(i)}const n=new Worker(t,{type:"module"});let r=0;const o=new TextEncoder;let a=await this.getFile().then((e=>e.size));const h=e=>new Promise(((t,s)=>{const i=new MessageChannel;i.port1.onmessage=e=>{e.data instanceof Error?s(e.data):t(e.data),i.port1.close(),i.port2.close(),i.port1.onmessage=null},n.postMessage(e,[i.port2])})),l=await navigator.storage.getDirectory(),c=await e.get(this),d=await l.resolve(c);if(null===d)throw new DOMException(...qe);return await h({type:"open",path:d,name:this.name}),!1===i?.keepExistingData&&(await h({type:"truncate",size:0}),a=0),new $e({async write(e){if("write"===(e=e?.constructor===Object?{...e}:{type:"write",data:e,position:r}).type){if(!("data"in e))throw await h({type:"close"}),new DOMException(...We("write requires a data argument"));if(e.position??=r,"string"==typeof e.data)e.data=o.encode(e.data);else if(e.data instanceof ArrayBuffer)e.data=new Uint8Array(e.data);else if(e.data instanceof Uint8Array||!ArrayBuffer.isView(e.data)){if(!(e.data instanceof Uint8Array)){const t=await new Response(e.data).arrayBuffer();e.data=new Uint8Array(t)}}else e.data=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.byteLength);Number.isInteger(e.position)&&e.position>=0&&(r=e.position),r+=e.data.byteLength,a+=e.data.byteLength}else{if("seek"===e.type){if(Number.isInteger(e.position)&&e.position>=0){if(a=0))throw await h({type:"close"}),new DOMException(...We("truncate requires a size argument"));a=e.size,r>a&&(r=a)}}await h(e)},async close(){await h({type:"close"}),n.terminate()},async abort(e){await h({type:"abort",reason:e}),n.terminate()}})};const i=FileSystemDirectoryHandle.prototype.getFileHandle;FileSystemDirectoryHandle.prototype.getFileHandle=async function(...t){const s=await i.call(this,...t);return e.set(s,this),s}}const ze=/[<>:"/\\|?*\u0000-\u001F]/g;globalThis.navigator?.storage?.getDirectory&&navigator.storage.getDirectory().then((e=>{e.removeEntry("chunks",{recursive:!0}).catch((()=>{}))}));const Ve=(e,t)=>{};class Ge{name="";chunks=[];chunkMap=[];directoryMap={};files;rootDirPromise;storageDirPromise;chunksDirPromise;closing=!1;closed=!1;constructor(e,t={}){if(this.chunkLength=Number(e),!this.chunkLength)throw new Error("First argument must be a chunk length");if(!globalThis.navigator?.storage?.getDirectory)throw new Error("FSA API is not supported");if(this.closed=!1,this.name=t.name||crypto.randomUUID(),this.rootDirPromise=t.rootDir||navigator.storage.getDirectory(),this.storageDirPromise=(async()=>(await this.rootDirPromise).getDirectoryHandle(this.name,{create:!0}))(),this.chunksDirPromise=this.storageDirPromise,t.files&&t.rootDir){if(this.chunksDirPromise=this._getChunksDirHandle(),this.files=t.files.map(((e,t,s)=>{if(null==e.path)throw new Error("File is missing `path` property");if(null==e.length)throw new Error("File is missing `length` property");if(null==e.offset)if(0===t)e.offset=0;else{const i=s[t-1];e.offset=i.offset+i.length}null==e.handle&&(e.handle=this._createFileHandle({path:e.path})),e.blob=this._createBlobReference(e.handle);const i=e.offset,n=e.offset+e.length,r=Math.floor(i/this.chunkLength),o=Math.floor((n-1)/this.chunkLength);for(let t=r;t<=o;++t){const s=t*this.chunkLength,r=is+this.chunkLength?this.chunkLength:n-s,a=i>s?0:s-i;this.chunkMap[t]||(this.chunkMap[t]=[]),this.chunkMap[t].push({from:r,to:o,offset:a,file:e})}return e})),window.addEventListener("pagehide",(()=>this.cleanup())),this.length=this.files.reduce(((e,t)=>e+t.length),0),null!=t.length&&t.length!==this.length)throw new Error("total `files` length is not equal to explicit `length` option")}else this.length=Number(t.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(e){let t=this.chunks[e];if(!t){const s=await this.chunksDirPromise;this.chunks[e]=t=await s.getFileHandle(e,{create:!0})}return t}async _createFileHandle(e){const t=e.path.slice(e.path.lastIndexOf("/")+1);return(await this._getDirectoryHandle(e)).getFileHandle(t.replace(ze,""),{create:!0})}async _createBlobReference(e){return(await e).getFile()}async _getDirectoryHandle(e){const t=e.path.lastIndexOf("/");if(-1===t||0===t)return this.storageDirPromise;const s=e.path=e.path.slice(0,t);return this.directoryMap[s]||(this.directoryMap[s]=(async()=>(await this._getDirectoryHandle(e)).getDirectoryHandle(s.slice(s.lastIndexOf("/")+1),{create:!0}))()),this.directoryMap[s]}async _getChunksDirHandle(){const e=await navigator.storage.getDirectory();return(await e.getDirectoryHandle("chunks",{create:!0})).getDirectoryHandle(this.name,{create:!0})}async put(e,t,s=Ve){try{return await this._put(e,t),s(null),null}catch(e){return queueMicrotask((()=>s(e))),e}}async getStreamForHandle(e){return(await e).createWritable({keepExistingData:!0})}async _put(e,t){if(this.closed)throw new Error("Storage is closed");const s=e===this.lastChunkIndex;if(s&&t.length!==this.lastChunkLength)throw new Error(`Last chunk length must be ${this.lastChunkLength}`);if(!s&&t.length!==this.chunkLength)throw new Error(`Chunk length must be ${this.chunkLength}`);const i=(async()=>{const s=await this._getChunkHandle(e),i=await s.createWritable({keepExistingData:!1});await i.write(t),await i.close()})();if(!this.files)return i;const n=this.chunkMap[e];if(!n)throw new Error("No files matching the request range");const r=n.map((async({file:e,offset:s,from:i,to:n})=>{e.stream||(e.stream=this.getStreamForHandle(e.handle)),await(await e.stream).write({type:"write",position:s,data:t.slice(i,n)})}));r.push(i),await Promise.all(r)}async get(e,t,s=Ve){null==t&&(t={});try{const i=await this._get(e,t);return s(null,i),i}catch(e){return s(e),e}}async _get(e,t){if("function"==typeof t)return this.get(e,void 0,t);if(this.closed)throw new Error("Storage is closed");const s=e===this.lastChunkIndex?this.lastChunkLength:this.chunkLength,i=t.offset||0,n=t.length?i+t.length:s,r=t.length||s-i;if(i<0||i<0||n>s)throw new Error("Invalid offset and/or length");if(i===n)return new Uint8Array(0);if(!this.files||this.chunks[e]){const t=await this._getChunkHandle(e);let n=await t.getFile();0===i&&r===s||(n=n.slice(i,r+i));const o=await n.arrayBuffer();if(0===o.byteLength)throw new Error(`Index ${e} does not exist`);return new Uint8Array(o)}let o=this.chunkMap[e];if(!o)throw new Error("No files matching the request range");if(t&&(o=o.filter((({from:e,to:t})=>t>i&&e{t&&(s>n&&(s=n),equeueMicrotask((()=>e(new Error(t)))))(e,"Storage is closed");this.closing=!0,this.chunkMap=void 0,this.directoryMap=void 0,this.files&&await this.cleanup(),this.closed=!0,queueMicrotask((()=>e(null)))}async cleanup(){if(this.closed||!this.files)return;const e=[];for(const t of this.files)t.stream&&(e.push(t.stream.then((e=>e.close()))),t.stream=void 0);const t=(async()=>{const e=await this.chunksDirPromise;this.chunks=[];for await(const t of e.keys())await e.removeEntry(t,{recursive:!0});this.chunksDirPromise=this._getChunksDirHandle(),await this.chunksDirPromise})();await Promise.all(e);for(const e of this.files)e.blob=this._createBlobReference(e.handle);await t}async destroy(e=Ve){this.close((async t=>{if(t)return e(t);try{const e=await this.rootDirPromise;await e.removeEntry(this.name,{recursive:!0})}catch(t){return e(t)}e(null)}))}}var Ke=n(3714),Ye=n(1314);const Je=A("lt_donthave"),Xe=()=>{class e extends r.EventEmitter{constructor(e){super(),this._peerSupports=!1,this._wire=e}onExtendedHandshake(){this._peerSupports=!0}onMessage(e){let t;try{t=new DataView(e.buffer).getUint32(0)}catch(e){return}this._wire.peerPieces.get(t)&&(Je("got donthave %d",t),this._wire.peerPieces.set(t,!1),this.emit("donthave",t),this._failRequests(t))}donthave(e){if(!this._peerSupports)return;Je("donthave %d",e);const t=new Uint8Array(4);new DataView(t.buffer).setUint32(0,e),this._wire.extended("lt_donthave",t)}_failRequests(e){const t=this._wire.requests;for(let s=0;s{class t extends r.EventEmitter{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new de.A(0,{grow:1e3}),ArrayBuffer.isView(e)&&this.setMetadata(e)}onHandshake(e,t,s){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1e7this._metadataSize&&(s=this._metadataSize);const i=this.metadata.slice(t,s);this._data(e,i,this._metadataSize)}_onData(e,t,s){t.length>nt||!this._fetching||(this.metadata.set(t,e*nt),this._bitfield.set(e),this._checkDone())}_onReject(e){this._remainingRejects>0&&this._fetching?(this._request(e),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 e=0;e0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return t.prototype.name="ut_metadata",t};var ot=n(8878),at=n(1133);const ht=A("webtorrent:file-iterator");class lt extends r{constructor(e,{start:t,end:s}){super(),this._torrent=e._torrent,this._pieceLength=e._torrent.pieceLength,this._startPiece=(t+e.offset)/this._pieceLength|0,this._endPiece=(s+e.offset)/this._pieceLength|0,this._piece=this._startPiece,this._offset=t+e.offset-this._startPiece*this._pieceLength,this._missing=s-t+1,this._criticalLength=Math.min(1048576/this._pieceLength|0,2),this._torrent._select(this._startPiece,this._endPiece,1,null,!0),this.destroyed=!1}[Symbol.asyncIterator](){return this}next(){return new Promise(((e,t)=>{if(0===this._missing||this.destroyed)return e({done:!0}),this.destroy();const s=(i,n)=>{if(!this._torrent.bitfield.get(i)){const e=t=>{(t===i||this.destroyed)&&(this._torrent.removeListener("verified",e),s(i,n))};return this._torrent.on("verified",e),this._torrent.critical(i,i+this._criticalLength)}if(this._torrent.destroyed)return t(new Error("Torrent removed"));this._torrent.store.get(i,n,((s,n)=>this.destroyed?e({done:!0}):(ht("read %s and yielding (length %s) (err %s)",i,n?.length,s?.message),s?t(s):void e({value:n,done:!1}))))},i=Math.min(this._missing,this._pieceLength-this._offset);s(this._piece++,{length:i,offset:this._offset}),this._missing-=i,this._offset=0}))}async return(){return this.destroy(),{done:!0}}async throw(e){throw e}destroy(e=()=>{},t){this.destroyed||(this.destroyed=!0,this._torrent.destroyed||this._torrent._deselect(this._startPiece,this._endPiece,!0),this.emit("return"),e(t))}}class ct extends r{constructor(e,t){super(),this._torrent=e,this._destroyed=!1,this._fileStreams=new Set,this._iterators=new Set,this.name=t.name,this.path=t.path,this.length=t.length,this.size=t.length,this.type=at.getType(this.name)||"application/octet-stream",this.offset=t.offset,this.done=!1;const s=t.offset,i=s+t.length-1;this._startPiece=s/this._torrent.pieceLength|0,this._endPiece=i/this._torrent.pieceLength|0,0===this.length&&(this.done=!0,this.emit("done")),this._client=e.client}get downloaded(){if(this._destroyed||!this._torrent.bitfield)return 0;const{pieces:e,bitfield:t,pieceLength:s,lastPieceLength:i}=this._torrent,{_startPiece:n,_endPiece:r}=this,o=n=>{const r=n===e.length-1?i:s;return t.get(n)?r:r-e[n].missing};let a=0;for(let t=n;t<=r;t+=1){const h=o(t);if(a+=h,t===n){const e=this.offset%s;a-=Math.min(e,h)}if(t===r){const t=(r===e.length-1?i:s)-(this.offset+this.length)%s;a-=Math.min(t,h)}}return a}get progress(){return this.length?this.downloaded/this.length:0}select(e){0!==this.length&&this._torrent.select(this._startPiece,this._endPiece,e)}deselect(){0!==this.length&&this._torrent.deselect(this._startPiece,this._endPiece)}[Symbol.asyncIterator](e={}){if(0===this.length)return async function*(){}();const{start:t=0}=e??{},s=e?.end&&e.end{this._iterators.delete(i)})),i}createReadStream(e){const t=this[Symbol.asyncIterator](e),s=K.Readable.from(t);return this._fileStreams.add(s),s.once("close",(()=>{this._fileStreams.delete(s)})),s}async arrayBuffer(e={}){const{start:t=0}=e,s=e?.end&&e.end{t=this[Symbol.asyncIterator](e)},async pull(e){const{value:s,done:i}=await t.next();i?e.close():e.enqueue(s)},cancel(){t.return()}})}get streamURL(){if(!this._client._server)throw new Error("No server created");return`${this._client._server.pathname}/${this._torrent.infoHash}/${this.path}`}streamTo(e){return e.src=this.streamURL,e}includes(e){return this._startPiece<=e&&this._endPiece>=e}_destroy(){this._destroyed=!0,this._torrent=null;for(const e of this._fileStreams)e.destroy();this._fileStreams.clear();for(const e of this._iterators)e.destroy();this._iterators.clear()}}var dt=n(5658);class ut{constructor(e){this._torrent=e,this._numPieces=e.pieces.length,this._pieces=new Array(this._numPieces),this._onWire=e=>{this.recalculate(),this._initWire(e)},this._onWireHave=e=>{this._pieces[e]+=1},this._onWireBitfield=()=>{this.recalculate()},this._torrent.wires.forEach((e=>{this._initWire(e)})),this._torrent.on("wire",this._onWire),this.recalculate()}getRarestPiece(e){let t=[],s=1/0;for(let i=0;i{this._cleanupWireEvents(e)})),this._torrent=null,this._pieces=null,this._onWire=null,this._onWireHave=null,this._onWireBitfield=null}_initWire(e){e._onClose=()=>{this._cleanupWireEvents(e);for(let t=0;t{const i=await(0,w.tW)(e,"hex");if(this.destroyed)return;this.handshake(t,i);const n=this._torrent.pieces.length,r=new de.A(n);for(let e=0;e<=n;e++)r.set(e,!0);this.bitfield(r)})),this.once("interested",(()=>{_t("interested"),this.unchoke()})),this.on("uninterested",(()=>{_t("uninterested")})),this.on("choke",(()=>{_t("choke")})),this.on("unchoke",(()=>{_t("unchoke")})),this.on("bitfield",(()=>{_t("bitfield")})),this.lt_donthave.on("donthave",(()=>{_t("donthave")})),this.on("request",((e,t,s,i)=>{_t("request pieceIndex=%d offset=%d length=%d",e,t,s),this.httpRequest(e,t,s,((t,s)=>{if(t){this.lt_donthave.donthave(e);const t=setTimeout((()=>{this.destroyed||this.have(e)}),1e4);t.unref&&t.unref()}i(t,s)}))}))}async httpRequest(e,t,s,i){i=ge(i);const n=e*this._torrent.pieceLength+t,r=n+s-1,o=this._torrent.files;let a,h;if(o.length<=1)a=[{url:this.url,start:n,end:r}];else{const e=o.filter((e=>e.offset<=r&&e.offset+e.length>n));if(e.length<1)return i(new Error("Could not find file corresponding to web seed range request"));a=e.map((e=>{const t=e.offset+e.length-1;return{url:this.url+("/"===this.url[this.url.length-1]?"":"/")+e.path.replace(this._torrent.path,""),fileOffsetInRange:Math.max(e.offset-n,0),start:Math.max(n-e.offset,0),end:Math.min(t,r-e.offset)}}))}try{h=await Promise.all(a.map((async({start:i,end:n,url:r})=>{_t("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",r,e,t,s,i,n);const o=await R(r,{cache:"no-store",method:"GET",headers:{"Cache-Control":"no-store","user-agent":`WebTorrent/${mt} (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 _t("Got data of length %d",a.length),a})))}catch(e){return i(e)}i(null,(0,w.xW)(h))}destroy(){super.destroy(),this._torrent=null}}class yt{_items=[];remove(e){for(let t=0;t=0&&0!==e.from&&i.push(n);const r={...s,from:e.to+1};r.to-r.from>=0&&i.push(r),this._items.splice(t,1,...i),t=t-1+i.length}else kt(e,s)&&(this._items.splice(t,1),t--)}}insert(e){if(e.from>e.to)throw new Error("Invalid interval");if(!e.isStreamSelection){const{notify:t}=e,s=[];for(const t of this._items)t.notify&&xt(e,t)&&s.push(t.notify);s.length>0&&(e.notify=()=>{s.forEach((e=>e())),t?.()}),this.remove(e)}this._items.push(e)}sort(e=(e,t)=>e.from-t.from){this._items.sort(e)}get length(){return this._items.length}get(e){return this._items[e]}swap(e,t){const s=this._items[e];this._items[e]=this._items[t],this._items[t]=s}clear(){this._items.length=0}*[Symbol.iterator](){for(let e=0;e{this._items.splice(e,1),e--},yield t,delete t.remove}}}function wt(e,t){return e.from<=t.to&&e.from>t.from&&e.to>t.to}function bt(e,t){return e.to>=t.from&&e.to=t.from&&e.to<=t.to&&i=t.to}const xt=(e,t)=>()=>wt(e,t)||bt(e,t)||vt(e,t)||kt(e,t);var St=n(717);const Et=A("webtorrent:torrent"),Ct=5e3,Pt=3*tt.BLOCK_LENGTH,Tt=St.browser?me().length:2,At=[1e3,5e3,15e3],It=`WebTorrent/${mt} (https://webtorrent.io)`,Lt=globalThis.navigator?.storage?.getDirectory&&globalThis.FileSystemFileHandle?.prototype?.createWritable,Ot=!St.browser||Lt?Ge:Qe;let Rt;try{Rt=h(re.statSync("/tmp")&&"/tmp","webtorrent")}catch(e){Rt=h("function"==typeof ae.tmpdir?ae.tmpdir():"/","webtorrent")}const Ht="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback&&window.requestIdleCallback;class Nt extends r{constructor(e,t,s){super(),this._debugId="unknown infohash",this.client=t,this.announce=s.announce,this.urlList=s.urlList,this.path=s.path||Rt,this.addUID=s.addUID||!1,this.rootDir=s.rootDir||null,this.skipVerify=!!s.skipVerify,this._startupBitfield=s.bitfield,this._store=s.store||Ot,this._preloadedStore=s.preloadedStore||null,this._storeCacheSlots=void 0!==s.storeCacheSlots?s.storeCacheSlots:20,this._destroyStoreOnDestroy=s.destroyStoreOnDestroy||!1,this.store=null,this.storeOpts=s.storeOpts,this.alwaysChokeSeeders=s.alwaysChokeSeeders??!0,this._getAnnounceOpts=s.getAnnounceOpts,"boolean"==typeof s.private&&(this.private=s.private),this.strategy=s.strategy||"sequential",this.maxWebConns=s.maxWebConns||4,this._rechokeNumSlots=!1===s.uploads||0===s.uploads?0:+s.uploads||10,this._rechokeOptimisticWire=null,this._rechokeOptimisticTime=0,this._rechokeIntervalId=null,this._noPeersIntervalId=null,this._noPeersIntervalTime=s.noPeersIntervalTime?1e3*s.noPeersIntervalTime:3e4,this._startAsDeselected=s.deselect||!1,this.ready=!1,this.destroyed=!1,this.paused=s.paused||!1,this.done=!1,this.metadata=null,this.files=[],this.pieces=[],this._amInterested=!1,this._selections=new yt,this._critical=[],this.wires=[],this._queue=[],this._peers={},this._peersLength=0,this.received=0,this.uploaded=0,this._downloadSpeed=te(),this._uploadSpeed=te(),this._servers=[],this._xsRequests=[],this._fileModtimes=s.fileModtimes,null!==e&&this._onTorrentId(e),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 e=0;for(let t=0,s=this.pieces.length;t{this.destroyed||this._onParsedTorrent(t)}))):j(e,((e,t)=>{if(!this.destroyed)return e?this._destroy(e):void this._onParsedTorrent(t)}))}_onParsedTorrent(e){if(!this.destroyed){if(this._processParsedTorrent(e),!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(e){this._debugId=(0,w.V5)(e.infoHash).substring(0,7),void 0!==this.private&&(e.private=this.private),Array.isArray(this.announce)&&(e.announce=e.announce.concat(this.announce)),this.client.tracker&&Array.isArray(this.client.tracker.announce)&&!e.private&&(e.announce=e.announce.concat(this.client.tracker.announce)),this.client.tracker&&globalThis.WEBTORRENT_ANNOUNCE&&!e.private&&(e.announce=e.announce.concat(globalThis.WEBTORRENT_ANNOUNCE)),this.urlList&&(e.urlList=e.urlList.concat(this.urlList)),e.announce=Array.from(new Set(e.announce)),e.urlList=Array.from(new Set(e.urlList)),Object.assign(this,e),this.magnetURI=W(e),this.torrentFile=function(e){const t={info:e.info};return t["announce-list"]=(e.announce||[]).map((e=>(t.announce||(t.announce=e),[e=(0,w.L0)(e)]))),t["url-list"]=e.urlList||[],void 0!==e.private&&(t.private=Number(e.private)),e.created&&(t["creation date"]=e.created.getTime()/1e3|0),e.createdBy&&(t["created by"]=e.createdBy),e.comment&&(t.comment=e.comment),c.A.encode(t)}(e)}_onListening(){this.destroyed||(this.info?this._onMetadata(this):(this.xs&&this._getMetadataFromServer(),this._startDiscovery()))}_startDiscovery(){if(this.discovery||this.destroyed)return;let e=this.client.tracker;e&&(e=Object.assign({},this.client.tracker,{getAnnounceOpts:()=>{if(this.destroyed)return;const e={uploaded:this.uploaded,downloaded:this.downloaded,left:Math.max(this.length-this.downloaded,0)};return this.client.tracker.getAnnounceOpts&&Object.assign(e,this.client.tracker.getAnnounceOpts()),this._getAnnounceOpts&&Object.assign(e,this._getAnnounceOpts()),e}})),this.peerAddresses&&this.peerAddresses.forEach((e=>this.addPeer(e,dt.default.SOURCE_MANUAL))),this.discovery=new Be({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:e,port:this.client.torrentPort,userAgent:It,lsd:this.client.lsd}),this.discovery.on("error",(e=>{this._destroy(e)})),this.discovery.on("peer",((e,t)=>{this._debug("peer %s discovered via %s",e,t),this.client.seedOutgoingConnections||!this.done?this.addPeer(e,t):this._debug("discovery ignoring peer %s: torrent is done and seedOutgoingConnections is false",e)})),this.discovery.on("trackerAnnounce",(()=>{this.emit("trackerAnnounce")})),this.discovery.on("dhtAnnounce",(()=>{this.emit("dhtAnnounce")})),this.discovery.on("warning",(e=>{this.emit("warning",e)})),this._noPeersIntervalId=setInterval((()=>{if(this.destroyed)return;const e={[dt.default.SOURCE_TRACKER]:{enabled:!!this.client.tracker,numPeers:0},[dt.default.SOURCE_DHT]:{enabled:!!this.client.dht,numPeers:0},[dt.default.SOURCE_LSD]:{enabled:!!this.client.lsd,numPeers:0},[dt.default.SOURCE_UT_PEX]:{enabled:this.client.utPex&&"function"==typeof ot,numPeers:0}};for(const t of Object.values(this._peers)){const s=e[t.source];void 0!==s&&s.numPeers++}for(const t of Object.keys(e)){const s=e[t];s.enabled&&0===s.numPeers&&this.emit("noPeers",t)}}),this._noPeersIntervalTime),this._noPeersIntervalId.unref&&this._noPeersIntervalId.unref()}_getMetadataFromServer(){const e=this,t=Array.isArray(this.xs)?this.xs:[this.xs];e._xsRequestsController=new AbortController;const s=e._xsRequestsController.signal,i=t.map((t=>i=>{!async function(t,i){if(0!==t.indexOf("http://")&&0!==t.indexOf("https://"))return e.emit("warning",new Error(`skipping non-http xs param: ${t}`)),i(null);const n={method:"GET",headers:{"user-agent":It},signal:s};let r,o,a;try{r=await R(t,n)}catch(s){return e.emit("warning",new Error(`http error from xs param: ${t}`)),i(null)}if(e.destroyed)return i(null);if(e.metadata)return i(null);if(200!==r.status)return e.emit("warning",new Error(`non-200 status code ${r.status} from xs param: ${t}`)),i(null);try{o=new Uint8Array(await r.arrayBuffer())}catch(t){return e.emit("warning",t),i(null)}try{a=await q(o)}catch(e){}if(!a)return e.emit("warning",new Error(`got invalid torrent file from xs param: ${t}`)),i(null);if(a.infoHash!==e.infoHash)return e.emit("warning",new Error(`got torrent file with incorrect info hash from xs param: ${t}`)),i(null);e._onMetadata(a),i(null)}(t,i)}));g(i)}async _onMetadata(e){if(this.metadata||this.destroyed)return;let t;if(this._debug("got metadata"),this._xsRequestsController?.abort(),this._xsRequestsController=null,e&&e.infoHash)t=e;else try{t=await q(e)}catch(e){return this._destroy(e)}this._processParsedTorrent(t),this.metadata=this.torrentFile,this.client.enableWebSeeds&&this.urlList.forEach((e=>{this.addWebSeed(e)})),this._rarityMap=new ut(this),this.files=this.files.map((e=>new ct(this,e)));let s=this._preloadedStore;if(s||(s=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&&!(s instanceof Qe)&&(s=new ue(s,{max:this._storeCacheSlots})),this.store=new Ke(s),this.so&&!this._startAsDeselected?this.files.forEach(((e,t)=>{this.so.includes(t)&&this.files[t].select()})):0===this.pieces.length||this._startAsDeselected||this.select(0,this.pieces.length-1,0),this._hashes=this.pieces,this._hasStartupBitfield=this._startupBitfield&&this._startupBitfield.length===Math.ceil(this.pieces.length/8)&&!this.skipVerify,this.bitfield=new de.A(this._hasStartupBitfield?new Uint8Array(this._startupBitfield):this.pieces.length),this._reservations=this._hasStartupBitfield?this.pieces.map(((e,t)=>this.bitfield.get(t)?null:[])):this.pieces.map((()=>[])),this.pieces=this.pieces.map(((e,t)=>{if(this._hasStartupBitfield&&this.bitfield.get(t))return null;const s=t===this.pieces.length-1?this.lastPieceLength:this.pieceLength;return new tt(s)})),this.emit("metadata"),!this.destroyed)if(this.skipVerify)this._markAllVerified(),this._onStore();else{const e=e=>{if(e)return this._destroy(e);this._debug("done verifying"),this._onStore()};this._debug("verifying existing torrent data"),this._fileModtimes&&this._store===Ge?this.getFileModtimes(((t,s)=>{if(t)return this._destroy(t);this.files.map(((e,t)=>s[t]===this._fileModtimes[t])).every((e=>e))?(this._markAllVerified(),this._onStore()):this._verifyPieces(e)})):this._verifyPieces(e)}}getFileModtimes(e){const t=[];Ze(this.files.map(((e,s)=>i=>{const n=this.addUID?h(this.name+" - "+this.infoHash.slice(0,8)):h(this.path,e.path);re.stat(n,((e,n)=>{if(e&&"ENOENT"!==e.code)return i(e);t[s]=n&&n.mtime.getTime(),i(null)}))})),Tt,(s=>{this._debug("done getting file modtimes"),e(s,t)}))}_verifyPiece(e,t){if(this.destroyed)return t(new Error("torrent is destroyed"));const s={};e===this.pieces.length-1&&(s.length=this.lastPieceLength),this.store.get(e,s,(async(s,i)=>{if(this.destroyed)return t(new Error("torrent is destroyed"));if(s)return y((()=>t(null,!1)));const n=await(0,w.tW)(i,"hex");if(this.destroyed)return t(new Error("torrent is destroyed"));t(null,n===this._hashes[e])}))}_verifyPiecesUsingBitfield(e){const t=new Set,s=new Map;for(const e of this.files){let i=2,n=null;for(let t=e._startPiece;t<=e._endPiece;++t)this.bitfield.get(t)&&(i&&(n=t,i--),s.has(t)||s.set(t,[]),s.get(t).push(e));null!==n&&t.add(n)}this._verifyPiecesUsingHash([...t],(i=>{if(i)return e(i);const n=new Set;for(const e of t)if(!this.bitfield.get(e)){const t=s.get(e);for(const e of t)n.add(e)}if(n.size){const t=[];for(const e of n)for(let s=e._startPiece;s<=e._endPiece;++s)-1===t.indexOf(s)&&t.push(s);return this._verifyPiecesUsingHash(t,e)}e(null)}))}_verifyPiecesUsingHash(e,t){Ze(e.map(((e,t)=>s=>{const i=Number.isInteger(e)?e:t;this._verifyPiece(i,((e,t)=>{if(e)return s(e);t?(this._debug("piece verified %s",i),this._markVerified(i)):(this._markUnverified(i),this._debug("piece invalid %s",i)),s(null)}))})),Tt,t)}_verifyPieces(e){if(this._hasStartupBitfield)return this._verifyPiecesUsingBitfield(e);this._verifyPiecesUsingHash(this.pieces,e)}rescanFiles(e){if(this.destroyed)throw new Error("torrent is destroyed");e||(e=Mt),this._verifyPiecesUsingHash(this.pieces,(t=>{if(t)return this._destroy(t),e(t);this._checkDone(),e(null)}))}_markAllVerified(){for(let e=0;ee))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((e=>{e.ut_metadata&&e.ut_metadata.setMetadata(this.metadata),this._onWireWithMetadata(e)})))}destroy(e,t){if("function"==typeof e)return this.destroy(null,e);this._destroy(null,e,t)}_destroy(e,t,s){if("function"==typeof t)return this._destroy(e,null,t);if(this.destroyed)return;this.destroyed=!0,this._debug("destroy"),this.client._remove(this),this._selections.clear(),clearInterval(this._rechokeIntervalId),clearInterval(this._noPeersIntervalId),this._xsRequestsController?.abort(),this._rarityMap&&this._rarityMap.destroy();for(const e in this._peers)this.removePeer(e);for(const e of this.files)e instanceof ct&&e._destroy();const i=this._servers.map((e=>t=>{e.destroy(t)}));if(this.discovery&&i.push((e=>{this.discovery.destroy(e)})),this.store){let e=this._destroyStoreOnDestroy;t&&void 0!==t.destroyStore&&(e=t.destroyStore),i.push((t=>{e?this.store.destroy(t):this.store.close(t)}))}g(i,s),e&&(0===this.listenerCount("error")?this.client.emit("error",e):this.emit("error",e)),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,this._queue=null}addPeer(e,t){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 s;if("string"==typeof e){let t;try{t=ce(e)}catch(t){return this._debug("ignoring peer: invalid %s",e),this.emit("invalidPeer",e),!1}s=t[0]}else"string"==typeof e.remoteAddress&&(s=e.remoteAddress);if(this.client.blocked&&s&&this.client.blocked.contains(s))return this._debug("ignoring peer: blocked %s",e),"string"!=typeof e&&e.destroy(),this.emit("blockedPeer",e),!1;const i=this.client.utp&&this._isIPv4(s)?"utp":"tcp",n=!!this._addPeer(e,i,t);return n?this.emit("peer",e):this.emit("invalidPeer",e),n}_addPeer(e,t,s){if(this.destroyed)return"string"!=typeof e&&e.destroy(),null;if("string"==typeof e&&!this._validAddr(e))return this._debug("ignoring peer: invalid %s",e),null;const i=e&&e.id||e;if(this._peers[i])return this._debug("ignoring peer: duplicate (%s)",i),"string"!=typeof e&&e.destroy(),null;if(this.paused)return this._debug("ignoring peer: torrent is paused"),"string"!=typeof e&&e.destroy(),null;let n;return this._debug("add peer %s",i),n="string"==typeof e?"utp"===t?dt.default.createUTPOutgoingPeer(e,this,this.client.throttleGroups,s):dt.default.createTCPOutgoingPeer(e,this,this.client.throttleGroups,s):dt.default.createWebRTCPeer(e,this,this.client.throttleGroups,s),this._registerPeer(n),"string"==typeof e&&(this._queue.push(n),this._drain()),n}addWebSeed(e){if(this.destroyed)throw new Error("torrent is destroyed");let t,s;if("string"==typeof e){if(t=e,!/^https?:\/\/.+/.test(t))return this.emit("warning",new Error(`ignoring invalid web seed: ${t}`)),void this.emit("invalidPeer",t);if(this._peers[t])return this.emit("warning",new Error(`ignoring duplicate web seed: ${t}`)),void this.emit("invalidPeer",t);s=new gt(t,this)}else{if(!e||"string"!=typeof e.connId)return void this.emit("warning",new Error("addWebSeed must be passed a string or connection object with id property"));if(s=e,t=s.connId,this._peers[t])return this.emit("warning",new Error(`ignoring duplicate web seed: ${t}`)),void this.emit("invalidPeer",t)}this._debug("add web seed %s",t);const i=dt.default.createWebSeedPeer(s,t,this,this.client.throttleGroups);this._registerPeer(i),this.emit("peer",t)}_addIncomingPeer(e){return this.destroyed?e.destroy(new Error("torrent is destroyed")):this.paused?e.destroy(new Error("torrent is paused")):(this._debug("add incoming peer %s",e.id),void this._registerPeer(e))}_registerPeer(e){e.on("download",(e=>{this.destroyed||(this.received+=e,this._downloadSpeed(e),this.client._downloadSpeed(e),this.emit("download",e),this.destroyed||this.client.emit("download",e))})),e.on("upload",(e=>{this.destroyed||(this.uploaded+=e,this._uploadSpeed(e),this.client._uploadSpeed(e),this.emit("upload",e),this.destroyed||this.client.emit("upload",e))})),this._peers[e.id]=e,this._peersLength+=1}removePeer(e){const t=e?.id||e;e&&!e.id&&(e=this._peers?.[t]),e&&(e.destroy(),this.destroyed||(this._debug("removePeer %s",t),delete this._peers[t],this._peersLength-=1,this._drain()))}_select(e=0,t=this.pieces.length-1,s,i,n=!1){if(this.destroyed)throw new Error("torrent is destroyed");if(e<0||tt.priority-e.priority)),this._updateSelections()}select(e,t,s,i){this._select(e,t,s,i,!1)}_deselect(e,t,s=!1){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("deselect %s-%s",e,t),this._selections.remove({from:e,to:t,isStreamSelection:s}),this._updateSelections()}deselect(e,t){this._deselect(e,t,!1)}critical(e,t){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("critical %s-%s",e,t);for(let s=e;s<=t;++s)this._critical[s]=!0;this._updateSelections()}_onWire(e,t){if(this._debug("got wire %s (%s)",e._debugId,t||"Unknown"),this.wires.push(e),t){const s=ce(t);e.remoteAddress=s[0],e.remotePort=s[1]}this.client.dht&&this.client.dht.listening&&e.on("port",(s=>{if(!this.destroyed&&!this.client.dht.destroyed){if(!e.remoteAddress)return this._debug("ignoring PORT from peer with no address");if(0===s||s>65536)return this._debug("ignoring invalid PORT from peer");this._debug("port: %s (from %s)",s,t),this.client.dht.addNode({host:e.remoteAddress,port:s})}})),e.on("timeout",(()=>{this._debug("wire timeout (%s)",t),e.destroy()})),"webSeed"!==e.type&&e.setTimeout(3e4,!0),e.setKeepAlive(!0),e.use(rt(this.metadata)),e.ut_metadata.on("warning",(e=>{this._debug("ut_metadata warning: %s",e.message)})),this.metadata||(e.ut_metadata.on("metadata",(e=>{this._debug("got metadata via ut_metadata"),this._onMetadata(e)})),e.ut_metadata.fetch()),this.client.utPex&&"function"==typeof ot&&!this.private&&(e.use(ot()),e.ut_pex.on("peer",(e=>{this.client.seedOutgoingConnections||!this.done?(this._debug("ut_pex: got peer: %s (from %s)",e,t),this.addPeer(e,dt.default.SOURCE_UT_PEX)):this._debug("ut_pex ignoring peer %s: torrent is done and seedOutgoingConnections is false",e)})),e.ut_pex.on("dropped",(e=>{const s=this._peers[e];s&&!s.connected&&(this._debug("ut_pex: dropped peer: %s (from %s)",e,t),this.removePeer(e))})),e.once("close",(()=>{e.ut_pex.reset()}))),e.use(Xe()),this.emit("wire",e,t),this.ready&&y((()=>{this._onWireWithMetadata(e)}))}_onWireWithMetadata(e){let t=null;const s=()=>{this.destroyed||e.destroyed||(this._numQueued>2*(this._numConns-this.numPeers)&&e.amInterested?e.destroy():(t=setTimeout(s,Ct),t.unref&&t.unref()))};let i;const n=()=>{if(e.peerPieces.buffer.length===this.bitfield.buffer.length){for(i=0;i{n(),this._update(),this._updateWireInterest(e)})),e.on("have",(()=>{n(),this._update(),this._updateWireInterest(e)})),e.lt_donthave.on("donthave",(()=>{n(),this._update(),this._updateWireInterest(e)})),e.on("have-all",(()=>{e.isSeeder=!0,this.alwaysChokeSeeders&&e.choke(),this._update(),this._updateWireInterest(e)})),e.on("have-none",(()=>{e.isSeeder=!1,this._update(),this._updateWireInterest(e)})),e.on("allowed-fast",(e=>{this._update()})),e.once("interested",(()=>{e.unchoke()})),e.once("close",(()=>{clearTimeout(t)})),e.on("choke",(()=>{clearTimeout(t),t=setTimeout(s,Ct),t.unref&&t.unref()})),e.on("unchoke",(()=>{clearTimeout(t),this._update()})),e.on("request",((t,s,i,n)=>{if(i>131072)return e.destroy();this.pieces[t]||this.store.get(t,{offset:s,length:i},n)})),e.hasFast&&this._hasAllPieces()?e.haveAll():e.hasFast&&this._hasNoPieces()?e.haveNone():e.bitfield(this.bitfield),this._updateWireInterest(e),e.peerExtensions.dht&&this.client.dht&&this.client.dht.listening&&e.port(this.client.dht.address().port),"webSeed"!==e.type&&(t=setTimeout(s,Ct),t.unref&&t.unref()),e.isSeeder=!1,n()}_updateSelections(){this.ready&&!this.destroyed&&(y((()=>{this._gcSelections()})),this._updateInterest(),this._update())}_gcSelections(){for(const e of this._selections){const t=e.offset;for(;this.bitfield.get(e.from+e.offset)&&e.from+e.offsetthis._updateWireInterest(e))),e!==this._amInterested&&(this._amInterested?this.emit("interested"):this.emit("uninterested"))}_updateWireInterest(e){let t=!1;for(let s=0;sthis._updateWireWrapper()),{timeout:250}):this._updateWireWrapper()}_updateWireWrapper(){if(this.destroyed)return;const e=st(this.wires);let t;for(;t=e();)this._updateWire(t)}_updateWire(e){if(e.destroyed)return!1;const t=this,s=Ut(e,.5);if(e.requests.length>=s)return;const i=Ut(e,1);if(e.peerChoking)e.hasFast&&e.peerAllowedFastSet.length>0&&!this._hasMorePieces(e.peerAllowedFastSet.length-1)&&function(){if(e.requests.length>=i)return!1;for(const s of e.peerAllowedFastSet){if(e.peerPieces.get(s)&&!t.bitfield.get(s))for(;t._request(e,s,!1)&&e.requests.length=i.from+i.offset;--r)if(e.peerPieces.get(r)&&t._request(e,r,!1))return}}();o(!1)||o(!0)}function n(t,s,i,n){return r=>r>=t&&r<=s&&!(r in i)&&e.peerPieces.get(r)&&(!n||n(r))}function r(e){let s=e;for(let i=e;i=i)return!0;const o=function(){const s=e.downloadSpeed()||1;if(s>Pt)return()=>!0;const i=Math.max(1,e.requests.length)*tt.BLOCK_LENGTH/s;let n=10,r=0;return e=>{if(!n||t.bitfield.get(e))return!0;let o=t.pieces[e].missing;for(;r0))return n--,!1}return!0}}();for(let a=0;a({wire:e,random:Math.random()}))).sort(((e,t)=>{const s=e.wire,i=t.wire;return s.downloadSpeed()!==i.downloadSpeed()?s.downloadSpeed()-i.downloadSpeed():s.uploadSpeed()!==i.uploadSpeed()?s.uploadSpeed()-i.uploadSpeed():s.amChoking!==i.amChoking?s.amChoking?-1:1:e.random-t.random})).map((e=>e.wire));this._rechokeOptimisticTime<=0?this._rechokeOptimisticWire=null:this._rechokeOptimisticTime-=1;let t=0;for(;e.length>0&&t0){const t=e.filter((e=>e.peerInterested));if(t.length>0){const e=t[(s=t.length,Math.random()*s|0)];e.unchoke(),this._rechokeOptimisticWire=e,this._rechokeOptimisticTime=2}}var s;e.filter((e=>e!==this._rechokeOptimisticWire)).forEach((e=>e.choke()))}_hotswap(e,t){const s=e.downloadSpeed();if(s=Pt||(2*a>s||a>o||(n=t,o=a))}if(!n)return!1;for(r=0;r=o)return!1;const a=i.pieces[t];let h=r?a.reserveRemaining():a.reserve();if(-1===h&&s&&i._hotswap(e,t)&&(h=r?a.reserveRemaining():a.reserve()),-1===h)return!1;let l=i._reservations[t];l||(l=i._reservations[t]=[]);let c=l.indexOf(null);-1===c&&(c=l.length),l[c]=e;const d=a.chunkOffset(h),u=r?a.chunkLengthRemaining(h):a.chunkLength(h);function p(){y((()=>{i._update()}))}return e.request(t,d,u,(async function s(n,o){if(i.destroyed)return;if(!i.ready)return i.once("ready",(()=>{s(n,o)}));if(l[c]===e&&(l[c]=null),a!==i.pieces[t])return p();if(n)return i._debug("error getting piece %s (offset: %s length: %s) from %s: %s",t,d,u,`${e.remoteAddress}:${e.remotePort}`,n.message),r?a.cancelRemaining(h):a.cancel(h),void p();if(i._debug("got piece %s (offset: %s length: %s) from %s",t,d,u,`${e.remoteAddress}:${e.remotePort}`),!a.set(h,o,e))return p();const f=a.flush(),m=await(0,w.tW)(f,"hex");i.destroyed||(m===i._hashes[t]?(i._debug("piece verified %s",t),i.store.put(t,f,(e=>{e?i._destroy(e):(i.pieces[t]=null,i._markVerified(t),i.wires.forEach((e=>{e.have(t)})),i._checkDone(),p())}))):(i.pieces[t]=new tt(a.length),i.emit("warning",new Error(`Piece ${t} failed verification`)),p()))})),!0}_checkDone(){if(this.destroyed)return;this.files.forEach((e=>{if(!e.done){for(let t=e._startPiece;t<=e._endPiece;++t)if(!this.bitfield.get(t))return;e.done=!0,e.emit("done"),this._debug(`file done: ${e.name}`)}}));const e=this.files.every((e=>e.done));return!this.done&&e?(this.done=!0,this._debug(`torrent done: ${this.infoHash}`),this.emit("done"),this.destroyed||this.discovery.complete()):this.done&&!e&&(this.done=!1,this.discovery.tracker?.start()),this._gcSelections(),e}async load(e,t){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.ready)return this.once("ready",(()=>{this.load(e,t)}));Array.isArray(e)||(e=[e]),t||(t=Mt);try{await fe(this.store,_(e),{chunkLength:this.pieceLength}),this._markAllVerified(),this._checkDone(),t(null)}catch(e){return t(e),e}}pause(){this.destroyed||(this._debug("pause"),this.paused=!0)}resume(){this.destroyed||(this._debug("resume"),this.paused=!1,this._drain())}_debug(){const e=[].slice.call(arguments);e[0]=`[${this.client?this.client._debugId:"No Client"}] [${this._debugId}] ${e[0]}`,Et(...e)}_drain(){if(this._debug("_drain numConns %s maxConns %s",this._numConns,this.client.maxConns),"function"!=typeof oe.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 e=this._queue.shift();if(!e)return;this._debug("%s connect attempt to %s",e.type,e.addr);const t=ce(e.addr),s={host:t[0],port:t[1]};this.client.utp&&e.type===dt.default.TYPE_UTP_OUTGOING?e.conn=pt.connect(s.port,s.host):e.conn=oe.connect(s);const i=e.conn;i.once("connect",(()=>{this.destroyed||e.onConnect()})),i.once("error",(t=>{e.destroy(t)})),e.startConnectTimeout(),i.on("close",(()=>{if(this.destroyed)return;if(e.retries>=At.length){if(this.client.utp){const t=this._addPeer(e.addr,"tcp",e.source);t&&(t.retries=0)}else this._debug("conn %s closed: will not re-add (max %s attempts)",e.addr,At.length);return}const t=At[e.retries];this._debug("conn %s closed: will re-add to queue in %sms (attempt %s)",e.addr,t,e.retries+1);const s=setTimeout((()=>{if(this.destroyed)return;const t=ce(e.addr)[0],s=this.client.utp&&this._isIPv4(t)?"utp":"tcp",i=this._addPeer(e.addr,s,e.source);i&&(i.retries=e.retries+1)}),t);s.unref&&s.unref()}))}_validAddr(e){let t;try{t=ce(e)}catch(e){return!1}const s=t[0],i=t[1];return i>0&&i<65535&&!("127.0.0.1"===s&&i===this.client.torrentPort)}_isIPv4(e){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(e)}}function Ut(e,t){let s=2+Math.ceil(t*e.downloadSpeed()/tt.BLOCK_LENGTH);if(e.peerExtendedHandshake){const t=e.peerExtendedHandshake.reqq;"number"==typeof t&&t>0&&(s=Math.min(s,t))}return s}function Mt(){}var Ft=n(4043),jt=n(580),Bt=n(815),Dt=n(2878);class qt{constructor(e,t={}){this.client=e,t.origin||(t.origin="*"),this.opts=t,this.pendingReady=new Set}static serveIndexPage(e,t,s){const i=t.map((e=>`
  • \n \n ${jt(e.name)}\n \n (${jt(e.length)} bytes)\n
  • `)).join("
    ");return e.status=200,e.headers["Content-Type"]="text/html",e.body=zt("WebTorrent",`

    WebTorrent

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

    405 - Method Not Allowed

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

    404 - Not Found

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

    ${jt(e.name)}

    \n
      ${i}
    `),t}static serveOptionsRequest(e,t){return t.status=204,t.headers["Access-Control-Max-Age"]="600",t.headers["Access-Control-Allow-Methods"]="GET,HEAD",e.headers["access-control-request-headers"]&&(t.headers["Access-Control-Allow-Headers"]=e.headers["access-control-request-headers"]),t}static serveFile(e,t,s){s.status=200,s.headers.Expires="0",s.headers["Cache-Control"]="no-cache, no-store, must-revalidate, max-age=0",s.headers["Accept-Ranges"]="bytes",s.headers["Content-Type"]=e.type,s.headers["transferMode.dlna.org"]="Streaming",s.headers["contentFeatures.dlna.org"]="DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000","document"===t.destination?(s.headers["Content-Type"]="application/octet-stream",s.headers["Content-Disposition"]=`attachment; filename*=UTF-8''${Vt(e.name)}`,s.body="DOWNLOAD"):s.headers["Content-Disposition"]=`inline; filename*=UTF-8''${Vt(e.name)}`;let i=Dt(e.length,t.headers.range||"");if(Array.isArray(i)?(s.status=206,i=i[0],s.headers["Content-Range"]=`bytes ${i.start}-${i.end}/${e.length}`,s.headers["Content-Length"]=i.end-i.start+1):(s.statusCode=200,i=null,s.headers["Content-Length"]=e.length),"GET"===t.method){const n=e[Symbol.asyncIterator](i);let r=null;e.emit("iterator",{iterator:n,req:t,file:e},(e=>{r=e}));const o=K.Readable.from(r||n);let a=null;e.emit("stream",{stream:o,req:t,file:e},(e=>{a=Bt(o,e)})),s.body=a||o}else s.body=!1;return s}async onRequest(e,t){let s=new URL(e.url,"http://example.com").pathname;s=s.slice(s.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(e)&&(i.headers["Access-Control-Allow-Origin"]="*"===this.opts.origin?"*":e.headers.origin),"favicon.ico"===s)return t(qt.serve404Page(i));if("OPTIONS"===e.method)return this.isOriginAllowed(e)?t(qt.serveOptionsRequest(e,i)):t(qt.serveMethodNotAllowed(i));const n=async()=>{this.pendingReady.delete(n);const e=await r();t(e)},r=async()=>{if(""===s)return qt.serveIndexPage(i,this.client.torrents,this.pathname);let[t,...n]=s.split("/");n=decodeURI(n.join("/"));const r=await this.client.get(t);if(!t||!r)return qt.serve404Page(i);if(!n)return qt.serveTorrentPage(r,i,this.pathname);const o=r.files.find((e=>e.path.replace(/\\/g,"/")===n));return o?qt.serveFile(o,e,i):qt.serve404Page(i)};if("GET"===e.method||"HEAD"===e.method){if(this.client.ready){const e=await r();return t(e)}return this.pendingReady.add(n),void this.client.once("ready",n)}return t(qt.serveMethodNotAllowed(i))}close(e=()=>{}){this.closed=!0,this.pendingReady.forEach((e=>{this.client.removeListener("ready",e)})),this.pendingReady.clear(),y(e)}destroy(e=()=>{}){this.closed?y(e):this.close(e),this.client=null}}class Wt extends qt{constructor(e,t){super(e,t),this.server=Ft.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=t?.pathname||"/webtorrent"}wrapRequest(e,t){return this.opts.hostname&&e.headers.host!==`${this.opts.hostname}:${this.server.address().port}`?e.destroy():new URL(e.url,"http://example.com").pathname.startsWith(this.pathname)?void this.onRequest(e,(({status:e,headers:s,body:i})=>{t.writeHead(e,s),i?._readableState||i?._writableState?Bt(i,t):t.end(i)})):e.destroy()}onConnection(e){e.setTimeout(36e6),this.sockets.add(e),e.once("close",(()=>{this.sockets.delete(e)}))}address(){return this.server.address()}listen(...e){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,e)}close(e=()=>{}){this.server.removeAllListeners("connection"),this.server.removeAllListeners("request"),this.server.removeAllListeners("listening"),super.close(),this._close.call(this.server,e)}destroy(e){this.sockets.forEach((e=>{e.destroy()})),super.destroy(e)}}class $t extends qt{constructor(e,t){super(e,t),this.registration=t.controller,this.workerKeepAliveInterval=null,this.workerPortCount=0;const s=new URL(t.controller.scope);this.pathname=s.pathname+"webtorrent",this._address={port:s.port,family:"IPv4",address:s.hostname},this.boundHandler=this.wrapRequest.bind(this),navigator.serviceWorker.addEventListener("message",this.boundHandler),fetch(`${this.pathname}/cancel/`).then((e=>{e.body.cancel()}))}wrapRequest(e){const t=e.data;if("webtorrent"===!t?.type||!t.url)return null;const[s]=e.ports;this.onRequest(t,(({status:e,headers:t,body:i})=>{const n=i[Symbol.asyncIterator]?.(),r=()=>{s.onmessage=null,i?.destroy&&i.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};s.onmessage=async e=>{if(e.data){let e;try{e=(await n.next()).value}catch(e){}s.postMessage(e),e||r(),this.workerKeepAliveInterval||(this.workerKeepAliveInterval=setInterval((()=>fetch(`${this.pathname}/keepalive/`)),2e4))}else r()},this.workerPortCount++,s.postMessage({status:e,headers:t,body:n?"STREAM":i})}))}listen(e,t){t()}address(){return this._address}close(e){navigator.serviceWorker.removeEventListener("message",this.boundHandler),super.close(e)}destroy(e){super.destroy(e)}}function zt(e,t){return`\n \n \n \n \n ${e}\n \n \n ${t}\n \n \n `}function Vt(e){return encodeURIComponent(e).replace(/['()]/g,escape).replace(/\*/g,"%2A").replace(/%(?:7C|60|5E)/g,unescape)}const Gt=A("webtorrent"),Kt=mt.replace(/\d*./g,(e=>("0"+e%100).slice(-2))).slice(0,4),Yt=`-WW${Kt}-`;class Jt extends r{constructor(e={}){super(),"string"==typeof e.peerId?this.peerId=e.peerId:ArrayBuffer.isView(e.peerId)?this.peerId=(0,w.V5)(e.peerId):this.peerId=(0,w.V5)((0,w.L0)(Yt+(0,w.NJ)((0,w.po)(9)))),this.peerIdBuffer=(0,w.fk)(this.peerId),"string"==typeof e.nodeId?this.nodeId=e.nodeId:ArrayBuffer.isView(e.nodeId)?this.nodeId=(0,w.V5)(e.nodeId):this.nodeId=(0,w.V5)((0,w.po)(20)),this.nodeIdBuffer=(0,w.fk)(this.nodeId),this._debugId=this.peerId.substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=e.torrentPort||0,this.dhtPort=e.dhtPort||0,this.tracker=void 0!==e.tracker?e.tracker:{},this.lsd=!1!==e.lsd,this.utPex=!1!==e.utPex,this.natUpnp=e.natUpnp??!0,this.natPmp=e.natPmp??!0,this.torrents=[],this.maxConns=Number(e.maxConns)||55,this.utp=Jt.UTP_SUPPORT&&!1!==e.utp,this.seedOutgoingConnections=e.seedOutgoingConnections??!0,this._downloadLimit=Math.max("number"==typeof e.downloadLimit?e.downloadLimit:-1,-1),this._uploadLimit=Math.max("number"==typeof e.uploadLimit?e.uploadLimit:-1,-1),(this.natUpnp||this.natPmp)&&"function"==typeof ie&&(this.natTraversal=new ie({enableUPNP:this.natUpnp,enablePMP:this.natPmp,upnpPermanentFallback:"permanent"===e.natUpnp})),!0===e.secure&&Promise.resolve().then(n.bind(n,5658)).then((({enableSecure:e})=>e())),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new se.ThrottleGroup({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new se.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 ne?this._connPool=new ne(this):y((()=>{this._onListening()})),this._downloadSpeed=te(),this._uploadSpeed=te(),!1!==e.dht&&"function"==typeof I.Client?(this.dht=new I.Client(Object.assign({},{nodeId:this.nodeId},e.dht)),this.dht.once("error",(e=>{this._destroy(e)})),this.dht.once("listening",(()=>{const e=this.dht.address();e&&(this.dhtPort=e.port,this.natTraversal&&this.natTraversal.map({publicPort:this.dhtPort,privatePort:this.dhtPort,protocol:"udp",description:"WebTorrent DHT"}).catch((e=>{Gt("error mapping DHT port via UPnP/PMP: %o",e)})))})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==e.webSeeds;const t=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof L&&null!=e.blocklist?L(e.blocklist,{headers:{"user-agent":`WebTorrent/${mt} (https://webtorrent.io)`}},((e,s)=>{if(e)return console.error(`Failed to load blocklist: ${e.message}`);this.blocked=s,t()})):y(t)}createServer(e,t){if(this.destroyed)throw new Error("torrent is destroyed");if(this._server)throw new Error("server already created");if("undefined"!=typeof window&&"node"!==t||"browser"===t){if(!(e?.controller instanceof ServiceWorkerRegistration))throw new Error("Invalid worker registration");if("activated"!==e.controller.active.state)throw new Error("Worker isn't activated");return this._server=new $t(this,e),this._server}return this._server=new Wt(this,e),this._server}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter((e=>1!==e.progress));return e.reduce(((e,t)=>e+t.downloaded),0)/(e.reduce(((e,t)=>e+(t.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((e,t)=>e+t.uploaded),0)/(this.torrents.reduce(((e,t)=>e+t.received),0)||1)}async get(e){if(e instanceof Nt){if(this.torrents.includes(e))return e}else{const t=this.torrents;let s;try{s=await q(e)}catch(e){}if(!s)return null;if(!s.infoHash)throw new Error("Invalid torrent identifier");for(const e of t)if(e.infoHash===s.infoHash)return e}return null}add(e,t={},s=()=>{}){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,s]=[{},t]);const i=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===r.infoHash&&e!==r)return r._destroy(new Error(`Cannot add duplicate torrent ${r.infoHash}`)),void s(e)},n=()=>{this.destroyed||(s(r),this.emit("torrent",r))};this._debug("add"),t=t?Object.assign({},t):{};const r=new Nt(e,this,t);return this.torrents.push(r),r.once("_infoHash",i),r.once("ready",n),r.once("close",(function e(){r.removeListener("_infoHash",i),r.removeListener("ready",n),r.removeListener("close",e)})),this.emit("add",r),r}seed(e,t,s){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,s]=[{},t]),this._debug("seed"),(t=t?Object.assign({},t):{}).skipVerify=!0;const i="string"==typeof e;i&&(t.path=function(e){if(o(e),0===e.length)return".";let t=e.charCodeAt(0);const s=47===t;let i=-1,n=!0;for(let s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),47===t){if(!n){i=s;break}}else n=!1;return-1===i?s?"/":".":s&&1===i?"//":e.slice(0,i)}(e)),t.createdBy||(t.createdBy=`WebTorrent/${Kt}`);const n=e=>{this._debug("on seed"),"function"==typeof s&&s(e),e.emit("seed"),this.emit("seed",e)},r=this.add(null,t,(e=>{const s=[s=>{if(i||t.preloadedStore)return s();e.load(a,s)}];this.dht&&s.push((t=>{e.once("dhtAnnounce",t)})),g(s,(t=>{if(!this.destroyed)return t?e._destroy(t):void n(e)}))}));let a;var h;return h=e,"undefined"!=typeof FileList&&h instanceof FileList?e=Array.from(e):Array.isArray(e)||(e=[e]),g(e.map((e=>async s=>{if(!t.preloadedStore&&function(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}(e)){const t=[];try{for await(const s of e)t.push(s)}catch(e){return s(e)}const i=(0,w.xW)(t);i.name=e.name,s(null,i)}else s(null,e)})),((e,i)=>{if(!this.destroyed)return e?r._destroy(e):void function(e,t,s){"function"==typeof t&&([t,s]=[s,t]),x(e,t=t?Object.assign({},t):{},s)}(i,t,((e,n)=>{if(!this.destroyed){if(e)return r._destroy(e);a=n.map((e=>e.getStream)),T(i,t,(async(e,t)=>{if(this.destroyed)return;if(e)return r._destroy(e);const i=await this.get(t);i?(console.warn("A torrent with the same id is already being seeded"),r._destroy(),"function"==typeof s&&s(i)):r._onTorrentId(t)}))}}))})),r}async remove(e,t,s){if("function"==typeof t)return this.remove(e,null,t);this._debug("remove");const i=await this.get(e);if(!i)throw new Error(`No torrent with id ${e}`);this._remove(i,t,s)}_remove(e,t,s){if(!e)return;if("function"==typeof t)return this._remove(e,null,t);const i=this.torrents.indexOf(e);-1!==i&&(this.torrents.splice(i,1),e.destroy(t,s),this.dht&&this.dht._tables.remove(e.infoHash),this.emit("remove",e))}address(){return this.listening?this._connPool?this._connPool.tcpServer.address():{address:"0.0.0.0",family:"IPv4",port:0}:null}throttleDownload(e){return e=Number(e),!(isNaN(e)||!isFinite(e)||e<-1)&&(this._downloadLimit=e,this._downloadLimit<0?this.throttleGroups.down.setEnabled(!1):(this.throttleGroups.down.setEnabled(!0),void this.throttleGroups.down.setRate(this._downloadLimit)))}throttleUpload(e){return e=Number(e),!(isNaN(e)||!isFinite(e)||e<-1)&&(this._uploadLimit=e,this._uploadLimit<0?this.throttleGroups.up.setEnabled(!1):(this.throttleGroups.up.setEnabled(!0),void this.throttleGroups.up.setRate(this._uploadLimit)))}destroy(e){if(this.destroyed)throw new Error("client already destroyed");this._destroy(null,e)}_destroy(e,t){this._debug("client destroy"),this.destroyed=!0;const s=this.torrents.map((e=>t=>{e.destroy(t)}));this._connPool&&s.push((e=>{this._connPool.destroy(e)})),this.dht&&s.push((e=>{this.dht.destroy(e)})),this._server&&s.push((e=>{this._server.destroy(e)})),this.natTraversal&&s.push((e=>{this.natTraversal.destroy().then((()=>e()))})),g(s,t),e&&this.emit("error",e),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 e=this._connPool.tcpServer.address();e&&(this.torrentPort=e.port,this.natTraversal&&this.natTraversal.map({publicPort:this.torrentPort,privatePort:this.torrentPort,protocol:this.utp?null:"tcp",description:"WebTorrent Torrent"}).catch((e=>{Gt("error mapping WebTorrent port via UPnP/PMP: %o",e)})))}this.emit("listening")}_debug(){const e=[].slice.call(arguments);e[0]=`[${this._debugId}] ${e[0]}`,Gt(...e)}async _getByHash(e){for(const t of this.torrents)if(t.infoHashHash||(t.infoHashHash=await(0,w.tW)((0,w.fk)("72657132"+t.infoHash),"hex")),e===t.infoHashHash)return t;return null}}Jt.WEBRTC_SUPPORT=ee.WEBRTC_SUPPORT,Jt.UTP_SUPPORT=ne.UTP_SUPPORT,Jt.VERSION=mt;export{Jt as default}; +var e,t,s={61:()=>{},405:e=>{e.exports=async function*(e){for(let t of e)"function"==typeof t&&(t=t()),yield*t}},580:e=>{var t=/["'&<>]/;e.exports=function(e){var s,i=""+e,n=t.exec(i);if(!n)return i;var r="",o=0,a=0;for(o=n.index;o{s.r(t),s.d(t,{addListener:()=>u,argv:()=>a,binding:()=>S,browser:()=>r,chdir:()=>E,cwd:()=>k,emit:()=>g,env:()=>o,listeners:()=>v,nextTick:()=>b,off:()=>f,on:()=>d,once:()=>p,prependListener:()=>y,prependOnceListener:()=>w,removeAllListeners:()=>_,removeListener:()=>m,title:()=>n,umask:()=>x,version:()=>h,versions:()=>l});var i=s(9596);const n="browser",r=!0,o={},a=[],h="",l={};function c(){}const d=c,u=c,p=c,f=c,m=c,_=c,g=c,y=c,w=c,b=(e,...t)=>i((()=>e(...t))),v=e=>[],k=()=>"/",x=()=>0,S=e=>{throw new Error("process.binding is not supported")},E=e=>{throw new Error("process.chdir is not supported")}},736:(e,t,s)=>{e.exports=function(e){function t(e){let s,n,r,o=null;function a(...e){if(!a.enabled)return;const i=a,n=Number(new Date),r=n-(s||n);i.diff=r,i.prev=s,i.curr=n,s=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((s,n)=>{if("%%"===s)return"%";o++;const r=t.formatters[n];if("function"==typeof r){const t=e[o];s=r.call(i,t),e.splice(o,1),o--}return s})),t.formatArgs.call(i,e);(i.log||t.log).apply(i,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=i,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==t.namespaces&&(n=t.namespaces,r=t.enabled(e)),r),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function i(e,s){const i=t(this.namespace+(void 0===s?":":s)+e);return i.log=this.log,i}function n(e,t){let s=0,i=0,n=-1,r=0;for(;s"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const s=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of s)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const s of t.skips)if(n(e,s))return!1;for(const s of t.names)if(n(e,s))return!0;return!1},t.humanize=s(6585),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((s=>{t[s]=e[s]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let s=0;for(let t=0;t{var i,n=s(717),r=s(3519),o=s(6611);try{i=s(2376)}catch(e){}var a=function(){},h=/^v?\.0/.test(n.version),l=function(e){return"function"==typeof e},c=function(e,t,s,n){n=r(n);var c=!1;e.on("close",(function(){c=!0})),o(e,{readable:t,writable:s},(function(e){if(e)return n(e);c=!0,n()}));var d=!1;return function(t){if(!c&&!d)return d=!0,function(e){return!!h&&!!i&&(e instanceof(i.ReadStream||a)||e instanceof(i.WriteStream||a))&&l(e.close)}(e)?e.close(a):function(e){return e.setHeader&&l(e.abort)}(e)?e.abort():l(e.destroy)?e.destroy():void n(t||new Error("stream was destroyed"))}},d=function(e){e()},u=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),s=l(t[t.length-1]||a)&&t.pop()||a;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var i=t.map((function(n,r){var o=r0,(function(t){e||(e=t),t&&i.forEach(d),o||(i.forEach(d),s(e))}))}));return t.reduce(u)}},826:()=>{},988:(e,t,s)=>{s.d(t,{A:()=>f});var i=s(9639);function n(e){const t=e<0?1:0;return e=Math.abs(Number(e||1)),Math.floor(Math.log10(e))+1+t}function r(e){return ArrayBuffer.isView(e)?"arraybufferview":Array.isArray(e)?"array":e instanceof Number?"number":e instanceof Boolean?"boolean":e instanceof Set?"set":e instanceof Map?"map":e instanceof String?"string":e instanceof ArrayBuffer?"arraybuffer":typeof e}function o(e,t,s){const n=[];let r=null;return o._encode(n,e),r=(0,i.xW)(n),o.bytes=r.length,ArrayBuffer.isView(t)?(t.set(r,s),t):r}o.bytes=-1,o._floatConversionDetected=!1,o._encode=function(e,t){if(null!=t)switch(r(t)){case"object":o.dict(e,t);break;case"map":o.dictMap(e,t);break;case"array":o.list(e,t);break;case"set":o.listSet(e,t);break;case"string":o.string(e,t);break;case"number":case"boolean":o.number(e,t);break;case"arraybufferview":o.buffer(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength));break;case"arraybuffer":o.buffer(e,new Uint8Array(t))}};const a=new Uint8Array([101]),h=new Uint8Array([100]),l=new Uint8Array([108]);o.buffer=function(e,t){e.push((0,i.L0)(t.length+":"),t)},o.string=function(e,t){e.push((0,i.L0)((0,i.L0)(t).byteLength+":"+t))},o.number=function(e,t){if(Number.isInteger(t))return e.push((0,i.L0)("i"+BigInt(t)+"e"));const s=2147483648,n=(t/s|0)*s+(t%s|0);e.push((0,i.L0)("i"+n+"e")),n===t||o._floatConversionDetected||(o._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value "'+t+'":','Bencoding only defines support for integers, value was converted to "'+n+'"'),console.trace())},o.dict=function(e,t){e.push(h);let s,i=0;const n=Object.keys(t).sort(),r=n.length;for(;i=48)i=10*i+(s-48);else if(r!==t||43!==s){if(r!==t||45!==s){if(46===s)break;throw new Error("not a number: buffer["+r+"] = "+s)}n=-1}}return i*n}function u(e,t,s,n){return null==e||0===e.length?null:("number"!=typeof t&&null==n&&(n=t,t=void 0),"number"!=typeof s&&null==n&&(n=s,s=void 0),u.position=0,u.encoding=n||null,u.data=ArrayBuffer.isView(e)?new Uint8Array(e.slice(t,s)):(0,i.L0)(e),u.bytes=u.data.length,u.next())}u.bytes=0,u.position=0,u.data=null,u.encoding=null,u.next=function(){switch(u.data[u.position]){case 100:return u.dictionary();case 108:return u.list();case 105:return u.integer();default:return u.buffer()}},u.find=function(e){let t=u.position;const s=u.data.length,i=u.data;for(;t{function t(e){return(+Date.now()-e)/100&65535}e.exports=function(e){const s=+Date.now(),i=10*(e||5),n=[0];let r=1,o=t(s)-1&65535;return function(e){const a=t(s);let h=a-o&65535;for(h>i&&(h=i),o=a;h--;)r===i&&(r=0),n[r]=n[0===r?i-1:r-1],r++;e&&(n[r-1]+=e);const l=n[r-1],c=n.length{let i=s(8673);e.exports=new i(s(8446))},1314:e=>{e.exports=function(e,t){if(t>=e.length||t<0)return;var s=e.pop();if(t{function t(e,t){if("string"==typeof e[0])return e.join("");if("number"==typeof e[0])return new Uint8Array(e);const s=new Uint8Array(t);let i=0;for(let t=0,n=e.length;t=s){const e=t(o,a);let i=0;for(;a>=s;)yield e.slice(i,i+s),a-=s,i+=s;o=[e.slice(i,e.length)]}a&&(yield t(o,r?s:a))}},1551:()=>{},1827:()=>{},2072:e=>{e.exports={wait:function(e){return new Promise((t=>setTimeout(t,e)))}}},2123:()=>{},2376:()=>{},2532:()=>{},2701:()=>{},2799:()=>{},2878:e=>{function t(e,t){return{start:e.start,end:e.end,index:t}}function s(e){return{start:e.start,end:e.end}}function i(e,t){return e.index-t.index}function n(e,t){return e.start-t.start}e.exports=function(e,r,o){if("string"!=typeof r)throw new TypeError("argument str must be a string");var a=r.indexOf("=");if(-1===a)return-2;var h=r.slice(a+1).split(","),l=[];l.type=r.slice(0,a);for(var c=0;ce-1&&(p=e-1),isNaN(u)||isNaN(p)||u>p||u<0||l.push({start:u,end:p})}if(l.length<1)return-1;return o&&o.combine?function(e){for(var r=e.map(t).sort(n),o=0,a=1;al.end+1?r[++o]=h:h.end>l.end&&(l.end=h.end,l.index=Math.min(l.index,h.index))}r.length=o+1;var c=r.sort(i).map(s);return c.type=e.type,c}(l):l}},3033:(e,t,s)=>{function i(e){return(e>>3)+Number(e%8!=0)}s.d(t,{A:()=>n});class n{get length(){return this.buffer.length<<3}constructor(e=0,t){const s=null==t?void 0:t.grow;this.grow=s?Number.isFinite(s)?i(s):s:0,this.buffer="number"==typeof e?new Uint8Array(i(e)):e}get(e){const t=e>>3;return t>e%8)}set(e,t=!0){const s=e>>3;if(t){if(s>=this.buffer.length){const e=Math.max(s+1,Math.min(2*this.buffer.length,this.grow));if(e<=this.grow){const t=new Uint8Array(e);t.set(this.buffer),this.buffer=t}}this.buffer[s]|=128>>e%8}else s>e%8))}setAll(e,t=0){const s=Math.min(i(t+e.length),this.grow);if(this.buffer.length>3,r=128>>t%8;for(let t=0;t=this.buffer.length)break;r=128}else r>>=1}forEach(e,t=0,s=8*this.buffer.length){let i=t>>3,n=128>>t%8;for(let r=t;r>=1}isEmpty(){for(let e=0;e{var i=s(717),n=s(5472),r=s(3085),o=function(e,t,s){this.tokenBucket=new n(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=r(),this.tokensThisInterval=0,this.fireImmediately=s};o.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,t){if(e>this.tokenBucket.bucketSize)return i.nextTick(t.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var s=this,n=r();if((n=this.tokenBucket.interval)&&(this.curIntervalStart=n,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)i.nextTick(t.bind(null,null,-1));else{var o=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-n);setTimeout((function(){s.tokenBucket.removeTokens(e,a)}),o)}return!1}return this.tokenBucket.removeTokens(e,a);function a(i,n){if(i)return t(i,null);s.tokensThisInterval+=e,t(null,n)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=r();if((t=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var s=this.tokenBucket.tryRemoveTokens(e);return s&&(this.tokensThisInterval+=e),s},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},e.exports=o},3085:(e,t,s)=>{var i=s(717);e.exports=function(){if(void 0!==i&&i.hrtime){var e=i.hrtime(),t=e[0],s=e[1];return 1e3*t+Math.floor(s/1e6)}return(new Date).getTime()}},3198:e=>{e.exports=class{constructor(e){this.decoder=new TextDecoder("utf16le"===e?"utf16-le":e)}get remaining(){return-1}decode(e){return this.decoder.decode(e,{stream:!0})}flush(){return this.decoder.decode(new Uint8Array(0))}}},3208:()=>{},3278:()=>{},3468:()=>{"undefined"!=typeof ReadableStream&&(ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=function({preventCancel:e}={}){const t=this.getReader(),s=this;let i=t.read();return{next(){const e=i;return i=t.read(),e},return:async n=>(await i,t.releaseLock(),e||s.cancel(),{done:!0,value:n}),async throw(e){throw await this.return(),e},[Symbol.asyncIterator](){return this}}}),ReadableStream.prototype.getIterator||(ReadableStream.prototype.getIterator=function({preventCancel:e}={}){return this[Symbol.asyncIterator]({preventCancel:e})}))},3519:(e,t,s)=>{var i=s(6587);function n(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function r(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},s=e.name||"Function wrapped with `once`";return t.onceError=s+" shouldn't be called more than once",t.called=!1,t}e.exports=i(n),e.exports.strict=i(r),n.proto=n((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return r(this)},configurable:!0})}))},3714:(e,t,s)=>{const i=s(9596);e.exports=class{constructor(e){if(this.store=e,this.chunkLength=e.chunkLength,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.mem=[]}put(e,t,s=()=>{}){this.mem[e]=t,this.store.put(e,t,(t=>{this.mem[e]=null,s(t)}))}get(e,t,s=()=>{}){if("function"==typeof t)return this.get(e,null,t);let n=this.mem[e];if(!n)return this.store.get(e,t,s);t||(t={});const r=t.offset||0,o=t.length||n.length-r;0===r&&o===n.length||(n=n.slice(r,o+r)),i((()=>s(null,n)))}close(e=()=>{}){this.store.close(e)}destroy(e=()=>{}){this.store.destroy(e)}}},3970:()=>{},4018:e=>{e.exports=function(){for(var e=navigator.hardwareConcurrency||1,t=[],s=0;s{},4343:()=>{},4497:(e,t,s)=>{const i=s(8454),n=s(9596);e.exports=class{constructor(e,t){if(this.store=e,this.chunkLength=e.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(t)}put(e,t,s=()=>{}){if(!this.cache)return n((()=>s(new Error("CacheStore closed"))));this.cache.remove(e),this.store.put(e,t,s)}get(e,t,s=()=>{}){if("function"==typeof t)return this.get(e,null,t);if(!this.cache)return n((()=>s(new Error("CacheStore closed"))));t||(t={});let i=this.cache.get(e);if(i){const e=t.offset||0,r=t.length||i.length-e;return 0===e&&r===i.length||(i=i.slice(e,r+e)),n((()=>s(null,i)))}let r=this.inProgressGets.get(e);const o=!!r;r||(r=[],this.inProgressGets.set(e,r)),r.push({opts:t,cb:s}),o||this.store.get(e,((t,s)=>{t||null==this.cache||this.cache.set(e,s);const i=this.inProgressGets.get(e);this.inProgressGets.delete(e);for(const{opts:e,cb:n}of i)if(t)n(t);else{const t=e.offset||0,i=e.length||s.length-t;let r=s;0===t&&i===s.length||(r=s.slice(t,i+t)),n(null,r)}}))}close(e=()=>{}){if(!this.cache)return n((()=>e(new Error("CacheStore closed"))));this.cache=null,this.store.close(e)}destroy(e=()=>{}){if(!this.cache)return n((()=>e(new Error("CacheStore closed"))));this.cache=null,this.store.destroy(e)}}},4862:(e,t,s)=>{e.exports=n;const i=s(9596);function n(e,t){if(!(this instanceof n))return new n(e,t);if(t||(t={}),this.chunkLength=Number(e),!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=Number(t.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(e,t,s=()=>{}){if(this.closed)return i((()=>s(new Error("Storage is closed"))));const n=e===this.lastChunkIndex;return n&&t.length!==this.lastChunkLength?i((()=>s(new Error("Last chunk length must be "+this.lastChunkLength)))):n||t.length===this.chunkLength?(this.chunks[e]=t,void i((()=>s(null)))):i((()=>s(new Error("Chunk length must be "+this.chunkLength))))},n.prototype.get=function(e,t,s=()=>{}){if("function"==typeof t)return this.get(e,null,t);if(this.closed)return i((()=>s(new Error("Storage is closed"))));let n=this.chunks[e];if(!n){const e=new Error("Chunk not found");return e.notFound=!0,i((()=>s(e)))}t||(t={});const r=t.offset||0,o=t.length||n.length-r;0===r&&o===n.length||(n=n.slice(r,o+r)),i((()=>s(null,n)))},n.prototype.close=n.prototype.destroy=function(e=()=>{}){if(this.closed)return i((()=>e(new Error("Storage is closed"))));this.closed=!0,this.chunks=null,i((()=>e(null)))}},5335:(e,t,s)=>{const i=s(3198),n=s(3198);e.exports=class{constructor(e="utf8"){switch(this.encoding=function(e){switch(e=e.toLowerCase()){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:throw new Error("Unknown encoding: "+e)}}(e),this.encoding){case"utf8":this.decoder=new n;break;case"utf16le":case"base64":throw new Error("Unsupported encoding: "+this.encoding);default:this.decoder=new i(this.encoding)}}get remaining(){return this.decoder.remaining}push(e){return"string"==typeof e?e:this.decoder.decode(e)}write(e){return this.push(e)}end(e){let t="";return e&&(t=this.push(e)),t+=this.decoder.flush(),t}}},5372:(e,t,s)=>{e.exports=function(e,t,s){if("number"!=typeof t)throw new Error("second argument must be a Number");let n,r,o,a,h,l,c=!0;Array.isArray(e)?(n=[],o=r=e.length):(a=Object.keys(e),n={},o=r=a.length);function d(e){function t(){s&&s(e,n),s=null}c?i(t):t()}function u(t,s,i){if(n[t]=i,s&&(h=!0),0==--o||s)d(s);else if(!h&&l{var i=s(717),n=function(e,t,s,i){if(this.bucketSize=e,this.tokensPerInterval=t,"string"==typeof s)switch(s){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 "+s)}else this.interval=s;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(e,t){var s=this;return this.bucketSize?e>this.bucketSize?(i.nextTick(t.bind(null,"Requested tokens "+e+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),e>this.content?n():this.parentBucket?this.parentBucket.removeTokens(e,(function(i,r){return i?t(i,null):e>s.content?n():(s.content-=e,void t(null,Math.min(r,s.content)))})):(this.content-=e,i.nextTick(t.bind(null,null,this.content)),!0)):(i.nextTick(t.bind(null,null,e,Number.POSITIVE_INFINITY)),!0);function n(){var i=Math.ceil((e-s.content)*(s.interval/s.tokensPerInterval));return setTimeout((function(){s.removeTokens(e,t)}),i),!1}},tryRemoveTokens:function(e){return!this.bucketSize||!(e>this.bucketSize)&&(this.drip(),!(e>this.content)&&(!(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))&&(this.content-=e,!0)))},drip:function(){if(this.tokensPerInterval){var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var s=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+s,this.bucketSize)}else this.content=this.bucketSize}},e.exports=n},5658:(e,t,s)=>{s.r(t),s.d(t,{default:()=>_,enableSecure:()=>m});var i=s(7007),n=s(8179),r=s(1314),o=s(7833),a=s(6458);const h="tcpIncoming",l="tcpOutgoing",c="utpIncoming",d="utpOutgoing",u="webSeed",p=o("webtorrent:peer");let f=!1;const m=()=>{f=!0};class _ extends i{constructor(e,t){super(),this.id=e,this.type=t,p("new %s Peer %s",t,e),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,p("Peer %s connected",this.id),clearTimeout(this.connectTimeout);const e=this.conn;e.once("end",(()=>{this.destroy()})),e.once("close",(()=>{this.destroy()})),e.once("finish",(()=>{this.destroy()})),e.once("error",(e=>{this.destroy(e)}));const t=this.wire=new a.A(this.type,this.retries,f);t.once("end",(()=>{this.destroy()})),t.once("close",(()=>{this.destroy()})),t.once("finish",(()=>{this.destroy()})),t.once("error",(e=>{this.destroy(e)})),t.once("pe1",(()=>{this.onPe1()})),t.once("pe2",(()=>{this.onPe2()})),t.once("pe3",(()=>{this.onPe3()})),t.once("pe4",(()=>{this.onPe4()})),t.once("handshake",((e,t)=>{this.onHandshake(e,t)})),this.startHandshakeTimeout(),this.setThrottlePipes(),this.swarm&&("tcpOutgoing"===this.type?f&&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(e){this.swarm&&(this.swarm.infoHashHash!==e&&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 e=this;(0,n.pipeline)(this.conn,this.throttleGroups.down.throttle(),new n.Transform({transform(t,s){e.emit("download",t.length),e.destroyed||s(null,t)}}),this.wire,this.throttleGroups.up.throttle(),new n.Transform({transform(t,s){e.emit("upload",t.length),e.destroyed||s(null,t)}}),this.conn)}onHandshake(e,t){if(!this.swarm)return;if(this.destroyed)return;if(this.swarm.destroyed)return this.destroy(new Error("swarm already destroyed"));if(e!==this.swarm.infoHash)return this.destroy(new Error("unexpected handshake info hash for this swarm"));if(t===this.swarm.peerId)return this.destroy(new Error("refusing to connect to ourselves"));p("Peer %s got handshake %s",this.id,e),clearTimeout(this.handshakeTimeout),this.retries=0;let s=this.addr;!s&&this.conn.remoteAddress&&this.conn.remotePort&&(s=`${this.conn.remoteAddress}:${this.conn.remotePort}`),this.swarm._onWire(this.wire,s),this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}handshake(){const e={dht:!this.swarm.private&&!!this.swarm.client.dht,fast:!0};this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,e),this.sentHandshake=!0}startConnectTimeout(){clearTimeout(this.connectTimeout);const e={webrtc:25e3,tcpOutgoing:5e3,utpOutgoing:5e3};this.connectTimeout=setTimeout((()=>{this.destroy(new Error("connect timeout"))}),e[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(e){if(this.destroyed)return;this.destroyed=!0,this.connected=!1,p("destroy %s %s (error: %s)",this.type,this.id,e&&(e.message||e)),clearTimeout(this.connectTimeout),clearTimeout(this.handshakeTimeout);const t=this.swarm,s=this.conn,i=this.wire;this.swarm=null,this.conn=null,this.wire=null,t&&i&&r(t.wires,t.wires.indexOf(i)),s&&(s.on("error",(()=>{})),s.destroy()),i&&i.destroy(),t&&t.removePeer(this.id)}}_.TYPE_TCP_INCOMING=h,_.TYPE_TCP_OUTGOING=l,_.TYPE_UTP_INCOMING=c,_.TYPE_UTP_OUTGOING=d,_.TYPE_WEBRTC="webrtc",_.TYPE_WEBSEED=u,_.SOURCE_MANUAL="manual",_.SOURCE_TRACKER="tracker",_.SOURCE_DHT="dht",_.SOURCE_LSD="lsd",_.SOURCE_UT_PEX="ut_pex",_.createWebRTCPeer=(e,t,s,i=null)=>{const n=new _(e.id,"webrtc");if(n.conn=e,n.swarm=t,n.throttleGroups=s,n.source=i,n.conn.connected)n.onConnect();else{const e=()=>{n.conn.removeListener("connect",t),n.conn.removeListener("error",s)},t=()=>{e(),n.onConnect()},s=t=>{e(),n.destroy(t)};n.conn.once("connect",t),n.conn.once("error",s),n.startConnectTimeout()}return n},_.createTCPIncomingPeer=(e,t)=>_._createIncomingPeer(e,h,t),_.createUTPIncomingPeer=(e,t)=>_._createIncomingPeer(e,c,t),_.createTCPOutgoingPeer=(e,t,s,i)=>_._createOutgoingPeer(e,t,l,s,i),_.createUTPOutgoingPeer=(e,t,s,i)=>_._createOutgoingPeer(e,t,d,s,i),_._createIncomingPeer=(e,t,s)=>{const i=`${e.remoteAddress}:${e.remotePort}`,n=new _(i,t);return n.conn=e,n.addr=i,n.throttleGroups=s,n.onConnect(),n},_._createOutgoingPeer=(e,t,s,i,n=null)=>{const r=new _(e,s);return r.addr=e,r.swarm=t,r.throttleGroups=i,r.source=n,r},_.createWebSeedPeer=(e,t,s,i)=>{const n=new _(t,u);return n.swarm=s,n.conn=e,n.throttleGroups=i,n.onConnect(),n}},5809:e=>{e.exports=class{constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-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(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},6080:(e,t,s)=>{const i=s(5809);e.exports=class{constructor(e){this.hwm=e||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(e){if(this.length++,!this.head.push(e)){const t=this.head;this.head=t.next=new i(2*this.head.buffer.length),this.head.push(e)}}shift(){0!==this.length&&this.length--;const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}peek(){const e=this.tail.peek();return void 0===e&&this.tail.next?this.tail.next.peek():e}isEmpty(){return 0===this.length}}},6310:e=>{function t(e,t){for(const s in t)Object.defineProperty(e,s,{value:t[s],enumerable:!0,configurable:!0});return e}e.exports=function(e,s,i){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");i||(i={}),"object"==typeof s&&(i=s,s=""),s&&(i.code=s);try{return t(e,i)}catch(s){i.message=e.message,i.stack=e.stack;const n=function(){};n.prototype=Object.create(Object.getPrototypeOf(e));return t(new n,i)}}},6458:(e,t,s)=>{s.d(t,{A:()=>I});var i=s(988),n=s(3033),r=s(7264),o=s(7833),a=s(8727),h=s(8179),l=s(9639),c=s(1035),d=s(1314);const u=o("bittorrent-protocol"),p=(0,l.L0)("BitTorrent protocol"),f=new Uint8Array([0,0,0,0]),m=new Uint8Array([0,0,0,1,0]),_=new Uint8Array([0,0,0,1,1]),g=new Uint8Array([0,0,0,1,2]),y=new Uint8Array([0,0,0,1,3]),w=[0,0,0,0,0,0,0,0],b=[0,0,0,3,9,0,0],v=new Uint8Array([0,0,0,1,14]),k=new Uint8Array([0,0,0,1,15]),x=new Uint8Array([0,0,0,0,0,0,0,0]),S=new Uint8Array([0,0,1,2]),E=new Uint8Array([0,0,0,2]);function C(e,t){for(let s=e.length;s--;)e[s]^=t[s];return e}class P{constructor(e,t,s,i){this.piece=e,this.offset=t,this.length=s,this.callback=i}}class T{constructor(){this.buffer=new Uint8Array}get(e){return!0}set(e){}}class A extends h.Duplex{constructor(e=null,t=0,s=!1){super(),this._debugId=(0,l.V5)((0,l.po)(4)),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=e,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=c(),this.downloadSpeed=c(),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=s,s?(this._dh=r.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===t?this._parsePe2():this._parseHandshake(null)}setKeepAlive(e){this._debug("setKeepAlive %s",e),clearInterval(this._keepAliveInterval),!1!==e&&(this._keepAliveInterval=setInterval((()=>{this.keepAlive()}),55e3))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._timeoutMs=e,this._timeoutUnref=!!t,this._resetTimeout(!0)}destroy(){if(!this.destroyed)return this._debug("destroy"),this.end(),this}end(e){if(!this.destroyed&&!this.destroying)return this._debug("end"),this._onUninterested(),this._onChoke(),super.end(e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const s=this._nextExt,i=new e(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[s]=t,this._ext[t]=i,this[t]=i,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(f)}sendPe1(){if(this._peEnabled){const e=Math.floor(513*Math.random()),t=(0,l.po)(e);this._push((0,l.xW)([(0,l.fk)(this._myPubKey),t]))}}sendPe2(){const e=Math.floor(513*Math.random()),t=(0,l.po)(e);this._push((0,l.xW)([(0,l.fk)(this._myPubKey),t]))}async sendPe3(e){await this.setEncrypt(this._sharedSecret,e);const t=await(0,l.tW)((0,l.fk)(this._utfToHex("req1")+this._sharedSecret)),s=C(await(0,l.tW)((0,l.fk)(this._utfToHex("req2")+e)),await(0,l.tW)((0,l.fk)(this._utfToHex("req3")+this._sharedSecret))),i=new DataView((0,l.po)(2).buffer).getUint16(0)%512,n=(0,l.po)(i);let r=new Uint8Array(14+i+2);r.set(x),r.set(S,8);const o=new DataView(r.buffer);o.setInt16(12,i),n.copy(r,14),o.setInt16(14+i,0),r=this._encryptHandshake(r),this._push((0,l.xW)([t,s,r]))}async sendPe4(e){await this.setEncrypt(this._sharedSecret,e);const t=new DataView((0,l.po)(2).buffer).getUint16(0)%512,s=(0,l.po)(t);let i=new Uint8Array(14+t);const n=new DataView(i.buffer);i.set(x),i.set(E,8),n.setInt16(12,t),i.set(s,14),i=this._encryptHandshake(i),this._push(i),this._cryptoHandshakeDone=!0,this._debug("completed crypto handshake")}handshake(e,t,s){let i,n;if("string"==typeof e?(e=e.toLowerCase(),i=(0,l.fk)(e)):(i=e,e=(0,l.V5)(i)),"string"==typeof t?n=(0,l.fk)(t):(n=t,t=(0,l.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",e,t,s);const r=new Uint8Array(w);this.extensions={extended:!0,dht:!(!s||!s.dht),fast:!(!s||!s.fast)},r[5]|=16,this.extensions.dht&&(r[7]|=1),this.extensions.fast&&(r[7]|=4),this.extensions.fast&&this.peerExtensions.fast&&(this._debug("fast extension is enabled"),this.hasFast=!0),this._push((0,l.xW)([p,r,i,n])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=Object.assign({},this.extendedHandshake);e.m={};for(const t in this.extendedMapping){const s=this.extendedMapping[t];e.m[s]=Number(t)}this.extended(0,i.A.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking)if(this.amChoking=!0,this._debug("choke"),this._push(m),this.hasFast){let e=0;for(;this.peerRequests.length>e;){const t=this.peerRequests[e];this.allowedFastSet.includes(t.piece)?++e:this.reject(t.piece,t.offset,t.length)}}else for(;this.peerRequests.length;)this.peerRequests.pop()}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(_))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(g))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(y))}have(e){this._debug("have %d",e),this._message(4,[e],null)}bitfield(e){this._debug("bitfield"),ArrayBuffer.isView(e)||(e=e.buffer),this._message(5,[],e)}request(e,t,s,i){return i||(i=()=>{}),this._finished?i(new Error("wire is closed")):!this.peerChoking||this.hasFast&&this.peerAllowedFastSet.includes(e)?(this._debug("request index=%d offset=%d length=%d",e,t,s),this.requests.push(new P(e,t,s,i)),this._timeout||this._resetTimeout(!0),void this._message(6,[e,t,s],null)):i(new Error("peer is choking"))}piece(e,t,s){this._debug("piece index=%d offset=%d",e,t),this._message(7,[e,t],s),this.uploaded+=s.length,this.uploadSpeed(s.length),this.emit("upload",s.length)}cancel(e,t,s){this._debug("cancel index=%d offset=%d length=%d",e,t,s),this._callback(this._pull(this.requests,e,t,s),new Error("request was cancelled"),null),this._message(8,[e,t,s],null)}port(e){this._debug("port %d",e);const t=new Uint8Array(b);new DataView(t.buffer).setUint16(5,e),this._push(t)}suggest(e){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("suggest %d",e),this._message(13,[e],null)}haveAll(){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("have-all"),this._push(v)}haveNone(){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("have-none"),this._push(k)}reject(e,t,s){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("reject index=%d offset=%d length=%d",e,t,s),this._pull(this.peerRequests,e,t,s),this._message(16,[e,t,s],null)}allowedFast(e){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("allowed-fast %d",e),this.allowedFastSet.includes(e)||this.allowedFastSet.push(e),this._message(17,[e],null)}extended(e,t){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"!=typeof e)throw new Error(`Unrecognized extension: ${e}`);{const s=new Uint8Array([e]),n=ArrayBuffer.isView(t)?t:i.A.encode(t);this._message(20,[],(0,l.xW)([s,n]))}}async setEncrypt(e,t){let s,i,n,r;switch(this.type){case"tcpIncoming":s=await(0,l.tW)((0,l.fk)(this._utfToHex("keyB")+e+t)),n=await(0,l.tW)((0,l.fk)(this._utfToHex("keyA")+e+t)),i=[];for(const e of s.values())i.push(e);r=[];for(const e of n.values())r.push(e);this._encryptGenerator=new a(i),this._decryptGenerator=new a(r);break;case"tcpOutgoing":s=await(0,l.tW)((0,l.fk)(this._utfToHex("keyA")+e+t)),n=await(0,l.tW)((0,l.fk)(this._utfToHex("keyB")+e+t)),i=[];for(const e of s.values())i.push(e);r=[];for(const e of n.values())r.push(e);this._encryptGenerator=new a(i),this._decryptGenerator=new a(r);break;default:return!1}for(let e=0;e<1024;e++)this._encryptGenerator.randomByte(),this._decryptGenerator.randomByte();return this._setGenerators=!0,!0}_message(e,t,s){const i=s?s.length:0,n=new Uint8Array(5+4*t.length),r=new DataView(n.buffer);r.setUint32(0,n.length+i-4),n[4]=e;for(let e=0;e{if(n===this._pull(this.peerRequests,e,t,s))return i?(this._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,s,i.message),void(this.hasFast&&this.reject(e,t,s))):void this.piece(e,t,r)},n=new P(e,t,s,i);this.peerRequests.push(n),this.emit("request",e,t,s,i)}_onPiece(e,t,s){this._debug("got piece index=%d offset=%d",e,t),this._callback(this._pull(this.requests,e,t,s.length),null,s),this.downloaded+=s.length,this.downloadSpeed(s.length),this.emit("download",s.length),this.emit("piece",e,t,s)}_onCancel(e,t,s){this._debug("got cancel index=%d offset=%d length=%d",e,t,s),this._pull(this.peerRequests,e,t,s),this.emit("cancel",e,t,s)}_onPort(e){this._debug("got port %d",e),this.emit("port",e)}_onSuggest(e){if(!this.hasFast)return this._debug("Error: got suggest whereas fast extension is disabled"),void this.destroy();this._debug("got suggest %d",e),this.emit("suggest",e)}_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 T,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(e,t,s){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",e,t,s),this._callback(this._pull(this.requests,e,t,s),new Error("request was rejected"),null),this.emit("reject",e,t,s)}_onAllowedFast(e){if(!this.hasFast)return this._debug("Error: got allowed-fast whereas fast extension is disabled"),void this.destroy();this._debug("got allowed-fast %d",e),this.peerAllowedFastSet.includes(e)||this.peerAllowedFastSet.push(e),this.peerAllowedFastSet.length>100&&this.peerAllowedFastSet.shift(),this.emit("allowed-fast",e)}_onExtended(e,t){if(0===e){let e;try{e=i.A.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!e)return;if(this.peerExtendedHandshake=e,"object"==typeof e.m)for(const t in e.m)this.peerExtendedMapping[t]=Number(e.m[t].toString());for(const e in this._ext)this.peerExtendedMapping[e]&&this._ext[e].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(e,t){if(2===this._encryptionMethod&&this._cryptoHandshakeDone&&(e=this._decrypt(e)),this._bufferSize+=e.length,this._buffer.push(e),this._buffer.length>1&&(this._buffer=[(0,l.xW)(this._buffer,this._bufferSize)]),this._cryptoSyncPattern){const t=this._buffer[0].indexOf(this._cryptoSyncPattern);if(-1!==t)this._buffer[0]=this._buffer[0].slice(t+this._cryptoSyncPattern.length),this._bufferSize-=t+this._cryptoSyncPattern.length,this._cryptoSyncPattern=null;else if(this._bufferSize+e.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 e=this._buffer[0];this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[e.slice(this._parserSize)]:[],this._parser(e.slice(0,this._parserSize))}t(null)}_callback(e,t,s){e&&(this._resetTimeout(!this.peerChoking&&!this._finished),e.callback(t,s))}_resetTimeout(e){if(!e||!this._timeoutMs||!this.requests.length)return clearTimeout(this._timeout),this._timeout=null,void(this._timeoutExpiresAt=null);const t=Date.now()+this._timeoutMs;if(this._timeout){if(t-this._timeoutExpiresAt<.05*this._timeoutMs)return;clearTimeout(this._timeout)}this._timeoutExpiresAt=t,this._timeout=setTimeout((()=>this._onTimeout()),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref()}_parse(e,t){this._parserSize=e,this._parser=t}_parseUntil(e,t){this._cryptoSyncPattern=e,this._waitMaxBytes=t}_onMessageLength(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))}_onMessage(e){this._parse(4,this._onMessageLength);const t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e[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(t.getUint32(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(t.getUint32(1),t.getUint32(5),t.getUint32(9));case 7:return this._onPiece(t.getUint32(1),t.getUint32(5),e.slice(9));case 8:return this._onCancel(t.getUint32(1),t.getUint32(5),t.getUint32(9));case 9:return this._onPort(t.getUint16(1));case 13:return this._onSuggest(t.getUint32(1));case 14:return this._onHaveAll();case 15:return this._onHaveNone();case 16:return this._onReject(t.getUint32(1),t.getUint32(5),t.getUint32(9));case 17:return this._onAllowedFast(t.getUint32(1));case 20:return this._onExtended(e[1],e.slice(2));default:return this._debug("got unknown message"),this.emit("unknownmessage",e)}}_determineHandshakeType(){this._parse(1,(e=>{const t=e[0];19===t?this._parse(t+48,this._onHandshakeBuffer):this._parsePe1(e)}))}_parsePe1(e){this._parse(95,(t=>{this._onPe1((0,l.xW)([e,t])),this._parsePe3()}))}_parsePe2(){this._parse(96,(e=>{for(this._onPe2(e);!this._setGenerators;);this._parsePe4()}))}async _parsePe3(){const e=await(0,l.tW)((0,l.fk)(this._utfToHex("req1")+this._sharedSecret));this._parseUntil(e,512),this._parse(20,(e=>{for(this._onPe3(e);!this._setGenerators;);this._parsePe3Encrypted()}))}_parsePe3Encrypted(){this._parse(14,(e=>{const t=this._decryptHandshake(e.slice(0,8)),s=this._decryptHandshake(e.slice(8,12)),i=new DataView(this._decryptHandshake(e.slice(12,14)).buffer).getUint16(0);this._parse(i,(e=>{e=this._decryptHandshake(e),this._parse(2,(i=>{const n=new DataView(this._decryptHandshake(i).buffer).getUint16(0);this._parse(n,(i=>{i=this._decryptHandshake(i),this._onPe3Encrypted(t,s,e,i);const r=n?i[0]:null,o=n?i.slice(1,20):null;19===r&&"BitTorrent protocol"===(0,l.dU)(o)?this._onHandshakeBuffer(i.slice(1)):this._parseHandshake()}))}))}))}))}_parsePe4(){const e=this._decryptHandshake(x);this._parseUntil(e,512),this._parse(6,(e=>{const t=this._decryptHandshake(e.slice(0,4)),s=new DataView(this._decryptHandshake(e.slice(4,6)).buffer).getUint16(0);this._parse(s,(e=>{this._decryptHandshake(e),this._onPe4(t),this._parseHandshake(null)}))}))}_parseHandshake(){this._parse(1,(e=>{const t=e[0];if(19!==t)return this._debug("Error: wire not speaking BitTorrent protocol (%s)",t.toString()),void this.end();this._parse(t+48,this._onHandshakeBuffer)}))}_onHandshakeBuffer(e){const t=e.slice(0,19);if("BitTorrent protocol"!==(0,l.dU)(t))return this._debug("Error: wire not speaking BitTorrent protocol (%s)",(0,l.dU)(t)),void this.end();e=e.slice(19),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),fast:!!(4&e[7]),extended:!!(16&e[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(...e){e[0]=`[${this._debugId}] ${e[0]}`,u(...e)}_pull(e,t,s,i){for(let n=0;n{var t=1e3,s=60*t,i=60*s,n=24*i,r=7*n,o=365.25*n;function a(e,t,s,i){var n=t>=1.5*s;return Math.round(e/s)+" "+i+(n?"s":"")}e.exports=function(e,h){h=h||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var h=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*r;case"days":case"day":case"d":return h*n;case"hours":case"hour":case"hrs":case"hr":case"h":return h*i;case"minutes":case"minute":case"mins":case"min":case"m":return h*s;case"seconds":case"second":case"secs":case"sec":case"s":return h*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}(e);if("number"===l&&isFinite(e))return h.long?function(e){var r=Math.abs(e);if(r>=n)return a(e,r,n,"day");if(r>=i)return a(e,r,i,"hour");if(r>=s)return a(e,r,s,"minute");if(r>=t)return a(e,r,t,"second");return e+" ms"}(e):function(e){var r=Math.abs(e);if(r>=n)return Math.round(e/n)+"d";if(r>=i)return Math.round(e/i)+"h";if(r>=s)return Math.round(e/s)+"m";if(r>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},6587:e=>{e.exports=function e(t,s){if(t&&s)return e(t)(s);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){i[e]=t[e]})),i;function i(){for(var e=new Array(arguments.length),s=0;s{var i=s(717),n=s(3519),r=function(){},o=function(e,t,s){if("function"==typeof t)return o(e,null,t);t||(t={}),s=n(s||r);var a=e._writableState,h=e._readableState,l=t.readable||!1!==t.readable&&e.readable,c=t.writable||!1!==t.writable&&e.writable,d=!1,u=function(){e.writable||p()},p=function(){c=!1,l||s.call(e)},f=function(){l=!1,c||s.call(e)},m=function(t){s.call(e,t?new Error("exited with error code: "+t):null)},_=function(t){s.call(e,t)},g=function(){i.nextTick(y)},y=function(){if(!d)return(!l||h&&h.ended&&!h.destroyed)&&(!c||a&&a.ended&&!a.destroyed)?void 0:s.call(e,new Error("premature close"))},w=function(){e.req.on("finish",p)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?c&&!a&&(e.on("end",u),e.on("close",u)):(e.on("complete",p),e.on("abort",g),e.req?w():e.on("request",w)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",m),e.on("end",f),e.on("finish",p),!1!==t.error&&e.on("error",_),e.on("close",g),function(){d=!0,e.removeListener("complete",p),e.removeListener("abort",g),e.removeListener("request",w),e.req&&e.req.removeListener("finish",p),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",p),e.removeListener("exit",m),e.removeListener("end",f),e.removeListener("error",_),e.removeListener("close",g)}};e.exports=o},6664:()=>{},6686:()=>{},6698:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var s=function(){};s.prototype=t.prototype,e.prototype=new s,e.prototype.constructor=e}}},6819:(e,t,s)=>{e.exports=s(8330).version},6889:()=>{},7007:e=>{var t=Object.create||function(e){var t=function(){};return t.prototype=e,new t},s=Object.keys||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return s},i=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function n(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=t(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0;var r,o=10;try{var a={};Object.defineProperty&&Object.defineProperty(a,"x",{value:0}),r=0===a.x}catch(e){r=!1}function h(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function l(e,s,i,n){var r,o,a;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",s,i.listener?i.listener:i),o=e._events),a=o[s]):(o=e._events=t(null),e._eventsCount=0),a){if("function"==typeof a?a=o[s]=n?[i,a]:[a,i]:n?a.unshift(i):a.push(i),!a.warned&&(r=h(e))&&r>0&&a.length>r){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(s)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=e,l.type=s,l.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else a=o[s]=i,++e._eventsCount;return e}function c(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var h=new Error('Unhandled "error" event. ('+t+")");throw h.context=t,h}if(!(s=o[e]))return!1;var l="function"==typeof s;switch(i=arguments.length){case 1:!function(e,t,s){if(t)e.call(s);else for(var i=e.length,n=f(e,i),r=0;r=0;o--)if(i[o]===s||i[o].listener===s){a=i[o].listener,r=o;break}if(r<0)return this;0===r?i.shift():function(e,t){for(var s=t,i=s+1,n=e.length;i=0;r--)this.removeListener(e,i[r]);return this},n.prototype.listeners=function(e){return u(this,e,!0)},n.prototype.rawListeners=function(e){return u(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},n.prototype.listenerCount=p,n.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},7264:()=>{},7373:e=>{e.exports=function(e){var t=0;return function(){if(t===e.length)return null;var s=e.length-t,i=Math.random()*s|0,n=e[t+i],r=e[t];return e[t]=n,e[t+i]=r,t++,n}}},7541:(e,t,s)=>{const i=s(8765),n=s(8499);e.exports={Throttle:i,ThrottleGroup:n}},7828:()=>{},7833:(e,t,s)=>{var i=s(717);t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;t.splice(1,0,s,"color: inherit");let i=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(n=i))})),t.splice(n,0,s)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==i&&"env"in i&&(e=i.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.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"],t.log=console.debug||console.log||(()=>{}),e.exports=s(736)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},7936:()=>{},8179:(e,t,s)=>{const{EventEmitter:i}=s(7007),n=new Error("Stream was destroyed"),r=new Error("Premature close"),o=s(6080),a=s(5335),h=536870911,l=1^h,c=2^h,d=32,u=64,p=128,f=256,m=1024,_=2048,g=4096,y=8192,w=16384,b=32768,v=131072,k=131328,x=16^h,S=536805375,E=768^h,C=536838143,P=536739839,T=1<<18,A=2<<18,I=4<<18,L=8<<18,O=16<<18,R=32<<18,H=64<<18,N=128<<18,U=256<<18,M=512<<18,F=1024<<18,j=535822335,B=503316479,D=268435455,q=262160,W=536608751,$=8404992,z=14,V=15,G=8405006,K=33587200,Y=33587215,J=2359296,X=270794767,Q=Symbol.asyncIterator||Symbol("asyncIterator");class Z{constructor(e,{highWaterMark:t=16384,map:s=null,mapWritable:i,byteLength:n,byteLengthWritable:r}={}){this.stream=e,this.queue=new o,this.highWaterMark=t,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=r||n||xe,this.map=i||s,this.afterWrite=oe.bind(this),this.afterUpdateNextTick=le.bind(this)}get ended(){return!!(this.stream._duplexState&R)}push(e){return!(142606350&this.stream._duplexState)&&(null!==this.map&&(e=this.map(e)),this.buffered+=this.byteLength(e),this.queue.push(e),this.buffered0,this.error=null,this.pipeline=null,this.byteLength=r||n||xe,this.map=i||s,this.pipeTo=null,this.afterRead=ae.bind(this),this.afterUpdateNextTick=he.bind(this)}get ended(){return!!(this.stream._duplexState&w)}pipe(e,t){if(null!==this.pipeTo)throw new Error("Can only pipe to one destination");if("function"!=typeof t&&(t=null),this.stream._duplexState|=512,this.pipeTo=e,this.pipeline=new se(this.stream,e,t),t&&this.stream.on("error",Se),ke(e))e._writableState.pipeline=this.pipeline,t&&e.on("error",Se),e.on("finish",this.pipeline.finished.bind(this.pipeline));else{const t=this.pipeline.done.bind(this.pipeline,e),s=this.pipeline.done.bind(this.pipeline,e,null);e.on("error",t),e.on("close",s),e.on("finish",this.pipeline.finished.bind(this.pipeline))}e.on("drain",ie.bind(this)),this.stream.emit("piping",e),e.emit("pipe",this.stream)}push(e){const t=this.stream;return null===e?(this.highWaterMark=0,t._duplexState=536805311&t._duplexState|1024,!1):null!==this.map&&null===(e=this.map(e))?(t._duplexState&=S,this.buffered0;)t.push(this.shift());for(let e=0;e0;)i.drains.shift().resolve(!1);null!==i.pipeline&&i.pipeline.done(t,e)}}function oe(e){const t=this.stream;e&&t.destroy(e),t._duplexState&=469499903,null!==this.drains&&function(e){for(let t=0;t0)?null:s(i)},this}_read(e){e(null)}pipe(e,t){return this._readableState.updateNextTick(),this._readableState.pipe(e,t),e}read(){return this._readableState.updateNextTick(),this._readableState.read()}push(e){return this._readableState.updateNextTickIfOpen(),this._readableState.push(e)}unshift(e){return this._readableState.updateNextTickIfOpen(),this._readableState.unshift(e)}resume(){return this._duplexState|=k,this._readableState.updateNextTick(),this}pause(){return this._duplexState&=!1===this._readableState.readAhead?536739583:536870655,this}static _fromAsyncIterator(e,t){let s;const i=new fe({...t,read(t){e.next().then(n).then(t.bind(null,null)).catch(t)},predestroy(){s=e.return()},destroy(e){if(!s)return e(null);s.then(e.bind(null,null)).catch(e)}});return i;function n(e){e.done?i.push(null):i.push(e.value)}}static from(e,t){if(ke(s=e)&&s.readable)return e;var s;if(e[Q])return this._fromAsyncIterator(e[Q](),t);Array.isArray(e)||(e=void 0===e?[]:[e]);let i=0;return new fe({...t,read(t){this.push(i===e.length?null:e[i++]),t(null)}})}static isBackpressured(e){return!!(17422&e._duplexState)||e._readableState.buffered>=e._readableState.highWaterMark}static isPaused(e){return!(e._duplexState&f)}[Q](){const e=this;let t=null,s=null,i=null;return this.on("error",(e=>{t=e})),this.on("readable",(function(){null!==s&&r(e.read())})),this.on("close",(function(){null!==s&&r(null)})),{[Q](){return this},next:()=>new Promise((function(t,n){s=t,i=n;const o=e.read();null!==o?r(o):8&e._duplexState&&r(null)})),return:()=>o(null),throw:e=>o(e)};function r(r){null!==i&&(t?i(t):null!==r||e._duplexState&w?s({value:r,done:null===r}):i(n),i=s=null)}function o(t){return e.destroy(t),new Promise(((s,i)=>{if(8&e._duplexState)return s({value:void 0,done:!0});e.once("close",(function(){t?i(t):s({value:void 0,done:!0})}))}))}}}class me extends pe{constructor(e){super(e),this._duplexState|=16385,this._writableState=new Z(this,e),e&&(e.writev&&(this._writev=e.writev),e.write&&(this._write=e.write),e.final&&(this._final=e.final),e.eagerOpen&&this._writableState.updateNextTick())}cork(){this._duplexState|=F}uncork(){this._duplexState&=D,this._writableState.updateNextTick()}_writev(e,t){t(null)}_write(e,t){this._writableState.autoBatch(e,t)}_final(e){e(null)}static isBackpressured(e){return!!(146800654&e._duplexState)}static drained(e){if(e.destroyed)return Promise.resolve(!1);const t=e._writableState;var s;const i=((s=e)._writev!==me.prototype._writev&&s._writev!==_e.prototype._writev?Math.min(1,t.queue.length):t.queue.length)+(e._duplexState&U?1:0);return 0===i?Promise.resolve(!0):(null===t.drains&&(t.drains=[]),new Promise((e=>{t.drains.push({writes:i,resolve:e})})))}write(e){return this._writableState.updateNextTick(),this._writableState.push(e)}end(e){return this._writableState.updateNextTick(),this._writableState.end(e),this}}class _e extends fe{constructor(e){super(e),this._duplexState=1|this._duplexState&v,this._writableState=new Z(this,e),e&&(e.writev&&(this._writev=e.writev),e.write&&(this._write=e.write),e.final&&(this._final=e.final))}cork(){this._duplexState|=F}uncork(){this._duplexState&=D,this._writableState.updateNextTick()}_writev(e,t){t(null)}_write(e,t){this._writableState.autoBatch(e,t)}_final(e){e(null)}write(e){return this._writableState.updateNextTick(),this._writableState.push(e)}end(e){return this._writableState.updateNextTick(),this._writableState.end(e),this}}class ge extends _e{constructor(e){super(e),this._transformState=new te(this),e&&(e.transform&&(this._transform=e.transform),e.flush&&(this._flush=e.flush))}_write(e,t){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=e:this._transform(e,this._transformState.afterTransform)}_read(e){if(null!==this._transformState.data){const t=this._transformState.data;this._transformState.data=null,e(null),this._transform(t,this._transformState.afterTransform)}else e(null)}destroy(e){super.destroy(e),null!==this._transformState.data&&(this._transformState.data=null,this._transformState.afterTransform())}_transform(e,t){t(null,e)}_flush(e){e(null)}_final(e){this._transformState.afterFinal=e,this._flush(ye.bind(this))}}function ye(e,t){const s=this._transformState.afterFinal;if(e)return s(e);null!=t&&this.push(t),this.push(null),s(null)}function we(e,...t){const s=Array.isArray(e)?[...e,...t]:[e,...t],i=s.length&&"function"==typeof s[s.length-1]?s.pop():null;if(s.length<2)throw new Error("Pipeline requires at least 2 streams");let n=s[0],o=null,a=null;for(let e=1;e1,l),n.pipe(o)),n=o;if(i){let e=!1;const t=ke(o)||!(!o._writableState||!o._writableState.autoDestroy);o.on("error",(e=>{null===a&&(a=e)})),o.on("finish",(()=>{e=!0,t||i(a)})),t&&o.on("close",(()=>i(a||(e?null:r))))}return o;function h(e,t,s,i){e.on("error",i),e.on("close",(function(){if(t&&e._readableState&&!e._readableState.ended)return i(r);if(s&&e._writableState&&!e._writableState.ended)return i(r)}))}function l(e){if(e&&!a){a=e;for(const t of s)t.destroy(e)}}}function be(e){return e}function ve(e){return!!e._readableState||!!e._writableState}function ke(e){return"number"==typeof e._duplexState&&ve(e)}function xe(e){return function(e){return"object"==typeof e&&null!==e&&"number"==typeof e.byteLength}(e)?e.byteLength:1024}function Se(){}function Ee(){this.destroy(new Error("Stream aborted."))}e.exports={pipeline:we,pipelinePromise:function(...e){return new Promise(((t,s)=>we(...e,(e=>{if(e)return s(e);t()}))))},isStream:ve,isStreamx:ke,isEnded:function(e){return!!e._readableState&&e._readableState.ended},isFinished:function(e){return!!e._writableState&&e._writableState.ended},isDisturbed:function(e){return!!(1&~e._duplexState)||!!(e._duplexState&K)},getStreamError:function(e,t={}){const s=e._readableState&&e._readableState.error||e._writableState&&e._writableState.error;return t.all||s!==n?s:null},Stream:pe,Writable:me,Readable:fe,Duplex:_e,Transform:ge,PassThrough:class extends ge{}}},8190:(e,t,s)=>{e.exports=function(e,t){let s,n,r,o=!0;Array.isArray(e)?(s=[],n=e.length):(r=Object.keys(e),s={},n=r.length);function a(e){function n(){t&&t(e,s),t=null}o?i(n):n()}function h(e,t,i){s[e]=i,(0==--n||t)&&a(t)}n?r?r.forEach((function(t){e[t]((function(e,s){h(t,e,s)}))})):e.forEach((function(e,t){e((function(e,s){h(t,e,s)}))})):a(null);o=!1};const i=s(9596)},8271:()=>{},8330:e=>{e.exports={version:"2.6.2"}},8444:e=>{e.exports=function(e){return Math.max(16384,1<{e.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"]}},8454:(e,t,s)=>{var i=s(7007),n=s(6698);function r(e){if(!(this instanceof r))return new r(e);"number"==typeof e&&(e={max:e}),e||(e={}),i.EventEmitter.call(this),this.cache={},this.head=this.tail=null,this.length=0,this.max=e.max||1e3,this.maxAge=e.maxAge||0}e.exports=r,n(r,i.EventEmitter),Object.defineProperty(r.prototype,"keys",{get:function(){return Object.keys(this.cache)}}),r.prototype.clear=function(){this.cache={},this.head=this.tail=null,this.length=0},r.prototype.remove=function(e){if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];return delete this.cache[e],this._unlink(e,t.prev,t.next),t.value}},r.prototype._unlink=function(e,t,s){this.length--,0===this.length?this.head=this.tail=null:this.head===e?(this.head=t,this.cache[this.head].next=null):this.tail===e?(this.tail=s,this.cache[this.tail].prev=null):(this.cache[t].next=s,this.cache[s].prev=t)},r.prototype.peek=function(e){if(this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return t.value}},r.prototype.set=function(e,t){var s;if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){if((s=this.cache[e]).value=t,this.maxAge&&(s.modified=Date.now()),e===this.head)return t;this._unlink(e,s.prev,s.next)}else s={value:t,modified:0,next:null,prev:null},this.maxAge&&(s.modified=Date.now()),this.cache[e]=s,this.length===this.max&&this.evict();return this.length++,s.next=null,s.prev=this.head,this.head&&(this.cache[this.head].next=e),this.head=e,this.tail||(this.tail=e),t},r.prototype._checkAge=function(e,t){return!(this.maxAge&&Date.now()-t.modified>this.maxAge)||(this.remove(e),this.emit("evict",{key:e,value:t.value}),!1)},r.prototype.get=function(e){if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return this.head!==e&&(e===this.tail?(this.tail=t.next,this.cache[this.tail].prev=null):this.cache[t.prev].next=t.next,this.cache[t.next].prev=t.prev,this.cache[this.head].next=e,t.prev=this.head,t.next=null,this.head=e),t.value}},r.prototype.evict=function(){if(this.tail){var e=this.tail,t=this.remove(this.tail);this.emit("evict",{key:e,value:t})}}},8499:(e,t,s)=>{const{TokenBucket:i}=s(9439),n=s(8765);e.exports=class{constructor(e={}){if("object"!=typeof e)throw new Error("Options must be an object");this.throttles=[],this.setEnabled(e.enabled),this.setRate(e.rate,e.chunksize)}getEnabled(){return this._enabled}getRate(){return this.bucket.tokensPerInterval}getChunksize(){return this.chunksize}setEnabled(e=!0){if("boolean"!=typeof e)throw new Error("Enabled must be a boolean");this._enabled=e;for(const t of this.throttles)t.setEnabled(e)}setRate(e,t=null){if(!Number.isInteger(e)||e<0)throw new Error("Rate must be an integer bigger than zero");if(e=parseInt(e),t&&("number"!=typeof t||t<=0))throw new Error("Chunksize must be bigger than zero");if(t=t||Math.max(parseInt(e/10),1),t=parseInt(t),e>0&&t>e)throw new Error("Chunk size must be smaller than rate");this.bucket||(this.bucket=new i(e,e,"second",null)),this.bucket.bucketSize=e,this.bucket.tokensPerInterval=e,this.chunksize=t}setChunksize(e){if(!Number.isInteger(e)||e<=0)throw new Error("Chunk size must be an integer bigger than zero");const t=this.getRate();if(e=parseInt(e),t>0&&e>t)throw new Error("Chunk size must be smaller than rate");this.chunksize=e}throttle(e={}){if("object"!=typeof e)throw new Error("Options must be an object");return new n({...e,group:this})}destroy(){for(const e of this.throttles)e.destroy();this.throttles=[]}_addThrottle(e){if(!(e instanceof n))throw new Error("Throttle must be an instance of Throttle");this.throttles.push(e)}_removeThrottle(e){const t=this.throttles.indexOf(e);t>-1&&this.throttles.splice(t,1)}}},8673:e=>{function t(){this._types=Object.create(null),this._extensions=Object.create(null);for(let e=0;e{function t(e){return parseInt(e,10)===e}function s(e){function s(t){if(void 0===t){t=new Array(e);for(var s=0;s{const{EventEmitter:i}=s(7007),{Transform:n}=s(8179),{wait:r}=s(2072);e.exports=class extends n{constructor(e={}){if(super(),"object"!=typeof e)throw new Error("Options must be an object");const t=Object.assign({},e);if(t.group&&!(t.group instanceof o))throw new Error("Group must be an instanece of ThrottleGroup");t.group||(t.group=new o(t)),this._setEnabled(t.enabled||t.group.enabled),this._group=t.group,this._emitter=new i,this._destroyed=!1,this._group._addThrottle(this)}getEnabled(){return this._enabled}getGroup(){return this._group}_setEnabled(e=!0){if("boolean"!=typeof e)throw new Error("Enabled must be a boolean");this._enabled=e}setEnabled(e){this._setEnabled(e),this._enabled?this._emitter.emit("enabled"):this._emitter.emit("disabled")}_transform(e,t){this._processChunk(e,t)}async _waitForTokens(e){return new Promise(((t,s)=>{let i=!1;const n=this;function r(e){if(n._emitter.removeListener("disabled",r),n._emitter.removeListener("destroyed",r),!i){if(i=!0,e)return s(e);t()}}this._emitter.once("disabled",r),this._emitter.once("destroyed",r),this._group.bucket.removeTokens(e,r)}))}_areBothEnabled(){return this._enabled&&this._group.getEnabled()}async _processChunk(e,t){if(!this._areBothEnabled())return t(null,e);let s=0,i=this._group.getChunksize(),n=e.slice(s,s+i);for(;n.length>0;){if(this._areBothEnabled())try{for(;0===this._group.getRate()&&!this._destroyed&&this._areBothEnabled();)if(await r(1e3),this._destroyed)return;if(this._areBothEnabled()&&!this._group.bucket.tryRemoveTokens(n.length)&&(await this._waitForTokens(n.length),this._destroyed))return}catch(e){return t(e)}this.push(n),s+=i,i=this._areBothEnabled()?this._group.getChunksize():e.length-s,n=e.slice(s,s+i)}return t()}destroy(...e){this._group._removeThrottle(this),this._destroyed=!0,this._emitter.emit("destroyed"),super.destroy(...e)}};const o=s(8499)},8878:()=>{},9439:(e,t,s)=>{t.RateLimiter=s(3065),t.TokenBucket=s(5472)},9596:e=>{let t;e.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:globalThis):e=>(t||(t=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))},9639:(e,t,s)=>{s.d(t,{NJ:()=>g,V5:()=>o,dU:()=>f,HB:()=>y,xW:()=>h,LC:()=>l,tW:()=>S,fk:()=>a,Ht:()=>w,po:()=>E,L0:()=>_});const i="0123456789abcdef",n=[],r=[];for(let e=0;e<256;e++)n[e]=i[e>>4&15]+i[15&e],e<16&&(e<10?r[48+e]=e:r[87+e]=e);const o=e=>{const t=e.length;let s="",i=0;for(;i{const t=e.length>>1,s=t<<1,i=new Uint8Array(t);let n=0,o=0;for(;o{const s=e.length||0;if(!t){let i=s;for(;i--;)t+=e[i].length}const i=new Uint8Array(t);let n=t,r=s;for(;r--;)n-=e[r].length,i.set(e[r],n);return i},l=(e,t)=>{if(e.length!==t.length)return!1;for(let s=e.length;s>-1;s-=1)if(e[s]!==t[s])return!1;return!0};for(var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="undefined"==typeof Uint8Array?[]:new Uint8Array(256),u=0;u<64;u++)d[c.charCodeAt(u)]=u;const p=new TextDecoder,f=(e,t)=>{if(!t)return p.decode(e);return new TextDecoder(t).decode(e)},m=new TextEncoder,_=e=>m.encode(e),g=e=>function(e){var t,s=new Uint8Array(e),i=s.length,n="";for(t=0;t>2],n+=c[(3&s[t])<<4|s[t+1]>>4],n+=c[(15&s[t+1])<<2|s[t+2]>>6],n+=c[63&s[t+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(e),y=e=>{let t,s="",n=0;const r=e.length;for(;n>4]+i[15&t];return s},w=e=>{const t=a(e);if(t.length<=65536)return String.fromCharCode(...t);let s="",i=0;for(;i{if(!k)throw new Error("no web crypto support");"string"==typeof e&&(e=_(e));const i=new Uint8Array(await k.digest(s,e));return t?x[t](i):i},E=e=>{const t=new Uint8Array(e);return v.getRandomValues(t)}}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return s[e](r,r.exports,n),r.exports}t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,n.t=function(s,i){if(1&i&&(s=this(s)),8&i)return s;if("object"==typeof s&&s){if(4&i&&s.__esModule)return s;if(16&i&&"function"==typeof s.then)return s}var r=Object.create(null);n.r(r);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&s;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>o[e]=()=>s[e]));return o.default=()=>s,n.d(r,o),r},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r=n(7007);function o(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function a(e,t){let s,i="",n=0,r=-1,o=0;for(let a=0;a<=e.length;++a){if(a2){const e=i.lastIndexOf("/");if(e!==i.length-1){-1===e?(i="",n=0):(i=i.slice(0,e),n=i.length-1-i.lastIndexOf("/")),r=a,o=0;continue}}else if(2===i.length||1===i.length){i="",n=0,r=a,o=0;continue}t&&(i.length>0?i+="/..":i="..",n=2)}else i.length>0?i+="/"+e.slice(r+1,a):i=e.slice(r+1,a),n=a-r-1;r=a,o=0}else 46===s&&-1!==o?++o:o=-1}return i}function h(){if(0===arguments.length)return".";let e;for(let t=0;t0&&(void 0===e?e=s:e+="/"+s)}return void 0===e?".":function(e){if(o(e),0===e.length)return".";const t=47===e.charCodeAt(0),s=47===e.charCodeAt(e.length-1);return 0!==(e=a(e,!t)).length||t||(e="."),e.length>0&&s&&(e+="/"),t?"/"+e:e}(e)}n(717);const l="/";var c=n(988),d=n(1467),u=n(8444),p=n(2123);const f=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("|"));function m(e){return f.test(e)}var _=n(405),g=n(8190),y=n(9596),w=n(9639),b=(n(3468),n(2532));const v=[["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"]];const k=Symbol("itemPath");function x(e,t,s){var i;if(i=e,"undefined"!=typeof FileList&&i instanceof FileList&&(e=Array.from(e)),Array.isArray(e)||(e=[e]),0===e.length)throw new Error("invalid input type");e.forEach((e=>{if(null==e)throw new Error(`invalid input type: ${e}`)})),1!==(e=e.map((e=>C(e)&&"string"==typeof e.path&&"function"==typeof b?e.path:e))).length||"string"==typeof e[0]||e[0].name||(e[0].name=t.name);let n=null;e.forEach(((t,s)=>{if("string"==typeof t)return;let i=t.fullPath||t.name;i||(i=`Unknown File ${s+1}`,t.unknownName=!0),t[k]=i.split("/"),t[k][0]||t[k].shift(),t[k].length<2?n=null:0===s&&e.length>1?n=t[k][0]:t[k][0]!==n&&(n=null)}));(void 0===t.filterJunkFiles||t.filterJunkFiles)&&(e=e.filter((e=>"string"==typeof e||!function(e){const t=e[e.length-1];return"."===t[0]&&m(t)}(e[k])))),n&&e.forEach((e=>{const t=(ArrayBuffer.isView(e)||P(e))&&!e[k];"string"==typeof e||t||e[k].shift()})),!t.name&&n&&(t.name=n),t.name||e.some((e=>"string"==typeof e?(t.name=function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');o(e);let s,i=0,n=-1,r=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let o=t.length-1,a=-1;for(s=e.length-1;s>=0;--s){const h=e.charCodeAt(s);if(47===h){if(!r){i=s+1;break}}else-1===a&&(r=!1,a=s+1),o>=0&&(h===t.charCodeAt(o)?-1==--o&&(n=s):(o=-1,n=a))}return i===n?n=a:-1===n&&(n=e.length),e.slice(i,n)}for(s=e.length-1;s>=0;--s)if(47===e.charCodeAt(s)){if(!r){i=s+1;break}}else-1===n&&(r=!1,n=s+1);return-1===n?"":e.slice(i,n)}(e),!0):!e.unknownName&&(t.name=e[k][e[k].length-1],!0))),t.name||(t.name=`Unnamed Torrent ${Date.now()}`),t.maxPieceLength||(t.maxPieceLength=4194304);const r=e.reduce(((e,t)=>e+Number("string"==typeof t)),0);let a=1===e.length;if(1===e.length&&"string"==typeof e[0]){if("function"!=typeof b)throw new Error("filesystem paths do not work in the browser");p(e[0],((e,t)=>{if(e)return s(e);a=t,h()}))}else y(h);function h(){g(e.map((e=>t=>{const s={};if(C(e))s.getStream=e.stream(),s.length=e.size;else if(ArrayBuffer.isView(e))s.getStream=[e],s.length=e.length;else{if(!P(e)){if("string"==typeof e){if("function"!=typeof b)throw new Error("filesystem paths do not work in the browser");return void b(e,r>1||a,t)}throw new Error("invalid input type")}s.getStream=async function*(e,t){for await(const s of e)t.length+=s.length,yield s}(e,s),s.length=0}s.path=e[k],t(null,s)})),((e,t)=>{if(e)return s(e);t=t.flat(),s(null,t,a)}))}}const S=5;function E(e,t){return e+t.length}function C(e){return"undefined"!=typeof Blob&&e instanceof Blob}function P(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}const T=function(e,t,s){"function"==typeof t&&([t,s]=[s,t]),x(e,t=t?Object.assign({},t):{},((e,i,n)=>{if(e)return s(e);t.singleFileTorrent=n,function(e,t,s){let i=t.announceList;i||("string"==typeof t.announce?i=[[t.announce]]:Array.isArray(t.announce)&&(i=t.announce.map((e=>[e]))));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((e=>[e])))));void 0===t.announce&&void 0===t.announceList&&(i=i.concat(v));"string"==typeof t.urlList&&(t.urlList=[t.urlList]);const n={info:{name:t.name},"creation date":Math.ceil((Number(t.creationDate)||Date.now())/1e3),encoding:"UTF-8"};0!==i.length&&(n.announce=i[0][0],n["announce-list"]=i);void 0!==t.comment&&(n.comment=t.comment);void 0!==t.createdBy&&(n["created by"]=t.createdBy);void 0!==t.private&&(n.info.private=Number(t.private));void 0!==t.info&&Object.assign(n.info,t.info);void 0!==t.sslCert&&(n.info["ssl-cert"]=t.sslCert);void 0!==t.urlList&&(n["url-list"]=t.urlList);const r=e.reduce(E,0),o=t.pieceLength||Math.min(u(r),t.maxPieceLength);n.info["piece length"]=o,async function(e,t,s,i,n){const r=[];let o=0,a=0;const h=e.map((e=>e.getStream)),l=i.onProgress;let c=0,u=0,p=!1;const f=d(_(h),t,{zeroPadding:!1});try{for await(const e of f)await new Promise((t=>{o+=e.length;const i=u;++u,++c{r[i]=h,--c,a+=e.length,l&&l(a,s),t(),p&&0===c&&n(null,(0,w.fk)(r.join("")),o)}))}));if(0===c)return n(null,(0,w.fk)(r.join("")),o);p=!0}catch(e){n(e)}}(e,o,r,t,((i,r,o)=>{if(i)return s(i);n.info.pieces=r,e.forEach((e=>{delete e.getStream})),t.singleFileTorrent?n.info.length=o:n.info.files=e,s(null,c.A.encode(n))}))}(i,t,s)}))};var A=n(7833),I=n(6664),L=n(1827),O=n(3208);self.Blob,self.File,self.FormData,self.Headers,self.Request,self.Response,self.AbortController,self.AbortSignal;const R=self.fetch||(()=>{throw new Error("global fetch is not available!")}),H=[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 N=function(e){if(!ArrayBuffer.isView(e)&&"string"!=typeof e)throw new TypeError("base32.decode only takes Buffer or string as parameter");let t,s=0,i=0,n=0;ArrayBuffer.isView(e)||(e=(0,w.L0)(e));const r=new Uint8Array(Math.ceil(5*e.length/8));for(let o=0;o>>s,r[n]=t,n++,t=255&i<<8-s)}return r.subarray(0,n)};function U(e){return e.reduce(((e,t,s,i)=>{const n=t.split("-").map((e=>parseInt(e)));return e.concat(((e,t=e)=>Array.from({length:t-e+1},((t,s)=>s+e)))(...n))}),[])}const M=function(e){const t={},s=e.split("magnet:?")[1];let i;if((s&&s.length>=0?s.split("&"):[]).forEach((e=>{const s=e.split("=");if(2!==s.length)return;const i=s[0];let n=s[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=U(decodeURIComponent(n).split(","))),t[i]?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(n)):t[i]=n})),t.xt){(Array.isArray(t.xt)?t.xt:[t.xt]).forEach((e=>{(i=e.match(/^urn:btih:(.{40})/))?t.infoHash=i[1].toLowerCase():(i=e.match(/^urn:btih:(.{32})/))?t.infoHash=(0,w.V5)(N(i[1])):(i=e.match(/^urn:btmh:1220(.{64})/))&&(t.infoHashV2=i[1].toLowerCase())}))}if(t.xs){(Array.isArray(t.xs)?t.xs:[t.xs]).forEach((e=>{(i=e.match(/^urn:btpk:(.{64})/))&&(t.publicKey=i[1].toLowerCase())}))}return t.infoHash&&(t.infoHashBuffer=(0,w.fk)(t.infoHash)),t.infoHashV2&&(t.infoHashV2Buffer=(0,w.fk)(t.infoHashV2)),t.publicKey&&(t.publicKeyBuffer=(0,w.fk)(t.publicKey)),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce=[],("string"==typeof t.tr||Array.isArray(t.tr))&&(t.announce=t.announce.concat(t.tr)),t.urlList=[],("string"==typeof t.as||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),("string"==typeof t.ws||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),t.peerAddresses=[],("string"==typeof t["x.pe"]||Array.isArray(t["x.pe"]))&&(t.peerAddresses=t.peerAddresses.concat(t["x.pe"])),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),t.peerAddresses=Array.from(new Set(t.peerAddresses)),t};async function F(e){if("string"==typeof e&&/^(stream-)?magnet:/.test(e)){const t=M(e);if(!t.infoHash)throw new Error("Invalid torrent identifier");return t}if("string"==typeof e&&(/^[a-f0-9]{40}$/i.test(e)||/^[a-z2-7]{32}$/i.test(e)))return M(`magnet:?xt=urn:btih:${e}`);if(ArrayBuffer.isView(e)&&20===e.length)return M(`magnet:?xt=urn:btih:${(0,w.V5)(e)}`);if(ArrayBuffer.isView(e))return await async function(e){ArrayBuffer.isView(e)&&(e=c.A.decode(e));D(e.info,"info"),D(e.info["name.utf-8"]||e.info.name,"info.name"),D(e.info["piece length"],"info['piece length']"),D(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach((e=>{D("number"==typeof e.length,"info.files[0].length"),D(e["path.utf-8"]||e.path,"info.files[0].path")})):D("number"==typeof e.info.length,"info.length");const t={info:e.info,infoBuffer:c.A.encode(e.info),name:(0,w.dU)(e.info["name.utf-8"]||e.info.name),announce:[]};t.infoHashBuffer=await(0,w.tW)(t.infoBuffer),t.infoHash=(0,w.V5)(t.infoHashBuffer),void 0!==e.info.private&&(t.private=!!e.info.private);e["creation date"]&&(t.created=new Date(1e3*e["creation date"]));e["created by"]&&(t.createdBy=(0,w.dU)(e["created by"]));ArrayBuffer.isView(e.comment)&&(t.comment=(0,w.dU)(e.comment));Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach((e=>{e.forEach((e=>{t.announce.push((0,w.dU)(e))}))})):e.announce&&t.announce.push((0,w.dU)(e.announce));ArrayBuffer.isView(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]);t.urlList=(e["url-list"]||[]).map((e=>(0,w.dU)(e))),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList));const s=e.info.files||[e.info];t.files=s.map(((e,i)=>{const n=[].concat(t.name,e["path.utf-8"]||e.path||[]).map((e=>ArrayBuffer.isView(e)?(0,w.dU)(e):e));return{path:h.apply(null,[l].concat(n)).slice(1),name:n[n.length-1],length:e.length,offset:s.slice(0,i).reduce(B,0)}})),t.length=s.reduce(B,0);const i=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(i.offset+i.length)%t.pieceLength||t.pieceLength,t.pieces=function(e){const t=[];for(let s=0;s{s(null,i)}));else if(n=e,"undefined"!=typeof Blob&&n instanceof Blob)try{r(new Uint8Array(await e.arrayBuffer()))}catch(e){return s(new Error(`Error converting Blob: ${e.message}`))}else if(/^https?:/.test(e))try{const s=await R(e,{headers:{"user-agent":"WebTorrent (https://webtorrent.io)"},signal:AbortSignal.timeout(3e4),...t});r(new Uint8Array(await s.arrayBuffer()))}catch(e){return s(new Error(`Error downloading torrent: ${e.message}`))}else"function"==typeof O.readFile&&"string"==typeof e?O.readFile(e,((e,t)=>{if(e)return s(new Error("Invalid torrent identifier"));r(t)})):y((()=>{s(new Error("Invalid torrent identifier"))}));var n;async function r(e){try{i=await F(e)}catch(e){return s(e)}i&&i.infoHash?s(null,i):s(new Error("Invalid torrent identifier"))}}function B(e,t){return e+t.length}function D(e,t){if(!e)throw new Error(`Torrent is missing required field: ${t}`)}const q=F,W=function(e){e=Object.assign({},e);let t=new Set;e.xt&&"string"==typeof e.xt&&t.add(e.xt),e.xt&&Array.isArray(e.xt)&&(t=new Set(e.xt)),e.infoHashBuffer&&t.add(`urn:btih:${(0,w.V5)(e.infoHashBuffer)}`),e.infoHash&&t.add(`urn:btih:${e.infoHash}`),e.infoHashV2Buffer&&t.add(e.xt=`urn:btmh:1220${(0,w.V5)(e.infoHashV2Buffer)}`),e.infoHashV2&&t.add(`urn:btmh:1220${e.infoHashV2}`);const s=Array.from(t);1===s.length&&(e.xt=s[0]),s.length>1&&(e.xt=s),e.publicKeyBuffer&&(e.xs=`urn:btpk:${(0,w.V5)(e.publicKeyBuffer)}`),e.publicKey&&(e.xs=`urn:btpk:${e.publicKey}`),e.name&&(e.dn=e.name),e.keywords&&(e.kt=e.keywords),e.announce&&(e.tr=e.announce),e.urlList&&(e.ws=e.urlList,delete e.as),e.peerAddresses&&(e["x.pe"]=e.peerAddresses);let i="magnet:?";return Object.keys(e).filter((e=>2===e.length||"x.pe"===e)).forEach(((t,s)=>{const n=Array.isArray(e[t])?e[t]:[e[t]];var r;n.forEach(((e,n)=>{(s>0||n>0)&&("kt"!==t&&"so"!==t||0===n)&&(i+="&"),"dn"===t&&(e=encodeURIComponent(e).replace(/%20/g,"+")),"tr"!==t&&"as"!==t&&"ws"!==t||(e=encodeURIComponent(e)),"xs"!==t||e.startsWith("urn:btpk:")||(e=encodeURIComponent(e)),"kt"===t&&(e=encodeURIComponent(e)),"so"!==t&&(i+="kt"===t&&n>0?`+${e}`:`${t}=${e}`)})),"so"===t&&(i+=`${t}=${r=n,r.reduce(((e,t,s,i)=>(0!==s&&t===i[s-1]+1||e.push([]),e[e.length-1].push(t),e)),[]).map((e=>e.length>1?`${e[0]}-${e[e.length-1]}`:`${e[0]}`))}`)})),i},$="undefined"!=typeof window?window:self,z=$.RTCPeerConnection||$.mozRTCPeerConnection||$.webkitRTCPeerConnection,V=$.RTCSessionDescription||$.mozRTCSessionDescription||$.webkitRTCSessionDescription,G=$.RTCIceCandidate||$.mozRTCIceCandidate||$.webkitRTCIceCandidate;$.RTCIceTransport,$.RTCDataChannel,$.RTCSctpTransport,$.RTCDtlsTransport,$.RTCCertificate,$.MediaStream,$.MediaStreamTrack,$.MediaStreamTrackEvent,$.RTCPeerConnectionIceEvent,$.RTCDataChannelEvent,$.RTCTrackEvent,$.RTCError,$.RTCErrorEvent,$.RTCRtpTransceiver,$.RTCRtpReceiver,$.RTCRtpSender;var K=n(8179),Y=n(6310);const J=A("simple-peer"),X=65536;function Q(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}class Z extends K.Duplex{_pc;constructor(e){if(super(e=Object.assign({allowHalfOpen:!1},e)),this.__objectMode=!!e.objectMode,this._id=(0,w.V5)((0,w.po)(4)).slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||(0,w.V5)((0,w.po)(20)):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||Z.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},Z.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.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,!z)throw"undefined"==typeof window?Y(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):Y(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 z(this.config)}catch(e){return void this.__destroy(Y(e,"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=e=>{this._onIceCandidate(e)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch((e=>{this.__destroy(Y(e,"ERR_PC_PEER_IDENTITY"))})),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},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(e){if(!this._destroying){if(this.destroyed)throw Y(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new V(e)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((e=>{this._addIceCandidate(e)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((e=>{this.__destroy(Y(e,"ERR_SET_REMOTE_DESCRIPTION"))})),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.__destroy(Y(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(e){const t=new G(e);this._pc.addIceCandidate(t).catch((e=>{var s;!t.address||t.address.endsWith(".local")?(s="Ignoring unsupported ICE candidate.",console.warn(s)):this.__destroy(Y(e,"ERR_ADD_ICE_CANDIDATE"))}))}send(e){if(!this._destroying){if(this.destroyed)throw Y(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(e)}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,queueMicrotask((()=>{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 Y(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(e){this._readableState.ended||this.push(null),e(null)}__destroy(e){this.end(),this._destroy((()=>{}),e)}_destroy(e,t){this.destroyed||this._destroying||(this._destroying=!0,this._debug("destroying (error: %s)",t&&(t.message||t)),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(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}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,t&&this.emit("error",t),e()}),0))}_setupData(e){if(!e.channel)return this.__destroy(Y(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=X),this.channelName=this._channel.label,this._channel.onmessage=e=>{this._onChannelMessage(e)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=e=>{const t=e.error instanceof Error?e.error:new Error(`Datachannel error: ${e.message} ${e.filename}:${e.lineno}:${e.colno}`);this.__destroy(Y(t,"ERR_DATA_CHANNEL"))};let t=!1;this._closingInterval=setInterval((()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1}),5e3)}_write(e,t){if(this.destroyed)return t(Y(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(e){return this.__destroy(Y(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>X?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=t):t(null)}else this._debug("write before connect"),this._chunk=e,this._cb=t}_onFinish(){if(this.destroyed)return;const e=()=>{setTimeout((()=>this.__destroy()),1e3)};this._connected?e():this.once("connect",e)}_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((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=Q(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(this.destroyed)return;const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})};this._pc.setLocalDescription(e).then((()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.__destroy(Y(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.__destroy(Y(e,"ERR_CREATE_OFFER"))}))}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=Q(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(this.destroyed)return;const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers?.()};this._pc.setLocalDescription(e).then((()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.__destroy(Y(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.__destroy(Y(e,"ERR_CREATE_ANSWER"))}))}_onConnectionStateChange(){this.destroyed||this._destroying||"failed"===this._pc.connectionState&&this.__destroy(Y(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.__destroy(Y(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.__destroy(Y(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(e){const t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach((t=>{Object.assign(e,t)})),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then((s=>{const i=[];s.forEach((e=>{i.push(t(e))})),e(null,i)}),(t=>e(t))):this._pc.getStats.length>0?this._pc.getStats((s=>{if(this.destroyed)return;const i=[];s.result().forEach((e=>{const s={};e.names().forEach((t=>{s[t]=e.stat(t)})),s.id=e.id,s.type=e.type,s.timestamp=e.timestamp,i.push(t(s))})),e(null,i)}),(t=>e(t))):e(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 e=()=>{this.destroyed||this._destroying||this.getStats(((t,s)=>{if(this.destroyed||this._destroying)return;t&&(s=[]);const i={},n={},r={};let o=!1;s.forEach((e=>{"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(n[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(r[e.id]=e)}));const a=e=>{o=!0;let t=n[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):"string"==typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let s=i[e.remoteCandidateId];s&&(s.ip||s.address)?(this.remoteAddress=s.ip||s.address,this.remotePort=Number(s.port)):s&&s.ipAddress?(this.remoteAddress=s.ipAddress,this.remotePort=Number(s.portNumber)):"string"==typeof e.googRemoteAddress&&(s=e.googRemoteAddress.split(":"),this.remoteAddress=s[0],this.remotePort=Number(s[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(s.forEach((e=>{"transport"===e.type&&e.selectedCandidatePairId&&a(r[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&a(e)})),o||Object.keys(r).length&&!Object.keys(n).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.__destroy(Y(t,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(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(e,100)}))};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>X||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach((e=>{this._pc.removeTrack(e),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(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer?t=new Uint8Array(t):!1===this.__objectMode&&(t=(0,w.L0)(t)),this.push(t)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const e=this._cb;this._cb=null,e(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 e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],J.apply(null,e)}}Z.WEBRTC_SUPPORT=!!z,Z.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},Z.channelConfig={};const ee=Z;var te=n(1035),se=n(7541),ie=n(3278),ne=n(8271),re=n(6686),oe=n(7828),ae=n(6889);const he=/^\[?([^\]]+)]?:(\d+)$/;let le=new Map;function ce(e){if(1e5===le.size&&le.clear(),!le.has(e)){const t=he.exec(e);if(!t)throw new Error(`invalid addr: ${e}`);le.set(e,[t[1],Number(t[2])])}return le.get(e)}var de=n(3033),ue=n(4497);async function*pe(e,t={}){if(e?.[Symbol.asyncIterator])return void(yield*e[Symbol.asyncIterator](t.offset));if(!e?.get)throw new Error("First argument must be an abstract-chunk-store compliant store");const s=t.chunkLength||e.chunkLength;if(!s)throw new Error("missing required `chunkLength` property");let i=t.length||e.length;if(!Number.isFinite(i))throw new Error("missing required `length` property");const n=t.offset||0,r=(t,s,i)=>new Promise(((n,r)=>{e.get(t,{offset:i,length:s},((e,t)=>{e&&r(e),n(t)}))}));let o=Math.floor(n/s);const a=n%s;if(n){const e=Math.min(i,s-a);i-=e,yield r(o++,e,a)}for(let e=i;e>0;++o,e-=s)yield r(o,Math.min(e,s))}async function fe(e,t,s={}){if(!e?.put)throw new Error("First argument must be an abstract-chunk-store compliant store");const i=s.chunkLength||e.chunkLength;if(!i)throw new Error("missing required `chunkLength` property");const n=s.storeMaxOutstandingPuts||16;let r=0,o=0,a=()=>{},h=!1;for await(const l of d(t,i,{zeroPadding:s.zeroPadding||!1}))await new Promise(((t,s)=>{r++<=n&&t(),e.put(o++,l,(e=>{if(e)return s(e);--r,t(),h&&0===r&&a()}))}));0!==r&&(h=new Promise((e=>{a=e})),await h)}var me=n(4018),_e=n(3970),ge=n(3519),ye=n(1551);const we={DEFAULT_ANNOUNCE_PEERS:50,MAX_ANNOUNCE_PEERS:82,parseUrl:e=>{const t=new URL(e.replace(/^udp:/,"http:"));return e.match(/^udp:/)&&Object.defineProperties(t,{href:{value:t.href.replace(/^http/,"udp")},protocol:{value:t.protocol.replace(/^http/,"udp")},origin:{value:t.origin.replace(/^http/,"udp")}}),t},...n.t(ye,2)};var be=n(826),ve=n(61),ke=n(2701);const xe=A("simple-websocket"),Se="function"!=typeof ke?WebSocket:ke;class Ee extends K.Duplex{constructor(e={}){if("string"==typeof e&&(e={url:e}),super(e=Object.assign({allowHalfOpen:!1},e)),this.__objectMode=!!e.objectMode,null!=e.objectMode&&delete e.objectMode,null==e.url&&null==e.socket)throw new Error("Missing required `url` or `socket` option");if(null!=e.url&&null!=e.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(this._id=(0,w.V5)((0,w.po)(4)).slice(0,7),this._debug("new websocket: %o",e),this.connected=!1,this._chunk=null,this._cb=null,this._interval=null,e.socket)this.url=e.socket.url,this._ws=e.socket,this.connected=e.socket.readyState===Se.OPEN;else{this.url=e.url;try{this._ws="function"==typeof ke?new Se(e.url,{...e,encoding:void 0}):new Se(e.url)}catch(e){return void y((()=>this.destroy(e)))}}this._ws.binaryType="arraybuffer",e.socket&&this.connected?y((()=>this._handleOpen())):this._ws.onopen=()=>this._handleOpen(),this._ws.onmessage=e=>this._handleMessage(e),this._ws.onclose=()=>this._handleClose(),this._ws.onerror=e=>this._handleError(e),this._handleFinishBound=()=>this._handleFinish(),this.once("finish",this._handleFinishBound)}send(e){this._ws.send(e)}_final(e){this._readableState.ended||this.push(null),e(null)}_destroy(e){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,t=()=>{e.onclose=null};if(e.readyState===Se.CLOSED)t();else try{e.onclose=t,e.close()}catch(e){t()}e.onopen=null,e.onmessage=null,e.onerror=()=>{}}this._ws=null,e()}}_write(e,t){if(this.destroyed)return t(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof ke&&this._ws.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=t):t(null)}else this._debug("write before connect"),this._chunk=e,this._cb=t}_handleOpen(){if(!this.connected&&!this.destroyed){if(this.connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(e)}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(null)}"function"!=typeof ke&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}}_handleMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=new Uint8Array(t)),!1===this.__objectMode&&(t=(0,w.L0)(t)),this.push(t)}_handleClose(){this.destroyed||(this._debug("on close"),this.destroy())}_handleError(e){this.destroy(new Error(`Error connecting to ${this.url}`))}_handleFinish(){if(this.destroyed)return;const e=()=>{setTimeout((()=>this.destroy()),1e3)};this.connected?e():this.once("connect",e)}_onInterval(){if(!this._cb||!this._ws||this._ws.bufferedAmount>65536)return;this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);const e=this._cb;this._cb=null,e(null)}_debug(){const e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],xe.apply(null,e)}}Ee.WEBSOCKET_SUPPORT=!!Se;const Ce=class extends r{constructor(e,t){super(),this.client=e,this.announceUrl=t,this.interval=null,this.destroyed=!1}setInterval(e){null==e&&(e=this.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(this.interval),e&&(this.interval=setInterval((()=>{this.announce(this.client._defaultAnnounceOpts())}),e),this.interval.unref&&this.interval.unref())}},Pe=A("bittorrent-tracker:websocket-tracker"),Te={};class Ae extends Ce{constructor(e,t){super(e,t),Pe("new websocket tracker %s",t),this.peers={},this.socket=null,this.reconnecting=!1,this.retries=0,this.reconnectTimer=null,this.expectingResponse=!1,this._openSocket()}announce(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.announce(e)}));const t=Object.assign({},e,{action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(t.trackerid=this._trackerId),"stopped"===e.event||"completed"===e.event)this._send(t);else{const s=Math.min(e.numwant,5);this._generateOffers(s,(e=>{t.numwant=s,t.offers=e,this._send(t)}))}}scrape(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.scrape(e)}));const t={action:"scrape",info_hash:Array.isArray(e.infoHash)&&e.infoHash.length>0?e.infoHash.map((e=>(0,w.Ht)(e))):e.infoHash&&(0,w.Ht)(e.infoHash)||this.client._infoHashBinary};this._send(t)}destroy(e=Ie){if(this.destroyed)return e(null);this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer);for(const e in this.peers){const t=this.peers[e];clearTimeout(t.trackerTimeout),t.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,Te[this.announceUrl]&&(Te[this.announceUrl].consumers-=1),Te[this.announceUrl].consumers>0)return e();let t,s=Te[this.announceUrl];if(delete Te[this.announceUrl],s.on("error",Ie),s.once("close",e),!this.expectingResponse)return i();function i(){t&&(clearTimeout(t),t=null),s.removeListener("data",i),s.destroy(),s=null}t=setTimeout(i,we.DESTROY_TIMEOUT),s.once("data",i)}_openSocket(){if(this.destroyed=!1,this.peers||(this.peers={}),this._onSocketConnectBound=()=>{this._onSocketConnect()},this._onSocketErrorBound=e=>{this._onSocketError(e)},this._onSocketDataBound=e=>{this._onSocketData(e)},this._onSocketCloseBound=()=>{this._onSocketClose()},this.socket=Te[this.announceUrl],this.socket)Te[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound();else{const e=new URL(this.announceUrl);let t;this.client._proxyOpts&&(t="wss:"===e.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!t&&this.client._proxyOpts.socksProxy&&(t=this.client._proxyOpts.socksProxy)),this.socket=Te[this.announceUrl]=new Ee({url:this.announceUrl,agent:t}),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(e){if(!this.destroyed){this.expectingResponse=!1;try{e=JSON.parse((0,w.dU)(e))}catch(e){return void this.client.emit("warning",new Error("Invalid tracker response"))}"announce"===e.action?this._onAnnounceResponse(e):"scrape"===e.action?this._onScrapeResponse(e):this._onSocketError(new Error(`invalid action in WS response: ${e.action}`))}}_onAnnounceResponse(e){if(e.info_hash!==this.client._infoHashBinary)return void Pe("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,(0,w.HB)(e.info_hash),this.client.infoHash);if(e.peer_id&&e.peer_id===this.client._peerIdBinary)return;Pe("received %s from %s for %s",JSON.stringify(e),this.announceUrl,this.client.infoHash);const t=e["failure reason"];if(t)return this.client.emit("warning",new Error(t));const s=e["warning message"];s&&this.client.emit("warning",new Error(s));const i=e.interval||e["min interval"];i&&this.setInterval(1e3*i);const n=e["tracker id"];if(n&&(this._trackerId=n),null!=e.complete){const t=Object.assign({},e,{announce:this.announceUrl,infoHash:(0,w.HB)(e.info_hash)});this.client.emit("update",t)}let r;if(e.offer&&e.peer_id&&(Pe("creating peer (from remote offer)"),r=this._createPeer(),r.id=(0,w.HB)(e.peer_id),r.once("signal",(t=>{const s={action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,to_peer_id:e.peer_id,answer:t,offer_id:e.offer_id};this._trackerId&&(s.trackerid=this._trackerId),this._send(s)})),this.client.emit("peer",r),r.signal(e.offer)),e.answer&&e.peer_id){const t=(0,w.HB)(e.offer_id);r=this.peers[t],r?(r.id=(0,w.HB)(e.peer_id),this.client.emit("peer",r),r.signal(e.answer),clearTimeout(r.trackerTimeout),r.trackerTimeout=null,delete this.peers[t]):Pe(`got unexpected answer: ${JSON.stringify(e.answer)}`)}}_onScrapeResponse(e){e=e.files||{};const t=Object.keys(e);0!==t.length?t.forEach((t=>{const s=Object.assign(e[t],{announce:this.announceUrl,infoHash:(0,w.HB)(t)});this.client.emit("scrape",s)})):this.client.emit("warning",new Error("invalid scrape response"))}_onSocketClose(){this.destroyed||(this.destroy(),this._startReconnectTimer())}_onSocketError(e){this.destroyed||(this.destroy(),this.client.emit("warning",e),this._startReconnectTimer())}_startReconnectTimer(){const e=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()}),e),this.reconnectTimer.unref&&this.reconnectTimer.unref(),Pe("reconnecting socket in %s ms",e)}_send(e){if(this.destroyed)return;this.expectingResponse=!0;const t=JSON.stringify(e);Pe("send %s",t),this.socket.send(t)}_generateOffers(e,t){const s=this,i=[];Pe("generating %s offers",e);for(let t=0;t{i.push({offer:t,offer_id:(0,w.Ht)(e)}),r()})),t.trackerTimeout=setTimeout((()=>{Pe("tracker timeout: destroying peer"),t.trackerTimeout=null,delete s.peers[e],t.destroy()}),5e4),t.trackerTimeout.unref&&t.trackerTimeout.unref()}function r(){i.length===e&&(Pe("generated %s offers",e),t(i))}r()}_createPeer(e){const t=this;e=Object.assign({trickle:!1,config:t.client._rtcConfig,wrtc:t.client._wrtc},e);const s=new ee(e);return s.once("error",i),s.once("connect",(function e(){s.removeListener("error",i),s.removeListener("connect",e)})),s;function i(e){t.client.emit("warning",new Error(`Connection error: ${e.message}`)),s.destroy()}}}function Ie(){}Ae.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,Ae._socketPool=Te;const Le=Ae;var Oe=n(717);const Re=A("bittorrent-tracker:client");class He extends r{constructor(e={}){if(super(),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");if(!Oe.browser&&!e.port)throw new Error("Option `port` is required");this.peerId="string"==typeof e.peerId?e.peerId:(0,w.V5)(e.peerId),this._peerIdBuffer=(0,w.fk)(this.peerId),this._peerIdBinary=(0,w.Ht)(this.peerId),this.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():(0,w.V5)(e.infoHash),this._infoHashBuffer=(0,w.fk)(this.infoHash),this._infoHashBinary=(0,w.Ht)(this.infoHash),Re("new client %s",this.infoHash),this.destroyed=!1,this._port=e.port,this._getAnnounceOpts=e.getAnnounceOpts,this._rtcConfig=e.rtcConfig,this._userAgent=e.userAgent,this._proxyOpts=e.proxyOpts,this._wrtc="function"==typeof e.wrtc?e.wrtc():e.wrtc;let t="string"==typeof e.announce?[e.announce]:null==e.announce?[]:e.announce;t=t.map((e=>(ArrayBuffer.isView(e)&&(e=(0,w.dU)(e)),"/"===e[e.length-1]&&(e=e.substring(0,e.length-1)),e))),t=Array.from(new Set(t));const s=!1!==this._wrtc&&(!!this._wrtc||ee.WEBRTC_SUPPORT),i=e=>{y((()=>{this.emit("warning",e)}))};this._trackers=t.map((e=>{let t;try{t=we.parseUrl(e)}catch(t){return i(new Error(`Invalid tracker URL: ${e}`)),null}const n=t.port;if(n<0||n>65535)return i(new Error(`Invalid tracker port: ${e}`)),null;const r=t.protocol;return"http:"!==r&&"https:"!==r||"function"!=typeof be?"udp:"===r&&"function"==typeof ve?new ve(this,e):"ws:"!==r&&"wss:"!==r||!s||"ws:"===r&&"undefined"!=typeof window&&"https:"===window.location.protocol?(i(new Error(`Unsupported tracker protocol: ${e}`)),null):new Le(this,e):new be(this,e)})).filter(Boolean)}start(e){(e=this._defaultAnnounceOpts(e)).event="started",Re("send `start` %o",e),this._announce(e),this._trackers.forEach((e=>{e.setInterval()}))}stop(e){(e=this._defaultAnnounceOpts(e)).event="stopped",Re("send `stop` %o",e),this._announce(e)}complete(e){e||(e={}),(e=this._defaultAnnounceOpts(e)).event="completed",Re("send `complete` %o",e),this._announce(e)}update(e){(e=this._defaultAnnounceOpts(e)).event&&delete e.event,Re("send `update` %o",e),this._announce(e)}_announce(e){this._trackers.forEach((t=>{t.announce(e)}))}scrape(e){Re("send `scrape`"),e||(e={}),this._trackers.forEach((t=>{t.scrape(e)}))}setInterval(e){Re("setInterval %d",e),this._trackers.forEach((t=>{t.setInterval(e)}))}destroy(e){if(this.destroyed)return;this.destroyed=!0,Re("destroy");const t=this._trackers.map((e=>t=>{e.destroy(t)}));g(t,e),this._trackers=[],this._getAnnounceOpts=null}_defaultAnnounceOpts(e={}){return null==e.numwant&&(e.numwant=we.DEFAULT_ANNOUNCE_PEERS),null==e.uploaded&&(e.uploaded=0),null==e.downloaded&&(e.downloaded=0),this._getAnnounceOpts&&(e=Object.assign({},e,this._getAnnounceOpts())),e}}He.scrape=(e,t)=>{if(t=ge(t),!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");const s=Object.assign({},e,{infoHash:Array.isArray(e.infoHash)?e.infoHash[0]:e.infoHash,peerId:(0,w.L0)("01234567890123456789"),port:6881}),i=new He(s);i.once("error",t),i.once("warning",t);let n=Array.isArray(e.infoHash)?e.infoHash.length:1;const r={};return i.on("scrape",(e=>{if(n-=1,r[e.infoHash]=e,0===n){i.destroy();const e=Object.keys(r);1===e.length?t(null,r[e[0]]):t(null,r)}})),i.scrape({infoHash:e.infoHash}),i};const Ne=He;n(7936);var Ue=n(2799),Me=n(717);const Fe=A("torrent-discovery");class je extends r.EventEmitter{constructor(e){if(super(),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!Me.browser&&!e.port)throw new Error("Option `port` is required");this.peerId="string"==typeof e.peerId?e.peerId:e.peerId.toString("hex"),this.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():e.infoHash.toString("hex"),this._port=e.port,this._userAgent=e.userAgent,this.destroyed=!1,this._announce=e.announce||[],this._intervalMs=e.intervalMs||9e5,this._trackerOpts=null,this._dhtAnnouncing=!1,this._dhtTimeout=!1,this._internalDHT=!1,this._onWarning=e=>{this.emit("warning",e)},this._onError=e=>{this.emit("error",e)},this._onDHTPeer=(e,t)=>{t.toString("hex")===this.infoHash&&this.emit("peer",`${e.host}:${e.port}`,"dht")},this._onTrackerPeer=e=>{this.emit("peer",e,"tracker")},this._onTrackerAnnounce=()=>{this.emit("trackerAnnounce")},this._onLSDPeer=(e,t)=>{this.emit("peer",e,"lsd")};const t=(e,t)=>{const s=new _e.Client(t);return s.on("warning",this._onWarning),s.on("error",this._onError),s.listen(e),this._internalDHT=!0,s};!1===e.tracker?this.tracker=null:e.tracker&&"object"==typeof e.tracker?(this._trackerOpts=Object.assign({},e.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),!1===e.dht||"function"!=typeof _e.Client?this.dht=null:e.dht&&"function"==typeof e.dht.addNode?this.dht=e.dht:e.dht&&"object"==typeof e.dht?this.dht=t(e.dhtPort,e.dht):this.dht=t(e.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce()),!1===e.lsd||"function"!=typeof Ue?this.lsd=null:this.lsd=this._createLSD()}updatePort(e){e!==this._port&&(this._port=e,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy((()=>{this.tracker=this._createTracker()}))))}complete(e){this.tracker&&this.tracker.complete(e)}destroy(e){if(this.destroyed)return;this.destroyed=!0,clearTimeout(this._dhtTimeout);const t=[];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),t.push((e=>{this.tracker.destroy(e)}))),this.dht&&this.dht.removeListener("peer",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener("warning",this._onWarning),this.dht.removeListener("error",this._onError),t.push((e=>{this.dht.destroy(e)}))),this.lsd&&(this.lsd.removeListener("warning",this._onWarning),this.lsd.removeListener("error",this._onError),this.lsd.removeListener("peer",this._onLSDPeer),t.push((e=>{this.lsd.destroy(e)}))),g(t,e),this.dht=null,this.tracker=null,this.lsd=null,this._announce=null}_createTracker(){const e=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),t=new Ne(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onTrackerPeer),t.on("update",this._onTrackerAnnounce),t.setInterval(this._intervalMs),t.start(),t}_dhtAnnounce(){this._dhtAnnouncing||(Fe("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,(e=>{this._dhtAnnouncing=!1,Fe("dht announce complete"),e&&this.emit("warning",e),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 e=Object.assign({},{infoHash:this.infoHash,peerId:this.peerId,port:this._port}),t=new Ue(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onLSDPeer),t.start(),t}}const Be=je;const De=["seeking position failed.","InvalidStateError"],qe=["A requested file or directory could not be found at the time an operation was processed.","NotFoundError"],We=e=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${e}`,"SyntaxError"];class $e extends WritableStream{constructor(e){super(e),Object.setPrototypeOf(this,FileSystemWritableFileStream.prototype),this._closed=!1}async close(){this._closed=!0;const e=this.getWriter(),t=e.close();return e.releaseLock(),t}seek(e){return this.write({type:"seek",position:e})}truncate(e){return this.write({type:"truncate",size:e})}write(e){if(this._closed)return Promise.reject(new TypeError("Cannot write to a CLOSED writable stream"));const t=this.getWriter(),s=t.write(e);return t.releaseLock(),s}}if(Object.defineProperty($e.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties($e.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}}),!globalThis.FileSystemFileHandle||globalThis.FileSystemFileHandle.prototype.createWritable||globalThis.FileSystemWritableFileStream||(globalThis.FileSystemWritableFileStream=$e),globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable){const e=new WeakMap;let t;const s=()=>{let e,t;onmessage=async s=>{const i=s.ports[0],n=s.data;switch(n.type){case"open":{const s=n.name;let i=await navigator.storage.getDirectory();for(const e of n.path)i=await i.getDirectoryHandle(e);e=await i.getFileHandle(s),t=await e.createSyncAccessHandle();break}case"write":t.write(n.data,{at:n.position}),t.flush();break;case"truncate":t.truncate(n.size);break;case"abort":case"close":t.close()}i.postMessage(0)}};globalThis.FileSystemFileHandle.prototype.createWritable=async function(i){if(!t){const e=`(${s.toString()})()`,i=new Blob([e],{type:"text/javascript"});t=URL.createObjectURL(i)}const n=new Worker(t,{type:"module"});let r=0;const o=new TextEncoder;let a=await this.getFile().then((e=>e.size));const h=e=>new Promise(((t,s)=>{const i=new MessageChannel;i.port1.onmessage=e=>{e.data instanceof Error?s(e.data):t(e.data),i.port1.close(),i.port2.close(),i.port1.onmessage=null},n.postMessage(e,[i.port2])})),l=await navigator.storage.getDirectory(),c=await e.get(this),d=await l.resolve(c);if(null===d)throw new DOMException(...qe);return await h({type:"open",path:d,name:this.name}),!1===i?.keepExistingData&&(await h({type:"truncate",size:0}),a=0),new $e({async write(e){if("write"===(e=e?.constructor===Object?{...e}:{type:"write",data:e,position:r}).type){if(!("data"in e))throw await h({type:"close"}),new DOMException(...We("write requires a data argument"));if(e.position??=r,"string"==typeof e.data)e.data=o.encode(e.data);else if(e.data instanceof ArrayBuffer)e.data=new Uint8Array(e.data);else if(e.data instanceof Uint8Array||!ArrayBuffer.isView(e.data)){if(!(e.data instanceof Uint8Array)){const t=await new Response(e.data).arrayBuffer();e.data=new Uint8Array(t)}}else e.data=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.byteLength);Number.isInteger(e.position)&&e.position>=0&&(r=e.position),r+=e.data.byteLength,a+=e.data.byteLength}else{if("seek"===e.type){if(Number.isInteger(e.position)&&e.position>=0){if(a=0))throw await h({type:"close"}),new DOMException(...We("truncate requires a size argument"));a=e.size,r>a&&(r=a)}}await h(e)},async close(){await h({type:"close"}),n.terminate()},async abort(e){await h({type:"abort",reason:e}),n.terminate()}})};const i=FileSystemDirectoryHandle.prototype.getFileHandle;FileSystemDirectoryHandle.prototype.getFileHandle=async function(...t){const s=await i.call(this,...t);return e.set(s,this),s}}const ze=/[<>:"/\\|?*\u0000-\u001F]/g;globalThis.navigator?.storage?.getDirectory&&navigator.storage.getDirectory().then((e=>{e.removeEntry("chunks",{recursive:!0}).catch((()=>{}))}));const Ve=(e,t)=>{};class Ge{name="";chunks=[];chunkMap=[];directoryMap={};files;rootDirPromise;storageDirPromise;chunksDirPromise;closing=!1;closed=!1;constructor(e,t={}){if(this.chunkLength=Number(e),!this.chunkLength)throw new Error("First argument must be a chunk length");if(!globalThis.navigator?.storage?.getDirectory)throw new Error("FSA API is not supported");if(this.closed=!1,this.name=t.name||crypto.randomUUID(),this.rootDirPromise=t.rootDir||navigator.storage.getDirectory(),this.storageDirPromise=(async()=>(await this.rootDirPromise).getDirectoryHandle(this.name,{create:!0}))(),this.chunksDirPromise=this.storageDirPromise,t.files&&t.rootDir){if(this.chunksDirPromise=this._getChunksDirHandle(),this.files=t.files.map(((e,t,s)=>{if(null==e.path)throw new Error("File is missing `path` property");if(null==e.length)throw new Error("File is missing `length` property");if(null==e.offset)if(0===t)e.offset=0;else{const i=s[t-1];e.offset=i.offset+i.length}null==e.handle&&(e.handle=this._createFileHandle({path:e.path})),e.blob=this._createBlobReference(e.handle);const i=e.offset,n=e.offset+e.length,r=Math.floor(i/this.chunkLength),o=Math.floor((n-1)/this.chunkLength);for(let t=r;t<=o;++t){const s=t*this.chunkLength,r=is+this.chunkLength?this.chunkLength:n-s,a=i>s?0:s-i;this.chunkMap[t]||(this.chunkMap[t]=[]),this.chunkMap[t].push({from:r,to:o,offset:a,file:e})}return e})),window.addEventListener("pagehide",(()=>this.cleanup())),this.length=this.files.reduce(((e,t)=>e+t.length),0),null!=t.length&&t.length!==this.length)throw new Error("total `files` length is not equal to explicit `length` option")}else this.length=Number(t.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(e){let t=this.chunks[e];if(!t){const s=await this.chunksDirPromise;this.chunks[e]=t=await s.getFileHandle(e,{create:!0})}return t}async _createFileHandle(e){const t=e.path.slice(e.path.lastIndexOf("/")+1);return(await this._getDirectoryHandle(e)).getFileHandle(t.replace(ze,""),{create:!0})}async _createBlobReference(e){return(await e).getFile()}async _getDirectoryHandle(e){const t=e.path.lastIndexOf("/");if(-1===t||0===t)return this.storageDirPromise;const s=e.path=e.path.slice(0,t);return this.directoryMap[s]||(this.directoryMap[s]=(async()=>(await this._getDirectoryHandle(e)).getDirectoryHandle(s.slice(s.lastIndexOf("/")+1),{create:!0}))()),this.directoryMap[s]}async _getChunksDirHandle(){const e=await navigator.storage.getDirectory();return(await e.getDirectoryHandle("chunks",{create:!0})).getDirectoryHandle(this.name,{create:!0})}async put(e,t,s=Ve){try{return await this._put(e,t),s(null),null}catch(e){return queueMicrotask((()=>s(e))),e}}async getStreamForHandle(e){return(await e).createWritable({keepExistingData:!0})}async _put(e,t){if(this.closed)throw new Error("Storage is closed");const s=e===this.lastChunkIndex;if(s&&t.length!==this.lastChunkLength)throw new Error(`Last chunk length must be ${this.lastChunkLength}`);if(!s&&t.length!==this.chunkLength)throw new Error(`Chunk length must be ${this.chunkLength}`);const i=(async()=>{const s=await this._getChunkHandle(e),i=await s.createWritable({keepExistingData:!1});await i.write(t),await i.close()})();if(!this.files)return i;const n=this.chunkMap[e];if(!n)throw new Error("No files matching the request range");const r=n.map((async({file:e,offset:s,from:i,to:n})=>{e.stream||(e.stream=this.getStreamForHandle(e.handle)),await(await e.stream).write({type:"write",position:s,data:t.slice(i,n)})}));r.push(i),await Promise.all(r)}async get(e,t,s=Ve){null==t&&(t={});try{const i=await this._get(e,t);return s(null,i),i}catch(e){return s(e),e}}async _get(e,t){if("function"==typeof t)return this.get(e,void 0,t);if(this.closed)throw new Error("Storage is closed");const s=e===this.lastChunkIndex?this.lastChunkLength:this.chunkLength,i=t.offset||0,n=t.length?i+t.length:s,r=t.length||s-i;if(i<0||i<0||n>s)throw new Error("Invalid offset and/or length");if(i===n)return new Uint8Array(0);if(!this.files||this.chunks[e]){const t=await this._getChunkHandle(e);let n=await t.getFile();0===i&&r===s||(n=n.slice(i,r+i));const o=await n.arrayBuffer();if(0===o.byteLength)throw new Error(`Index ${e} does not exist`);return new Uint8Array(o)}let o=this.chunkMap[e];if(!o)throw new Error("No files matching the request range");if(t&&(o=o.filter((({from:e,to:t})=>t>i&&e{t&&(s>n&&(s=n),equeueMicrotask((()=>e(new Error(t)))))(e,"Storage is closed");this.closing=!0,this.chunkMap=void 0,this.directoryMap=void 0,this.files&&await this.cleanup(),this.closed=!0,queueMicrotask((()=>e(null)))}async cleanup(){if(this.closed||!this.files)return;const e=[];for(const t of this.files)t.stream&&(e.push(t.stream.then((e=>e.close()))),t.stream=void 0);const t=(async()=>{const e=await this.chunksDirPromise;this.chunks=[];for await(const t of e.keys())await e.removeEntry(t,{recursive:!0});this.chunksDirPromise=this._getChunksDirHandle(),await this.chunksDirPromise})();await Promise.all(e);for(const e of this.files)e.blob=this._createBlobReference(e.handle);await t}async destroy(e=Ve){this.close((async t=>{if(t)return e(t);try{const e=await this.rootDirPromise;await e.removeEntry(this.name,{recursive:!0})}catch(t){return e(t)}e(null)}))}}var Ke=n(3714),Ye=n(1314);const Je=A("lt_donthave"),Xe=()=>{class e extends r.EventEmitter{constructor(e){super(),this._peerSupports=!1,this._wire=e}onExtendedHandshake(){this._peerSupports=!0}onMessage(e){let t;try{t=new DataView(e.buffer).getUint32(0)}catch(e){return}this._wire.peerPieces.get(t)&&(Je("got donthave %d",t),this._wire.peerPieces.set(t,!1),this.emit("donthave",t),this._failRequests(t))}donthave(e){if(!this._peerSupports)return;Je("donthave %d",e);const t=new Uint8Array(4);new DataView(t.buffer).setUint32(0,e),this._wire.extended("lt_donthave",t)}_failRequests(e){const t=this._wire.requests;for(let s=0;s{class t extends r.EventEmitter{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new de.A(0,{grow:1e3}),ArrayBuffer.isView(e)&&this.setMetadata(e)}onHandshake(e,t,s){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1e7this._metadataSize&&(s=this._metadataSize);const i=this.metadata.slice(t,s);this._data(e,i,this._metadataSize)}_onData(e,t,s){t.length>nt||!this._fetching||(this.metadata.set(t,e*nt),this._bitfield.set(e),this._checkDone())}_onReject(e){this._remainingRejects>0&&this._fetching?(this._request(e),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 e=0;e0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return t.prototype.name="ut_metadata",t};var ot=n(8878),at=n(1133);const ht=A("webtorrent:file-iterator");class lt extends r{constructor(e,{start:t,end:s}){super(),this._torrent=e._torrent,this._pieceLength=e._torrent.pieceLength,this._startPiece=(t+e.offset)/this._pieceLength|0,this._endPiece=(s+e.offset)/this._pieceLength|0,this._piece=this._startPiece,this._offset=t+e.offset-this._startPiece*this._pieceLength,this._missing=s-t+1,this._criticalLength=Math.min(1048576/this._pieceLength|0,2),this._torrent._select(this._startPiece,this._endPiece,1,null,!0),this.destroyed=!1}[Symbol.asyncIterator](){return this}next(){return new Promise(((e,t)=>{if(0===this._missing||this.destroyed)return e({done:!0}),this.destroy();const s=(i,n)=>{if(!this._torrent.bitfield.get(i)){const e=t=>{(t===i||this.destroyed)&&(this._torrent.removeListener("verified",e),s(i,n))};return this._torrent.on("verified",e),this._torrent.critical(i,i+this._criticalLength)}if(this._torrent.destroyed)return t(new Error("Torrent removed"));this._torrent.store.get(i,n,((s,n)=>this.destroyed?e({done:!0}):(ht("read %s and yielding (length %s) (err %s)",i,n?.length,s?.message),s?t(s):void e({value:n,done:!1}))))},i=Math.min(this._missing,this._pieceLength-this._offset);s(this._piece++,{length:i,offset:this._offset}),this._missing-=i,this._offset=0}))}async return(){return this.destroy(),{done:!0}}async throw(e){throw e}destroy(e=()=>{},t){this.destroyed||(this.destroyed=!0,this._torrent.destroyed||this._torrent._deselect(this._startPiece,this._endPiece,!0),this.emit("return"),e(t))}}class ct extends r{constructor(e,t){super(),this._torrent=e,this._destroyed=!1,this._fileStreams=new Set,this._iterators=new Set,this.name=t.name,this.path=t.path,this.length=t.length,this.size=t.length,this.type=at.getType(this.name)||"application/octet-stream",this.offset=t.offset,this.done=!1;const s=t.offset,i=s+t.length-1;this._startPiece=s/this._torrent.pieceLength|0,this._endPiece=i/this._torrent.pieceLength|0,0===this.length&&(this.done=!0,this.emit("done")),this._client=e.client}get downloaded(){if(this._destroyed||!this._torrent.bitfield)return 0;const{pieces:e,bitfield:t,pieceLength:s,lastPieceLength:i}=this._torrent,{_startPiece:n,_endPiece:r}=this,o=n=>{const r=n===e.length-1?i:s;return t.get(n)?r:r-e[n].missing};let a=0;for(let t=n;t<=r;t+=1){const h=o(t);if(a+=h,t===n){const e=this.offset%s;a-=Math.min(e,h)}if(t===r){const t=(r===e.length-1?i:s)-(this.offset+this.length)%s;a-=Math.min(t,h)}}return a}get progress(){return this.length?this.downloaded/this.length:0}select(e){0!==this.length&&this._torrent.select(this._startPiece,this._endPiece,e)}deselect(){0!==this.length&&this._torrent.deselect(this._startPiece,this._endPiece)}[Symbol.asyncIterator](e={}){if(0===this.length)return async function*(){}();const{start:t=0}=e??{},s=e?.end&&e.end{this._iterators.delete(i)})),i}createReadStream(e){const t=this[Symbol.asyncIterator](e),s=K.Readable.from(t);return this._fileStreams.add(s),s.once("close",(()=>{this._fileStreams.delete(s)})),s}async arrayBuffer(e={}){const{start:t=0}=e,s=e?.end&&e.end{t=this[Symbol.asyncIterator](e)},async pull(e){const{value:s,done:i}=await t.next();i?e.close():e.enqueue(s)},cancel(){t.return()}})}get streamURL(){if(!this._client._server)throw new Error("No server created");return`${this._client._server.pathname}/${this._torrent.infoHash}/${this.path}`}streamTo(e){return e.src=this.streamURL,e}includes(e){return this._startPiece<=e&&this._endPiece>=e}_destroy(){this._destroyed=!0,this._torrent=null;for(const e of this._fileStreams)e.destroy();this._fileStreams.clear();for(const e of this._iterators)e.destroy();this._iterators.clear()}}var dt=n(5658);class ut{constructor(e){this._torrent=e,this._numPieces=e.pieces.length,this._pieces=new Array(this._numPieces),this._onWire=e=>{this.recalculate(),this._initWire(e)},this._onWireHave=e=>{this._pieces[e]+=1},this._onWireBitfield=()=>{this.recalculate()},this._torrent.wires.forEach((e=>{this._initWire(e)})),this._torrent.on("wire",this._onWire),this.recalculate()}getRarestPiece(e){let t=[],s=1/0;for(let i=0;i{this._cleanupWireEvents(e)})),this._torrent=null,this._pieces=null,this._onWire=null,this._onWireHave=null,this._onWireBitfield=null}_initWire(e){e._onClose=()=>{this._cleanupWireEvents(e);for(let t=0;t{const i=await(0,w.tW)(e,"hex");if(this.destroyed)return;this.handshake(t,i);const n=this._torrent.pieces.length,r=new de.A(n);for(let e=0;e<=n;e++)r.set(e,!0);this.bitfield(r)})),this.once("interested",(()=>{_t("interested"),this.unchoke()})),this.on("uninterested",(()=>{_t("uninterested")})),this.on("choke",(()=>{_t("choke")})),this.on("unchoke",(()=>{_t("unchoke")})),this.on("bitfield",(()=>{_t("bitfield")})),this.lt_donthave.on("donthave",(()=>{_t("donthave")})),this.on("request",((e,t,s,i)=>{_t("request pieceIndex=%d offset=%d length=%d",e,t,s),this.httpRequest(e,t,s,((t,s)=>{if(t){this.lt_donthave.donthave(e);const t=setTimeout((()=>{this.destroyed||this.have(e)}),1e4);t.unref&&t.unref()}i(t,s)}))}))}async httpRequest(e,t,s,i){i=ge(i);const n=e*this._torrent.pieceLength+t,r=n+s-1,o=this._torrent.files;let a,h;if(o.length<=1)a=[{url:this.url,start:n,end:r}];else{const e=o.filter((e=>e.offset<=r&&e.offset+e.length>n));if(e.length<1)return i(new Error("Could not find file corresponding to web seed range request"));a=e.map((e=>{const t=e.offset+e.length-1;return{url:this.url+("/"===this.url[this.url.length-1]?"":"/")+e.path.replace(this._torrent.path,""),fileOffsetInRange:Math.max(e.offset-n,0),start:Math.max(n-e.offset,0),end:Math.min(t,r-e.offset)}}))}try{h=await Promise.all(a.map((async({start:i,end:n,url:r})=>{_t("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",r,e,t,s,i,n);const o=await R(r,{cache:"no-store",method:"GET",headers:{"Cache-Control":"no-store","user-agent":`WebTorrent/${mt} (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 _t("Got data of length %d",a.length),a})))}catch(e){return i(e)}i(null,(0,w.xW)(h))}destroy(){super.destroy(),this._torrent=null}}class yt{_items=[];remove(e){for(let t=0;t=0&&0!==e.from&&i.push(n);const r={...s,from:e.to+1};r.to-r.from>=0&&i.push(r),this._items.splice(t,1,...i),t=t-1+i.length}else kt(e,s)&&(this._items.splice(t,1),t--)}}insert(e){if(e.from>e.to)throw new Error("Invalid interval");if(!e.isStreamSelection){const{notify:t}=e,s=[];for(const t of this._items)t.notify&&xt(e,t)&&s.push(t.notify);s.length>0&&(e.notify=()=>{s.forEach((e=>e())),t?.()}),this.remove(e)}this._items.push(e)}sort(e=(e,t)=>e.from-t.from){this._items.sort(e)}get length(){return this._items.length}get(e){return this._items[e]}swap(e,t){const s=this._items[e];this._items[e]=this._items[t],this._items[t]=s}clear(){this._items.length=0}*[Symbol.iterator](){for(let e=0;e{this._items.splice(e,1),e--},yield t,delete t.remove}}}function wt(e,t){return e.from<=t.to&&e.from>t.from&&e.to>t.to}function bt(e,t){return e.to>=t.from&&e.to=t.from&&e.to<=t.to&&i=t.to}const xt=(e,t)=>()=>wt(e,t)||bt(e,t)||vt(e,t)||kt(e,t);var St=n(717);const Et=A("webtorrent:torrent"),Ct=5e3,Pt=3*tt.BLOCK_LENGTH,Tt=St.browser?me().length:2,At=[1e3,5e3,15e3],It=`WebTorrent/${mt} (https://webtorrent.io)`,Lt=globalThis.navigator?.storage?.getDirectory&&globalThis.FileSystemFileHandle?.prototype?.createWritable,Ot=!St.browser||Lt?Ge:Qe;let Rt;try{Rt=h(re.statSync("/tmp")&&"/tmp","webtorrent")}catch(e){Rt=h("function"==typeof ae.tmpdir?ae.tmpdir():"/","webtorrent")}const Ht="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback&&window.requestIdleCallback;class Nt extends r{constructor(e,t,s){super(),this._debugId="unknown infohash",this.client=t,this.announce=s.announce,this.urlList=s.urlList,this.path=s.path||Rt,this.addUID=s.addUID||!1,this.rootDir=s.rootDir||null,this.skipVerify=!!s.skipVerify,this._startupBitfield=s.bitfield,this._store=s.store||Ot,this._preloadedStore=s.preloadedStore||null,this._storeCacheSlots=void 0!==s.storeCacheSlots?s.storeCacheSlots:20,this._destroyStoreOnDestroy=s.destroyStoreOnDestroy||!1,this.store=null,this.storeOpts=s.storeOpts,this.alwaysChokeSeeders=s.alwaysChokeSeeders??!0,this._getAnnounceOpts=s.getAnnounceOpts,"boolean"==typeof s.private&&(this.private=s.private),this.strategy=s.strategy||"sequential",this.maxWebConns=s.maxWebConns||4,this._rechokeNumSlots=!1===s.uploads||0===s.uploads?0:+s.uploads||10,this._rechokeOptimisticWire=null,this._rechokeOptimisticTime=0,this._rechokeIntervalId=null,this._noPeersIntervalId=null,this._noPeersIntervalTime=s.noPeersIntervalTime?1e3*s.noPeersIntervalTime:3e4,this._startAsDeselected=s.deselect||!1,this.ready=!1,this.destroyed=!1,this.paused=s.paused||!1,this.done=!1,this.metadata=null,this.files=[],this.pieces=[],this._amInterested=!1,this._selections=new yt,this._critical=[],this.wires=[],this._queue=[],this._peers={},this._peersLength=0,this.received=0,this.uploaded=0,this._downloadSpeed=te(),this._uploadSpeed=te(),this._servers=[],this._xsRequests=[],this._fileModtimes=s.fileModtimes,null!==e&&this._onTorrentId(e),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 e=0;for(let t=0,s=this.pieces.length;t{this.destroyed||this._onParsedTorrent(t)}))):j(e,((e,t)=>{if(!this.destroyed)return e?this._destroy(e):void this._onParsedTorrent(t)}))}_onParsedTorrent(e){if(!this.destroyed){if(this._processParsedTorrent(e),!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(e){this._debugId=(0,w.V5)(e.infoHash).substring(0,7),void 0!==this.private&&(e.private=this.private),Array.isArray(this.announce)&&(e.announce=e.announce.concat(this.announce)),this.client.tracker&&Array.isArray(this.client.tracker.announce)&&!e.private&&(e.announce=e.announce.concat(this.client.tracker.announce)),this.client.tracker&&globalThis.WEBTORRENT_ANNOUNCE&&!e.private&&(e.announce=e.announce.concat(globalThis.WEBTORRENT_ANNOUNCE)),this.urlList&&(e.urlList=e.urlList.concat(this.urlList)),e.announce=Array.from(new Set(e.announce)),e.urlList=Array.from(new Set(e.urlList)),Object.assign(this,e),this.magnetURI=W(e),this.torrentFile=function(e){const t={info:e.info};return t["announce-list"]=(e.announce||[]).map((e=>(t.announce||(t.announce=e),[e=(0,w.L0)(e)]))),t["url-list"]=e.urlList||[],void 0!==e.private&&(t.private=Number(e.private)),e.created&&(t["creation date"]=e.created.getTime()/1e3|0),e.createdBy&&(t["created by"]=e.createdBy),e.comment&&(t.comment=e.comment),c.A.encode(t)}(e)}_onListening(){this.destroyed||(this.info?this._onMetadata(this):(this.xs&&this._getMetadataFromServer(),this._startDiscovery()))}_startDiscovery(){if(this.discovery||this.destroyed)return;let e=this.client.tracker;e&&(e=Object.assign({},this.client.tracker,{getAnnounceOpts:()=>{if(this.destroyed)return;const e={uploaded:this.uploaded,downloaded:this.downloaded,left:Math.max(this.length-this.downloaded,0)};return this.client.tracker.getAnnounceOpts&&Object.assign(e,this.client.tracker.getAnnounceOpts()),this._getAnnounceOpts&&Object.assign(e,this._getAnnounceOpts()),e}})),this.peerAddresses&&this.peerAddresses.forEach((e=>this.addPeer(e,dt.default.SOURCE_MANUAL))),this.discovery=new Be({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:e,port:this.client.torrentPort,userAgent:It,lsd:this.client.lsd}),this.discovery.on("error",(e=>{this._destroy(e)})),this.discovery.on("peer",((e,t)=>{this._debug("peer %s discovered via %s",e,t),this.client.seedOutgoingConnections||!this.done?this.addPeer(e,t):this._debug("discovery ignoring peer %s: torrent is done and seedOutgoingConnections is false",e)})),this.discovery.on("trackerAnnounce",(()=>{this.emit("trackerAnnounce")})),this.discovery.on("dhtAnnounce",(()=>{this.emit("dhtAnnounce")})),this.discovery.on("warning",(e=>{this.emit("warning",e)})),this._noPeersIntervalId=setInterval((()=>{if(this.destroyed)return;const e={[dt.default.SOURCE_TRACKER]:{enabled:!!this.client.tracker,numPeers:0},[dt.default.SOURCE_DHT]:{enabled:!!this.client.dht,numPeers:0},[dt.default.SOURCE_LSD]:{enabled:!!this.client.lsd,numPeers:0},[dt.default.SOURCE_UT_PEX]:{enabled:this.client.utPex&&"function"==typeof ot,numPeers:0}};for(const t of Object.values(this._peers)){const s=e[t.source];void 0!==s&&s.numPeers++}for(const t of Object.keys(e)){const s=e[t];s.enabled&&0===s.numPeers&&this.emit("noPeers",t)}}),this._noPeersIntervalTime),this._noPeersIntervalId.unref&&this._noPeersIntervalId.unref()}_getMetadataFromServer(){const e=this,t=Array.isArray(this.xs)?this.xs:[this.xs];e._xsRequestsController=new AbortController;const s=e._xsRequestsController.signal,i=t.map((t=>i=>{!async function(t,i){if(0!==t.indexOf("http://")&&0!==t.indexOf("https://"))return e.emit("warning",new Error(`skipping non-http xs param: ${t}`)),i(null);const n={method:"GET",headers:{"user-agent":It},signal:s};let r,o,a;try{r=await R(t,n)}catch(s){return e.emit("warning",new Error(`http error from xs param: ${t}`)),i(null)}if(e.destroyed)return i(null);if(e.metadata)return i(null);if(200!==r.status)return e.emit("warning",new Error(`non-200 status code ${r.status} from xs param: ${t}`)),i(null);try{o=new Uint8Array(await r.arrayBuffer())}catch(t){return e.emit("warning",t),i(null)}try{a=await q(o)}catch(e){}if(!a)return e.emit("warning",new Error(`got invalid torrent file from xs param: ${t}`)),i(null);if(a.infoHash!==e.infoHash)return e.emit("warning",new Error(`got torrent file with incorrect info hash from xs param: ${t}`)),i(null);e._onMetadata(a),i(null)}(t,i)}));g(i)}async _onMetadata(e){if(this.metadata||this.destroyed)return;let t;if(this._debug("got metadata"),this._xsRequestsController?.abort(),this._xsRequestsController=null,e&&e.infoHash)t=e;else try{t=await q(e)}catch(e){return this._destroy(e)}this._processParsedTorrent(t),this.metadata=this.torrentFile,this.client.enableWebSeeds&&this.urlList.forEach((e=>{this.addWebSeed(e)})),this._rarityMap=new ut(this),this.files=this.files.map((e=>new ct(this,e)));let s=this._preloadedStore;if(s||(s=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&&!(s instanceof Qe)&&(s=new ue(s,{max:this._storeCacheSlots})),this.store=new Ke(s),this.so&&!this._startAsDeselected?this.files.forEach(((e,t)=>{this.so.includes(t)&&this.files[t].select()})):0===this.pieces.length||this._startAsDeselected||this.select(0,this.pieces.length-1,0),this._hashes=this.pieces,this._hasStartupBitfield=this._startupBitfield&&this._startupBitfield.length===Math.ceil(this.pieces.length/8)&&!this.skipVerify,this.bitfield=new de.A(this._hasStartupBitfield?new Uint8Array(this._startupBitfield):this.pieces.length),this._reservations=this._hasStartupBitfield?this.pieces.map(((e,t)=>this.bitfield.get(t)?null:[])):this.pieces.map((()=>[])),this.pieces=this.pieces.map(((e,t)=>{if(this._hasStartupBitfield&&this.bitfield.get(t))return null;const s=t===this.pieces.length-1?this.lastPieceLength:this.pieceLength;return new tt(s)})),this.emit("metadata"),!this.destroyed)if(this.skipVerify)this._markAllVerified(),this._onStore();else{const e=e=>{if(e)return this._destroy(e);this._debug("done verifying"),this._onStore()};this._debug("verifying existing torrent data"),this._fileModtimes&&this._store===Ge?this.getFileModtimes(((t,s)=>{if(t)return this._destroy(t);this.files.map(((e,t)=>s[t]===this._fileModtimes[t])).every((e=>e))?(this._markAllVerified(),this._onStore()):this._verifyPieces(e)})):this._verifyPieces(e)}}getFileModtimes(e){const t=[];Ze(this.files.map(((e,s)=>i=>{const n=this.addUID?h(this.name+" - "+this.infoHash.slice(0,8)):h(this.path,e.path);re.stat(n,((e,n)=>{if(e&&"ENOENT"!==e.code)return i(e);t[s]=n&&n.mtime.getTime(),i(null)}))})),Tt,(s=>{this._debug("done getting file modtimes"),e(s,t)}))}_verifyPiece(e,t){if(this.destroyed)return t(new Error("torrent is destroyed"));const s={};e===this.pieces.length-1&&(s.length=this.lastPieceLength),this.store.get(e,s,(async(s,i)=>{if(this.destroyed)return t(new Error("torrent is destroyed"));if(s)return y((()=>t(null,!1)));const n=await(0,w.tW)(i,"hex");if(this.destroyed)return t(new Error("torrent is destroyed"));t(null,n===this._hashes[e])}))}_verifyPiecesUsingBitfield(e){const t=new Set,s=new Map;for(const e of this.files){let i=2,n=null;for(let t=e._startPiece;t<=e._endPiece;++t)this.bitfield.get(t)&&(i&&(n=t,i--),s.has(t)||s.set(t,[]),s.get(t).push(e));null!==n&&t.add(n)}this._verifyPiecesUsingHash([...t],(i=>{if(i)return e(i);const n=new Set;for(const e of t)if(!this.bitfield.get(e)){const t=s.get(e);for(const e of t)n.add(e)}if(n.size){const t=[];for(const e of n)for(let s=e._startPiece;s<=e._endPiece;++s)-1===t.indexOf(s)&&t.push(s);return this._verifyPiecesUsingHash(t,e)}e(null)}))}_verifyPiecesUsingHash(e,t){Ze(e.map(((e,t)=>s=>{const i=Number.isInteger(e)?e:t;this._verifyPiece(i,((e,t)=>{if(e)return s(e);t?(this._debug("piece verified %s",i),this._markVerified(i)):(this._markUnverified(i),this._debug("piece invalid %s",i)),s(null)}))})),Tt,t)}_verifyPieces(e){if(this._hasStartupBitfield)return this._verifyPiecesUsingBitfield(e);this._verifyPiecesUsingHash(this.pieces,e)}rescanFiles(e){if(this.destroyed)throw new Error("torrent is destroyed");e||(e=Mt),this._verifyPiecesUsingHash(this.pieces,(t=>{if(t)return this._destroy(t),e(t);this._checkDone(),e(null)}))}_markAllVerified(){for(let e=0;ee))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((e=>{e.ut_metadata&&e.ut_metadata.setMetadata(this.metadata),this._onWireWithMetadata(e)})))}destroy(e,t){if("function"==typeof e)return this.destroy(null,e);this._destroy(null,e,t)}_destroy(e,t,s){if("function"==typeof t)return this._destroy(e,null,t);if(this.destroyed)return;this.destroyed=!0,this._debug("destroy"),this.client._remove(this),this._selections.clear(),clearInterval(this._rechokeIntervalId),clearInterval(this._noPeersIntervalId),this._xsRequestsController?.abort(),this._rarityMap&&this._rarityMap.destroy();for(const e in this._peers)this.removePeer(e);for(const e of this.files)e instanceof ct&&e._destroy();const i=this._servers.map((e=>t=>{e.destroy(t)}));if(this.discovery&&i.push((e=>{this.discovery.destroy(e)})),this.store){let e=this._destroyStoreOnDestroy;t&&void 0!==t.destroyStore&&(e=t.destroyStore),i.push((t=>{e?this.store.destroy(t):this.store.close(t)}))}g(i,s),e&&(0===this.listenerCount("error")?this.client.emit("error",e):this.emit("error",e)),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,this._queue=null}addPeer(e,t){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 s;if("string"==typeof e){let t;try{t=ce(e)}catch(t){return this._debug("ignoring peer: invalid %s",e),this.emit("invalidPeer",e),!1}s=t[0]}else"string"==typeof e.remoteAddress&&(s=e.remoteAddress);if(this.client.blocked&&s&&this.client.blocked.contains(s))return this._debug("ignoring peer: blocked %s",e),"string"!=typeof e&&e.destroy(),this.emit("blockedPeer",e),!1;const i=this.client.utp&&this._isIPv4(s)?"utp":"tcp",n=!!this._addPeer(e,i,t);return n?this.emit("peer",e):this.emit("invalidPeer",e),n}_addPeer(e,t,s){if(this.destroyed)return"string"!=typeof e&&e.destroy(),null;if("string"==typeof e&&!this._validAddr(e))return this._debug("ignoring peer: invalid %s",e),null;const i=e&&e.id||e;if(this._peers[i])return this._debug("ignoring peer: duplicate (%s)",i),"string"!=typeof e&&e.destroy(),null;if(this.paused)return this._debug("ignoring peer: torrent is paused"),"string"!=typeof e&&e.destroy(),null;let n;return this._debug("add peer %s",i),n="string"==typeof e?"utp"===t?dt.default.createUTPOutgoingPeer(e,this,this.client.throttleGroups,s):dt.default.createTCPOutgoingPeer(e,this,this.client.throttleGroups,s):dt.default.createWebRTCPeer(e,this,this.client.throttleGroups,s),this._registerPeer(n),"string"==typeof e&&(this._queue.push(n),this._drain()),n}addWebSeed(e){if(this.destroyed)throw new Error("torrent is destroyed");let t,s;if("string"==typeof e){if(t=e,!/^https?:\/\/.+/.test(t))return this.emit("warning",new Error(`ignoring invalid web seed: ${t}`)),void this.emit("invalidPeer",t);if(this._peers[t])return this.emit("warning",new Error(`ignoring duplicate web seed: ${t}`)),void this.emit("invalidPeer",t);s=new gt(t,this)}else{if(!e||"string"!=typeof e.connId)return void this.emit("warning",new Error("addWebSeed must be passed a string or connection object with id property"));if(s=e,t=s.connId,this._peers[t])return this.emit("warning",new Error(`ignoring duplicate web seed: ${t}`)),void this.emit("invalidPeer",t)}this._debug("add web seed %s",t);const i=dt.default.createWebSeedPeer(s,t,this,this.client.throttleGroups);this._registerPeer(i),this.emit("peer",t)}_addIncomingPeer(e){return this.destroyed?e.destroy(new Error("torrent is destroyed")):this.paused?e.destroy(new Error("torrent is paused")):(this._debug("add incoming peer %s",e.id),void this._registerPeer(e))}_registerPeer(e){e.on("download",(e=>{this.destroyed||(this.received+=e,this._downloadSpeed(e),this.client._downloadSpeed(e),this.emit("download",e),this.destroyed||this.client.emit("download",e))})),e.on("upload",(e=>{this.destroyed||(this.uploaded+=e,this._uploadSpeed(e),this.client._uploadSpeed(e),this.emit("upload",e),this.destroyed||this.client.emit("upload",e))})),this._peers[e.id]=e,this._peersLength+=1}removePeer(e){const t=e?.id||e;e&&!e.id&&(e=this._peers?.[t]),e&&(e.destroy(),this.destroyed||(this._debug("removePeer %s",t),delete this._peers[t],this._peersLength-=1,this._drain()))}_select(e=0,t=this.pieces.length-1,s,i,n=!1){if(this.destroyed)throw new Error("torrent is destroyed");if(e<0||tt.priority-e.priority)),this._updateSelections()}select(e,t,s,i){this._select(e,t,s,i,!1)}_deselect(e,t,s=!1){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("deselect %s-%s",e,t),this._selections.remove({from:e,to:t,isStreamSelection:s}),this._updateSelections()}deselect(e,t){this._deselect(e,t,!1)}critical(e,t){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("critical %s-%s",e,t);for(let s=e;s<=t;++s)this._critical[s]=!0;this._updateSelections()}_onWire(e,t){if(this._debug("got wire %s (%s)",e._debugId,t||"Unknown"),this.wires.push(e),t){const s=ce(t);e.remoteAddress=s[0],e.remotePort=s[1]}this.client.dht&&this.client.dht.listening&&e.on("port",(s=>{if(!this.destroyed&&!this.client.dht.destroyed){if(!e.remoteAddress)return this._debug("ignoring PORT from peer with no address");if(0===s||s>65536)return this._debug("ignoring invalid PORT from peer");this._debug("port: %s (from %s)",s,t),this.client.dht.addNode({host:e.remoteAddress,port:s})}})),e.on("timeout",(()=>{this._debug("wire timeout (%s)",t),e.destroy()})),"webSeed"!==e.type&&e.setTimeout(3e4,!0),e.setKeepAlive(!0),e.use(rt(this.metadata)),e.ut_metadata.on("warning",(e=>{this._debug("ut_metadata warning: %s",e.message)})),this.metadata||(e.ut_metadata.on("metadata",(e=>{this._debug("got metadata via ut_metadata"),this._onMetadata(e)})),e.ut_metadata.fetch()),this.client.utPex&&"function"==typeof ot&&!this.private&&(e.use(ot()),e.ut_pex.on("peer",(e=>{this.client.seedOutgoingConnections||!this.done?(this._debug("ut_pex: got peer: %s (from %s)",e,t),this.addPeer(e,dt.default.SOURCE_UT_PEX)):this._debug("ut_pex ignoring peer %s: torrent is done and seedOutgoingConnections is false",e)})),e.ut_pex.on("dropped",(e=>{const s=this._peers[e];s&&!s.connected&&(this._debug("ut_pex: dropped peer: %s (from %s)",e,t),this.removePeer(e))})),e.once("close",(()=>{e.ut_pex.reset()}))),e.use(Xe()),this.emit("wire",e,t),this.ready&&y((()=>{this._onWireWithMetadata(e)}))}_onWireWithMetadata(e){let t=null;const s=()=>{this.destroyed||e.destroyed||(this._numQueued>2*(this._numConns-this.numPeers)&&e.amInterested?e.destroy():(t=setTimeout(s,Ct),t.unref&&t.unref()))};let i;const n=()=>{if(e.peerPieces.buffer.length===this.bitfield.buffer.length){for(i=0;i{n(),this._update(),this._updateWireInterest(e)})),e.on("have",(()=>{n(),this._update(),this._updateWireInterest(e)})),e.lt_donthave.on("donthave",(()=>{n(),this._update(),this._updateWireInterest(e)})),e.on("have-all",(()=>{e.isSeeder=!0,this.alwaysChokeSeeders&&e.choke(),this._update(),this._updateWireInterest(e)})),e.on("have-none",(()=>{e.isSeeder=!1,this._update(),this._updateWireInterest(e)})),e.on("allowed-fast",(e=>{this._update()})),e.once("interested",(()=>{e.unchoke()})),e.once("close",(()=>{clearTimeout(t)})),e.on("choke",(()=>{clearTimeout(t),t=setTimeout(s,Ct),t.unref&&t.unref()})),e.on("unchoke",(()=>{clearTimeout(t),this._update()})),e.on("request",((t,s,i,n)=>{if(i>131072)return e.destroy();this.pieces[t]||this.store.get(t,{offset:s,length:i},n)})),e.hasFast&&this._hasAllPieces()?e.haveAll():e.hasFast&&this._hasNoPieces()?e.haveNone():e.bitfield(this.bitfield),this._updateWireInterest(e),e.peerExtensions.dht&&this.client.dht&&this.client.dht.listening&&e.port(this.client.dht.address().port),"webSeed"!==e.type&&(t=setTimeout(s,Ct),t.unref&&t.unref()),e.isSeeder=!1,n()}_updateSelections(){this.ready&&!this.destroyed&&(y((()=>{this._gcSelections()})),this._updateInterest(),this._update())}_gcSelections(){for(const e of this._selections){const t=e.offset;for(;this.bitfield.get(e.from+e.offset)&&e.from+e.offsetthis._updateWireInterest(e))),e!==this._amInterested&&(this._amInterested?this.emit("interested"):this.emit("uninterested"))}_updateWireInterest(e){let t=!1;for(let s=0;sthis._updateWireWrapper()),{timeout:250}):this._updateWireWrapper()}_updateWireWrapper(){if(this.destroyed)return;const e=st(this.wires);let t;for(;t=e();)this._updateWire(t)}_updateWire(e){if(e.destroyed)return!1;const t=this,s=Ut(e,.5);if(e.requests.length>=s)return;const i=Ut(e,1);if(e.peerChoking)e.hasFast&&e.peerAllowedFastSet.length>0&&!this._hasMorePieces(e.peerAllowedFastSet.length-1)&&function(){if(e.requests.length>=i)return!1;for(const s of e.peerAllowedFastSet){if(e.peerPieces.get(s)&&!t.bitfield.get(s))for(;t._request(e,s,!1)&&e.requests.length=i.from+i.offset;--r)if(e.peerPieces.get(r)&&t._request(e,r,!1))return}}();o(!1)||o(!0)}function n(t,s,i,n){return r=>r>=t&&r<=s&&!(r in i)&&e.peerPieces.get(r)&&(!n||n(r))}function r(e){let s=e;for(let i=e;i=i)return!0;const o=function(){const s=e.downloadSpeed()||1;if(s>Pt)return()=>!0;const i=Math.max(1,e.requests.length)*tt.BLOCK_LENGTH/s;let n=10,r=0;return e=>{if(!n||t.bitfield.get(e))return!0;let o=t.pieces[e].missing;for(;r0))return n--,!1}return!0}}();for(let a=0;a({wire:e,random:Math.random()}))).sort(((e,t)=>{const s=e.wire,i=t.wire;return s.downloadSpeed()!==i.downloadSpeed()?s.downloadSpeed()-i.downloadSpeed():s.uploadSpeed()!==i.uploadSpeed()?s.uploadSpeed()-i.uploadSpeed():s.amChoking!==i.amChoking?s.amChoking?-1:1:e.random-t.random})).map((e=>e.wire));this._rechokeOptimisticTime<=0?this._rechokeOptimisticWire=null:this._rechokeOptimisticTime-=1;let t=0;for(;e.length>0&&t0){const t=e.filter((e=>e.peerInterested));if(t.length>0){const e=t[(s=t.length,Math.random()*s|0)];e.unchoke(),this._rechokeOptimisticWire=e,this._rechokeOptimisticTime=2}}var s;e.filter((e=>e!==this._rechokeOptimisticWire)).forEach((e=>e.choke()))}_hotswap(e,t){const s=e.downloadSpeed();if(s=Pt||(2*a>s||a>o||(n=t,o=a))}if(!n)return!1;for(r=0;r=o)return!1;const a=i.pieces[t];let h=r?a.reserveRemaining():a.reserve();if(-1===h&&s&&i._hotswap(e,t)&&(h=r?a.reserveRemaining():a.reserve()),-1===h)return!1;let l=i._reservations[t];l||(l=i._reservations[t]=[]);let c=l.indexOf(null);-1===c&&(c=l.length),l[c]=e;const d=a.chunkOffset(h),u=r?a.chunkLengthRemaining(h):a.chunkLength(h);function p(){y((()=>{i._update()}))}return e.request(t,d,u,(async function s(n,o){if(i.destroyed)return;if(!i.ready)return i.once("ready",(()=>{s(n,o)}));if(l[c]===e&&(l[c]=null),a!==i.pieces[t])return p();if(n)return i._debug("error getting piece %s (offset: %s length: %s) from %s: %s",t,d,u,`${e.remoteAddress}:${e.remotePort}`,n.message),r?a.cancelRemaining(h):a.cancel(h),void p();if(i._debug("got piece %s (offset: %s length: %s) from %s",t,d,u,`${e.remoteAddress}:${e.remotePort}`),!a.set(h,o,e))return p();const f=a.flush(),m=await(0,w.tW)(f,"hex");i.destroyed||(m===i._hashes[t]?(i._debug("piece verified %s",t),i.store.put(t,f,(e=>{e?i._destroy(e):(i.pieces[t]=null,i._markVerified(t),i.wires.forEach((e=>{e.have(t)})),i._checkDone(),p())}))):(i.pieces[t]=new tt(a.length),i.emit("warning",new Error(`Piece ${t} failed verification`)),p()))})),!0}_checkDone(){if(this.destroyed)return;this.files.forEach((e=>{if(!e.done){for(let t=e._startPiece;t<=e._endPiece;++t)if(!this.bitfield.get(t))return;e.done=!0,e.emit("done"),this._debug(`file done: ${e.name}`)}}));const e=this.files.every((e=>e.done));return!this.done&&e?(this.done=!0,this._debug(`torrent done: ${this.infoHash}`),this.emit("done"),this.destroyed||this.discovery.complete()):this.done&&!e&&(this.done=!1,this.discovery.tracker?.start()),this._gcSelections(),e}async load(e,t){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.ready)return this.once("ready",(()=>{this.load(e,t)}));Array.isArray(e)||(e=[e]),t||(t=Mt);try{await fe(this.store,_(e),{chunkLength:this.pieceLength}),this._markAllVerified(),this._checkDone(),t(null)}catch(e){return t(e),e}}pause(){this.destroyed||(this._debug("pause"),this.paused=!0)}resume(){this.destroyed||(this._debug("resume"),this.paused=!1,this._drain())}_debug(){const e=[].slice.call(arguments);e[0]=`[${this.client?this.client._debugId:"No Client"}] [${this._debugId}] ${e[0]}`,Et(...e)}_drain(){if(this._debug("_drain numConns %s maxConns %s",this._numConns,this.client.maxConns),"function"!=typeof oe.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 e=this._queue.shift();if(!e)return;this._debug("%s connect attempt to %s",e.type,e.addr);const t=ce(e.addr),s={host:t[0],port:t[1]};this.client.utp&&e.type===dt.default.TYPE_UTP_OUTGOING?e.conn=pt.connect(s.port,s.host):e.conn=oe.connect(s);const i=e.conn;i.once("connect",(()=>{this.destroyed||e.onConnect()})),i.once("error",(t=>{e.destroy(t)})),e.startConnectTimeout(),i.on("close",(()=>{if(this.destroyed)return;if(e.retries>=At.length){if(this.client.utp){const t=this._addPeer(e.addr,"tcp",e.source);t&&(t.retries=0)}else this._debug("conn %s closed: will not re-add (max %s attempts)",e.addr,At.length);return}const t=At[e.retries];this._debug("conn %s closed: will re-add to queue in %sms (attempt %s)",e.addr,t,e.retries+1);const s=setTimeout((()=>{if(this.destroyed)return;const t=ce(e.addr)[0],s=this.client.utp&&this._isIPv4(t)?"utp":"tcp",i=this._addPeer(e.addr,s,e.source);i&&(i.retries=e.retries+1)}),t);s.unref&&s.unref()}))}_validAddr(e){let t;try{t=ce(e)}catch(e){return!1}const s=t[0],i=t[1];return i>0&&i<65535&&!("127.0.0.1"===s&&i===this.client.torrentPort)}_isIPv4(e){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(e)}}function Ut(e,t){let s=2+Math.ceil(t*e.downloadSpeed()/tt.BLOCK_LENGTH);if(e.peerExtendedHandshake){const t=e.peerExtendedHandshake.reqq;"number"==typeof t&&t>0&&(s=Math.min(s,t))}return s}function Mt(){}var Ft=n(4043),jt=n(580),Bt=n(815),Dt=n(2878);class qt{constructor(e,t={}){this.client=e,t.origin||(t.origin="*"),this.opts=t,this.pendingReady=new Set}static serveIndexPage(e,t,s){const i=t.map((e=>`
  • \n \n ${jt(e.name)}\n \n (${jt(e.length)} bytes)\n
  • `)).join("
    ");return e.status=200,e.headers["Content-Type"]="text/html",e.body=zt("WebTorrent",`

    WebTorrent

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

    405 - Method Not Allowed

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

    404 - Not Found

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

    ${jt(e.name)}

    \n
      ${i}
    `),t}static serveOptionsRequest(e,t){return t.status=204,t.headers["Access-Control-Max-Age"]="600",t.headers["Access-Control-Allow-Methods"]="GET,HEAD",e.headers["access-control-request-headers"]&&(t.headers["Access-Control-Allow-Headers"]=e.headers["access-control-request-headers"]),t}static serveFile(e,t,s){s.status=200,s.headers.Expires="0",s.headers["Cache-Control"]="no-cache, no-store, must-revalidate, max-age=0",s.headers["Accept-Ranges"]="bytes",s.headers["Content-Type"]=e.type,s.headers["transferMode.dlna.org"]="Streaming",s.headers["contentFeatures.dlna.org"]="DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000","document"===t.destination?(s.headers["Content-Type"]="application/octet-stream",s.headers["Content-Disposition"]=`attachment; filename*=UTF-8''${Vt(e.name)}`,s.body="DOWNLOAD"):s.headers["Content-Disposition"]=`inline; filename*=UTF-8''${Vt(e.name)}`;let i=Dt(e.length,t.headers.range||"");if(Array.isArray(i)?(s.status=206,i=i[0],s.headers["Content-Range"]=`bytes ${i.start}-${i.end}/${e.length}`,s.headers["Content-Length"]=i.end-i.start+1):(s.statusCode=200,i=null,s.headers["Content-Length"]=e.length),"GET"===t.method){const n=e[Symbol.asyncIterator](i);let r=null;e.emit("iterator",{iterator:n,req:t,file:e},(e=>{r=e}));const o=K.Readable.from(r||n);let a=null;e.emit("stream",{stream:o,req:t,file:e},(e=>{a=Bt(o,e)})),s.body=a||o}else s.body=!1;return s}async onRequest(e,t){let s=new URL(e.url,"http://example.com").pathname;s=s.slice(s.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(e)&&(i.headers["Access-Control-Allow-Origin"]="*"===this.opts.origin?"*":e.headers.origin),"favicon.ico"===s)return t(qt.serve404Page(i));if("OPTIONS"===e.method)return this.isOriginAllowed(e)?t(qt.serveOptionsRequest(e,i)):t(qt.serveMethodNotAllowed(i));const n=async()=>{this.pendingReady.delete(n);const e=await r();t(e)},r=async()=>{if(""===s)return qt.serveIndexPage(i,this.client.torrents,this.pathname);let[t,...n]=s.split("/");n=decodeURI(n.join("/"));const r=await this.client.get(t);if(!t||!r)return qt.serve404Page(i);if(!n)return qt.serveTorrentPage(r,i,this.pathname);const o=r.files.find((e=>e.path.replace(/\\/g,"/")===n));return o?qt.serveFile(o,e,i):qt.serve404Page(i)};if("GET"===e.method||"HEAD"===e.method){if(this.client.ready){const e=await r();return t(e)}return this.pendingReady.add(n),void this.client.once("ready",n)}return t(qt.serveMethodNotAllowed(i))}close(e=()=>{}){this.closed=!0,this.pendingReady.forEach((e=>{this.client.removeListener("ready",e)})),this.pendingReady.clear(),y(e)}destroy(e=()=>{}){this.closed?y(e):this.close(e),this.client=null}}class Wt extends qt{constructor(e,t){super(e,t),this.server=Ft.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=t?.pathname||"/webtorrent"}wrapRequest(e,t){return this.opts.hostname&&e.headers.host!==`${this.opts.hostname}:${this.server.address().port}`?e.destroy():new URL(e.url,"http://example.com").pathname.startsWith(this.pathname)?void this.onRequest(e,(({status:e,headers:s,body:i})=>{t.writeHead(e,s),i?._readableState||i?._writableState?Bt(i,t):t.end(i)})):e.destroy()}onConnection(e){e.setTimeout(36e6),this.sockets.add(e),e.once("close",(()=>{this.sockets.delete(e)}))}address(){return this.server.address()}listen(...e){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,e)}close(e=()=>{}){this.server.removeAllListeners("connection"),this.server.removeAllListeners("request"),this.server.removeAllListeners("listening"),super.close(),this._close.call(this.server,e)}destroy(e){this.sockets.forEach((e=>{e.destroy()})),super.destroy(e)}}class $t extends qt{constructor(e,t){super(e,t),this.registration=t.controller,this.workerKeepAliveInterval=null,this.workerPortCount=0;const s=new URL(t.controller.scope);this.pathname=s.pathname+"webtorrent",this._address={port:s.port,family:"IPv4",address:s.hostname},this.boundHandler=this.wrapRequest.bind(this),navigator.serviceWorker.addEventListener("message",this.boundHandler),fetch(`${this.pathname}/cancel/`).then((e=>{e.body.cancel()}))}wrapRequest(e){const t=e.data;if("webtorrent"===!t?.type||!t.url)return null;const[s]=e.ports;this.onRequest(t,(({status:e,headers:t,body:i})=>{const n=i[Symbol.asyncIterator]?.(),r=()=>{s.onmessage=null,i?.destroy&&i.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};s.onmessage=async e=>{if(e.data){let e;try{e=(await n.next()).value}catch(e){}s.postMessage(e),e||r(),this.workerKeepAliveInterval||(this.workerKeepAliveInterval=setInterval((()=>fetch(`${this.pathname}/keepalive/`)),2e4))}else r()},this.workerPortCount++,s.postMessage({status:e,headers:t,body:n?"STREAM":i})}))}listen(e,t){t()}address(){return this._address}close(e){navigator.serviceWorker.removeEventListener("message",this.boundHandler),super.close(e)}destroy(e){super.destroy(e)}}function zt(e,t){return`\n \n \n \n \n ${e}\n \n \n ${t}\n \n \n `}function Vt(e){return encodeURIComponent(e).replace(/['()]/g,escape).replace(/\*/g,"%2A").replace(/%(?:7C|60|5E)/g,unescape)}const Gt=A("webtorrent"),Kt=mt.replace(/\d*./g,(e=>("0"+e%100).slice(-2))).slice(0,4),Yt=`-WW${Kt}-`;class Jt extends r{constructor(e={}){super(),"string"==typeof e.peerId?this.peerId=e.peerId:ArrayBuffer.isView(e.peerId)?this.peerId=(0,w.V5)(e.peerId):this.peerId=(0,w.V5)((0,w.L0)(Yt+(0,w.NJ)((0,w.po)(9)))),this.peerIdBuffer=(0,w.fk)(this.peerId),"string"==typeof e.nodeId?this.nodeId=e.nodeId:ArrayBuffer.isView(e.nodeId)?this.nodeId=(0,w.V5)(e.nodeId):this.nodeId=(0,w.V5)((0,w.po)(20)),this.nodeIdBuffer=(0,w.fk)(this.nodeId),this._debugId=this.peerId.substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=e.torrentPort||0,this.dhtPort=e.dhtPort||0,this.tracker=void 0!==e.tracker?e.tracker:{},this.lsd=!1!==e.lsd,this.utPex=!1!==e.utPex,this.natUpnp=e.natUpnp??!0,this.natPmp=e.natPmp??!0,this.torrents=[],this.maxConns=Number(e.maxConns)||55,this.utp=Jt.UTP_SUPPORT&&!1!==e.utp,this.seedOutgoingConnections=e.seedOutgoingConnections??!0,this._downloadLimit=Math.max("number"==typeof e.downloadLimit?e.downloadLimit:-1,-1),this._uploadLimit=Math.max("number"==typeof e.uploadLimit?e.uploadLimit:-1,-1),(this.natUpnp||this.natPmp)&&"function"==typeof ie&&(this.natTraversal=new ie({enableUPNP:this.natUpnp,enablePMP:this.natPmp,upnpPermanentFallback:"permanent"===e.natUpnp})),!0===e.secure&&Promise.resolve().then(n.bind(n,5658)).then((({enableSecure:e})=>e())),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new se.ThrottleGroup({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new se.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 ne?this._connPool=new ne(this):y((()=>{this._onListening()})),this._downloadSpeed=te(),this._uploadSpeed=te(),!1!==e.dht&&"function"==typeof I.Client?(this.dht=new I.Client(Object.assign({},{nodeId:this.nodeId},e.dht)),this.dht.once("error",(e=>{this._destroy(e)})),this.dht.once("listening",(()=>{const e=this.dht.address();e&&(this.dhtPort=e.port,this.natTraversal&&this.natTraversal.map({publicPort:this.dhtPort,privatePort:this.dhtPort,protocol:"udp",description:"WebTorrent DHT"}).catch((e=>{Gt("error mapping DHT port via UPnP/PMP: %o",e)})))})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==e.webSeeds;const t=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof L&&null!=e.blocklist?L(e.blocklist,{headers:{"user-agent":`WebTorrent/${mt} (https://webtorrent.io)`}},((e,s)=>{if(e)return console.error(`Failed to load blocklist: ${e.message}`);this.blocked=s,t()})):y(t)}createServer(e,t){if(this.destroyed)throw new Error("torrent is destroyed");if(this._server)throw new Error("server already created");if("undefined"!=typeof window&&"node"!==t||"browser"===t){if(!(e?.controller instanceof ServiceWorkerRegistration))throw new Error("Invalid worker registration");if("activated"!==e.controller.active.state)throw new Error("Worker isn't activated");return this._server=new $t(this,e),this._server}return this._server=new Wt(this,e),this._server}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter((e=>1!==e.progress));return e.reduce(((e,t)=>e+t.downloaded),0)/(e.reduce(((e,t)=>e+(t.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((e,t)=>e+t.uploaded),0)/(this.torrents.reduce(((e,t)=>e+t.received),0)||1)}async get(e){if(e instanceof Nt){if(this.torrents.includes(e))return e}else{const t=this.torrents;let s;try{s=await q(e)}catch(e){}if(!s)return null;if(!s.infoHash)throw new Error("Invalid torrent identifier");for(const e of t)if(e.infoHash===s.infoHash)return e}return null}add(e,t={},s=()=>{}){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,s]=[{},t]);const i=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===r.infoHash&&e!==r)return r._destroy(new Error(`Cannot add duplicate torrent ${r.infoHash}`)),void s(e)},n=()=>{this.destroyed||(s(r),this.emit("torrent",r))};this._debug("add"),t=t?Object.assign({},t):{};const r=new Nt(e,this,t);return this.torrents.push(r),r.once("_infoHash",i),r.once("ready",n),r.once("close",(function e(){r.removeListener("_infoHash",i),r.removeListener("ready",n),r.removeListener("close",e)})),this.emit("add",r),r}seed(e,t,s){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,s]=[{},t]),this._debug("seed"),(t=t?Object.assign({},t):{}).skipVerify=!0;const i="string"==typeof e;i&&(t.path=function(e){if(o(e),0===e.length)return".";let t=e.charCodeAt(0);const s=47===t;let i=-1,n=!0;for(let s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),47===t){if(!n){i=s;break}}else n=!1;return-1===i?s?"/":".":s&&1===i?"//":e.slice(0,i)}(e)),t.createdBy||(t.createdBy=`WebTorrent/${Kt}`);const n=e=>{this._debug("on seed"),"function"==typeof s&&s(e),e.emit("seed"),this.emit("seed",e)},r=this.add(null,t,(e=>{const s=[s=>{if(i||t.preloadedStore)return s();e.load(a,s)}];this.dht&&s.push((t=>{e.once("dhtAnnounce",t)})),g(s,(t=>{if(!this.destroyed)return t?e._destroy(t):void n(e)}))}));let a;var h;return h=e,"undefined"!=typeof FileList&&h instanceof FileList?e=Array.from(e):Array.isArray(e)||(e=[e]),g(e.map((e=>async s=>{if(!t.preloadedStore&&function(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}(e)){const t=[];try{for await(const s of e)t.push(s)}catch(e){return s(e)}const i=(0,w.xW)(t);i.name=e.name,s(null,i)}else s(null,e)})),((e,i)=>{if(!this.destroyed)return e?r._destroy(e):void function(e,t,s){"function"==typeof t&&([t,s]=[s,t]),x(e,t=t?Object.assign({},t):{},s)}(i,t,((e,n)=>{if(!this.destroyed){if(e)return r._destroy(e);a=n.map((e=>e.getStream)),T(i,t,(async(e,t)=>{if(this.destroyed)return;if(e)return r._destroy(e);const i=await this.get(t);i?(console.warn("A torrent with the same id is already being seeded"),r._destroy(),"function"==typeof s&&s(i)):r._onTorrentId(t)}))}}))})),r}async remove(e,t,s){if("function"==typeof t)return this.remove(e,null,t);this._debug("remove");const i=await this.get(e);if(!i)throw new Error(`No torrent with id ${e}`);this._remove(i,t,s)}_remove(e,t,s){if(!e)return;if("function"==typeof t)return this._remove(e,null,t);const i=this.torrents.indexOf(e);-1!==i&&(this.torrents.splice(i,1),e.destroy(t,s),this.dht&&this.dht._tables.remove(e.infoHash),this.emit("remove",e))}address(){return this.listening?this._connPool?this._connPool.tcpServer.address():{address:"0.0.0.0",family:"IPv4",port:0}:null}throttleDownload(e){return e=Number(e),!(isNaN(e)||!isFinite(e)||e<-1)&&(this._downloadLimit=e,this._downloadLimit<0?this.throttleGroups.down.setEnabled(!1):(this.throttleGroups.down.setEnabled(!0),void this.throttleGroups.down.setRate(this._downloadLimit)))}throttleUpload(e){return e=Number(e),!(isNaN(e)||!isFinite(e)||e<-1)&&(this._uploadLimit=e,this._uploadLimit<0?this.throttleGroups.up.setEnabled(!1):(this.throttleGroups.up.setEnabled(!0),void this.throttleGroups.up.setRate(this._uploadLimit)))}destroy(e){if(this.destroyed)throw new Error("client already destroyed");this._destroy(null,e)}_destroy(e,t){this._debug("client destroy"),this.destroyed=!0;const s=this.torrents.map((e=>t=>{e.destroy(t)}));this._connPool&&s.push((e=>{this._connPool.destroy(e)})),this.dht&&s.push((e=>{this.dht.destroy(e)})),this._server&&s.push((e=>{this._server.destroy(e)})),this.natTraversal&&s.push((e=>{this.natTraversal.destroy().then((()=>e()))})),g(s,t),e&&this.emit("error",e),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 e=this._connPool.tcpServer.address();e&&(this.torrentPort=e.port,this.natTraversal&&this.natTraversal.map({publicPort:this.torrentPort,privatePort:this.torrentPort,protocol:this.utp?null:"tcp",description:"WebTorrent Torrent"}).catch((e=>{Gt("error mapping WebTorrent port via UPnP/PMP: %o",e)})))}this.emit("listening")}_debug(){const e=[].slice.call(arguments);e[0]=`[${this._debugId}] ${e[0]}`,Gt(...e)}async _getByHash(e){for(const t of this.torrents)if(t.infoHashHash||(t.infoHashHash=await(0,w.tW)((0,w.fk)("72657132"+t.infoHash),"hex")),e===t.infoHashHash)return t;return null}}Jt.WEBRTC_SUPPORT=ee.WEBRTC_SUPPORT,Jt.UTP_SUPPORT=ne.UTP_SUPPORT,Jt.VERSION=mt;export{Jt as default}; //# sourceMappingURL=webtorrent.min.js.map \ No newline at end of file diff --git a/package.json b/package.json index 2b160e69e2..a4bc8cd3ed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "webtorrent", "description": "Streaming torrent client", - "version": "2.6.2", + "version": "2.6.3", "author": { "name": "WebTorrent LLC", "email": "feross@webtorrent.io", @@ -70,7 +70,7 @@ "speed-limiter": "^1.0.2", "streamx": "2.22.0", "throughput": "^1.0.1", - "torrent-discovery": "^11.0.15", + "torrent-discovery": "^11.0.16", "torrent-piece": "^3.0.1", "uint8-util": "^2.2.5", "unordered-array-remove": "^1.0.2",