Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2019-07-30 23:28:36 +0300
committerFeross Aboukhadijeh <feross@feross.org>2019-07-30 23:28:36 +0300
commitaa2c489195c267b8825cec2b69bc93137cdda474 (patch)
treef9fc660ba1c084f975e789d35f6eebae75a65812 /webtorrent.min.js
parentc7095965cbaa86227b1cd1f6626593b3692fe1ec (diff)
build
Diffstat (limited to 'webtorrent.min.js')
-rw-r--r--webtorrent.min.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/webtorrent.min.js b/webtorrent.min.js
index 38636ae..c1b739f 100644
--- a/webtorrent.min.js
+++ b/webtorrent.min.js
@@ -8,4 +8,4 @@
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
- */t.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},{}],70:[function(e,t){'use strict';function n(e){return r.existsSync(e)&&r.statSync(e).isFile()}var r=e("fs");t.exports=function(e,t){return t?void r.stat(e,function(e,n){return e?t(e):t(null,n.isFile())}):n(e)},t.exports.sync=n},{fs:34}],71:[function(e,t){function n(e){return r(e)||o(e)}function r(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return i[a.call(e)]}t.exports=n,n.strict=r,n.loose=o;var a=Object.prototype.toString,i={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},{}],72:[function(e,t){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},{}],73:[function(e,t,n){'use strict';n.re=()=>{throw new Error("`junk.re` was renamed to `junk.regex`")},n.regex=new RegExp(["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^Desktop\\.ini$","@eaDir$"].join("|")),n.is=e=>n.regex.test(e),n.not=e=>!n.is(e),n.default=t.exports},{}],74:[function(e,t){(function(n){function r(e){const t={},r=e.split("magnet:?")[1],i=r&&0<=r.length?r.split("&"):[];i.forEach(e=>{const n=e.split("=");if(2!==n.length)return;const r=n[0];let o=n[1];if("dn"===r&&(o=decodeURIComponent(o).replace(/\+/g," ")),("tr"===r||"xs"===r||"as"===r||"ws"===r)&&(o=decodeURIComponent(o)),"kt"===r&&(o=decodeURIComponent(o).split("+")),"ix"===r&&(o=+o),!t[r])t[r]=o;else if(Array.isArray(t[r]))t[r].push(o);else{const e=t[r];t[r]=[e,o]}});let s;if(t.xt){const e=Array.isArray(t.xt)?t.xt:[t.xt];e.forEach(e=>{if(s=e.match(/^urn:btih:(.{40})/))t.infoHash=s[1].toLowerCase();else if(s=e.match(/^urn:btih:(.{32})/)){const e=o.decode(s[1]);t.infoHash=n.from(e,"binary").toString("hex")}})}return t.infoHash&&(t.infoHashBuffer=n.from(t.infoHash,"hex")),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce="string"==typeof t.tr?[t.tr]:Array.isArray(t.tr)?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)),a(t.announce),a(t.urlList),t}t.exports=r,t.exports.decode=r,t.exports.encode=function(e){e=Object.assign({},e),e.infoHashBuffer&&(e.xt=`urn:btih:${e.infoHashBuffer.toString("hex")}`),e.infoHash&&(e.xt=`urn:btih:${e.infoHash}`),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);let t="magnet:?";return Object.keys(e).filter(e=>2===e.length).forEach((n,r)=>{const o=Array.isArray(e[n])?e[n]:[e[n]];o.forEach((e,o)=>{(0<r||0<o)&&("kt"!==n||0===o)&&(t+="&"),"dn"===n&&(e=encodeURIComponent(e).replace(/%20/g,"+")),("tr"===n||"xs"===n||"as"===n||"ws"===n)&&(e=encodeURIComponent(e)),"kt"===n&&(e=encodeURIComponent(e)),t+="kt"===n&&0<o?`+${e}`:`${n}=${e}`})}),t};const o=e("thirty-two"),a=e("uniq")}).call(this,e("buffer").Buffer)},{buffer:39,"thirty-two":172,uniq:182}],75:[function(e,t){function n(e,t){var r=this;if(!(r instanceof n))return new n(e,t);if(!d)throw new Error("web browser lacks MediaSource support");t||(t={}),r._debug=t.debug,r._bufferDuration=t.bufferDuration||60,r._elem=e,r._mediaSource=new d,r._streams=[],r.detailedError=null,r._errorHandler=function(){r._elem.removeEventListener("error",r._errorHandler);var e=r._streams.slice();e.forEach(function(e){e.destroy(r._elem.error)})},r._elem.addEventListener("error",r._errorHandler),r._elem.src=window.URL.createObjectURL(r._mediaSource)}function r(e,t){var n=this;if(i.Writable.call(n),n._wrapper=e,n._elem=e._elem,n._mediaSource=e._mediaSource,n._allStreams=e._streams,n._allStreams.push(n),n._bufferDuration=e._bufferDuration,n._sourceBuffer=null,n._debugBuffers=[],n._openHandler=function(){n._onSourceOpen()},n._flowHandler=function(){n._flow()},n._errorHandler=function(e){n.destroyed||n.emit("error",e)},"string"==typeof t)n._type=t,"open"===n._mediaSource.readyState?n._createSourceBuffer():n._mediaSource.addEventListener("sourceopen",n._openHandler);else if(null===t._sourceBuffer)t.destroy(),n._type=t._type,n._mediaSource.addEventListener("sourceopen",n._openHandler);else if(t._sourceBuffer)t.destroy(),n._type=t._type,n._sourceBuffer=t._sourceBuffer,n._debugBuffers=t._debugBuffers,n._sourceBuffer.addEventListener("updateend",n._flowHandler),n._sourceBuffer.addEventListener("error",n._errorHandler);else throw new Error("The argument to MediaElementWrapper.createWriteStream must be a string or a previous stream returned from that function");n._elem.addEventListener("timeupdate",n._flowHandler),n.on("error",function(e){n._wrapper.error(e)}),n.on("finish",function(){if(!n.destroyed&&(n._finished=!0,n._allStreams.every(function(e){return e._finished}))){n._wrapper._dumpDebugData();try{n._mediaSource.endOfStream()}catch(e){}}})}function o(e,t){var n=document.createElement("a");n.href=window.URL.createObjectURL(new window.Blob(e)),n.download=t,n.click()}t.exports=n;var a=e("inherits"),i=e("readable-stream"),s=e("to-arraybuffer"),d="undefined"!=typeof window&&window.MediaSource;n.prototype.createWriteStream=function(e){var t=this;return new r(t,e)},n.prototype.error=function(e){var t=this;t.detailedError||(t.detailedError=e),t._dumpDebugData();try{t._mediaSource.endOfStream("decode")}catch(e){}try{window.URL.revokeObjectURL(t._elem.src)}catch(e){}},n.prototype._dumpDebugData=function(){var e=this;e._debug&&(e._debug=!1,e._streams.forEach(function(e,t){o(e._debugBuffers,"mediasource-stream-"+t)}))},a(r,i.Writable),r.prototype._onSourceOpen=function(){var e=this;e.destroyed||(e._mediaSource.removeEventListener("sourceopen",e._openHandler),e._createSourceBuffer())},r.prototype.destroy=function(e){var t=this;t.destroyed||(t.destroyed=!0,t._allStreams.splice(t._allStreams.indexOf(t),1),t._mediaSource.removeEventListener("sourceopen",t._openHandler),t._elem.removeEventListener("timeupdate",t._flowHandler),t._sourceBuffer&&(t._sourceBuffer.removeEventListener("updateend",t._flowHandler),t._sourceBuffer.removeEventListener("error",t._errorHandler),"open"===t._mediaSource.readyState&&t._sourceBuffer.abort()),e&&t.emit("error",e),t.emit("close"))},r.prototype._createSourceBuffer=function(){var e=this;if(!e.destroyed)if(!d.isTypeSupported(e._type))e.destroy(new Error("The provided type is not supported"));else if(e._sourceBuffer=e._mediaSource.addSourceBuffer(e._type),e._sourceBuffer.addEventListener("updateend",e._flowHandler),e._sourceBuffer.addEventListener("error",e._errorHandler),e._cb){var t=e._cb;e._cb=null,t()}},r.prototype._write=function(e,t,n){var r=this;if(!r.destroyed){if(!r._sourceBuffer)return void(r._cb=function(o){return o?n(o):void r._write(e,t,n)});if(r._sourceBuffer.updating)return n(new Error("Cannot append buffer while source buffer updating"));var o=s(e);r._wrapper._debug&&r._debugBuffers.push(o);try{r._sourceBuffer.appendBuffer(o)}catch(e){return void r.destroy(e)}r._cb=n}},r.prototype._flow=function(){var e=this;if(!(e.destroyed||!e._sourceBuffer||e._sourceBuffer.updating)&&!("open"===e._mediaSource.readyState&&e._getBufferDuration()>e._bufferDuration)&&e._cb){var t=e._cb;e._cb=null,t()}};r.prototype._getBufferDuration=function(){for(var e=this,t=e._sourceBuffer.buffered,n=e._elem.currentTime,r=-1,o=0;o<t.length;o++){var a=t.start(o),s=t.end(o)+0;if(a>n)break;else(0<=r||n<=s)&&(r=s)}var d=r-n;return 0>d&&(d=0),d}},{inherits:67,"readable-stream":115,"to-arraybuffer":175}],76:[function(e,t){(function(e){function n(e,t){if(!(this instanceof n))return new n(e,t);if(t||(t={}),this.chunkLength=+e,!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=+t.length||1/0,this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=a(this.length/this.chunkLength)-1)}function r(t,n,r){e.nextTick(function(){t&&t(n,r)})}t.exports=n,n.prototype.put=function(e,t,n){if(this.closed)return r(n,new Error("Storage is closed"));var o=e===this.lastChunkIndex;return o&&t.length!==this.lastChunkLength?r(n,new Error("Last chunk length must be "+this.lastChunkLength)):o||t.length===this.chunkLength?void(this.chunks[e]=t,r(n,null)):r(n,new Error("Chunk length must be "+this.chunkLength))},n.prototype.get=function(e,t,n){if("function"==typeof t)return this.get(e,null,t);if(this.closed)return r(n,new Error("Storage is closed"));var o=this.chunks[e];if(!o){var a=new Error("Chunk not found");return a.notFound=!0,r(n,a)}if(!t)return r(n,null,o);var i=t.offset||0,s=t.length||o.length-i;r(n,null,o.slice(i,s+i))},n.prototype.close=n.prototype.destroy=function(e){return this.closed?r(e,new Error("Storage is closed")):void(this.closed=!0,this.chunks=null,r(e,null))}}).call(this,e("_process"))},{_process:92}],77:[function(e,t,n){function o(e,t,n){for(var r=t;r<n;r++)e[r]=0}function a(e,t,n){t.writeUInt32BE(r((e.getTime()+2082844800000)/1e3),n)}function i(e,t,n){t.writeUIntBE(r((e.getTime()+2082844800000)/1e3),n,6)}function s(e,t,n){t.writeUInt16BE(r(e)%65536,n),t.writeUInt16BE(r(256*(256*e))%65536,n+2)}function l(e,t,n){t[n]=r(e)%256,t[n+1]=r(256*e)%256}function c(e,t,n){e||(e=[0,0,0,0,0,0,0,0,0]);for(var r=0;r<e.length;r++)s(e[r],t,n+4*r)}function u(e,t,n){var r=k(e,"utf8");r.copy(t,n),t[n+r.length]=0}function p(e){for(var t=Array(e.length/4),n=0;n<t.length;n++)t[n]=m(e,4*n);return t}function f(e,t){return new Date(1e3*e.readUIntBE(t,6)-2082844800000)}function h(e,t){return new Date(1e3*e.readUInt32BE(t)-2082844800000)}function m(e,t){return e.readUInt16BE(t)+e.readUInt16BE(t+2)/65536}function g(e,t){return e[t]+e[t+1]/256}function _(e,t,n){var r;for(r=0;r<n&&!(0===e[t+r]);r++);return e.toString("utf8",t,t+r)}var b=e("./index"),y=e("./descriptor"),w=e("buffer-alloc"),k=e("buffer-from"),x=e("uint64be");n.fullBoxes={};["mvhd","tkhd","mdhd","vmhd","smhd","stsd","esds","stsz","stco","co64","stss","stts","ctts","stsc","dref","elst","hdlr","mehd","trex","mfhd","tfhd","tfdt","trun"].forEach(function(e){n.fullBoxes[e]=!0}),n.ftyp={},n.ftyp.encode=function(e,t,r){t=t?t.slice(r):w(n.ftyp.encodingLength(e));var o=e.compatibleBrands||[];t.write(e.brand,0,4,"ascii"),t.writeUInt32BE(e.brandVersion,4);for(var a=0;a<o.length;a++)t.write(o[a],8+4*a,4,"ascii");return n.ftyp.encode.bytes=8+4*o.length,t},n.ftyp.decode=function(e,t){e=e.slice(t);for(var n=e.toString("ascii",0,4),r=e.readUInt32BE(4),o=[],a=8;a<e.length;a+=4)o.push(e.toString("ascii",a,a+4));return{brand:n,brandVersion:r,compatibleBrands:o}},n.ftyp.encodingLength=function(e){return 8+4*(e.compatibleBrands||[]).length},n.mvhd={},n.mvhd.encode=function(e,t,r){return t=t?t.slice(r):w(96),a(e.ctime||new Date,t,0),a(e.mtime||new Date,t,4),t.writeUInt32BE(e.timeScale||0,8),t.writeUInt32BE(e.duration||0,12),s(e.preferredRate||0,t,16),l(e.preferredVolume||0,t,20),o(t,22,32),c(e.matrix,t,32),t.writeUInt32BE(e.previewTime||0,68),t.writeUInt32BE(e.previewDuration||0,72),t.writeUInt32BE(e.posterTime||0,76),t.writeUInt32BE(e.selectionTime||0,80),t.writeUInt32BE(e.selectionDuration||0,84),t.writeUInt32BE(e.currentTime||0,88),t.writeUInt32BE(e.nextTrackId||0,92),n.mvhd.encode.bytes=96,t},n.mvhd.decode=function(e,t){return e=e.slice(t),{ctime:h(e,0),mtime:h(e,4),timeScale:e.readUInt32BE(8),duration:e.readUInt32BE(12),preferredRate:m(e,16),preferredVolume:g(e,20),matrix:p(e.slice(32,68)),previewTime:e.readUInt32BE(68),previewDuration:e.readUInt32BE(72),posterTime:e.readUInt32BE(76),selectionTime:e.readUInt32BE(80),selectionDuration:e.readUInt32BE(84),currentTime:e.readUInt32BE(88),nextTrackId:e.readUInt32BE(92)}},n.mvhd.encodingLength=function(){return 96},n.tkhd={},n.tkhd.encode=function(e,t,r){return t=t?t.slice(r):w(80),a(e.ctime||new Date,t,0),a(e.mtime||new Date,t,4),t.writeUInt32BE(e.trackId||0,8),o(t,12,16),t.writeUInt32BE(e.duration||0,16),o(t,20,28),t.writeUInt16BE(e.layer||0,28),t.writeUInt16BE(e.alternateGroup||0,30),t.writeUInt16BE(e.volume||0,32),c(e.matrix,t,36),t.writeUInt32BE(e.trackWidth||0,72),t.writeUInt32BE(e.trackHeight||0,76),n.tkhd.encode.bytes=80,t},n.tkhd.decode=function(e,t){return e=e.slice(t),{ctime:h(e,0),mtime:h(e,4),trackId:e.readUInt32BE(8),duration:e.readUInt32BE(16),layer:e.readUInt16BE(28),alternateGroup:e.readUInt16BE(30),volume:e.readUInt16BE(32),matrix:p(e.slice(36,72)),trackWidth:e.readUInt32BE(72),trackHeight:e.readUInt32BE(76)}},n.tkhd.encodingLength=function(){return 80},n.mdhd={},n.mdhd.encode=function(e,t,r){return 1===e.version?(t=t?t.slice(r):w(32),i(e.ctime||new Date,t,0),i(e.mtime||new Date,t,8),t.writeUInt32BE(e.timeScale||0,16),t.writeUIntBE(e.duration||0,20,6),t.writeUInt16BE(e.language||0,28),t.writeUInt16BE(e.quality||0,30),n.mdhd.encode.bytes=32,t):(t=t?t.slice(r):w(20),a(e.ctime||new Date,t,0),a(e.mtime||new Date,t,4),t.writeUInt32BE(e.timeScale||0,8),t.writeUInt32BE(e.duration||0,12),t.writeUInt16BE(e.language||0,16),t.writeUInt16BE(e.quality||0,18),n.mdhd.encode.bytes=20,t)},n.mdhd.decode=function(e,t,n){e=e.slice(t);return 20!=n-t?{ctime:f(e,0),mtime:f(e,8),timeScale:e.readUInt32BE(16),duration:e.readUIntBE(20,6),language:e.readUInt16BE(28),quality:e.readUInt16BE(30)}:{ctime:h(e,0),mtime:h(e,4),timeScale:e.readUInt32BE(8),duration:e.readUInt32BE(12),language:e.readUInt16BE(16),quality:e.readUInt16BE(18)}},n.mdhd.encodingLength=function(e){return 1===e.version?32:20},n.vmhd={},n.vmhd.encode=function(e,t,r){t=t?t.slice(r):w(8),t.writeUInt16BE(e.graphicsMode||0,0);var o=e.opcolor||[0,0,0];return t.writeUInt16BE(o[0],2),t.writeUInt16BE(o[1],4),t.writeUInt16BE(o[2],6),n.vmhd.encode.bytes=8,t},n.vmhd.decode=function(e,t){return e=e.slice(t),{graphicsMode:e.readUInt16BE(0),opcolor:[e.readUInt16BE(2),e.readUInt16BE(4),e.readUInt16BE(6)]}},n.vmhd.encodingLength=function(){return 8},n.smhd={},n.smhd.encode=function(e,t,r){return t=t?t.slice(r):w(4),t.writeUInt16BE(e.balance||0,0),o(t,2,4),n.smhd.encode.bytes=4,t},n.smhd.decode=function(e,t){return e=e.slice(t),{balance:e.readUInt16BE(0)}},n.smhd.encodingLength=function(){return 4},n.stsd={},n.stsd.encode=function(e,t,r){t=t?t.slice(r):w(n.stsd.encodingLength(e));var o=e.entries||[];t.writeUInt32BE(o.length,0);for(var a=4,s=0,d;s<o.length;s++)d=o[s],b.encode(d,t,a),a+=b.encode.bytes;return n.stsd.encode.bytes=a,t},n.stsd.decode=function(e,t,n){e=e.slice(t);for(var r=e.readUInt32BE(0),o=Array(r),a=4,s=0,d;s<r;s++)d=b.decode(e,a,n),o[s]=d,a+=d.length;return{entries:o}},n.stsd.encodingLength=function(e){var t=4;if(!e.entries)return t;for(var n=0;n<e.entries.length;n++)t+=b.encodingLength(e.entries[n]);return t},n.avc1=n.VisualSampleEntry={},n.VisualSampleEntry.encode=function(e,t,r){t=t?t.slice(r):w(n.VisualSampleEntry.encodingLength(e)),o(t,0,6),t.writeUInt16BE(e.dataReferenceIndex||0,6),o(t,8,24),t.writeUInt16BE(e.width||0,24),t.writeUInt16BE(e.height||0,26),t.writeUInt32BE(e.hResolution||4718592,28),t.writeUInt32BE(e.vResolution||4718592,32),o(t,36,40),t.writeUInt16BE(e.frameCount||1,40);var a=e.compressorName||"",i=d(a.length,31);t.writeUInt8(i,42),t.write(a,43,i,"utf8"),t.writeUInt16BE(e.depth||24,74),t.writeInt16BE(-1,76);var s=78,l=e.children||[];l.forEach(function(e){b.encode(e,t,s),s+=b.encode.bytes}),n.VisualSampleEntry.encode.bytes=s},n.VisualSampleEntry.decode=function(e,t,n){e=e.slice(t);for(var r=n-t,o=d(e.readUInt8(42),31),a={dataReferenceIndex:e.readUInt16BE(6),width:e.readUInt16BE(24),height:e.readUInt16BE(26),hResolution:e.readUInt32BE(28),vResolution:e.readUInt32BE(32),frameCount:e.readUInt16BE(40),compressorName:e.toString("utf8",43,43+o),depth:e.readUInt16BE(74),children:[]},i=78;8<=r-i;){var s=b.decode(e,i,r);a.children.push(s),a[s.type]=s,i+=s.length}return a},n.VisualSampleEntry.encodingLength=function(e){var t=78,n=e.children||[];return n.forEach(function(e){t+=b.encodingLength(e)}),t},n.avcC={},n.avcC.encode=function(e,t,r){t=t?t.slice(r):w(e.buffer.length),e.buffer.copy(t),n.avcC.encode.bytes=e.buffer.length},n.avcC.decode=function(e,t,n){return e=e.slice(t,n),{mimeCodec:e.toString("hex",1,4),buffer:k(e)}},n.avcC.encodingLength=function(e){return e.buffer.length},n.mp4a=n.AudioSampleEntry={},n.AudioSampleEntry.encode=function(e,t,r){t=t?t.slice(r):w(n.AudioSampleEntry.encodingLength(e)),o(t,0,6),t.writeUInt16BE(e.dataReferenceIndex||0,6),o(t,8,16),t.writeUInt16BE(e.channelCount||2,16),t.writeUInt16BE(e.sampleSize||16,18),o(t,20,24),t.writeUInt32BE(e.sampleRate||0,24);var a=28,i=e.children||[];i.forEach(function(e){b.encode(e,t,a),a+=b.encode.bytes}),n.AudioSampleEntry.encode.bytes=a},n.AudioSampleEntry.decode=function(e,t,n){e=e.slice(t,n);for(var r=n-t,o={dataReferenceIndex:e.readUInt16BE(6),channelCount:e.readUInt16BE(16),sampleSize:e.readUInt16BE(18),sampleRate:e.readUInt32BE(24),children:[]},a=28;8<=r-a;){var i=b.decode(e,a,r);o.children.push(i),o[i.type]=i,a+=i.length}return o},n.AudioSampleEntry.encodingLength=function(e){var t=28,n=e.children||[];return n.forEach(function(e){t+=b.encodingLength(e)}),t},n.esds={},n.esds.encode=function(e,t,r){t=t?t.slice(r):w(e.buffer.length),e.buffer.copy(t,0),n.esds.encode.bytes=e.buffer.length},n.esds.decode=function(e,t,n){e=e.slice(t,n);var r=y.Descriptor.decode(e,0,e.length),o="ESDescriptor"===r.tagName?r:{},a=o.DecoderConfigDescriptor||{},i=a.oti||0,s=a.DecoderSpecificInfo,d=s?(248&s.buffer.readUInt8(0))>>3:0,l=null;return i&&(l=i.toString(16),d&&(l+="."+d)),{mimeCodec:l,buffer:k(e.slice(0))}},n.esds.encodingLength=function(e){return e.buffer.length},n.stsz={},n.stsz.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.stsz.encodingLength(e)),t.writeUInt32BE(0,0),t.writeUInt32BE(o.length,4);for(var a=0;a<o.length;a++)t.writeUInt32BE(o[a],4*a+8);return n.stsz.encode.bytes=8+4*o.length,t},n.stsz.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=e.readUInt32BE(4),o=Array(r),a=0;a<r;a++)o[a]=0===n?e.readUInt32BE(4*a+8):n;return{entries:o}},n.stsz.encodingLength=function(e){return 8+4*e.entries.length},n.stss=n.stco={},n.stco.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.stco.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0;a<o.length;a++)t.writeUInt32BE(o[a],4*a+4);return n.stco.encode.bytes=4+4*o.length,t},n.stco.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0;o<n;o++)r[o]=e.readUInt32BE(4*o+4);return{entries:r}},n.stco.encodingLength=function(e){return 4+4*e.entries.length},n.co64={},n.co64.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.co64.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0;a<o.length;a++)x.encode(o[a],t,8*a+4);return n.co64.encode.bytes=4+8*o.length,t},n.co64.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0;o<n;o++)r[o]=x.decode(e,8*o+4);return{entries:r}},n.co64.encodingLength=function(e){return 4+8*e.entries.length},n.stts={},n.stts.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.stts.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0,s;a<o.length;a++)s=8*a+4,t.writeUInt32BE(o[a].count||0,s),t.writeUInt32BE(o[a].duration||0,s+4);return n.stts.encode.bytes=4+8*e.entries.length,t},n.stts.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0,a;o<n;o++)a=8*o+4,r[o]={count:e.readUInt32BE(a),duration:e.readUInt32BE(a+4)};return{entries:r}},n.stts.encodingLength=function(e){return 4+8*e.entries.length},n.ctts={},n.ctts.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.ctts.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0,s;a<o.length;a++)s=8*a+4,t.writeUInt32BE(o[a].count||0,s),t.writeUInt32BE(o[a].compositionOffset||0,s+4);return n.ctts.encode.bytes=4+8*o.length,t},n.ctts.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0,a;o<n;o++)a=8*o+4,r[o]={count:e.readUInt32BE(a),compositionOffset:e.readInt32BE(a+4)};return{entries:r}},n.ctts.encodingLength=function(e){return 4+8*e.entries.length},n.stsc={},n.stsc.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.stsc.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0,s;a<o.length;a++)s=12*a+4,t.writeUInt32BE(o[a].firstChunk||0,s),t.writeUInt32BE(o[a].samplesPerChunk||0,s+4),t.writeUInt32BE(o[a].sampleDescriptionId||0,s+8);return n.stsc.encode.bytes=4+12*o.length,t},n.stsc.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0,a;o<n;o++)a=12*o+4,r[o]={firstChunk:e.readUInt32BE(a),samplesPerChunk:e.readUInt32BE(a+4),sampleDescriptionId:e.readUInt32BE(a+8)};return{entries:r}},n.stsc.encodingLength=function(e){return 4+12*e.entries.length},n.dref={},n.dref.encode=function(e,t,r){t=t?t.slice(r):w(n.dref.encodingLength(e));var o=e.entries||[];t.writeUInt32BE(o.length,0);for(var a=4,s=0;s<o.length;s++){var d=o[s],l=(d.buf?d.buf.length:0)+4+4;t.writeUInt32BE(l,a),a+=4,t.write(d.type,a,4,"ascii"),a+=4,d.buf&&(d.buf.copy(t,a),a+=d.buf.length)}return n.dref.encode.bytes=a,t},n.dref.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=4,a=0;a<n;a++){var s=e.readUInt32BE(o),d=e.toString("ascii",o+4,o+8),l=e.slice(o+8,o+s);o+=s,r[a]={type:d,buf:l}}return{entries:r}},n.dref.encodingLength=function(e){var t=4;if(!e.entries)return t;for(var n=0,r;n<e.entries.length;n++)r=e.entries[n].buf,t+=(r?r.length:0)+4+4;return t},n.elst={},n.elst.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.elst.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0,d;a<o.length;a++)d=12*a+4,t.writeUInt32BE(o[a].trackDuration||0,d),t.writeUInt32BE(o[a].mediaTime||0,d+4),s(o[a].mediaRate||0,t,d+8);return n.elst.encode.bytes=4+12*o.length,t},n.elst.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0,a;o<n;o++)a=12*o+4,r[o]={trackDuration:e.readUInt32BE(a),mediaTime:e.readInt32BE(a+4),mediaRate:m(e,a+8)};return{entries:r}},n.elst.encodingLength=function(e){return 4+12*e.entries.length},n.hdlr={},n.hdlr.encode=function(e,t,r){t=t?t.slice(r):w(n.hdlr.encodingLength(e));var o=21+(e.name||"").length;return t.fill(0,0,o),t.write(e.handlerType||"",4,4,"ascii"),u(e.name||"",t,20),n.hdlr.encode.bytes=o,t},n.hdlr.decode=function(e,t,n){return e=e.slice(t),{handlerType:e.toString("ascii",4,8),name:_(e,20,n)}},n.hdlr.encodingLength=function(e){return 21+(e.name||"").length},n.mehd={},n.mehd.encode=function(e,t,r){return t=t?t.slice(r):w(4),t.writeUInt32BE(e.fragmentDuration||0,0),n.mehd.encode.bytes=4,t},n.mehd.decode=function(e,t){return e=e.slice(t),{fragmentDuration:e.readUInt32BE(0)}},n.mehd.encodingLength=function(){return 4},n.trex={},n.trex.encode=function(e,t,r){return t=t?t.slice(r):w(20),t.writeUInt32BE(e.trackId||0,0),t.writeUInt32BE(e.defaultSampleDescriptionIndex||0,4),t.writeUInt32BE(e.defaultSampleDuration||0,8),t.writeUInt32BE(e.defaultSampleSize||0,12),t.writeUInt32BE(e.defaultSampleFlags||0,16),n.trex.encode.bytes=20,t},n.trex.decode=function(e,t){return e=e.slice(t),{trackId:e.readUInt32BE(0),defaultSampleDescriptionIndex:e.readUInt32BE(4),defaultSampleDuration:e.readUInt32BE(8),defaultSampleSize:e.readUInt32BE(12),defaultSampleFlags:e.readUInt32BE(16)}},n.trex.encodingLength=function(){return 20},n.mfhd={},n.mfhd.encode=function(e,t,r){return t=t?t.slice(r):w(4),t.writeUInt32BE(e.sequenceNumber||0,0),n.mfhd.encode.bytes=4,t},n.mfhd.decode=function(e){return{sequenceNumber:e.readUInt32BE(0)}},n.mfhd.encodingLength=function(){return 4},n.tfhd={},n.tfhd.encode=function(e,t,r){return t=t?t.slice(r):w(4),t.writeUInt32BE(e.trackId,0),n.tfhd.encode.bytes=4,t},n.tfhd.decode=function(){},n.tfhd.encodingLength=function(){return 4},n.tfdt={},n.tfdt.encode=function(e,t,r){return t=t?t.slice(r):w(4),t.writeUInt32BE(e.baseMediaDecodeTime||0,0),n.tfdt.encode.bytes=4,t},n.tfdt.decode=function(){},n.tfdt.encodingLength=function(){return 4},n.trun={},n.trun.encode=function(e,t,r){t=t?t.slice(r):w(8+16*e.entries.length),t.writeUInt32BE(e.entries.length,0),t.writeInt32BE(e.dataOffset,4);for(var o=8,a=0,s;a<e.entries.length;a++)s=e.entries[a],t.writeUInt32BE(s.sampleDuration,o),o+=4,t.writeUInt32BE(s.sampleSize,o),o+=4,t.writeUInt32BE(s.sampleFlags,o),o+=4,0===(e.version||0)?t.writeUInt32BE(s.sampleCompositionTimeOffset,o):t.writeInt32BE(s.sampleCompositionTimeOffset,o),o+=4;n.trun.encode.bytes=o},n.trun.decode=function(){},n.trun.encodingLength=function(e){return 8+16*e.entries.length},n.mdat={},n.mdat.encode=function(e,t,r){e.buffer?(e.buffer.copy(t,r),n.mdat.encode.bytes=e.buffer.length):n.mdat.encode.bytes=n.mdat.encodingLength(e)},n.mdat.decode=function(e,t,n){return{buffer:k(e.slice(t,n))}},n.mdat.encodingLength=function(e){return e.buffer?e.buffer.length:e.contentLength}},{"./descriptor":78,"./index":79,"buffer-alloc":36,"buffer-from":38,uint64be:181}],78:[function(e,t,n){var r=e("buffer-from"),o={3:"ESDescriptor",4:"DecoderConfigDescriptor",5:"DecoderSpecificInfo",6:"SLConfigDescriptor"};n.Descriptor={},n.Descriptor.decode=function(e,t,a){var i=e.readUInt8(t),s=t+1,d=0,l;do l=e.readUInt8(s++),d=d<<7|127&l;while(128&l);var c=o[i],u;return u=n[c]?n[c].decode(e,s,a):{buffer:r(e.slice(s,s+d))},u.tag=i,u.tagName=c,u.length=s-t+d,u.contentsLen=d,u},n.DescriptorArray={},n.DescriptorArray.decode=function(e,t,r){for(var a=t,i={};a+2<=r;){var s=n.Descriptor.decode(e,a,r);a+=s.length;var d=o[s.tag]||"Descriptor"+s.tag;i[d]=s}return i},n.ESDescriptor={},n.ESDescriptor.decode=function(e,t,r){var o=e.readUInt8(t+2),a=t+3;if(128&o&&(a+=2),64&o){var i=e.readUInt8(a);a+=i+1}return 32&o&&(a+=2),n.DescriptorArray.decode(e,a,r)},n.DecoderConfigDescriptor={},n.DecoderConfigDescriptor.decode=function(e,t,r){var o=e.readUInt8(t),a=n.DescriptorArray.decode(e,t+13,r);return a.oti=o,a}},{"buffer-from":38}],79:[function(e,t,n){var r=e("uint64be"),o=e("buffer-alloc"),a=e("buffer-from"),i=e("./boxes"),s=4294967295,d=n,l=n.containers={moov:["mvhd","meta","traks","mvex"],trak:["tkhd","tref","trgr","edts","meta","mdia","udta"],edts:["elst"],mdia:["mdhd","hdlr","elng","minf"],minf:["vmhd","smhd","hmhd","sthd","nmhd","dinf","stbl"],dinf:["dref"],stbl:["stsd","stts","ctts","cslg","stsc","stsz","stz2","stco","co64","stss","stsh","padb","stdp","sdtp","sbgps","sgpds","subss","saizs","saios"],mvex:["mehd","trexs","leva"],moof:["mfhd","meta","trafs"],traf:["tfhd","tfdt","trun","sbgps","sgpds","subss","saizs","saios","meta"]};d.encode=function(e,t,n){return d.encodingLength(e),n=n||0,t=t||o(e.length),d._encode(e,t,n)},d._encode=function(e,t,n){var o=e.type,a=e.length;a>s&&(a=1),t.writeUInt32BE(a,n),t.write(e.type,n+4,4,"ascii");var c=n+8;if(1===a&&(r.encode(e.length,t,c),c+=8),i.fullBoxes[o]&&(t.writeUInt32BE(e.flags||0,c),t.writeUInt8(e.version||0,c),c+=4),l[o]){var u=l[o];u.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){d._encode(e,t,c),c+=d.encode.bytes})}else e[n]&&(d._encode(e[n],t,c),c+=d.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){d._encode(e,t,c),c+=d.encode.bytes})}else if(i[o]){var p=i[o].encode;p(e,t,c),c+=p.bytes}else if(e.buffer){var f=e.buffer;f.copy(t,c),c+=e.buffer.length}else throw new Error("Either `type` must be set to a known type (not'"+o+"') or `buffer` must be set");return d.encode.bytes=c-n,t},d.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,8>n-t)return 8;var o=e.readUInt32BE(t),a=e.toString("ascii",t+4,t+8),s=t+8;if(1===o){if(16>n-t)return 16;o=r.decode(e,s),s+=8}var d,l;return i.fullBoxes[a]&&(d=e.readUInt8(s),l=16777215&e.readUInt32BE(s),s+=4),{length:o,headersLen:s-t,contentLen:o-(s-t),type:a,version:d,flags:l}},d.decode=function(e,t,n){t=t||0,n=n||e.length;var r=d.readHeaders(e,t,n);if(!r||r.length>n-t)throw new Error("Data too short");return d.decodeWithoutHeaders(r,e,t+r.headersLen,t+r.length)},d.decodeWithoutHeaders=function(e,t,n,r){n=n||0,r=r||t.length;var o=e.type,s={};if(l[o]){s.otherBoxes=[];for(var c=l[o],u=n,p;8<=r-u;)if(p=d.decode(t,u,r),u+=p.length,0<=c.indexOf(p.type))s[p.type]=p;else if(0<=c.indexOf(p.type+"s")){var f=p.type+"s",h=s[f]=s[f]||[];h.push(p)}else s.otherBoxes.push(p)}else if(i[o]){var m=i[o].decode;s=m(t,n,r)}else s.buffer=a(t.slice(n,r));return s.length=e.length,s.contentLen=e.contentLen,s.type=e.type,s.version=e.version,s.flags=e.flags,s},d.encodingLength=function(e){var t=e.type,n=8;if(i.fullBoxes[t]&&(n+=4),l[t]){var r=l[t];r.forEach(function(t){if(5===t.length){var r=e[t]||[];t=t.substr(0,4),r.forEach(function(e){e.type=t,n+=d.encodingLength(e)})}else if(e[t]){var o=e[t];o.type=t,n+=d.encodingLength(o)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){n+=d.encodingLength(e)})}else if(i[t])n+=i[t].encodingLength(e);else if(e.buffer)n+=e.buffer.length;else throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");return n>s&&(n+=8),e.length=n,n}},{"./boxes":77,"buffer-alloc":36,"buffer-from":38,uint64be:181}],80:[function(e,t){(function(n){function r(){return this instanceof r?void(a.Writable.call(this),this.destroyed=!1,this._pending=0,this._missing=0,this._ignoreEmpty=!1,this._buf=null,this._str=null,this._cb=null,this._ondrain=null,this._writeBuffer=null,this._writeCb=null,this._ondrain=null,this._kick()):new r}function o(e){this._parent=e,this.destroyed=!1,a.PassThrough.call(this)}var a=e("readable-stream"),i=e("inherits"),s=e("next-event"),d=e("mp4-box-encoding"),l=e("buffer-alloc"),c=l(0);t.exports=r,i(r,a.Writable),r.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))},r.prototype._write=function(e,t,n){if(!this.destroyed){for(var r=!this._str||!this._str._writableState.needDrain;e.length&&!this.destroyed;){if(!this._missing&&!this._ignoreEmpty)return this._writeBuffer=e,void(this._writeCb=n);var o=e.length<this._missing?e.length:this._missing;if(this._buf?e.copy(this._buf,this._buf.length-this._missing):this._str&&(r=this._str.write(o===e.length?e:e.slice(0,o))),this._missing-=o,!this._missing){var a=this._buf,i=this._cb,s=this._str;this._buf=this._cb=this._str=this._ondrain=null,r=!0,this._ignoreEmpty=!1,s&&s.end(),i&&i(a)}e=o===e.length?c:e.slice(o)}return this._pending&&!this._missing?(this._writeBuffer=e,void(this._writeCb=n)):void(r?n():this._ondrain(n))}},r.prototype._buffer=function(e,t){this._missing=e,this._buf=l(e),this._cb=t},r.prototype._stream=function(e,t){var n=this;return this._missing=e,this._str=new o(this),this._ondrain=s(this._str,"drain"),this._pending++,this._str.on("end",function(){n._pending--,n._kick()}),this._cb=t,this._str},r.prototype._readBox=function(){function e(r,o){t._buffer(r,function(r){o=o?n.concat([o,r]):r;var a=d.readHeaders(o);"number"==typeof a?e(a-o.length,o):(t._pending++,t._headers=a,t.emit("box",a))})}var t=this;e(8)},r.prototype.stream=function(){var e=this;if(!e._headers)throw new Error("this function can only be called once after 'box' is emitted");var t=e._headers;return e._headers=null,e._stream(t.contentLen,null)},r.prototype.decode=function(e){var t=this;if(!t._headers)throw new Error("this function can only be called once after 'box' is emitted");var n=t._headers;t._headers=null,t._buffer(n.contentLen,function(r){var o=d.decodeWithoutHeaders(n,r);e(o),t._pending--,t._kick()})},r.prototype.ignore=function(){var e=this;if(!e._headers)throw new Error("this function can only be called once after 'box' is emitted");var t=e._headers;e._headers=null,this._missing=t.contentLen,0===this._missing&&(this._ignoreEmpty=!0),this._cb=function(){e._pending--,e._kick()}},r.prototype._kick=function(){if(!this._pending&&(this._buf||this._str||this._readBox(),this._writeBuffer)){var e=this._writeCb,t=this._writeBuffer;this._writeBuffer=null,this._writeCb=null,this._write(t,null,e)}},i(o,a.PassThrough),o.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._parent.destroy(e),e&&this.emit("error",e),this.emit("close"))}}).call(this,e("buffer").Buffer)},{buffer:39,"buffer-alloc":36,inherits:67,"mp4-box-encoding":79,"next-event":85,"readable-stream":115}],81:[function(e,t){(function(n){function r(){}function o(){if(!(this instanceof o))return new o;i.Readable.call(this),this.destroyed=!1,this._finalized=!1,this._reading=!1,this._stream=null,this._drain=null,this._want=!1,this._onreadable=function(){e._want&&(e._want=!1,e._read())},this._onend=function(){e._stream=null};var e=this}function a(e){this._parent=e,this.destroyed=!1,i.PassThrough.call(this)}var i=e("readable-stream"),s=e("inherits"),d=e("mp4-box-encoding"),l=e("buffer-alloc");t.exports=o,s(o,i.Readable),o.prototype.mediaData=o.prototype.mdat=function(e,t){var n=new a(this);return this.box({type:"mdat",contentLength:e,encodeBufferLen:8,stream:n},t),n},o.prototype.box=function(e,t){if(t||(t=r),this.destroyed)return t(new Error("Encoder is destroyed"));var o;if(e.encodeBufferLen&&(o=l(e.encodeBufferLen)),e.stream)e.buffer=null,o=d.encode(e,o),this.push(o),this._stream=e.stream,this._stream.on("readable",this._onreadable),this._stream.on("end",this._onend),this._stream.on("end",t),this._forward();else{o=d.encode(e,o);var a=this.push(o);if(a)return n.nextTick(t);this._drain=t}},o.prototype.destroy=function(e){if(!this.destroyed){if(this.destroyed=!0,this._stream&&this._stream.destroy&&this._stream.destroy(),this._stream=null,this._drain){var t=this._drain;this._drain=null,t(e)}e&&this.emit("error",e),this.emit("close")}},o.prototype.finalize=function(){this._finalized=!0,this._stream||this._drain||this.push(null)},o.prototype._forward=function(){if(this._stream)for(;!this.destroyed;){var e=this._stream.read();if(!e)return void(this._want=!!this._stream);if(!this.push(e))return}},o.prototype._read=function(){if(!(this._reading||this.destroyed)){if(this._reading=!0,this._stream&&this._forward(),this._drain){var e=this._drain;this._drain=null,e()}this._reading=!1,this._finalized&&this.push(null)}},s(a,i.PassThrough),a.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._parent.destroy(e),e&&this.emit("error",e),this.emit("close"))}}).call(this,e("_process"))},{_process:92,"buffer-alloc":36,inherits:67,"mp4-box-encoding":79,"readable-stream":115}],82:[function(e,t,n){n.decode=e("./decode"),n.encode=e("./encode")},{"./decode":80,"./encode":81}],83:[function(e,n){var s=Math.round;function r(e){if(e+="",!(100<e.length)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();return"years"===n||"year"===n||"yrs"===n||"yr"===n||"y"===n?31557600000*r:"weeks"===n||"week"===n||"w"===n?604800000*r:"days"===n||"day"===n||"d"===n?86400000*r:"hours"===n||"hour"===n||"hrs"===n||"hr"===n||"h"===n?3600000*r:"minutes"===n||"minute"===n||"mins"===n||"min"===n||"m"===n?60000*r:"seconds"===n||"second"===n||"secs"===n||"sec"===n||"s"===n?1000*r:"milliseconds"===n||"millisecond"===n||"msecs"===n||"msec"===n||"ms"===n?r:void 0}}}function o(e){var n=t(e);return 86400000<=n?s(e/86400000)+"d":3600000<=n?s(e/3600000)+"h":60000<=n?s(e/60000)+"m":1000<=n?s(e/1000)+"s":e+"ms"}function a(e){var n=t(e);return 86400000<=n?i(e,n,86400000,"day"):3600000<=n?i(e,n,3600000,"hour"):60000<=n?i(e,n,60000,"minute"):1000<=n?i(e,n,1000,"second"):e+" ms"}function i(e,t,r,n){return s(e/r)+" "+n+(t>=1.5*r?"s":"")}var l=24*(60*60000);n.exports=function(e,t){t=t||{};var n=typeof e;if("string"==n&&0<e.length)return r(e);if("number"==n&&isFinite(e))return t.long?a(e):o(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],84:[function(e,t){function n(e,t){var a=this;return a instanceof n?void(d.Readable.call(a,t),a.destroyed=!1,a._drained=!1,a._forwarding=!1,a._current=null,a._toStreams2=t&&t.objectMode?r:o,"function"==typeof e?a._queue=e:(a._queue=e.map(a._toStreams2),a._queue.forEach(function(e){"function"!=typeof e&&a._attachErrorListener(e)})),a._next()):new n(e,t)}function r(e){return a(e,{objectMode:!0,highWaterMark:16})}function o(e){return a(e)}function a(e,t){if(!e||"function"==typeof e||e._readableState)return e;var n=new d.Readable(t).wrap(e);return e.destroy&&(n.destroy=e.destroy.bind(e)),n}t.exports=n;var i=e("inherits"),d=e("readable-stream");i(n,d.Readable),n.obj=function(e){return new n(e,{objectMode:!0,highWaterMark:16})},n.prototype._read=function(){this._drained=!0,this._forward()},n.prototype._forward=function(){if(!this._forwarding&&this._drained&&this._current){this._forwarding=!0;for(var e;null!==(e=this._current.read());)this._drained=this.push(e);this._forwarding=!1}},n.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._current&&this._current.destroy&&this._current.destroy(),"function"!=typeof this._queue&&this._queue.forEach(function(e){e.destroy&&e.destroy()}),e&&this.emit("error",e),this.emit("close"))},n.prototype._next=function(){var e=this;if(e._current=null,"function"==typeof e._queue)e._queue(function(t,n){return t?e.destroy(t):void(n=e._toStreams2(n),e._attachErrorListener(n),e._gotNextStream(n))});else{var t=e._queue.shift();"function"==typeof t&&(t=e._toStreams2(t()),e._attachErrorListener(t)),e._gotNextStream(t)}},n.prototype._gotNextStream=function(e){function t(){o._forward()}function n(){e._readableState.ended||o.destroy()}function r(){o._current=null,e.removeListener("readable",t),e.removeListener("end",r),e.removeListener("close",n),o._next()}var o=this;return e?void(o._current=e,o._forward(),e.on("readable",t),e.once("end",r),e.once("close",n)):(o.push(null),void o.destroy())},n.prototype._attachErrorListener=function(e){function t(r){e.removeListener("error",t),n.destroy(r)}var n=this;e&&e.once("error",t)}},{inherits:67,"readable-stream":115}],85:[function(e,t){t.exports=function(e,t){var n=null;return e.on(t,function(e){if(n){var t=n;n=null,t(e)}}),function(e){n=e}}},{}],86:[function(e,t){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)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}var o=e("wrappy");t.exports=o(n),t.exports.strict=o(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})})},{wrappy:191}],87:[function(e,t){function n(e){if(/^-?\d+$/.test(e))return parseInt(e,10);var t;if(t=e.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){var n=t[1],r=t[2],o=t[3];if(n&&o){n=parseInt(n),o=parseInt(o);var a=[],s=n<o?1:-1;("-"==r||".."==r||"\u2025"==r)&&(o+=s);for(var d=n;d!=o;d+=s)a.push(d);return a}}return[]}t.exports.parse=function(e){var t=e.split(","),r=t.map(function(e){return n(e)});return 0===r.length?[]:1===r.length?Array.isArray(r[0])?r[0]:r:r.reduce(function(e,t){return Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.concat(t)})}},{}],88:[function(e,t){(function(n,r){function o(e){if("string"==typeof e&&/^(stream-)?magnet:/.test(e))return h(e);if("string"==typeof e&&(/^[a-f0-9]{40}$/i.test(e)||/^[a-z2-7]{32}$/i.test(e)))return h(`magnet:?xt=urn:btih:${e}`);if(r.isBuffer(e)&&20===e.length)return h(`magnet:?xt=urn:btih:${e.toString("hex")}`);if(r.isBuffer(e))return a(e);if(e&&e.infoHash)return e.infoHash=e.infoHash.toLowerCase(),e.announce||(e.announce=[]),"string"==typeof e.announce&&(e.announce=[e.announce]),e.urlList||(e.urlList=[]),e;throw new Error("Invalid torrent identifier")}function a(e){r.isBuffer(e)&&(e=c.decode(e)),l(e.info,"info"),l(e.info["name.utf-8"]||e.info.name,"info.name"),l(e.info["piece length"],"info['piece length']"),l(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(e=>{l("number"==typeof e.length,"info.files[0].length"),l(e["path.utf-8"]||e.path,"info.files[0].path")}):l("number"==typeof e.info.length,"info.length");const t={info:e.info,infoBuffer:c.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};t.infoHash=g.sync(t.infoBuffer),t.infoHashBuffer=r.from(t.infoHash,"hex"),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=e["created by"].toString()),r.isBuffer(e.comment)&&(t.comment=e.comment.toString()),Array.isArray(e["announce-list"])&&0<e["announce-list"].length?e["announce-list"].forEach(e=>{e.forEach(e=>{t.announce.push(e.toString())})}):e.announce&&t.announce.push(e.announce.toString()),r.isBuffer(e["url-list"])&&(e["url-list"]=0<e["url-list"].length?[e["url-list"]]:[]),t.urlList=(e["url-list"]||[]).map(e=>e.toString()),_(t.announce),_(t.urlList);const n=e.info.files||[e.info];t.files=n.map((e,r)=>{const o=[].concat(t.name,e["path.utf-8"]||e.path||[]).map(e=>e.toString());return{path:m.join.apply(null,[m.sep].concat(o)).slice(1),name:o[o.length-1],length:e.length,offset:n.slice(0,r).reduce(s,0)}}),t.length=n.reduce(s,0);const o=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(o.offset+o.length)%t.pieceLength||t.pieceLength,t.pieces=d(e.info.pieces),t}function i(e){return"undefined"!=typeof Blob&&e instanceof Blob}function s(e,t){return e+t.length}function d(e){const t=[];for(let n=0;n<e.length;n+=20)t.push(e.slice(n,n+20).toString("hex"));return t}function l(e,t){if(!e)throw new Error(`Torrent is missing required field: ${t}`)}const c=e("bencode"),u=e("blob-to-buffer"),p=e("fs"),f=e("simple-get"),h=e("magnet-uri"),m=e("path"),g=e("simple-sha1"),_=e("uniq");t.exports=o,t.exports.remote=function(e,t){function r(e){try{a=o(e)}catch(e){return t(e)}a&&a.infoHash?t(null,a):t(new Error("Invalid torrent identifier"))}let a;if("function"!=typeof t)throw new Error("second argument must be a Function");try{a=o(e)}catch(e){}a&&a.infoHash?n.nextTick(()=>{t(null,a)}):i(e)?u(e,(e,n)=>e?t(new Error(`Error converting Blob: ${e.message}`)):void r(n)):"function"==typeof f&&/^https?:/.test(e)?f.concat({url:e,timeout:30000,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},(e,n,o)=>e?t(new Error(`Error downloading torrent: ${e.message}`)):void r(o)):"function"==typeof p.readFile&&"string"==typeof e?p.readFile(e,(e,n)=>e?t(new Error("Invalid torrent identifier")):void r(n)):n.nextTick(()=>{t(new Error("Invalid torrent identifier"))})},t.exports.toMagnetURI=h.encode,t.exports.toTorrentFile=function(e){const t={info:e.info};return t["announce-list"]=(e.announce||[]).map(e=>(t.announce||(t.announce=e),e=r.from(e,"utf8"),[e])),t["url-list"]=e.urlList||[],void 0!==e.private&&(t["private"]=+e.private),e.created&&(t["creation date"]=0|e.created.getTime()/1e3),e.createdBy&&(t["created by"]=e.createdBy),e.comment&&(t.comment=e.comment),c.encode(t)};(()=>{r.alloc(0)})()}).call(this,e("_process"),e("buffer").Buffer)},{_process:92,bencode:11,"blob-to-buffer":20,buffer:39,fs:34,"magnet-uri":74,path:89,"simple-get":123,"simple-sha1":136,uniq:182}],89:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1,o;0<=r;r--)o=e[r],"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--);if(t)for(;n--;n)e.unshift("..");return e}function r(e){"string"!=typeof e&&(e+="");var t=0,n=-1,r=!0,o;for(o=e.length-1;0<=o;--o)if(!(47===e.charCodeAt(o)))-1===n&&(r=!1,n=o+1);else if(!r){t=o+1;break}return-1===n?"":e.slice(t,n)}function o(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}n.resolve=function(){for(var n="",r=!1,a=arguments.length-1,s;-1<=a&&!r;a--){if(s=0<=a?arguments[a]:e.cwd(),"string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");else if(!s)continue;n=s+"/"+n,r="/"===s.charAt(0)}return n=t(o(n.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+n||"."},n.normalize=function(e){var r=n.isAbsolute(e),i="/"===a(e,-1);return e=t(o(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(o(e,function(e){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;0<=n&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var o=r(e.split("/")),a=r(t.split("/")),s=d(o.length,a.length),l=s,c=0;c<s;c++)if(o[c]!==a[c]){l=c;break}for(var u=[],c=l;c<o.length;c++)u.push("..");return u=u.concat(a.slice(l)),u.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,r=-1,o=!0,a=e.length-1;1<=a;--a)if(t=e.charCodeAt(a),47!==t)o=!1;else if(!o){r=a;break}return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},n.basename=function(e,t){var n=r(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,o=!0,a=0,s=e.length-1,d;0<=s;--s){if(d=e.charCodeAt(s),47===d){if(!o){n=s+1;break}continue}-1===r&&(o=!1,r=s+1),46===d?-1===t?t=s:1!==a&&(a=1):-1!==t&&(a=-1)}return-1===t||-1===r||0===a||1===a&&t===r-1&&t===n+1?"":e.slice(t,r)};var a=function(e,t,n){return e.substr(t,n)}}).call(this,e("_process"))},{_process:92}],90:[function(e,t){for(var r=e("closest-to"),o=n(2,10),a=13,i=[];22>a++;)i.push(n(2,a));t.exports=function(e){return r(e/o,i)}},{"closest-to":42}],91:[function(e,t){(function(e){'use strict';t.exports="undefined"!=typeof e&&e.version&&0!==e.version.indexOf("v0.")&&(0!==e.version.indexOf("v1.")||0===e.version.indexOf("v1.8."))?e:{nextTick:function(t,n,r,o){if("function"!=typeof t)throw new TypeError("\"callback\" argument must be a function");var a=arguments.length,s,d;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,o)});default:for(s=Array(a-1),d=0;d<s.length;)s[d++]=arguments[d];return e.nextTick(function(){t.apply(null,s)});}}}}).call(this,e("_process"))},{_process:92}],92:[function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(t){if(u===setTimeout)return setTimeout(t,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(n){try{return u.call(null,t,0)}catch(n){return u.call(this,t,0)}}}function a(t){if(p===clearTimeout)return clearTimeout(t);if((p===r||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(n){try{return p.call(null,t)}catch(n){return p.call(this,t)}}}function i(){h&&g&&(h=!1,g.length?f=g.concat(f):m=-1,f.length&&s())}function s(){if(!h){var e=o(i);h=!0;for(var t=f.length;t;){for(g=f,f=[];++m<t;)g&&g[m].run();m=-1,t=f.length}g=null,h=!1,a(e)}}function d(e,t){this.fun=e,this.array=t}function l(){}var c=t.exports={},u,p;(function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(t){u=n}try{p="function"==typeof clearTimeout?clearTimeout:r}catch(t){p=r}})();var f=[],h=!1,m=-1,g;c.nextTick=function(e){var t=Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new d(e,t)),1!==f.length||h||o(s)},d.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=l,c.addListener=l,c.once=l,c.off=l,c.removeListener=l,c.removeAllListeners=l,c.emit=l,c.prependListener=l,c.prependOnceListener=l,c.listeners=function(){return[]},c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],93:[function(e,t){(function(n){var r=e("once"),o=e("end-of-stream"),a=e("fs"),i=function(){},s=/^v?\.0/.test(n.version),d=function(e){return"function"==typeof e},l=function(e){return!!s&&!!a&&(e instanceof(a.ReadStream||i)||e instanceof(a.WriteStream||i))&&d(e.close)},c=function(e){return e.setHeader&&d(e.abort)},u=function(e,t,n,a){a=r(a);var s=!1;e.on("close",function(){s=!0}),o(e,{readable:t,writable:n},function(e){return e?a(e):void(s=!0,a())});var u=!1;return function(t){if(!s)return u?void 0:(u=!0,l(e)?e.close(i):c(e)?e.abort():d(e.destroy)?e.destroy():void a(t||new Error("stream was destroyed")))}},p=function(e){e()},f=function(e,t){return e.pipe(t)};t.exports=function(){var e=Array.prototype.slice.call(arguments),t=d(e[e.length-1]||i)&&e.pop()||i;if(Array.isArray(e[0])&&(e=e[0]),2>e.length)throw new Error("pump requires two streams per minimum");var n=e.map(function(o,a){var i=a<e.length-1;return u(o,i,0<a,function(e){r||(r=e),e&&n.forEach(p),i||(n.forEach(p),t(r))})}),r;return e.reduce(f)}}).call(this,e("_process"))},{_process:92,"end-of-stream":48,fs:33,once:86}],94:[function(e,t,n){(function(e){/*! https://mths.be/punycode v1.4.1 by @mathias */(function(a){function s(e){throw new RangeError(E[e])}function d(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function c(e,t){var n=e.split("@"),r="";1<n.length&&(r=n[0]+"@",e=n[1]),e=e.replace(S,".");var o=e.split("."),a=d(o,t).join(".");return r+a}function u(e){for(var t=[],n=0,r=e.length,o,a;n<r;)o=e.charCodeAt(n++),55296<=o&&56319>=o&&n<r?(a=e.charCodeAt(n++),56320==(64512&a)?t.push(((1023&o)<<10)+(1023&a)+65536):(t.push(o),n--)):t.push(o);return t}function p(e){return d(e,function(e){var t="";return 65535<e&&(e-=65536,t+=v(55296|1023&e>>>10),e=56320|1023&e),t+=v(e),t}).join("")}function f(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:36}function h(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function m(e,t,n){var r=0;for(e=n?C(e/700):e>>1,e+=C(e/t);455<e;r+=36)e=C(e/35);return C(r+36*e/(e+38))}function g(e){var r=[],o=e.length,a=0,d=128,l=72,c,u,h,g,_,b,y,x,S,E;for(u=e.lastIndexOf("-"),0>u&&(u=0),h=0;h<u;++h)128<=e.charCodeAt(h)&&s("not-basic"),r.push(e.charCodeAt(h));for(g=0<u?u+1:0;g<o;){for(_=a,b=1,y=36;;y+=36){if(g>=o&&s("invalid-input"),x=f(e.charCodeAt(g++)),(36<=x||x>C((2147483647-a)/b))&&s("overflow"),a+=x*b,S=y<=l?1:y>=l+26?26:y-l,x<S)break;E=36-S,b>C(2147483647/E)&&s("overflow"),b*=E}c=r.length+1,l=m(a-_,c,0==_),C(a/c)>2147483647-d&&s("overflow"),d+=C(a/c),a%=c,r.splice(a++,0,d)}return p(r)}function _(e){var r=[],o,a,i,d,l,c,p,f,g,_,b,y,w,x,S;for(e=u(e),y=e.length,o=128,a=0,l=72,c=0;c<y;++c)b=e[c],128>b&&r.push(v(b));for(i=d=r.length,d&&r.push("-");i<y;){for(p=2147483647,c=0;c<y;++c)b=e[c],b>=o&&b<p&&(p=b);for(w=i+1,p-o>C((2147483647-a)/w)&&s("overflow"),a+=(p-o)*w,o=p,c=0;c<y;++c)if(b=e[c],b<o&&2147483647<++a&&s("overflow"),b==o){for(f=a,g=36;;g+=36){if(_=g<=l?1:g>=l+26?26:g-l,f<_)break;S=f-_,x=36-_,r.push(v(h(_+S%x,0))),f=C(S/x)}r.push(v(h(f,0))),l=m(a,w,i==d),a=0,++i}++a,++o}return r.join("")}var b="object"==typeof n&&n&&!n.nodeType&&n,y="object"==typeof t&&t&&!t.nodeType&&t,w="object"==typeof e&&e;(w.global===w||w.window===w||w.self===w)&&(a=w);var k=/^xn--/,x=/[^\x20-\x7E]/,S=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=r,v=o,L,I;if(L={version:"1.4.1",ucs2:{decode:u,encode:p},decode:g,encode:_,toASCII:function(e){return c(e,function(e){return x.test(e)?"xn--"+_(e):e})},toUnicode:function(e){return c(e,function(e){return k.test(e)?g(e.slice(4).toLowerCase()):e})}},"function"==typeof l&&"object"==typeof l.amd&&l.amd)l("punycode",function(){return L});else if(!(b&&y))a.punycode=L;else if(t.exports==b)y.exports=L;else for(I in L)L.hasOwnProperty(I)&&(b[I]=L[I])})(this)}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],95:[function(e,t){'use strict';function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,o,a){t=t||"&",o=o||"=";var s={};if("string"!=typeof e||0===e.length)return s;var d=/\+/g;e=e.split(t);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var c=e.length;0<l&&c>l&&(c=l);for(var u=0;u<c;++u){var p=e[u].replace(d,"%20"),f=p.indexOf(o),h,m,g,_;0<=f?(h=p.substr(0,f),m=p.substr(f+1)):(h=p,m=""),g=decodeURIComponent(h),_=decodeURIComponent(m),n(s,g)?r(s[g])?s[g].push(_):s[g]=[s[g],_]:s[g]=_}return s};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],96:[function(e,t){'use strict';function n(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return"";}};t.exports=function(e,t,i,s){return t=t||"&",i=i||"=",null===e&&(e=void 0),"object"==typeof e?n(a(e),function(a){var s=encodeURIComponent(r(a))+i;return o(e[a])?n(e[a],function(e){return s+encodeURIComponent(r(e))}).join(t):s+encodeURIComponent(r(e[a]))}).join(t):s?encodeURIComponent(r(s))+i+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},{}],97:[function(e,t,n){'use strict';n.decode=n.parse=e("./decode"),n.encode=n.stringify=e("./encode")},{"./decode":95,"./encode":96}],98:[function(e,t){t.exports=function(e){var t=0;return function(){if(t===e.length)return null;var n=e.length-t,r=0|Math.random()*n,o=e[t+r],a=e[t];return e[t]=o,e[t+r]=a,t++,o}}},{}],99:[function(e,t){(function(n,r){'use strict';var o=e("safe-buffer").Buffer,a=r.crypto||r.msCrypto;t.exports=a&&a.getRandomValues?function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=o.allocUnsafe(e);if(0<e)if(65536<e)for(var i=0;i<e;i+=65536)a.getRandomValues(r.slice(i,i+65536));else a.getRandomValues(r);return"function"==typeof t?n.nextTick(function(){t(null,r)}):r}:function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{_process:92,"safe-buffer":121}],100:[function(e,t){const{Writable:n,PassThrough:r}=e("readable-stream");t.exports=class extends n{constructor(e,t={}){super(t),this.destroyed=!1,this._queue=[],this._position=e||0,this._cb=null,this._buffer=null,this._out=null}_write(e,t,n){let r=!0;for(;;){if(this.destroyed)return;if(0===this._queue.length)return this._buffer=e,void(this._cb=n);this._buffer=null;var o=this._queue[0];const t=s(o.start-this._position,0),a=o.end-this._position;if(t>=e.length)return this._position+=e.length,n(null);let i;if(a>e.length){this._position+=e.length,i=0===t?e:e.slice(t),r=o.stream.write(i)&&r;break}this._position+=a,i=0===t&&a===e.length?e:e.slice(t,a),r=o.stream.write(i)&&r,o.last&&o.stream.end(),e=e.slice(a),this._queue.shift()}r?n(null):o.stream.once("drain",n.bind(null,null))}slice(e){if(this.destroyed)return null;Array.isArray(e)||(e=[e]);const t=new r;return e.forEach((n,r)=>{this._queue.push({start:n.start,end:n.end,stream:t,last:r===e.length-1})}),this._buffer&&this._write(this._buffer,null,this._cb),t}destroy(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e))}}},{"readable-stream":115}],101:[function(e,t){'use strict';function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function r(e,t,r){function o(e,n,r){return"string"==typeof t?t:t(e,n,r)}r||(r=Error);var a=function(e){function t(t,n,r){return e.call(this,o(t,n,r))||this}return n(t,e),t}(r);a.prototype.name=r.name,a.prototype.code=e,d[e]=a}function o(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return e+""}),2<n?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(e+"")}function a(e,t,n){return e.substr(!n||0>n?0:+n,t.length)===t}function i(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function s(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}var d={};r("ERR_INVALID_OPT_VALUE",function(e,t){return"The value \""+t+"\" is invalid for option \""+e+"\""},TypeError),r("ERR_INVALID_ARG_TYPE",function(e,t,n){var r;"string"==typeof t&&a(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be";var d;if(i(e," argument"))d="The ".concat(e," ").concat(r," ").concat(o(t,"type"));else{var l=s(e,".")?"property":"argument";d="The \"".concat(e,"\" ").concat(l," ").concat(r," ").concat(o(t,"type"))}return d+=". Received type ".concat(typeof n),d},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" 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(e){return"Unknown encoding: "+e},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=d},{}],102:[function(e,t){(function(e){'use strict';var n=new Set;t.exports.emitExperimentalWarning=e.emitWarning?function(t){if(!n.has(t)){n.add(t),e.emitWarning(t+" is an experimental feature. This feature could change at any time","ExperimentalWarning")}}:function(){}}).call(this,e("_process"))},{_process:92}],103:[function(e,t){(function(n){'use strict';function r(e){return this instanceof r?void(s.call(this,e),d.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",o)))):new r(e)}function o(){this._writableState.ended||n.nextTick(a,this)}function a(e){e.end()}var i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var s=e("./_stream_readable"),d=e("./_stream_writable");e("inherits")(r,s);for(var l=i(d.prototype),c=0,u;c<l.length;c++)u=l[c],r.prototype[u]||(r.prototype[u]=d.prototype[u]);Object.defineProperty(r.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(r.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(r.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(r.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0===this._readableState||void 0===this._writableState||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this,e("_process"))},{"./_stream_readable":105,"./_stream_writable":107,_process:92,inherits:67}],104:[function(e,t){'use strict';function n(e){return this instanceof n?void r.call(this,e):new n(e)}t.exports=n;var r=e("./_stream_transform");e("inherits")(n,r),n.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":106,inherits:67}],105:[function(e,t){(function(n,r){'use strict';function o(e){return U.from(e)}function a(e){return U.isBuffer(e)||e instanceof P}function i(e,t,n){return"function"==typeof e.prependListener?e.prependListener(t,n):void(e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n))}function s(t,n,r){T=T||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof T),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=q(this,t,"readableHighWaterMark",r),this.buffer=new j,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.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(!Y&&(Y=e("string_decoder/").StringDecoder),this.decoder=new Y(t.encoding),this.encoding=t.encoding)}function d(t){if(T=T||e("./_stream_duplex"),!(this instanceof d))return new d(t);var n=this instanceof T;this._readableState=new s(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),A.call(this)}function l(e,t,n,r,a){O("readableAddChunk",t);var i=e._readableState;if(null===t)i.reading=!1,h(e,i);else{var s;if(a||(s=u(i,t)),s)e.emit("error",s);else if(!(i.objectMode||t&&0<t.length))r||(i.reading=!1,_(e,i));else if("string"==typeof t||i.objectMode||Object.getPrototypeOf(t)===U.prototype||(t=o(t)),r)i.endEmitted?e.emit("error",new V):c(e,i,t,!0);else if(i.ended)e.emit("error",new W);else{if(i.destroyed)return!1;i.reading=!1,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||0!==t.length?c(e,i,t,!1):_(e,i)):c(e,i,t,!1)}}return!i.ended&&(i.length<i.highWaterMark||0===i.length)}function c(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&m(e)),_(e,t)}function u(e,t){var n;return a(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new D("chunk",["string","Buffer","Uint8Array"],t)),n}function p(e){return 8388608<=e?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=p(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function h(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?m(e):(t.needReadable=!1,!t.emittedReadable&&(t.emittedReadable=!0,g(e)))}}function m(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(O("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(g,e))}function g(e){var t=e._readableState;O("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,E(e)}function _(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(b,e,t))}function b(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(O("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function y(e){return function(){var t=e._readableState;O("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&R(e,"data")&&(t.flowing=!0,E(e))}}function w(e){var t=e._readableState;t.readableListening=0<e.listenerCount("readable"),t.resumeScheduled&&!t.paused?t.flowing=!0:0<e.listenerCount("data")&&e.resume()}function k(e){O("readable nexttick read 0"),e.read(0)}function x(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(S,e,t))}function S(e,t){O("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),E(e),t.flowing&&!t.reading&&e.read(0)}function E(e){var t=e._readableState;for(O("flow",t.flowing);t.flowing&&null!==e.read(););}function C(e,t){if(0===t.length)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function v(e){var t=e._readableState;O("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(L,t,e))}function L(e,t){O("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function I(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}t.exports=d;var T;d.ReadableState=s;var B=e("events").EventEmitter,R=function(e,t){return e.listeners(t).length},A=e("./internal/streams/stream"),U=e("buffer").Buffer,P=r.Uint8Array||function(){},M=e("util"),O;O=M&&M.debuglog?M.debuglog("stream"):function(){};var j=e("./internal/streams/buffer_list"),N=e("./internal/streams/destroy"),F=e("./internal/streams/state"),q=F.getHighWaterMark,H=e("../errors").codes,D=H.ERR_INVALID_ARG_TYPE,W=H.ERR_STREAM_PUSH_AFTER_EOF,z=H.ERR_METHOD_NOT_IMPLEMENTED,V=H.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,G=e("../experimentalWarning"),K=G.emitExperimentalWarning,Y,$;e("inherits")(d,A);var X=["error","close","destroy","pause","resume"];Object.defineProperty(d.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),d.prototype.destroy=N.destroy,d.prototype._undestroy=N.undestroy,d.prototype._destroy=function(e,t){t(e)},d.prototype.push=function(e,t){var n=this._readableState,r;return n.objectMode?r=!0:"string"==typeof e&&(t=t||n.defaultEncoding,t!==n.encoding&&(e=U.from(e,t),t=""),r=!0),l(this,e,t,!1,r)},d.prototype.unshift=function(e){return l(this,e,null,!0,!1)},d.prototype.isPaused=function(){return!1===this._readableState.flowing},d.prototype.setEncoding=function(t){return Y||(Y=e("string_decoder/").StringDecoder),this._readableState.decoder=new Y(t),this._readableState.encoding=this._readableState.decoder.encoding,this};d.prototype.read=function(e){O("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0===t.highWaterMark?0<t.length:t.length>=t.highWaterMark)||t.ended))return O("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?v(this):m(this),null;if(e=f(e,t),0===e&&t.ended)return 0===t.length&&v(this),null;var o=t.needReadable;O("need readable",o),(0===t.length||t.length-e<t.highWaterMark)&&(o=!0,O("length less than watermark",o)),t.ended||t.reading?(o=!1,O("reading or ended",o)):o&&(O("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,!t.reading&&(e=f(r,t)));var a;return a=0<e?C(e,t):null,null===a?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(!t.ended&&(t.needReadable=!0),r!==e&&t.ended&&v(this)),null!==a&&this.emit("data",a),a},d.prototype._read=function(){this.emit("error",new z("_read()"))},d.prototype.pipe=function(e,t){function r(e,t){O("onunpipe"),e===p&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,a())}function o(){O("onend"),e.end()}function a(){O("cleanup"),e.removeListener("close",l),e.removeListener("finish",c),e.removeListener("drain",g),e.removeListener("error",d),e.removeListener("unpipe",r),p.removeListener("end",o),p.removeListener("end",u),p.removeListener("data",s),_=!0,f.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&g()}function s(t){O("ondata");var n=e.write(t);O("dest.write",n),!1===n&&((1===f.pipesCount&&f.pipes===e||1<f.pipesCount&&-1!==I(f.pipes,e))&&!_&&(O("false write response, pause",f.awaitDrain),f.awaitDrain++),p.pause())}function d(t){O("onerror",t),u(),e.removeListener("error",d),0===R(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",c),u()}function c(){O("onfinish"),e.removeListener("close",l),u()}function u(){O("unpipe"),p.unpipe(e)}var p=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e);}f.pipesCount+=1,O("pipe count=%d opts=%j",f.pipesCount,t);var h=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,m=h?o:u;f.endEmitted?n.nextTick(m):p.once("end",m),e.on("unpipe",r);var g=y(p);e.on("drain",g);var _=!1;return p.on("data",s),i(e,"error",d),e.once("close",l),e.once("finish",c),e.emit("pipe",p),f.flowing||(O("pipe resume"),p.resume()),e},d.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<o;a++)r[a].emit("unpipe",this,{hasUnpiped:!1});return this}var s=I(t.pipes,e);return-1===s?this:(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)},d.prototype.on=function(e,t){var r=A.prototype.on.call(this,e,t),o=this._readableState;return"data"===e?(o.readableListening=0<this.listenerCount("readable"),!1!==o.flowing&&this.resume()):"readable"==e&&!o.endEmitted&&!o.readableListening&&(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,O("on readable",o.length,o.reading),o.length?m(this):!o.reading&&n.nextTick(k,this)),r},d.prototype.addListener=d.prototype.on,d.prototype.removeListener=function(e,t){var r=A.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(w,this),r},d.prototype.removeAllListeners=function(e){var t=A.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&n.nextTick(w,this),t},d.prototype.resume=function(){var e=this._readableState;return e.flowing||(O("resume"),e.flowing=!e.readableListening,x(this,e)),e.paused=!1,this},d.prototype.pause=function(){return O("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(O("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},d.prototype.wrap=function(e){var t=this,r=this._readableState,o=!1;for(var a in e.on("end",function(){if(O("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(n){if((O("wrapped data"),r.decoder&&(n=r.decoder.write(n)),!(r.objectMode&&(null===n||void 0===n)))&&(r.objectMode||n&&n.length)){var a=t.push(n);a||(o=!0,e.pause())}}),e)void 0===this[a]&&"function"==typeof e[a]&&(this[a]=function(t){return function(){return e[t].apply(e,arguments)}}(a));for(var i=0;i<X.length;i++)e.on(X[i],this.emit.bind(this,X[i]));return this._read=function(t){O("wrapped _read",t),o&&(o=!1,e.resume())},this},"function"==typeof Symbol&&(d.prototype[Symbol.asyncIterator]=function(){return K("Readable[Symbol.asyncIterator]"),void 0===$&&($=e("./internal/streams/async_iterator")),$(this)}),Object.defineProperty(d.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(d.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(d.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),d._fromList=C,Object.defineProperty(d.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}})}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"../errors":101,"../experimentalWarning":102,"./_stream_duplex":103,"./internal/streams/async_iterator":108,"./internal/streams/buffer_list":109,"./internal/streams/destroy":110,"./internal/streams/state":113,"./internal/streams/stream":114,_process:92,buffer:39,events:49,inherits:67,"string_decoder/":170,util:33}],106:[function(e,t){'use strict';function n(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new d);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function r(e){return this instanceof r?void(u.call(this,e),this._transformState={afterTransform:n.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",o)):new r(e)}function o(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?a(this,null,null):this._flush(function(t,n){a(e,t,n)})}function a(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new c;if(e._transformState.transforming)throw new l;return e.push(null)}t.exports=r;var i=e("../errors").codes,s=i.ERR_METHOD_NOT_IMPLEMENTED,d=i.ERR_MULTIPLE_CALLBACK,l=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=i.ERR_TRANSFORM_WITH_LENGTH_0,u=e("./_stream_duplex");e("inherits")(r,u),r.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},r.prototype._transform=function(e,t,n){n(new s("_transform()"))},r.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var o=this._readableState;(r.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},r.prototype._read=function(){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},r.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,function(e){t(e)})}},{"../errors":101,"./_stream_duplex":103,inherits:67}],107:[function(e,t){(function(n,r){'use strict';function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){v(t,e)}}function a(e){return B.from(e)}function i(e){return B.isBuffer(e)||e instanceof R}function s(){}function d(t,n,r){L=L||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof L),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=P(this,t,"writableHighWaterMark",r),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(e){_(n,e)},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.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function l(t){L=L||e("./_stream_duplex");var n=this instanceof L;return n||z.call(l,this)?void(this._writableState=new d(t,this,n),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)),T.call(this)):new l(t)}function c(e,t){var r=new D;e.emit("error",r),n.nextTick(t,r)}function u(e,t,r,o){var a;return null===r?a=new H:"string"!=typeof r&&!t.objectMode&&(a=new O("chunk",["string","Buffer"],r)),!a||(e.emit("error",a),n.nextTick(o,a),!1)}function p(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=B.from(t,n)),t}function f(e,t,n,r,o,a){if(!n){var i=p(t,r,o);r!==i&&(n=!0,o="buffer",r=i)}var s=t.objectMode?1:r.length;t.length+=s;var d=t.length<t.highWaterMark;if(d||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:o,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else h(e,t,!1,s,r,o,a);return d}function h(e,t,n,r,o,a,i){t.writelen=r,t.writecb=i,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new q("write")):n?e._writev(o,t.onwrite):e._write(o,a,t.onwrite),t.sync=!1}function m(e,t,r,o,a){--t.pendingcb,r?(n.nextTick(a,o),n.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",o)):(a(o),e._writableState.errorEmitted=!0,e.emit("error",o),E(e,t))}function g(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function _(e,t){var r=e._writableState,o=r.sync,a=r.writecb;if("function"!=typeof a)throw new N;if(g(r),t)m(e,r,o,t,a);else{var i=k(r)||e.destroyed;i||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),o?n.nextTick(b,e,r,i,a):b(e,r,i,a)}}function b(e,t,n,r){n||y(e,t),t.pendingcb--,r(),E(e,t)}function y(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function w(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,a=Array(r),i=t.corkedRequestsFree;i.entry=n;for(var s=0,d=!0;n;)a[s]=n,n.isBuf||(d=!1),n=n.next,s+=1;a.allBuffers=d,h(e,t,!0,t.length,a,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,u=n.callback,p=t.objectMode?1:l.length;if(h(e,t,!1,p,l,c,u),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function k(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function x(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),E(e,t)})}function S(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(x,e,t)))}function E(e,t){var n=k(t);return n&&(S(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}function C(e,t,r){t.ending=!0,E(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function v(e,t,n){var r=e.entry;for(e.entry=null;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree.next=e}t.exports=l;var L;l.WritableState=d;var I={deprecate:e("util-deprecate")},T=e("./internal/streams/stream"),B=e("buffer").Buffer,R=r.Uint8Array||function(){},A=e("./internal/streams/destroy"),U=e("./internal/streams/state"),P=U.getHighWaterMark,M=e("../errors").codes,O=M.ERR_INVALID_ARG_TYPE,j=M.ERR_METHOD_NOT_IMPLEMENTED,N=M.ERR_MULTIPLE_CALLBACK,F=M.ERR_STREAM_CANNOT_PIPE,q=M.ERR_STREAM_DESTROYED,H=M.ERR_STREAM_NULL_VALUES,D=M.ERR_STREAM_WRITE_AFTER_END,W=M.ERR_UNKNOWN_ENCODING;e("inherits")(l,T),d.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(d.prototype,"buffer",{get:I.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}();var z;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(z=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function(e){return!!z.call(this,e)||!(this!==l)&&e&&e._writableState instanceof d}})):z=function(e){return e instanceof this},l.prototype.pipe=function(){this.emit("error",new F)},l.prototype.write=function(e,t,n){var r=this._writableState,o=!1,d=!r.objectMode&&i(e);return d&&!B.isBuffer(e)&&(e=a(e)),"function"==typeof t&&(n=t,t=null),d?t="buffer":!t&&(t=r.defaultEncoding),"function"!=typeof n&&(n=s),r.ending?c(this,n):(d||u(this,r,e,n))&&(r.pendingcb++,o=f(this,r,d,e,t,n)),o},l.prototype.cork=function(){this._writableState.corked++},l.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&w(this,e))},l.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())))throw new W(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),l.prototype._write=function(e,t,n){n(new j("_write()"))},l.prototype._writev=null,l.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||C(this,r,n),this},Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),l.prototype.destroy=A.destroy,l.prototype._undestroy=A.undestroy,l.prototype._destroy=function(e,t){t(e)}}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"../errors":101,"./_stream_duplex":103,"./internal/streams/destroy":110,"./internal/streams/state":113,"./internal/streams/stream":114,_process:92,buffer:39,inherits:67,"util-deprecate":188}],108:[function(e,t){(function(n){'use strict';function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return{value:e,done:t}}function a(e){var t=e[l];if(null!==t){var n=e[m].read();null!==n&&(e[f]=null,e[l]=null,e[c]=null,t(o(n,!1)))}}function i(e){n.nextTick(a,e)}function s(e,t){return function(n,r){e.then(function(){return t[p]?void n(o(void 0,!0)):void t[h](n,r)},r)}}var d=e("./end-of-stream"),l=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),p=Symbol("ended"),f=Symbol("lastPromise"),h=Symbol("handlePromise"),m=Symbol("stream"),g=Object.getPrototypeOf(function(){}),_=Object.setPrototypeOf((b={get stream(){return this[m]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[p])return Promise.resolve(o(void 0,!0));if(this[m].destroyed)return new Promise(function(t,r){n.nextTick(function(){e[u]?r(e[u]):t(o(void 0,!0))})});var r=this[f],a;if(r)a=new Promise(s(r,this));else{var i=this[m].read();if(null!==i)return Promise.resolve(o(i,!1));a=new Promise(this[h])}return this[f]=a,a}},r(b,Symbol.asyncIterator,function(){return this}),r(b,"return",function(){var e=this;return new Promise(function(t,n){e[m].destroy(null,function(e){return e?void n(e):void t(o(void 0,!0))})})}),b),g),b;t.exports=function(e){var t=Object.create(_,(n={},r(n,m,{value:e,writable:!0}),r(n,l,{value:null,writable:!0}),r(n,c,{value:null,writable:!0}),r(n,u,{value:null,writable:!0}),r(n,p,{value:e._readableState.endEmitted,writable:!0}),r(n,h,{value:function(e,n){var r=t[m].read();r?(t[f]=null,t[l]=null,t[c]=null,e(o(r,!1))):(t[l]=e,t[c]=n)},writable:!0}),n)),n;return t[f]=null,d(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var n=t[c];return null!==n&&(t[f]=null,t[l]=null,t[c]=null,n(e)),void(t[u]=e)}var r=t[l];null!==r&&(t[f]=null,t[l]=null,t[c]=null,r(o(void 0,!0))),t[p]=!0}),e.on("readable",i.bind(null,t)),t}}).call(this,e("_process"))},{"./end-of-stream":111,_process:92}],109:[function(e,t){'use strict';function n(e){for(var t=1;t<arguments.length;t++){var n=null==arguments[t]?{}:arguments[t],o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){r(e,t,n[t])})}return e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t,n){s.prototype.copy.call(e,t,n)}var a=e("buffer"),s=a.Buffer,d=e("util"),l=d.inspect,c=l&&l.custom||"inspect";t.exports=function(){function e(){this.head=null,this.tail=null,this.length=0}var t=e.prototype;return t.push=function(e){var t={data:e,next:null};0<this.length?this.tail.next=t:this.head=t,this.tail=t,++this.length},t.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},t.shift=function(){if(0!==this.length){var e=this.head.data;return this.head=1===this.length?this.tail=null:this.head.next,--this.length,e}},t.clear=function(){this.head=this.tail=null,this.length=0},t.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},t.concat=function(e){if(0===this.length)return s.alloc(0);for(var t=s.allocUnsafe(e>>>0),n=this.head,r=0;n;)o(n.data,t,r),r+=n.data.length,n=n.next;return t},t.consume=function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):e===this.head.data.length?n=this.shift():n=t?this._getString(e):this._getBuffer(e),n},t.first=function(){return this.head.data},t._getString=function(e){var t=this.head,r=1,o=t.data;for(e-=o.length;t=t.next;){var a=t.data,i=e>a.length?a.length:e;if(o+=i===a.length?a:a.slice(0,e),e-=i,0===e){i===a.length?(++r,this.head=t.next?t.next:this.tail=null):(this.head=t,t.data=a.slice(i));break}++r}return this.length-=r,o},t._getBuffer=function(e){var t=s.allocUnsafe(e),r=this.head,o=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(t,t.length-e,0,i),e-=i,0===e){i===a.length?(++o,this.head=r.next?r.next:this.tail=null):(this.head=r,r.data=a.slice(i));break}++o}return this.length-=o,t},t[c]=function(e,t){return l(this,n({},t,{depth:0,customInspect:!1}))},e}()},{buffer:39,util:33}],110:[function(e,t){(function(e){'use strict';function n(e,t){o(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(e,t){e.emit("error",t)}t.exports={destroy:function(t,a){var i=this,s=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return s||d?(a?a(t):t&&(!this._writableState||!this._writableState.errorEmitted)&&e.nextTick(o,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!a&&t?(e.nextTick(n,i,t),i._writableState&&(i._writableState.errorEmitted=!0)):a?(e.nextTick(r,i),a(t)):e.nextTick(r,i)}),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)}}}).call(this,e("_process"))},{_process:92}],111:[function(e,t){'use strict';function n(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];e.apply(this,r)}}}function r(){}function o(e){return e.setHeader&&"function"==typeof e.abort}function a(e,t,s){if("function"==typeof t)return a(e,null,t);t||(t={}),s=n(s||r);var d=t.readable||!1!==t.readable&&e.readable,l=t.writable||!1!==t.writable&&e.writable,c=function(){e.writable||p()},u=e._writableState&&e._writableState.finished,p=function(){l=!1,u=!0,d||s.call(e)},f=e._readableState&&e._readableState.endEmitted,h=function(){d=!1,f=!0,l||s.call(e)},m=function(t){s.call(e,t)},g=function(){var t;return d&&!f?(e._readableState&&e._readableState.ended||(t=new i),s.call(e,t)):l&&!u?(e._writableState&&e._writableState.ended||(t=new i),s.call(e,t)):void 0},_=function(){e.req.on("finish",p)};return o(e)?(e.on("complete",p),e.on("abort",g),e.req?_():e.on("request",_)):l&&!e._writableState&&(e.on("end",c),e.on("close",c)),e.on("end",h),e.on("finish",p),!1!==t.error&&e.on("error",m),e.on("close",g),function(){e.removeListener("complete",p),e.removeListener("abort",g),e.removeListener("request",_),e.req&&e.req.removeListener("finish",p),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",p),e.removeListener("end",h),e.removeListener("error",m),e.removeListener("close",g)}}var i=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;t.exports=a},{"../../../errors":101}],112:[function(e,t){'use strict';function n(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}function r(e){if(e)throw e}function o(e){return e.setHeader&&"function"==typeof e.abort}function a(t,r,a,i){i=n(i);var s=!1;t.on("close",function(){s=!0}),p===void 0&&(p=e("./end-of-stream")),p(t,{readable:r,writable:a},function(e){return e?i(e):void(s=!0,i())});var d=!1;return function(e){if(!s)return d?void 0:(d=!0,o(t)?t.abort():"function"==typeof t.destroy?t.destroy():void i(e||new u("pipe")))}}function i(e){e()}function s(e,t){return e.pipe(t)}function d(e){return e.length?"function"==typeof e[e.length-1]?e.pop():r:r}var l=e("../../../errors").codes,c=l.ERR_MISSING_ARGS,u=l.ERR_STREAM_DESTROYED,p;t.exports=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=d(t);if(Array.isArray(t[0])&&(t=t[0]),2>t.length)throw new c("streams");var o=t.map(function(e,n){var s=n<t.length-1;return a(e,s,0<n,function(e){l||(l=e),e&&o.forEach(i),s||(o.forEach(i),r(l))})}),l;return t.reduce(s)}},{"../../../errors":101,"./end-of-stream":111}],113:[function(e,t){'use strict';function n(e,t,n){return null==e.highWaterMark?t?e[n]:null:e.highWaterMark}var o=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,a,i){var s=n(t,i,a);if(null!=s){if(!(isFinite(s)&&r(s)===s)||0>s){var d=i?a:"highWaterMark";throw new o(d,s)}return r(s)}return e.objectMode?16:16384}}},{"../../../errors":101}],114:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29,events:49}],115:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),n.Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js"),n.finished=e("./lib/internal/streams/end-of-stream.js"),n.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":103,"./lib/_stream_passthrough.js":104,"./lib/_stream_readable.js":105,"./lib/_stream_transform.js":106,"./lib/_stream_writable.js":107,"./lib/internal/streams/end-of-stream.js":111,"./lib/internal/streams/pipeline.js":112}],116:[function(e,t,n){function r(e,t,n,r){function a(){E.removeEventListener("loadstart",a),n.autoplay&&E.play()}function s(){E.removeEventListener("canplay",s),r(null,E)}function p(){o(e,function(e,n){return e?k(e):void(".pdf"===x?(E=t("object"),E.setAttribute("typemustmatch",!0),E.setAttribute("type","application/pdf"),E.setAttribute("data",n)):(E=t("iframe"),E.sandbox="allow-forms allow-scripts",E.src=n),r(null,E))})}function k(t){t.message="Error rendering file \""+e.name+"\": "+t.message,d(t.message),r(t)}var x=u.extname(e.name).toLowerCase(),S=0,E;0<=g.indexOf(x)?function(){function r(){d("Use `videostream` package for "+e.name),_(),E.addEventListener("error",p),E.addEventListener("loadstart",a),E.addEventListener("canplay",s),f(e,E)}function l(){d("Use MediaSource API for "+e.name),_(),E.addEventListener("error",g),E.addEventListener("loadstart",a),E.addEventListener("canplay",s);var t=new c(E),n=t.createWriteStream(i(e.name));e.createReadStream().pipe(n),S&&(E.currentTime=S)}function u(){d("Use Blob URL for "+e.name),_(),E.addEventListener("error",k),E.addEventListener("loadstart",a),E.addEventListener("canplay",s),o(e,function(e,t){return e?k(e):void(E.src=t,S&&(E.currentTime=S))})}function p(e){d("videostream error: fallback to MediaSource API: %o",e.message||e),E.removeEventListener("error",p),E.removeEventListener("canplay",s),l()}function g(t){return d("MediaSource API error: fallback to Blob URL: %o",t.message||t),"number"==typeof e.length&&e.length>n.maxBlobLength?(d("File length too large for Blob URL approach: %d (max: %d)",e.length,n.maxBlobLength),k(new Error("File length too large for Blob URL approach: "+e.length+" (max: "+n.maxBlobLength+")"))):void(E.removeEventListener("error",g),E.removeEventListener("canplay",s),u())}function _(){E||(E=t(b),E.addEventListener("progress",function(){S=E.currentTime}))}var b=0<=m.indexOf(x)?"video":"audio";w?0<=h.indexOf(x)?r():l():u()}():0<=_.indexOf(x)?function(){E=t("audio"),o(e,function(e,t){return e?k(e):void(E.addEventListener("error",k),E.addEventListener("loadstart",a),E.addEventListener("canplay",s),E.src=t)})}():0<=b.indexOf(x)?function(){E=t("img"),o(e,function(t,n){return t?k(t):void(E.src=n,E.alt=e.name,r(null,E))})}():0<=y.indexOf(x)?p():function(){function t(){l(n)?(d("File extension \"%s\" appears ascii, so will render.",x),p()):(d("File extension \"%s\" appears non-ascii, will not render.",x),r(new Error("Unsupported file type \""+x+"\": Cannot append to DOM")))}d("Unknown file extension \"%s\" - will attempt to render into iframe",x);var n="";e.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",function(e){n+=e}).on("end",t).on("error",r)}()}function o(e,t){var r=u.extname(e.name).toLowerCase();p(e.createReadStream(),n.mime[r],t)}function a(e){if(null==e)throw new Error("file cannot be null or undefined");if("string"!=typeof e.name)throw new Error("missing or invalid file.name property");if("function"!=typeof e.createReadStream)throw new Error("missing or invalid file.createReadStream property")}function i(e){var t=u.extname(e).toLowerCase();return{".m4a":"audio/mp4; codecs=\"mp4a.40.5\"",".m4v":"video/mp4; codecs=\"avc1.640029, mp4a.40.5\"",".mkv":"video/webm; codecs=\"avc1.640029, mp4a.40.5\"",".mp3":"audio/mpeg",".mp4":"video/mp4; codecs=\"avc1.640029, mp4a.40.5\"",".webm":"video/webm; codecs=\"vorbis, vp8\""}[t]}function s(e){null==e.autoplay&&(e.autoplay=!1),null==e.muted&&(e.muted=!1),null==e.controls&&(e.controls=!0),null==e.maxBlobLength&&(e.maxBlobLength=200000000)}n.render=function(e,t,n,o){"function"==typeof n&&(o=n,n={}),n||(n={}),o||(o=function(){}),a(e),s(n),"string"==typeof t&&(t=document.querySelector(t)),r(e,function(n){if(t.nodeName!==n.toUpperCase()){var r=u.extname(e.name).toLowerCase();throw new Error("Cannot render \""+r+"\" inside a \""+t.nodeName.toLowerCase()+"\" element, expected \""+n+"\"")}return t},n,o)},n.append=function(e,t,n,o){function i(e){var r=d(e);return n.autoplay&&(r.autoplay=!0),n.muted&&(r.muted=!0),n.controls&&(r.controls=!0),t.appendChild(r),r}function d(e){var n=document.createElement(e);return t.appendChild(n),n}function l(e,t){e&&t&&t.remove(),o(e,t)}if("function"==typeof n&&(o=n,n={}),n||(n={}),o||(o=function(){}),a(e),s(n),"string"==typeof t&&(t=document.querySelector(t)),t&&("VIDEO"===t.nodeName||"AUDIO"===t.nodeName))throw new Error("Invalid video/audio node argument. Argument must be root element that video/audio tag will be appended to.");r(e,function(e){return"video"===e||"audio"===e?i(e):d(e)},n,l)},n.mime=e("./lib/mime.json");var d=e("debug")("render-media"),l=e("is-ascii"),c=e("mediasource"),u=e("path"),p=e("stream-to-blob-url"),f=e("videostream"),h=[".m4a",".m4v",".mp4"],m=[".m4v",".mkv",".mp4",".webm"],g=[].concat(m,[".m4a",".mp3"]),_=[".aac",".oga",".ogg",".wav",".flac"],b=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],y=[".css",".html",".js",".md",".pdf",".txt"],w="undefined"!=typeof window&&window.MediaSource},{"./lib/mime.json":117,debug:45,"is-ascii":68,mediasource:75,path:89,"stream-to-blob-url":167,videostream:190}],117:[function(e,t){t.exports={".3gp":"video/3gpp",".aac":"audio/aac",".aif":"audio/x-aiff",".aiff":"audio/x-aiff",".atom":"application/atom+xml",".avi":"video/x-msvideo",".bmp":"image/bmp",".bz2":"application/x-bzip2",".conf":"text/plain",".css":"text/css",".csv":"text/plain",".diff":"text/x-diff",".doc":"application/msword",".flv":"video/x-flv",".gif":"image/gif",".gz":"application/x-gzip",".htm":"text/html",".html":"text/html",".ico":"image/vnd.microsoft.icon",".ics":"text/calendar",".iso":"application/octet-stream",".jar":"application/java-archive",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"application/javascript",".json":"application/json",".less":"text/css",".log":"text/plain",".m3u":"audio/x-mpegurl",".m4a":"audio/mp4",".m4v":"video/mp4",".manifest":"text/cache-manifest",".markdown":"text/x-markdown",".mathml":"application/mathml+xml",".md":"text/x-markdown",".mid":"audio/midi",".midi":"audio/midi",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".mp4v":"video/mp4",".mpeg":"video/mpeg",".mpg":"video/mpeg",".odp":"application/vnd.oasis.opendocument.presentation",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odt":"application/vnd.oasis.opendocument.text",".oga":"audio/ogg",".ogg":"application/ogg",".pdf":"application/pdf",".png":"image/png",".pps":"application/vnd.ms-powerpoint",".ppt":"application/vnd.ms-powerpoint",".ps":"application/postscript",".psd":"image/vnd.adobe.photoshop",".qt":"video/quicktime",".rar":"application/x-rar-compressed",".rdf":"application/rdf+xml",".rss":"application/rss+xml",".rtf":"application/rtf",".svg":"image/svg+xml",".svgz":"image/svg+xml",".swf":"application/x-shockwave-flash",".tar":"application/x-tar",".tbz":"application/x-bzip-compressed-tar",".text":"text/plain",".tif":"image/tiff",".tiff":"image/tiff",".torrent":"application/x-bittorrent",".ttf":"application/x-font-ttf",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".wma":"audio/x-ms-wma",".wmv":"video/x-ms-wmv",".xls":"application/vnd.ms-excel",".xml":"application/xml",".yaml":"text/yaml",".yml":"text/yaml",".zip":"application/zip"}},{}],118:[function(e,t){(function(e){t.exports=function(t,n,r){function o(t){function n(){r&&r(t,s),r=null}i?e.nextTick(n):n()}function a(e,n,r){if(s[e]=r,n&&(u=!0),0==--l||n)o(n);else if(!u&&p<d){var i;c?(i=c[p],p+=1,t[i](function(e,t){a(i,e,t)})):(i=p,p+=1,t[i](function(e,t){a(i,e,t)}))}}if("number"!=typeof n)throw new Error("second argument must be a Number");var i=!0,s,d,l,c,u;Array.isArray(t)?(s=[],l=d=t.length):(c=Object.keys(t),s={},l=d=c.length);var p=n;l?c?c.some(function(e,r){if(t[e](function(t,n){a(e,t,n)}),r===n-1)return!0}):t.some(function(e,t){if(e(function(e,n){a(t,e,n)}),t===n-1)return!0}):o(null),i=!1}}).call(this,e("_process"))},{_process:92}],119:[function(e,t){(function(e){t.exports=function(t,n){function r(t){function r(){n&&n(t,s),n=null}a?e.nextTick(r):r()}function o(e,t,n){s[e]=n,(0==--d||t)&&r(t)}var a=!0,s,d,l;Array.isArray(t)?(s=[],d=t.length):(l=Object.keys(t),s={},d=l.length),d?l?l.forEach(function(e){t[e](function(t,n){o(e,t,n)})}):t.forEach(function(e,t){e(function(e,n){o(t,e,n)})}):r(null),a=!1}}).call(this,e("_process"))},{_process:92}],120:[function(e,t,n){(function(e,r){"object"==typeof n&&"object"==typeof t?t.exports=r():"function"==typeof l&&l.amd?l([],r):"object"==typeof n?n.Rusha=r():e.Rusha=r()})("undefined"==typeof self?this:self,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(5),a=n(1),i=a.toHex,s=a.ceilHeapSize,l=n(6),c=function(e){for(e+=9;0<e%64;e+=1);return e},u=function(e,t){var n=new Uint8Array(e.buffer),r=t%4,o=t-r;switch(r){case 0:n[o+3]=0;case 1:n[o+2]=0;case 2:n[o+1]=0;case 3:n[o+0]=0;}for(var a=(t>>2)+1;a<e.length;a++)e[a]=0},p=function(e,t,n){e[t>>2]|=128<<24-(t%4<<3),e[(-16&(t>>2)+2)+14]=0|n/536870912,e[(-16&(t>>2)+2)+15]=n<<3},f=function(e,t){var n=new Int32Array(e,t+320,5),r=new Int32Array(5),o=new DataView(r.buffer);return o.setInt32(0,n[0],!1),o.setInt32(4,n[1],!1),o.setInt32(8,n[2],!1),o.setInt32(12,n[3],!1),o.setInt32(16,n[4],!1),r},h=function(){function e(t){if(r(this,e),t=t||65536,0<t%64)throw new Error("Chunk size must be a multiple of 128 bit");this._offset=0,this._maxChunkLen=t,this._padMaxChunkLen=c(t),this._heap=new ArrayBuffer(s(this._padMaxChunkLen+320+20)),this._h32=new Int32Array(this._heap),this._h8=new Int8Array(this._heap),this._core=new o({Int32Array:Int32Array},{},this._heap)}return e.prototype._initState=function(e,t){this._offset=0;var n=new Int32Array(e,t+320,5);n[0]=1732584193,n[1]=-271733879,n[2]=-1732584194,n[3]=271733878,n[4]=-1009589776},e.prototype._padChunk=function(e,t){var n=c(e),r=new Int32Array(this._heap,0,n>>2);return u(r,e),p(r,e,t),n},e.prototype._write=function(e,t,n,r){l(e,this._h8,this._h32,t,n,r||0)},e.prototype._coreCall=function(e,t,n,r,o){var a=n;this._write(e,t,n),o&&(a=this._padChunk(n,r)),this._core.hash(a,this._padMaxChunkLen)},e.prototype.rawDigest=function(e){var t=e.byteLength||e.length||e.size||0;this._initState(this._heap,this._padMaxChunkLen);var n=0,r=this._maxChunkLen;for(n=0;t>n+r;n+=r)this._coreCall(e,n,r,t,!1);return this._coreCall(e,n,t-n,t,!0),f(this._heap,this._padMaxChunkLen)},e.prototype.digest=function(e){return i(this.rawDigest(e).buffer)},e.prototype.digestFromString=function(e){return this.digest(e)},e.prototype.digestFromBuffer=function(e){return this.digest(e)},e.prototype.digestFromArrayBuffer=function(e){return this.digest(e)},e.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},e.prototype.append=function(e){var t=0,n=e.byteLength||e.length||e.size||0,r=this._offset%this._maxChunkLen,o=void 0;for(this._offset+=n;t<n;)o=d(n-t,this._maxChunkLen-r),this._write(e,t,o,r),r+=o,t+=o,r===this._maxChunkLen&&(this._core.hash(this._maxChunkLen,this._padMaxChunkLen),r=0);return this},e.prototype.getState=function(){var e=this._offset%this._maxChunkLen,t=void 0;if(!e){var n=new Int32Array(this._heap,this._padMaxChunkLen+320,5);t=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}else t=this._heap.slice(0);return{offset:this._offset,heap:t}},e.prototype.setState=function(e){if(this._offset=e.offset,20===e.heap.byteLength){var t=new Int32Array(this._heap,this._padMaxChunkLen+320,5);t.set(new Int32Array(e.heap))}else this._h32.set(new Int32Array(e.heap));return this},e.prototype.rawEnd=function(){var e=this._offset,t=e%this._maxChunkLen,n=this._padChunk(t,e);this._core.hash(n,this._padMaxChunkLen);var r=f(this._heap,this._padMaxChunkLen);return this._initState(this._heap,this._padMaxChunkLen),r},e.prototype.end=function(){return i(this.rawEnd().buffer)},e}();e.exports=h,e.exports._core=o},function(e){for(var t=Array(256),n=0;256>n;n++)t[n]=(16>n?"0":"")+n.toString(16);e.exports.toHex=function(e){for(var n=new Uint8Array(e),r=Array(e.byteLength),o=0;o<r.length;o++)r[o]=t[n[o]];return r.join("")},e.exports.ceilHeapSize=function(e){var t=0;if(65536>=e)return 65536;if(16777216>e)for(t=1;t<e;t<<=1);else for(t=16777216;t<e;t+=16777216);return t},e.exports.isDedicatedWorkerScope=function(e){var t="WorkerGlobalScope"in e&&e instanceof e.WorkerGlobalScope,n="SharedWorkerGlobalScope"in e&&e instanceof e.SharedWorkerGlobalScope,r="ServiceWorkerGlobalScope"in e&&e instanceof e.ServiceWorkerGlobalScope;return t&&!n&&!r}},function(e,t,n){e.exports=function(){var e=n(0),t=function(e,t,n){try{return n(null,e.digest(t))}catch(t){return n(t)}},r=function(e,t,n,o,a){var i=new self.FileReader;i.onloadend=function(){if(i.error)return a(i.error);var s=i.result;t+=i.result.byteLength;try{e.append(s)}catch(t){return void a(t)}t<o.size?r(e,t,n,o,a):a(null,e.end())},i.readAsArrayBuffer(o.slice(t,t+n))},o=!0;return self.onmessage=function(n){if(o){var a=n.data.data,i=n.data.file,s=n.data.id;if("undefined"!=typeof s&&(i||a)){var d=n.data.blockSize||4194304,l=new e(d);l.resetState();var c=function(e,t){e?self.postMessage({id:s,error:e.name}):self.postMessage({id:s,hash:t})};a&&t(l,a,c),i&&r(l,0,d,i,c)}}},function(){o=!1}}},function(e,t,n){var r=n(4),o=n(0),a=n(7),i=n(2),s=n(1),d=s.isDedicatedWorkerScope,l="undefined"!=typeof self&&d(self);o.disableWorkerBehaviour=l?i():function(){},o.createWorker=function(){var e=r(2),t=e.terminate;return e.terminate=function(){URL.revokeObjectURL(e.objectURL),t.call(e)},e},o.createHash=a,e.exports=o},function(e,t,n){function r(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t.oe=function(e){throw console.error(e),e};var r=t(t.s=ENTRY_MODULE);return r.default||r}function o(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,r){var a={};a[r]=[];var i=t.toString(),s=i.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return a;for(var d=s[1],l=new RegExp("(\\\\n|\\W)"+o(d)+"\\((/\\*.*?\\*/)?s?.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g"),c;c=l.exec(i);)"dll-reference"!==c[3]&&a[r].push(c[3]);for(l=new RegExp("\\("+o(d)+"\\(\"(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))\"\\)\\)\\((/\\*.*?\\*/)?s?.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");c=l.exec(i);)e[c[2]]||(a[r].push(c[1]),e[c[2]]=n(c[1]).m),a[c[2]]=a[c[2]]||[],a[c[2]].push(c[4]);return a}function s(e){var t=Object.keys(e);return t.reduce(function(t,n){return t||0<e[n].length},!1)}function d(e,t){for(var n={main:[t]},r={main:[]},o={main:{}};s(n);)for(var d=Object.keys(n),l=0;l<d.length;l++){var c=d[l],u=n[c],p=u.pop();if(o[c]=o[c]||{},!o[c][p]&&e[c][p]){o[c][p]=!0,r[c]=r[c]||[],r[c].push(p);for(var f=a(e,e[c][p],c),h=Object.keys(f),m=0;m<h.length;m++)n[h[m]]=n[h[m]]||[],n[h[m]]=n[h[m]].concat(f[h[m]])}}return r}e.exports=function(e,t){t=t||{};var o={main:n.m},a=t.all?{main:Object.keys(o)}:d(o,e),i="";Object.keys(a).filter(function(e){return"main"!==e}).forEach(function(e){for(var t=0;a[e][t];)t++;a[e].push(t),o[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",i=i+"var "+e+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+a[e].map(function(t){return""+JSON.stringify(t)+": "+o[e][t].toString()}).join(",")+"});\n"}),i=i+"("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+a.main.map(function(e){return""+JSON.stringify(e)+": "+o.main[e].toString()}).join(",")+"})(self);";var s=new window.Blob([i],{type:"text/javascript"});if(t.bare)return s;var l=window.URL||window.webkitURL||window.mozURL||window.msURL,c=l.createObjectURL(s),u=new window.Worker(c);return u.objectURL=c,u}},function(e){e.exports=function(e,t,n){'use asm';var r=new e.Int32Array(n);return{hash:function(e,t){e|=0,t|=0;var n=0,o=0,a=0,i=0,s=0,d=0,l=0,c=0,u=0,p=0,f=0,h=0,m=0,g=0;for(a=0|r[t+320>>2],s=0|r[t+324>>2],l=0|r[t+328>>2],u=0|r[t+332>>2],f=0|r[t+336>>2],n=0;(0|n)<(0|e);n=0|n+64){for(i=a,d=s,c=l,p=u,h=f,o=0;64>(0|o);o=0|o+4)g=0|r[n+o>>2],m=0|(0|(a<<5|a>>>27)+(s&l|~s&u))+(0|(0|g+f)+1518500249),f=u,u=l,l=s<<30|s>>>2,s=a,a=m,r[e+o>>2]=g;for(o=0|e+64;(0|o)<(0|e+80);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(a<<5|a>>>27)+(s&l|~s&u))+(0|(0|g+f)+1518500249),f=u,u=l,l=s<<30|s>>>2,s=a,a=m,r[o>>2]=g;for(o=0|e+80;(0|o)<(0|e+160);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(a<<5|a>>>27)+(s^l^u))+(0|(0|g+f)+1859775393),f=u,u=l,l=s<<30|s>>>2,s=a,a=m,r[o>>2]=g;for(o=0|e+160;(0|o)<(0|e+240);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(a<<5|a>>>27)+(s&l|s&u|l&u))+(0|(0|g+f)-1894007588),f=u,u=l,l=s<<30|s>>>2,s=a,a=m,r[o>>2]=g;for(o=0|e+240;(0|o)<(0|e+320);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(a<<5|a>>>27)+(s^l^u))+(0|(0|g+f)-899497514),f=u,u=l,l=s<<30|s>>>2,s=a,a=m,r[o>>2]=g;a=0|a+i,s=0|s+d,l=0|l+c,u=0|u+p,f=0|f+h}r[t+320>>2]=a,r[t+324>>2]=s,r[t+328>>2]=l,r[t+332>>2]=u,r[t+336>>2]=f}}}},function(e){var t=this,n=void 0;"undefined"!=typeof self&&"undefined"!=typeof self.FileReaderSync&&(n=new self.FileReaderSync);var r=function(e,t,n,r,o,a){var s=a%4,d=(o+s)%4,l=o-d,c;switch(s){case 0:t[a]=e.charCodeAt(r+3);case 1:t[0|a+1-(s<<1)]=e.charCodeAt(r+2);case 2:t[0|a+2-(s<<1)]=e.charCodeAt(r+1);case 3:t[0|a+3-(s<<1)]=e.charCodeAt(r);}if(!(o<d+(4-s))){for(c=4-s;c<l;c=0|c+4)n[a+c>>2]=e.charCodeAt(r+c)<<24|e.charCodeAt(r+c+1)<<16|e.charCodeAt(r+c+2)<<8|e.charCodeAt(r+c+3);switch(d){case 3:t[0|a+l+1]=e.charCodeAt(r+l+2);case 2:t[0|a+l+2]=e.charCodeAt(r+l+1);case 1:t[0|a+l+3]=e.charCodeAt(r+l);}}},o=function(e,t,n,r,o,a){var s=a%4,d=(o+s)%4,l=o-d,c;switch(s){case 0:t[a]=e[r+3];case 1:t[0|a+1-(s<<1)]=e[r+2];case 2:t[0|a+2-(s<<1)]=e[r+1];case 3:t[0|a+3-(s<<1)]=e[r];}if(!(o<d+(4-s))){for(c=4-s;c<l;c=0|c+4)n[0|a+c>>2]=e[r+c]<<24|e[r+c+1]<<16|e[r+c+2]<<8|e[r+c+3];switch(d){case 3:t[0|a+l+1]=e[r+l+2];case 2:t[0|a+l+2]=e[r+l+1];case 1:t[0|a+l+3]=e[r+l];}}},a=function(e,t,r,o,a,s){var d=void 0,l=s%4,c=(a+l)%4,u=a-c,p=new Uint8Array(n.readAsArrayBuffer(e.slice(o,o+a)));switch(l){case 0:t[s]=p[3];case 1:t[0|s+1-(l<<1)]=p[2];case 2:t[0|s+2-(l<<1)]=p[1];case 3:t[0|s+3-(l<<1)]=p[0];}if(!(a<c+(4-l))){for(d=4-l;d<u;d=0|d+4)r[0|s+d>>2]=p[d]<<24|p[d+1]<<16|p[d+2]<<8|p[d+3];switch(c){case 3:t[0|s+u+1]=p[u+2];case 2:t[0|s+u+2]=p[u+1];case 1:t[0|s+u+3]=p[u];}}};e.exports=function(e,n,i,s,d,l){if("string"==typeof e)return r(e,n,i,s,d,l);if(e instanceof Array)return o(e,n,i,s,d,l);if(t&&t.Buffer&&t.Buffer.isBuffer(e))return o(e,n,i,s,d,l);if(e instanceof ArrayBuffer)return o(new Uint8Array(e),n,i,s,d,l);if(e.buffer instanceof ArrayBuffer)return o(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n,i,s,d,l);if(e instanceof Blob)return a(e,n,i,s,d,l);throw new Error("Unsupported data type.")}},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(0),a=n(1),i=a.toHex,s=function(){function e(){r(this,e),this._rusha=new o,this._rusha.resetState()}return e.prototype.update=function(e){return this._rusha.append(e),this},e.prototype.digest=function e(t){var e=this._rusha.rawEnd().buffer;if(!t)return e;if("hex"===t)return i(e);throw new Error("unsupported digest encoding")},e}();e.exports=function(){return new s}}])})},{}],121:[function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}var a=e("buffer"),i=a.Buffer;i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=a:(r(a,n),n.Buffer=o),o.prototype=Object.create(i.prototype),r(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0===t?r.fill(0):"string"==typeof n?r.fill(t,n):r.fill(t),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},{buffer:39}],122:[function(e,t){(function(e){t.exports=function(t,n){var r=[];t.on("data",function(e){r.push(e)}),t.once("end",function(){n&&n(null,e.concat(r)),n=null}),t.once("error",function(e){n&&n(e),n=null})}}).call(this,e("buffer").Buffer)},{buffer:39}],123:[function(e,t){(function(n){function r(e,t){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),t=d(t),e.url){const{hostname:t,port:n,protocol:r,auth:o,path:a}=c.parse(e.url);delete e.url,t||n||r||o?Object.assign(e,{hostname:t,port:n,protocol:r,auth:o,path:a}):e.path=a}const o={"accept-encoding":"gzip, deflate"};e.headers&&Object.keys(e.headers).forEach(t=>o[t.toLowerCase()]=e.headers[t]),e.headers=o;let p;e.body?p=e.json&&!u(e.body)?JSON.stringify(e.body):e.body:e.form&&(p="string"==typeof e.form?e.form:l.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),p&&(!e.method&&(e.method="POST"),!u(p)&&(e.headers["content-length"]=n.byteLength(p)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const f="https:"===e.protocol?s:i,h=f.request(e,n=>{if(300<=n.statusCode&&400>n.statusCode&&n.headers.location)return e.url=n.headers.location,delete e.headers.host,n.resume(),"POST"===e.method&&[301,302].includes(n.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?t(new Error("too many redirects")):r(e,t);const o="function"==typeof a&&"HEAD"!==e.method;t(null,o?a(n):n)});return h.on("timeout",()=>{h.abort(),t(new Error("Request timed out"))}),h.on("error",t),u(p)?p.on("error",t).pipe(h):h.end(p),h}t.exports=r;const o=e("simple-concat"),a=e("decompress-response"),i=e("http"),s=e("https"),d=e("once"),l=e("querystring"),c=e("url"),u=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;r.concat=(e,t)=>r(e,(n,r)=>n?t(n):void o(r,(n,o)=>{if(n)return t(n);if(e.json)try{o=JSON.parse(o.toString())}catch(e){return t(e,r,o)}t(null,r,o)})),["get","post","put","patch","head","delete"].forEach(e=>{r[e]=(t,n)=>("string"==typeof t&&(t={url:t}),r(Object.assign({method:e.toUpperCase()},t),n))})}).call(this,e("buffer").Buffer)},{buffer:39,"decompress-response":33,http:152,https:64,once:86,querystring:97,"simple-concat":122,url:184}],124:[function(e,t){(function(n){function r(e){var t=this;if(!(t instanceof r))return new r(e);if(t._id=l(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),c.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||l(20).toString("hex"):null,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||r.channelConfig,t.config=Object.assign({},r.config,e.config),t.offerOptions=e.offerOptions||{},t.answerOptions=e.answerOptions||{},t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,t.iceCompleteTimeout=e.iceCompleteTimeout||5000,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localFamily=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:s(),!t._wrtc)if("undefined"==typeof window)throw a("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT");else throw a("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._iceCompleteTimer=null,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!t.initiator,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new Map,t._firstStable=!0,t._closingInterval=null,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null;try{t._pc=new t._wrtc.RTCPeerConnection(t.config)}catch(e){t.destroy(e)}t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)},t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function o(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function a(e,t){var n=new Error(e);return n.code=t,n}t.exports=r;var i=e("debug")("simple-peer"),s=e("get-browser-rtc"),d=e("inherits"),l=e("randombytes"),c=e("readable-stream"),u=65536;d(r,c.Duplex),r.WEBRTC_SUPPORT=!!s(),r.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}],sdpSemantics:"unified-plan"},r.channelConfig={},Object.defineProperty(r.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}}),r.prototype.address=function(){var e=this;return{port:e.localPort,family:e.localFamily,address:e.localAddress}},r.prototype.signal=function(e){var t=this;if(t.destroyed)throw a("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&t.initiator&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.transceiverRequest&&t.initiator&&(t._debug("got request for transceiver"),t.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(t._pc.localDescription&&t._pc.localDescription.type&&t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e)).then(function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())}).catch(function(e){t.destroy(a(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||t.destroy(a("signal() called with invalid signal data","ERR_SIGNALING"))},r.prototype._addIceCandidate=function(e){var t=this;t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e)).catch(function(e){t.destroy(a(e,"ERR_ADD_ICE_CANDIDATE"))})},r.prototype.send=function(e){var t=this;t._channel.send(e)},r.prototype.addTransceiver=function(e,t){var n=this;if(n._debug("addTransceiver()"),n.initiator)try{n._pc.addTransceiver(e,t),n._needsNegotiation()}catch(e){n.destroy(e)}else n.emit("signal",{transceiverRequest:{kind:e,init:t}})},r.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(n){t.addTrack(n,e)})},r.prototype.addTrack=function(e,t){var n=this;n._debug("addTrack()");var r=n._senderMap.get(e)||new Map,o=r.get(t);o?o.removed?n.destroy(a("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):n.destroy(a("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED"):(o=n._pc.addTrack(e,t),r.set(t,o),n._senderMap.set(e,r),n._needsNegotiation())},r.prototype.replaceTrack=function(e,t,n){var r=this;r._debug("replaceTrack()");var o=r._senderMap.get(e),i=o?o.get(n):null;i||r.destroy(a("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED"),t&&r._senderMap.set(t,o),null==i.replaceTrack?r.destroy(a("replaceTrack is not supported in this browser","ERR_UNSUPPORTED_REPLACETRACK")):i.replaceTrack(t)},r.prototype.removeTrack=function(e,t){var n=this;n._debug("removeSender()");var r=n._senderMap.get(e),o=r?r.get(t):null;o||n.destroy(a("Cannot remove track that was never added.","ERR_TRACK_NOT_ADDED"));try{o.removed=!0,n._pc.removeTrack(o)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?n._sendersAwaitingStable.push(o):n.destroy(e)}n._needsNegotiation()},r.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(n){t.removeTrack(n,e)})},r.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation");e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},r.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?(e._queuedNegotiation=!0,e._debug("already negotiating, queueing")):(e._debug("start negotiation"),setTimeout(()=>{e._createOffer()},0)):!e._isNegotiating&&(e._debug("requesting negotiation from initiator"),e.emit("signal",{renegotiate:!0})),e._isNegotiating=!0},r.prototype.destroy=function(e){var t=this;t._destroy(e,function(){})},r.prototype._destroy=function(e,t){var n=this;if(!n.destroyed){if(n._debug("destroy (error: %s)",e&&(e.message||e)),n.readable=n.writable=!1,n._readableState.ended||n.push(null),n._writableState.finished||n.end(),n.destroyed=!0,n.connected=!1,n._pcReady=!1,n._channelReady=!1,n._remoteTracks=null,n._remoteStreams=null,n._senderMap=null,clearInterval(n._closingInterval),n._closingInterval=null,clearInterval(n._interval),n._interval=null,n._chunk=null,n._cb=null,n._onFinishBound&&n.removeListener("finish",n._onFinishBound),n._onFinishBound=null,n._channel){try{n._channel.close()}catch(e){}n._channel.onmessage=null,n._channel.onopen=null,n._channel.onclose=null,n._channel.onerror=null}if(n._pc){try{n._pc.close()}catch(e){}n._pc.oniceconnectionstatechange=null,n._pc.onicegatheringstatechange=null,n._pc.onsignalingstatechange=null,n._pc.onicecandidate=null,n._pc.ontrack=null,n._pc.ondatachannel=null}n._pc=null,n._channel=null,e&&n.emit("error",e),n.emit("close"),t()}},r.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(a("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=u),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(a(e,"ERR_DATA_CHANNEL"))};var n=!1;t._closingInterval=setInterval(function(){t._channel&&"closing"===t._channel.readyState?(n&&t._onChannelClose(),n=!0):n=!1},5000)},r.prototype._read=function(){},r.prototype._write=function(e,t,n){var r=this;if(r.destroyed)return n(a("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(r.connected){try{r.send(e)}catch(e){return r.destroy(a(e,"ERR_DATA_CHANNEL"))}r._channel.bufferedAmount>u?(r._debug("start backpressure: bufferedAmount %d",r._channel.bufferedAmount),r._cb=n):n(null)}else r._debug("write before connect"),r._chunk=e,r._cb=n},r.prototype._onFinish=function(){function e(){setTimeout(function(){t.destroy()},1e3)}var t=this;t.destroyed||(t.connected?e():t.once("connect",e))},r.prototype._startIceCompleteTimeout=function(){var e=this;e.destroyed||e._iceCompleteTimer||(e._debug("started iceComplete timeout"),e._iceCompleteTimer=setTimeout(function(){e._iceComplete||(e._iceComplete=!0,e._debug("iceComplete timeout completed"),e.emit("iceTimeout"),e.emit("_iceComplete"))},e.iceCompleteTimeout))},r.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(e.offerOptions).then(function(t){function n(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}}e.destroyed||(!e.trickle&&!e.allowHalfTrickle&&(t.sdp=o(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(function(){e._debug("createOffer success");e.destroyed||(e.trickle||e._iceComplete?n():e.once("_iceComplete",n))}).catch(function(t){e.destroy(a(t,"ERR_SET_LOCAL_DESCRIPTION"))}))}).catch(function(t){e.destroy(a(t,"ERR_CREATE_OFFER"))})},r.prototype._requestMissingTransceivers=function(){var e=this;e._pc.getTransceivers&&e._pc.getTransceivers().forEach(t=>{t.mid||!t.sender.track||t.requested||(t.requested=!0,e.addTransceiver(t.sender.track.kind))})},r.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(e.answerOptions).then(function(t){function n(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp}),e.initiator||e._requestMissingTransceivers()}}e.destroyed||(!e.trickle&&!e.allowHalfTrickle&&(t.sdp=o(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(function(){e.destroyed||(e.trickle||e._iceComplete?n():e.once("_iceComplete",n))}).catch(function(t){e.destroy(a(t,"ERR_SET_LOCAL_DESCRIPTION"))}))}).catch(function(t){e.destroy(a(t,"ERR_CREATE_ANSWER"))})},r.prototype._onIceStateChange=function(){var e=this;if(!e.destroyed){var t=e._pc.iceConnectionState,n=e._pc.iceGatheringState;e._debug("iceStateChange (connection: %s) (gathering: %s)",t,n),e.emit("iceStateChange",t,n),("connected"===t||"completed"===t)&&(e._pcReady=!0,e._maybeReady()),"failed"===t&&e.destroy(a("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&e.destroy(a("Ice connection closed.","ERR_ICE_CONNECTION_CLOSED"))}},r.prototype.getStats=function(e){function t(e){return"[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(function(t){Object.assign(e,t)}),e}var n=this;0===n._pc.getStats.length?n._pc.getStats().then(function(n){var r=[];n.forEach(function(e){r.push(t(e))}),e(null,r)},function(t){e(t)}):n._isReactNativeWebrtc?n._pc.getStats(null,function(n){var r=[];n.forEach(function(e){r.push(t(e))}),e(null,r)},function(t){e(t)}):0<n._pc.getStats.length?n._pc.getStats(function(r){if(!n.destroyed){var o=[];r.result().forEach(function(e){var n={};e.names().forEach(function(t){n[t]=e.stat(t)}),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,o.push(t(n))}),e(null,o)}},function(t){e(t)}):e(null,[])},r.prototype._maybeReady=function(){function e(){t.destroyed||t.getStats(function(n,r){function o(e){l=!0;var n=s[e.localCandidateId];n&&(n.ip||n.address)?(t.localAddress=n.ip||n.address,t.localPort=+n.port):n&&n.ipAddress?(t.localAddress=n.ipAddress,t.localPort=+n.portNumber):"string"==typeof e.googLocalAddress&&(n=e.googLocalAddress.split(":"),t.localAddress=n[0],t.localPort=+n[1]),t.localAddress&&(t.localFamily=t.localAddress.includes(":")?"IPv6":"IPv4");var r=i[e.remoteCandidateId];r&&(r.ip||r.address)?(t.remoteAddress=r.ip||r.address,t.remotePort=+r.port):r&&r.ipAddress?(t.remoteAddress=r.ipAddress,t.remotePort=+r.portNumber):"string"==typeof e.googRemoteAddress&&(r=e.googRemoteAddress.split(":"),t.remoteAddress=r[0],t.remotePort=+r[1]),t.remoteAddress&&(t.remoteFamily=t.remoteAddress.includes(":")?"IPv6":"IPv4"),t._debug("connect local: %s:%s remote: %s:%s",t.localAddress,t.localPort,t.remoteAddress,t.remotePort)}if(!t.destroyed){n&&(r=[]);var i={},s={},d={},l=!1;if(r.forEach(function(e){("remotecandidate"===e.type||"remote-candidate"===e.type)&&(i[e.id]=e),("localcandidate"===e.type||"local-candidate"===e.type)&&(s[e.id]=e),("candidatepair"===e.type||"candidate-pair"===e.type)&&(d[e.id]=e)}),r.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&o(d[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&o(e)}),!l&&(!Object.keys(d).length||Object.keys(s).length))return void setTimeout(e,100);if(t._connecting=!1,t.connected=!0,t._chunk){try{t.send(t._chunk)}catch(e){return t.destroy(a(e,"ERR_DATA_CHANNEL"))}t._chunk=null,t._debug("sent chunk from \"write before connect\"");var c=t._cb;t._cb=null,c(null)}"number"!=typeof t._channel.bufferedAmountLowThreshold&&(t._interval=setInterval(function(){t._onInterval()},150),t._interval.unref&&t._interval.unref()),t._debug("connect"),t.emit("connect")}})}var t=this;t._debug("maybeReady pc %s channel %s",t._pcReady,t._channelReady);t.connected||t._connecting||!t._pcReady||!t._channelReady||(t._connecting=!0,e())},r.prototype._onInterval=function(){var e=this;e._cb&&e._channel&&!(e._channel.bufferedAmount>u)&&e._onChannelBufferedAmountLow()},r.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"===e._pc.signalingState&&!e._firstStable&&(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._firstStable=!1,e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},r.prototype._onIceCandidate=function(e){var t=this;t.destroyed||(e.candidate&&t.trickle?t.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):!e.candidate&&!t._iceComplete&&(t._iceComplete=!0,t.emit("_iceComplete")),e.candidate&&t._startIceCompleteTimeout())},r.prototype._onChannelMessage=function(e){var t=this;if(!t.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=n.from(r)),t.push(r)}},r.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!e.destroyed&&e._cb){e._debug("ending backpressure: bufferedAmount %d",e._channel.bufferedAmount);var t=e._cb;e._cb=null,t(null)}},r.prototype._onChannelOpen=function(){var e=this;e.connected||e.destroyed||(e._debug("on channel open"),e._channelReady=!0,e._maybeReady())},r.prototype._onChannelClose=function(){var e=this;e.destroyed||(e._debug("on channel close"),e.destroy())},r.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n});t._remoteStreams.some(function(e){return e.id===n.id})||(t._remoteStreams.push(n),setTimeout(function(){t.emit("stream",n)},0))})},r.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+e._id+"] "+t[0],i.apply(null,t)}}).call(this,e("buffer").Buffer)},{buffer:39,debug:45,"get-browser-rtc":63,inherits:67,randombytes:99,"readable-stream":133}],125:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{"./_stream_readable":127,"./_stream_writable":129,"core-util-is":43,dup:22,inherits:67,"process-nextick-args":91}],126:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./_stream_transform":128,"core-util-is":43,dup:23,inherits:67}],127:[function(e,t,n){arguments[4][24][0].apply(n,arguments)},{"./_stream_duplex":125,"./internal/streams/BufferList":130,"./internal/streams/destroy":131,"./internal/streams/stream":132,_process:92,"core-util-is":43,dup:24,events:49,inherits:67,isarray:72,"process-nextick-args":91,"safe-buffer":134,"string_decoder/":135,util:33}],128:[function(e,t,n){arguments[4][25][0].apply(n,arguments)},{"./_stream_duplex":125,"core-util-is":43,dup:25,inherits:67}],129:[function(e,t,n){arguments[4][26][0].apply(n,arguments)},{"./_stream_duplex":125,"./internal/streams/destroy":131,"./internal/streams/stream":132,_process:92,"core-util-is":43,dup:26,inherits:67,"process-nextick-args":91,"safe-buffer":134,timers:174,"util-deprecate":188}],130:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{dup:27,"safe-buffer":134,util:33}],131:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28,"process-nextick-args":91}],132:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29,events:49}],133:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./lib/_stream_duplex.js":125,"./lib/_stream_passthrough.js":126,"./lib/_stream_readable.js":127,"./lib/_stream_transform.js":128,"./lib/_stream_writable.js":129,dup:30}],134:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{buffer:39,dup:31}],135:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32,"safe-buffer":134}],136:[function(e,t){function n(e){return s.digest(e)}function r(e,t){return c?void("string"==typeof e&&(e=o(e)),c.digest({name:"sha-1"},e).then(function(e){t(a(new Uint8Array(e)))},function(){t(n(e))})):void setTimeout(t,0,n(e))}function o(e){for(var t=e.length,n=new Uint8Array(t),r=0;r<t;r++)n[r]=e.charCodeAt(r);return n}function a(e){for(var t=e.length,n=[],r=0,o;r<t;r++)o=e[r],n.push((o>>>4).toString(16)),n.push((15&o).toString(16));return n.join("")}var i=e("rusha"),s=new i,d="undefined"==typeof window?self:window,l=d.crypto||d.msCrypto||{},c=l.subtle||l.webkitSubtle;try{c.digest({name:"sha-1"},new Uint8Array).catch(function(){c=!1})}catch(e){c=!1}t.exports=r,t.exports.sync=n},{rusha:120}],137:[function(e,t){(function(n,r){function o(e){var t=this;if(!(t instanceof o))return new o(e);if(e||(e={}),"string"==typeof e&&(e={url:e}),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(t._id=s(4).toString("hex").slice(0,7),t._debug("new websocket: %o",e),e=Object.assign({allowHalfOpen:!1},e),d.Duplex.call(t,e),t.connected=!1,t.destroyed=!1,t._chunk=null,t._cb=null,t._interval=null,e.socket)t.url=e.socket.url,t._ws=e.socket;else{t.url=e.url;try{t._ws="function"==typeof l?new c(e.url,e):new c(e.url)}catch(e){return void n.nextTick(function(){t.destroy(e)})}}t._ws.binaryType="arraybuffer",t._ws.onopen=function(){t._onOpen()},t._ws.onmessage=function(e){t._onMessage(e)},t._ws.onclose=function(){t._onClose()},t._ws.onerror=function(){t.destroy(new Error("connection error to "+t.url))},t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}t.exports=o;var a=e("debug")("simple-websocket"),i=e("inherits"),s=e("randombytes"),d=e("readable-stream"),l=e("ws"),c="function"==typeof l?l:WebSocket,u=65536;i(o,d.Duplex),o.WEBSOCKET_SUPPORT=!!c,o.prototype.send=function(e){this._ws.send(e)},o.prototype.destroy=function(e){this._destroy(e,function(){})},o.prototype._destroy=function(e,t){var n=this;if(!n.destroyed){if(n._debug("destroy (error: %s)",e&&(e.message||e)),n.readable=n.writable=!1,n._readableState.ended||n.push(null),n._writableState.finished||n.end(),n.connected=!1,n.destroyed=!0,clearInterval(n._interval),n._interval=null,n._chunk=null,n._cb=null,n._onFinishBound&&n.removeListener("finish",n._onFinishBound),n._onFinishBound=null,n._ws){var r=n._ws,o=function(){r.onclose=null};if(r.readyState===c.CLOSED)o();else try{r.onclose=o,r.close()}catch(e){o()}r.onopen=null,r.onmessage=null,r.onerror=function(){}}if(n._ws=null,e){if("undefined"!=typeof DOMException&&e instanceof DOMException){var a=e.code;e=new Error(e.message),e.code=a}n.emit("error",e)}n.emit("close"),t()}},o.prototype._read=function(){},o.prototype._write=function(e,t,n){if(this.destroyed)return n(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof l&&this._ws.bufferedAmount>u?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n},o.prototype._onFinish=function(){function e(){setTimeout(function(){t.destroy()},1e3)}var t=this;t.destroyed||(t.connected?e():t.once("connect",e))},o.prototype._onMessage=function(e){if(!this.destroyed){var t=e.data;t instanceof ArrayBuffer&&(t=r.from(t)),this.push(t)}},o.prototype._onOpen=function(){var e=this;if(!(e.connected||e.destroyed)){if(e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(t){return e.destroy(t)}e._chunk=null,e._debug("sent chunk from \"write before connect\"");var t=e._cb;e._cb=null,t(null)}"function"!=typeof l&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}},o.prototype._onInterval=function(){if(this._cb&&this._ws&&!(this._ws.bufferedAmount>u)){this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);var e=this._cb;this._cb=null,e(null)}},o.prototype._onClose=function(){this.destroyed||(this._debug("on close"),this.destroy())},o.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],a.apply(null,e)}}).call(this,e("_process"),e("buffer").Buffer)},{_process:92,buffer:39,debug:138,inherits:67,randombytes:99,"readable-stream":148,ws:33}],138:[function(e,t,n){(function(o){"use strict";function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(){var e;return"object"===("undefined"==typeof console?"undefined":a(console))&&console.log&&(e=console).log.apply(e,arguments)}function s(){var e;try{e=n.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof o&&"env"in o&&(e=o.env.DEBUG),e}n.log=i,n.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){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"===e||(r++,"%c"===e&&(o=r))}),e.splice(o,0,n)}},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=s,n.useColors=function(){return!!("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},n.storage=function(){try{return localStorage}catch(e){}}(),n.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.exports=e("./common")(n);var d=t.exports.formatters;d.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,e("_process"))},{"./common":139,_process:92}],139:[function(e,n){"use strict";n.exports=function(n){function r(e){for(var n=0,r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r),n|=0;return o.colors[t(n)%o.colors.length]}function o(e){function t(){if(t.enabled){for(var e=arguments.length,r=Array(e),a=0;a<e;a++)r[a]=arguments[a];var i=t,s=+new Date,d=s-(n||s);i.diff=d,i.prev=n,i.curr=s,n=s,r[0]=o.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var l=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,function(e,t){if("%%"===e)return e;l++;var n=o.formatters[t];if("function"==typeof n){var a=r[l];e=n.call(i,a),r.splice(l,1),l--}return e}),o.formatArgs.call(i,r);var c=i.log||o.log;c.apply(i,r)}}var n;return t.namespace=e,t.enabled=o.enabled(e),t.useColors=o.useColors(),t.color=r(e),t.destroy=a,t.extend=i,"function"==typeof o.init&&o.init(t),o.instances.push(t),t}function a(){var e=o.instances.indexOf(this);return-1!==e&&(o.instances.splice(e,1),!0)}function i(e,t){return o(this.namespace+("undefined"==typeof t?":":t)+e)}return o.debug=o,o.default=o,o.coerce=function(e){return e instanceof Error?e.stack||e.message:e},o.disable=function(){o.enable("")},o.enable=function(e){o.save(e),o.names=[],o.skips=[];var t=("string"==typeof e?e:"").split(/[\s,]+/),n=t.length,r;for(r=0;r<n;r++)t[r]&&(e=t[r].replace(/\*/g,".*?"),"-"===e[0]?o.skips.push(new RegExp("^"+e.substr(1)+"$")):o.names.push(new RegExp("^"+e+"$")));for(r=0;r<o.instances.length;r++){var a=o.instances[r];a.enabled=o.enabled(a.namespace)}},o.enabled=function(e){if("*"===e[e.length-1])return!0;var t,n;for(t=0,n=o.skips.length;t<n;t++)if(o.skips[t].test(e))return!1;for(t=0,n=o.names.length;t<n;t++)if(o.names[t].test(e))return!0;return!1},o.humanize=e("ms"),Object.keys(n).forEach(function(e){o[e]=n[e]}),o.instances=[],o.names=[],o.skips=[],o.formatters={},o.selectColor=r,o.enable(o.load()),o}},{ms:83}],140:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{"./_stream_readable":142,"./_stream_writable":144,"core-util-is":43,dup:22,inherits:67,"process-nextick-args":91}],141:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./_stream_transform":143,"core-util-is":43,dup:23,inherits:67}],142:[function(e,t,n){arguments[4][24][0].apply(n,arguments)},{"./_stream_duplex":140,"./internal/streams/BufferList":145,"./internal/streams/destroy":146,"./internal/streams/stream":147,_process:92,"core-util-is":43,dup:24,events:49,inherits:67,isarray:72,"process-nextick-args":91,"safe-buffer":149,"string_decoder/":150,util:33}],143:[function(e,t,n){arguments[4][25][0].apply(n,arguments)},{"./_stream_duplex":140,"core-util-is":43,dup:25,inherits:67}],144:[function(e,t,n){arguments[4][26][0].apply(n,arguments)},{"./_stream_duplex":140,"./internal/streams/destroy":146,"./internal/streams/stream":147,_process:92,"core-util-is":43,dup:26,inherits:67,"process-nextick-args":91,"safe-buffer":149,timers:174,"util-deprecate":188}],145:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{dup:27,"safe-buffer":149,util:33}],146:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28,"process-nextick-args":91}],147:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29,events:49}],148:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./lib/_stream_duplex.js":140,"./lib/_stream_passthrough.js":141,"./lib/_stream_readable.js":142,"./lib/_stream_transform.js":143,"./lib/_stream_writable.js":144,dup:30}],149:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{buffer:39,dup:31}],150:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32,"safe-buffer":149}],151:[function(e,t){var n=1,r=65535,o=4,a=function(){n=n+1&r},i;t.exports=function(e){i||(i=setInterval(a,0|1e3/o),i.unref&&i.unref());var t=o*(e||5),s=[0],d=1,l=n-1&r;return function(e){var a=n-l&r;for(a>t&&(a=t),l=n;a--;)d===t&&(d=0),s[d]=s[0===d?t-1:d-1],d++;e&&(s[d-1]+=e);var i=s[d-1],c=s.length<t?0:s[d===t?0:d];return s.length<o?i:(i-c)*o/s.length}}},{}],152:[function(e,t,n){(function(t){var r=e("./lib/request"),o=e("./lib/response"),a=e("xtend"),i=e("builtin-status-codes"),s=e("url"),d=n;d.request=function(e,n){e="string"==typeof e?s.parse(e):a(e);var o=-1===t.location.protocol.search(/^https?:$/)?"http:":"",i=e.protocol||o,d=e.hostname||e.host,l=e.port,c=e.path||"/";d&&-1!==d.indexOf(":")&&(d="["+d+"]"),e.url=(d?i+"//"+d:"")+(l?":"+l:"")+c,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var u=new r(e);return n&&u.on("response",n),u},d.get=function(e,t){var n=d.request(e,t);return n.end(),n},d.ClientRequest=r,d.IncomingMessage=o.IncomingMessage,d.Agent=function(){},d.Agent.defaultMaxSockets=4,d.globalAgent=new d.Agent,d.STATUS_CODES=i,d.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"./lib/request":154,"./lib/response":155,"builtin-status-codes":40,url:184,xtend:192}],153:[function(e,t,n){(function(e){function t(){if(s!==void 0)return s;if(e.XMLHttpRequest){s=new e.XMLHttpRequest;try{s.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(t){s=null}}else s=null;return s}function r(e){var n=t();if(!n)return!1;try{return n.responseType=e,n.responseType===e}catch(t){}return!1}function o(e){return"function"==typeof e}n.fetch=o(e.fetch)&&o(e.ReadableStream),n.writableStream=o(e.WritableStream),n.abortController=o(e.AbortController),n.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),n.blobConstructor=!0}catch(t){}var a="undefined"!=typeof e.ArrayBuffer,i=a&&o(e.ArrayBuffer.prototype.slice),s;n.arraybuffer=n.fetch||a&&r("arraybuffer"),n.msstream=!n.fetch&&i&&r("ms-stream"),n.mozchunkedarraybuffer=!n.fetch&&a&&r("moz-chunked-arraybuffer"),n.overrideMimeType=n.fetch||!!t()&&o(t().overrideMimeType),n.vbArray=o(e.VBArray),s=null}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],154:[function(e,t){(function(n,r,o){function a(e,t){return s.fetch&&t?"fetch":s.mozchunkedarraybuffer?"moz-chunked-arraybuffer":s.msstream?"ms-stream":s.arraybuffer&&e?"arraybuffer":s.vbArray&&e?"text:vbarray":"text"}function i(e){try{var t=e.status;return null!==t&&0!==t}catch(t){return!1}}var s=e("./capability"),d=e("inherits"),l=e("./response"),c=e("readable-stream"),u=e("to-arraybuffer"),p=l.IncomingMessage,f=l.readyStates,h=t.exports=function(e){var t=this;c.Writable.call(t),t._opts=e,t._body=[],t._headers={},e.auth&&t.setHeader("Authorization","Basic "+new o(e.auth).toString("base64")),Object.keys(e.headers).forEach(function(n){t.setHeader(n,e.headers[n])});var n=!0,r;if("disable-fetch"===e.mode||"requestTimeout"in e&&!s.abortController)n=!1,r=!0;else if("prefer-streaming"===e.mode)r=!1;else if("allow-wrong-content-type"===e.mode)r=!s.overrideMimeType;else if(!e.mode||"default"===e.mode||"prefer-fast"===e.mode)r=!0;else throw new Error("Invalid value for opts.mode");t._mode=a(r,n),t._fetchTimer=null,t.on("finish",function(){t._onFinish()})};d(h,c.Writable),h.prototype.setHeader=function(e,t){var n=this,r=e.toLowerCase();-1!==m.indexOf(r)||(n._headers[r]={name:e,value:t})},h.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},h.prototype.removeHeader=function(e){var t=this;delete t._headers[e.toLowerCase()]},h.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t=e._opts,a=e._headers,i=null;"GET"!==t.method&&"HEAD"!==t.method&&(s.arraybuffer?i=u(o.concat(e._body)):s.blobConstructor?i=new r.Blob(e._body.map(function(e){return u(e)}),{type:(a["content-type"]||{}).value||""}):i=o.concat(e._body).toString());var d=[];if(Object.keys(a).forEach(function(e){var t=a[e].name,n=a[e].value;Array.isArray(n)?n.forEach(function(e){d.push([t,e])}):d.push([t,n])}),"fetch"===e._mode){var l=null;if(s.abortController){var c=new AbortController;l=c.signal,e._fetchAbortController=c,"requestTimeout"in t&&0!==t.requestTimeout&&(e._fetchTimer=r.setTimeout(function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()},t.requestTimeout))}r.fetch(e._opts.url,{method:e._opts.method,headers:d,body:i||void 0,mode:"cors",credentials:t.withCredentials?"include":"same-origin",signal:l}).then(function(t){e._fetchResponse=t,e._connect()},function(t){r.clearTimeout(e._fetchTimer),e._destroyed||e.emit("error",t)})}else{var p=e._xhr=new r.XMLHttpRequest;try{p.open(e._opts.method,e._opts.url,!0)}catch(t){return void n.nextTick(function(){e.emit("error",t)})}"responseType"in p&&(p.responseType=e._mode.split(":")[0]),"withCredentials"in p&&(p.withCredentials=!!t.withCredentials),"text"===e._mode&&"overrideMimeType"in p&&p.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in t&&(p.timeout=t.requestTimeout,p.ontimeout=function(){e.emit("requestTimeout")}),d.forEach(function(e){p.setRequestHeader(e[0],e[1])}),e._response=null,p.onreadystatechange=function(){switch(p.readyState){case f.LOADING:case f.DONE:e._onXHRProgress();}},"moz-chunked-arraybuffer"===e._mode&&(p.onprogress=function(){e._onXHRProgress()}),p.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{p.send(i)}catch(t){return void n.nextTick(function(){e.emit("error",t)})}}}},h.prototype._onXHRProgress=function(){var e=this;!i(e._xhr)||e._destroyed||(!e._response&&e._connect(),e._response._onXHRProgress())},h.prototype._connect=function(){var e=this;e._destroyed||(e._response=new p(e._xhr,e._fetchResponse,e._mode,e._fetchTimer),e._response.on("error",function(t){e.emit("error",t)}),e.emit("response",e._response))},h.prototype._write=function(e,t,n){var r=this;r._body.push(e),n()},h.prototype.abort=h.prototype.destroy=function(){var e=this;e._destroyed=!0,r.clearTimeout(e._fetchTimer),e._response&&(e._response._destroyed=!0),e._xhr?e._xhr.abort():e._fetchAbortController&&e._fetchAbortController.abort()},h.prototype.end=function(e,t,n){var r=this;"function"==typeof e&&(n=e,e=void 0),c.Writable.prototype.end.call(r,e,t,n)},h.prototype.flushHeaders=function(){},h.prototype.setTimeout=function(){},h.prototype.setNoDelay=function(){},h.prototype.setSocketKeepAlive=function(){};var m=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,e("buffer").Buffer)},{"./capability":153,"./response":155,_process:92,buffer:39,inherits:67,"readable-stream":164,"to-arraybuffer":175}],155:[function(e,t,n){(function(t,r,o){var a=e("./capability"),i=e("inherits"),s=e("readable-stream"),d=n.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=n.IncomingMessage=function(e,n,i,d){var l=this;if(s.Readable.call(l),l._mode=i,l.headers={},l.rawHeaders=[],l.trailers={},l.rawTrailers=[],l.on("end",function(){t.nextTick(function(){l.emit("close")})}),"fetch"===i){function e(){u.read().then(function(t){return l._destroyed?void 0:t.done?(r.clearTimeout(d),void l.push(null)):void(l.push(new o(t.value)),e())}).catch(function(e){r.clearTimeout(d),l._destroyed||l.emit("error",e)})}if(l._fetchResponse=n,l.url=n.url,l.statusCode=n.status,l.statusMessage=n.statusText,n.headers.forEach(function(e,t){l.headers[t.toLowerCase()]=e,l.rawHeaders.push(t,e)}),a.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){l._destroyed?n():l.push(new o(e))?t():l._resumeFetch=t})},close:function(){r.clearTimeout(d),l._destroyed||l.push(null)},abort:function(e){l._destroyed||l.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){r.clearTimeout(d),l._destroyed||l.emit("error",e)})}catch(t){}}var u=n.body.getReader();e()}else{l._xhr=e,l._pos=0,l.url=e.responseURL,l.statusCode=e.status,l.statusMessage=e.statusText;var p=e.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===l.headers[n]&&(l.headers[n]=[]),l.headers[n].push(t[2])):void 0===l.headers[n]?l.headers[n]=t[2]:l.headers[n]+=", "+t[2],l.rawHeaders.push(t[1],t[2])}}),l._charset="x-user-defined",!a.overrideMimeType){var f=l.rawHeaders["mime-type"];if(f){var h=f.match(/;\s*charset=([^;])(;|$)/);h&&(l._charset=h[1].toLowerCase())}l._charset||(l._charset="utf-8")}}};i(l,s.Readable),l.prototype._read=function(){var e=this,t=e._resumeFetch;t&&(e._resumeFetch=null,t())},l.prototype._onXHRProgress=function(){var t=this,n=t._xhr,a=null;switch(t._mode){case"text:vbarray":if(n.readyState!==d.DONE)break;try{a=new r.VBArray(n.responseBody).toArray()}catch(t){}if(null!==a){t.push(new o(a));break}case"text":try{a=n.responseText}catch(n){t._mode="text:vbarray";break}if(a.length>t._pos){var s=a.substr(t._pos);if("x-user-defined"===t._charset){for(var l=new o(s.length),c=0;c<s.length;c++)l[c]=255&s.charCodeAt(c);t.push(l)}else t.push(s,t._charset);t._pos=a.length}break;case"arraybuffer":if(n.readyState!==d.DONE||!n.response)break;a=n.response,t.push(new o(new Uint8Array(a)));break;case"moz-chunked-arraybuffer":if(a=n.response,n.readyState!==d.LOADING||!a)break;t.push(new o(new Uint8Array(a)));break;case"ms-stream":if(a=n.response,n.readyState!==d.LOADING)break;var e=new r.MSStreamReader;e.onprogress=function(){e.result.byteLength>t._pos&&(t.push(new o(new Uint8Array(e.result.slice(t._pos)))),t._pos=e.result.byteLength)},e.onload=function(){t.push(null)},e.readAsArrayBuffer(a);}t._xhr.readyState===d.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,e("buffer").Buffer)},{"./capability":153,_process:92,buffer:39,inherits:67,"readable-stream":164}],156:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{"./_stream_readable":158,"./_stream_writable":160,"core-util-is":43,dup:22,inherits:67,"process-nextick-args":91}],157:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./_stream_transform":159,"core-util-is":43,dup:23,inherits:67}],158:[function(e,t,n){arguments[4][24][0].apply(n,arguments)},{"./_stream_duplex":156,"./internal/streams/BufferList":161,"./internal/streams/destroy":162,"./internal/streams/stream":163,_process:92,"core-util-is":43,dup:24,events:49,inherits:67,isarray:72,"process-nextick-args":91,"safe-buffer":165,"string_decoder/":166,util:33}],159:[function(e,t,n){arguments[4][25][0].apply(n,arguments)},{"./_stream_duplex":156,"core-util-is":43,dup:25,inherits:67}],160:[function(e,t,n){arguments[4][26][0].apply(n,arguments)},{"./_stream_duplex":156,"./internal/streams/destroy":162,"./internal/streams/stream":163,_process:92,"core-util-is":43,dup:26,inherits:67,"process-nextick-args":91,"safe-buffer":165,timers:174,"util-deprecate":188}],161:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{dup:27,"safe-buffer":165,util:33}],162:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28,"process-nextick-args":91}],163:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29,events:49}],164:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./lib/_stream_duplex.js":156,"./lib/_stream_passthrough.js":157,"./lib/_stream_readable.js":158,"./lib/_stream_transform.js":159,"./lib/_stream_writable.js":160,dup:30}],165:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{buffer:39,dup:31}],166:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32,"safe-buffer":165}],167:[function(e,t){var n=e("stream-to-blob");t.exports=function e(t,r,o){return"function"==typeof r?e(t,null,r):void n(t,r,function(e,t){if(e)return o(e);var n=URL.createObjectURL(t);o(null,n)})}},{"stream-to-blob":168}],168:[function(e,t){var n=e("once");t.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);o=n(o);var a=[];t.on("data",function(e){a.push(e)}).on("end",function(){var e=r?new Blob(a,{type:r}):new Blob(a);o(null,e)}).on("error",o)}},{once:86}],169:[function(e,t){(function(n){var r=e("once");t.exports=function(e,t,o){o=r(o);var a=n.alloc(t),i=0;e.on("data",function(e){e.copy(a,i),i+=e.length}).on("end",function(){o(null,a)}).on("error",o)}}).call(this,e("buffer").Buffer)},{buffer:39,once:86}],170:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32,"safe-buffer":171}],171:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{buffer:39,dup:31}],172:[function(e,t,n){var r=e("./thirty-two");n.encode=r.encode,n.decode=r.decode},{"./thirty-two":173}],173:[function(e,t,n){(function(e){'use strict';function t(e){var t=r(e.length/5);return 0==e.length%5?t:t+1}var o=[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];n.encode=function(n){e.isBuffer(n)||(n=new e(n));for(var r=0,o=0,a=0,s=0,d=new e(8*t(n));r<n.length;){var l=n[r];3<a?(s=l&255>>a,a=(a+5)%8,s=s<<a|(r+1<n.length?n[r+1]:0)>>8-a,r++):(s=31&l>>8-(a+5),a=(a+5)%8,0===a&&r++),d[o]="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".charCodeAt(s),o++}for(r=o;r<d.length;r++)d[r]=61;return d},n.decode=function(t){var n=0,r=0,s=0,d;e.isBuffer(t)||(t=new e(t));for(var l=new e(a(5*t.length/8)),c=0;c<t.length&&!(61===t[c]);c++){var u=t[c]-48;if(u<o.length)r=o[u],3>=n?(n=(n+5)%8,0==n?(d|=r,l[s]=d,s++,d=0):d|=255&r<<8-n):(n=(n+5)%8,d|=255&r>>>n,l[s]=d,s++,d=255&r<<8-n);else throw new Error("Invalid input - it is not base32 encoded string")}return l.slice(0,s)}}).call(this,e("buffer").Buffer)},{buffer:39}],174:[function(e,t,n){(function(t,r){function o(e,t){this._id=e,this._clearFn=t}var a=e("process/browser.js").nextTick,i=Function.prototype.apply,s=Array.prototype.slice,d={},l=0;n.setTimeout=function(){return new o(i.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new o(i.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=l++,r=!(2>arguments.length)&&s.call(arguments,1);return d[t]=!0,a(function(){d[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof r?r:function(e){delete d[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":92,timers:174}],175:[function(e,t){var n=e("buffer").Buffer;t.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),r=e.length,o=0;o<r;o++)t[o]=e[o];return t.buffer}throw new Error("Argument must be a Buffer")}},{buffer:39}],176:[function(e,t){(function(n){const o=e("debug")("torrent-discovery"),a=e("bittorrent-dht/client"),i=e("events").EventEmitter,s=e("run-parallel"),d=e("bittorrent-tracker/client");t.exports=class extends i{constructor(e){if(super(),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!n.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||900000,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")};const t=(e,t)=>{const n=new a(t);return n.on("warning",this._onWarning),n.on("error",this._onError),n.listen(e),this._internalDHT=!0,n};!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(),this.dht=!1===e.dht||"function"!=typeof a?null:e.dht&&"function"==typeof e.dht.addNode?e.dht:e.dht&&"object"==typeof e.dht?t(e.dhtPort,e.dht):t(e.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce())}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){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)})),s(t,e),this.dht=null,this.tracker=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 d(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||(o("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,e=>{this._dhtAnnouncing=!1,o("dht announce complete"),e&&this.emit("warning",e),this.emit("dhtAnnounce"),this.destroyed||(this._dhtTimeout=setTimeout(()=>{this._dhtAnnounce()},this._intervalMs+r(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())}))}}}).call(this,e("_process"))},{_process:92,"bittorrent-dht/client":33,"bittorrent-tracker/client":16,debug:177,events:49,"run-parallel":119}],177:[function(e,t,n){arguments[4][138][0].apply(n,arguments)},{"./common":178,_process:92,dup:138}],178:[function(e,t,n){arguments[4][139][0].apply(n,arguments)},{dup:139,ms:83}],179:[function(e,t){(function(e){const n=16384;class r{constructor(e){this.length=e,this.missing=e,this.sources=null,this._chunks=a(e/n),this._remainder=e%n||n,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,this._flushed=!1}chunkLength(e){return e===this._chunks-1?this._remainder:n}chunkLengthRemaining(e){return this.length-e*n}chunkOffset(e){return e*n}reserve(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations<this._chunks?this._reservations++:-1:-1}reserveRemaining(){if(!this.init())return-1;if(this._reservations<this._chunks){const e=this._reservations;return this._reservations=this._chunks,e}return-1}cancel(e){this.init()&&this._cancellations.push(e)}cancelRemaining(e){this.init()&&(this._reservations=e)}get(e){return this.init()?this._buffer[e]:null}set(e,t,r){if(!this.init())return!1;const o=t.length,i=a(o/n);for(let o=0;o<i;o++)if(!this._buffer[e+o]){const a=o*n,i=t.slice(a,a+n);this._buffered++,this._buffer[e+o]=i,this.missing-=i.length,this.sources.includes(r)||this.sources.push(r)}return this._buffered===this._chunks}flush(){if(!this._buffer||this._chunks!==this._buffered)return null;const t=e.concat(this._buffer,this.length);return this._buffer=null,this._cancellations=null,this.sources=null,this._flushed=!0,t}init(){return!this._flushed&&(!!this._buffer||(this._buffer=Array(this._chunks),this._cancellations=[],this.sources=[],!0))}}Object.defineProperty(r,"BLOCK_LENGTH",{value:16384}),t.exports=r}).call(this,e("buffer").Buffer)},{buffer:39}],180:[function(e,t){(function(n){var r=e("is-typedarray").strict;t.exports=function(e){if(r(e)){var t=n.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(t=t.slice(e.byteOffset,e.byteOffset+e.byteLength)),t}return n.from(e)}}).call(this,e("buffer").Buffer)},{buffer:39,"is-typedarray":71}],181:[function(e,t,o){var a=e("buffer-alloc"),i=n(2,32);o.encodingLength=function(){return 8},o.encode=function(e,t,n){t||(t=a(8)),n||(n=0);var o=r(e/i);return t.writeUInt32BE(o,n),t.writeUInt32BE(e-o*i,n+4),t},o.decode=function(e,t){t||(t=0);var n=e.readUInt32BE(t),r=e.readUInt32BE(t+4);return n*i+r},o.encode.bytes=8,o.decode.bytes=8},{"buffer-alloc":36}],182:[function(e,t){"use strict";function n(e,t){for(var n=1,r=e.length,o=e[0],s=e[0],d=1;d<r;++d)if(s=o,o=e[d],t(o,s)){if(d===n){n++;continue}e[n++]=o}return e.length=n,e}function r(e){for(var t=1,n=e.length,r=e[0],o=e[0],s=1;s<n;++s,o=r)if(o=r,r=e[s],r!==o){if(s===t){t++;continue}e[t++]=r}return e.length=t,e}t.exports=function(e,t,o){return 0===e.length?e:t?(o||e.sort(t),n(e,t)):(o||e.sort(),r(e))}},{}],183:[function(e,t){t.exports=function(e,t){if(!(t>=e.length||0>t)){var n=e.pop();if(t<e.length){var r=e[t];return e[t]=n,r}return n}}},{}],184:[function(e,t,n){'use strict';function r(){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}function o(e,t,n){if(e&&d.isObject(e)&&e instanceof r)return e;var o=new r;return o.parse(e,t,n),o}var a=e("punycode"),d=e("./util");n.parse=o,n.resolve=function(e,t){return o(e,!1,!0).resolve(t)},n.resolveObject=function(e,t){return e?o(e,!1,!0).resolveObject(t):t},n.format=function(e){return d.isString(e)&&(e=o(e)),e instanceof r?e.format():r.prototype.format.call(e)},n.Url=r;var c=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["{","}","|","\\","^","`"].concat(["<",">","\"","`"," ","\r","\n","\t"]),h=["'"].concat(f),m=["%","/","?",";","#"].concat(h),g=["/","?","#"],_=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},S=e("querystring");r.prototype.parse=function(e,t,n){if(!d.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),o=-1!==r&&r<e.indexOf("#")?"?":"#",u=e.split(o),f=/\\/g;u[0]=u[0].replace(f,"/"),e=u.join(o);var E=e;if(E=E.trim(),!n&&1===e.split("#").length){var C=p.exec(E);if(C)return this.path=E,this.href=E,this.pathname=C[1],C[2]?(this.search=C[2],this.query=t?S.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var v=c.exec(E);if(v){v=v[0];var L=v.toLowerCase();this.protocol=L,E=E.substr(v.length)}if(n||v||E.match(/^\/\/[^@\/]+@[^@\/]+/)){var I="//"===E.substr(0,2);I&&!(v&&w[v])&&(E=E.substr(2),this.slashes=!0)}if(!w[v]&&(I||v&&!x[v])){for(var T=-1,B=0,R;B<g.length;B++)R=E.indexOf(g[B]),-1!==R&&(-1===T||R<T)&&(T=R);var A,U;U=-1===T?E.lastIndexOf("@"):E.lastIndexOf("@",T),-1!==U&&(A=E.slice(0,U),E=E.slice(U+1),this.auth=decodeURIComponent(A)),T=-1;for(var B=0,R;B<m.length;B++)R=E.indexOf(m[B]),-1!==R&&(-1===T||R<T)&&(T=R);-1===T&&(T=E.length),this.host=E.slice(0,T),E=E.slice(T),this.parseHost(),this.hostname=this.hostname||"";var P="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!P)for(var M=this.hostname.split(/\./),B=0,O=M.length,N;B<O;B++)if(N=M[B],N&&!N.match(_)){for(var F="",q=0,H=N.length;q<H;q++)F+=127<N.charCodeAt(q)?"x":N[q];if(!F.match(_)){var k=M.slice(0,B),D=M.slice(B+1),W=N.match(b);W&&(k.push(W[1]),D.unshift(W[2])),D.length&&(E="/"+D.join(".")+E),this.hostname=k.join(".");break}}this.hostname=255<this.hostname.length?"":this.hostname.toLowerCase(),P||(this.hostname=a.toASCII(this.hostname));var z=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+z,this.href+=this.host,P&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==E[0]&&(E="/"+E))}if(!y[L])for(var B=0,O=h.length,G;B<O;B++)if(G=h[B],-1!==E.indexOf(G)){var K=encodeURIComponent(G);K===G&&(K=escape(G)),E=E.split(G).join(K)}var Y=E.indexOf("#");-1!==Y&&(this.hash=E.substr(Y),E=E.slice(0,Y));var $=E.indexOf("?");if(-1===$?t&&(this.search="",this.query={}):(this.search=E.substr($),this.query=E.substr($+1),t&&(this.query=S.parse(this.query)),E=E.slice(0,$)),E&&(this.pathname=E),x[L]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var z=this.pathname||"",X=this.search||"";this.path=z+X}return this.href=this.format(),this},r.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,a="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&d.isObject(this.query)&&Object.keys(this.query).length&&(a=S.stringify(this.query));var i=this.search||a&&"?"+a||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||x[t])&&!1!=o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):!o&&(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),i&&"?"!==i.charAt(0)&&(i="?"+i),n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),i=i.replace("#","%23"),t+o+n+i+r},r.prototype.resolve=function(e){return this.resolveObject(o(e,!1,!0)).format()},r.prototype.resolveObject=function(e){if(d.isString(e)){var t=new r;t.parse(e,!1,!0),e=t}for(var n=new r,o=Object.keys(this),a=0,l;a<o.length;a++)l=o[a],n[l]=this[l];if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var c=Object.keys(e),u=0,f;u<c.length;u++)f=c[u],"protocol"!==f&&(n[f]=e[f]);return x[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!x[e.protocol]){for(var h=Object.keys(e),m=0,g;m<h.length;m++)g=h[m],n[g]=e[g];return n.href=n.format(),n}if(n.protocol=e.protocol,!e.host&&!w[e.protocol]){for(var _=(e.pathname||"").split("/");_.length&&!(e.host=_.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==_[0]&&_.unshift(""),2>_.length&&_.unshift(""),n.pathname=_.join("/")}else n.pathname=e.pathname;if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var b=n.pathname||"",p=n.search||"";n.path=b+p}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var s=n.pathname&&"/"===n.pathname.charAt(0),y=e.host||e.pathname&&"/"===e.pathname.charAt(0),S=y||s||n.host&&e.pathname,E=S,C=n.pathname&&n.pathname.split("/")||[],_=e.pathname&&e.pathname.split("/")||[],L=n.protocol&&!x[n.protocol];if(L&&(n.hostname="",n.port=null,n.host&&(""===C[0]?C[0]=n.host:C.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===_[0]?_[0]=e.host:_.unshift(e.host)),e.host=null),S=S&&(""===_[0]||""===C[0])),y)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,C=_;else if(_.length)C||(C=[]),C.pop(),C=C.concat(_),n.search=e.search,n.query=e.query;else if(!d.isNullOrUndefined(e.search)){if(L){n.hostname=n.host=C.shift();var I=!!(n.host&&0<n.host.indexOf("@"))&&n.host.split("@");I&&(n.auth=I.shift(),n.host=n.hostname=I.shift())}return n.search=e.search,n.query=e.query,d.isNull(n.pathname)&&d.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!C.length)return n.pathname=null,n.path=n.search?"/"+n.search:null,n.href=n.format(),n;for(var T=C.slice(-1)[0],B=(n.host||e.host||1<C.length)&&("."===T||".."===T)||""===T,R=0,A=C.length;0<=A;A--)T=C[A],"."===T?C.splice(A,1):".."===T?(C.splice(A,1),R++):R&&(C.splice(A,1),R--);if(!S&&!E)for(;R--;R)C.unshift("..");S&&""!==C[0]&&(!C[0]||"/"!==C[0].charAt(0))&&C.unshift(""),B&&"/"!==C.join("/").substr(-1)&&C.push("");var U=""===C[0]||C[0]&&"/"===C[0].charAt(0);if(L){n.hostname=n.host=U?"":C.length?C.shift():"";var I=!!(n.host&&0<n.host.indexOf("@"))&&n.host.split("@");I&&(n.auth=I.shift(),n.host=n.hostname=I.shift())}return S=S||n.host&&C.length,S&&!U&&C.unshift(""),C.length?n.pathname=C.join("/"):(n.pathname=null,n.path=null),d.isNull(n.pathname)&&d.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var e=this.host,t=u.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":185,punycode:94,querystring:97}],185:[function(e,t){'use strict';t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],186:[function(e,t){(function(n){const{EventEmitter:r}=e("events"),o=e("bencode"),i=e("bitfield"),s=e("debug")("ut_metadata"),d=e("simple-sha1"),l=1E3,c=16384;t.exports=e=>{class t extends r{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new i(0,{grow:l}),n.isBuffer(e)&&this.setMetadata(e)}onHandshake(e,t,n){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1E7<e.metadata_size||0>=e.metadata_size?this.emit("warning",new Error("Peer gave invalid metadata size")):void(this._metadataSize=e.metadata_size,this._numPieces=a(this._metadataSize/c),this._remainingRejects=2*this._numPieces,this._fetching&&this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(e){let t,n;try{const r=e.toString(),a=r.indexOf("ee")+2;t=o.decode(r.substring(0,a)),n=e.slice(a)}catch(e){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,n,t.total_size);break;case 2:this._onReject(t.piece);}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(e){if(this._metadataComplete)return!0;s("set metadata");try{const t=o.decode(e).info;t&&(e=o.encode(t))}catch(e){}return!(this._infoHash&&this._infoHash!==d.sync(e))&&(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",o.encode({info:o.decode(this.metadata)})),!0)}_send(e,t){let r=o.encode(e);n.isBuffer(t)&&(r=n.concat([r,t])),this._wire.extended("ut_metadata",r)}_request(e){this._send({msg_type:0,piece:e})}_data(e,t,n){const r={msg_type:1,piece:e};"number"==typeof n&&(r.total_size=n),this._send(r,t)}_reject(e){this._send({msg_type:2,piece:e})}_onRequest(e){if(!this._metadataComplete)return void this._reject(e);const t=e*c;let n=t+c;n>this._metadataSize&&(n=this._metadataSize);const r=this.metadata.slice(t,n);this._data(e,r,this._metadataSize)}_onData(e,t,n){t.length>c||(t.copy(this.metadata,e*c),this._bitfield.set(e),this._checkDone())}_onReject(e){0<this._remainingRejects&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error("Peer sent \"reject\" too much"))}_requestPieces(){this.metadata=n.alloc(this._metadataSize);for(let e=0;e<this._numPieces;e++)this._request(e)}_checkDone(){let e=!0;for(let t=0;t<this._numPieces;t++)if(!this._bitfield.get(t)){e=!1;break}if(e){const e=this.setMetadata(this.metadata);e||this._failedMetadata()}}_failedMetadata(){this._bitfield=new i(0,{grow:l}),this._remainingRejects-=this._numPieces,0<this._remainingRejects?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return t.prototype.name="ut_metadata",t}}).call(this,e("buffer").Buffer)},{bencode:11,bitfield:187,buffer:39,debug:45,events:49,"simple-sha1":136}],187:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],188:[function(e,t){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===(n+"").toLowerCase()}t.exports=function(e,t){function r(){if(!o){if(n("throwDeprecation"))throw new Error(t);else n("traceDeprecation")?console.trace(t):console.warn(t);o=!0}return e.apply(this,arguments)}if(n("noDeprecation"))return e;var o=!1;return r}}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],189:[function(e,t){(function(n){function o(){return{version:0,flags:0,entries:[]}}const a=e("binary-search"),i=e("events"),s=e("mp4-stream"),d=e("mp4-box-encoding"),l=e("range-slice-stream");class c{constructor(e,t){this._entries=e,this._countName=t||"count",this._index=0,this._offset=0,this.value=this._entries[0]}inc(){this._offset++,this._offset>=this._entries[this._index][this._countName]&&(this._index++,this._offset=0),this.value=this._entries[this._index]}}t.exports=class extends i{constructor(e){super(),this._tracks=[],this._file=e,this._decoder=null,this._findMoov(0)}_findMoov(e){this._decoder&&this._decoder.destroy();let t=0;this._decoder=s.decode();const n=this._file.createReadStream({start:e});n.pipe(this._decoder),this._decoder.on("box",r=>{"moov"===r.type?this._decoder.decode(e=>{n.destroy();try{this._processMoov(e)}catch(e){e.message=`Cannot parse mp4 file: ${e.message}`,this.emit("error",e)}}):r.length<4096?(t+=r.length,this._decoder.ignore()):(t+=r.length,n.destroy(),this._decoder.destroy(),this._findMoov(e+t))})}_processMoov(e){const t=e.traks;this._tracks=[],this._hasVideo=!1,this._hasAudio=!1;for(let n=0;n<t.length;n++){const a=t[n],i=a.mdia.minf.stbl,s=i.stsd.entries[0],d=a.mdia.hdlr.handlerType;let l,u;if("vide"===d&&"avc1"===s.type){if(this._hasVideo)continue;this._hasVideo=!0,l="avc1",s.avcC&&(l+=`.${s.avcC.mimeCodec}`),u=`video/mp4; codecs="${l}"`}else if("soun"===d&&"mp4a"===s.type){if(this._hasAudio)continue;this._hasAudio=!0,l="mp4a",s.esds&&s.esds.mimeCodec&&(l+=`.${s.esds.mimeCodec}`),u=`audio/mp4; codecs="${l}"`}else continue;const p=[];let f=0,h=0,m=0,g=0,_=0,b=0;const y=new c(i.stts.entries);let w=null;i.ctts&&(w=new c(i.ctts.entries));for(let e=0;;){var r=i.stsc.entries[_];const t=i.stsz.entries[f],n=y.value.duration,o=w?w.value.compositionOffset:0;let a=!0;i.stss&&(a=i.stss.entries[e]===f+1);const s=i.stco||i.co64;if(p.push({size:t,duration:n,dts:b,presentationOffset:o,sync:a,offset:g+s.entries[m]}),f++,f>=i.stsz.entries.length)break;if(h++,g+=t,h>=r.samplesPerChunk){h=0,g=0,m++;const e=i.stsc.entries[_+1];e&&m+1>=e.firstChunk&&_++}b+=n,y.inc(),w&&w.inc(),a&&e++}a.mdia.mdhd.duration=0,a.tkhd.duration=0;const k=r.sampleDescriptionId,x={type:"moov",mvhd:e.mvhd,traks:[{tkhd:a.tkhd,mdia:{mdhd:a.mdia.mdhd,hdlr:a.mdia.hdlr,elng:a.mdia.elng,minf:{vmhd:a.mdia.minf.vmhd,smhd:a.mdia.minf.smhd,dinf:a.mdia.minf.dinf,stbl:{stsd:i.stsd,stts:o(),ctts:o(),stsc:o(),stsz:o(),stco:o(),stss:o()}}}}],mvex:{mehd:{fragmentDuration:e.mvhd.duration},trexs:[{trackId:a.tkhd.trackId,defaultSampleDescriptionIndex:k,defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0}]}};this._tracks.push({fragmentSequence:1,trackId:a.tkhd.trackId,timeScale:a.mdia.mdhd.timeScale,samples:p,currSample:null,currTime:null,moov:x,mime:u})}if(0===this._tracks.length)return void this.emit("error",new Error("no playable tracks"));e.mvhd.duration=0,this._ftyp={type:"ftyp",brand:"iso5",brandVersion:0,compatibleBrands:["iso5"]};const a=d.encode(this._ftyp),i=this._tracks.map(e=>{const t=d.encode(e.moov);return{mime:e.mime,init:n.concat([a,t])}});this.emit("ready",i)}seek(e){if(!this._tracks)throw new Error("Not ready yet; wait for 'ready' event");this._fileStream&&(this._fileStream.destroy(),this._fileStream=null);let t=-1;if(this._tracks.map((n,r)=>{n.outStream&&n.outStream.destroy(),n.inStream&&(n.inStream.destroy(),n.inStream=null);const o=n.outStream=s.encode(),a=this._generateFragment(r,e);if(!a)return o.finalize();(-1===t||a.ranges[0].start<t)&&(t=a.ranges[0].start);const i=e=>{o.destroyed||o.box(e.moof,t=>{if(t)return this.emit("error",t);if(!o.destroyed){const t=n.inStream.slice(e.ranges);t.pipe(o.mediaData(e.length,e=>{if(e)return this.emit("error",e);if(!o.destroyed){const e=this._generateFragment(r);return e?void i(e):o.finalize()}}))}})};i(a)}),0<=t){const e=this._fileStream=this._file.createReadStream({start:t});this._tracks.forEach(n=>{n.inStream=new l(t,{highWaterMark:1e7}),e.pipe(n.inStream)})}return this._tracks.map(e=>e.outStream)}_findSampleBefore(e,t){const n=this._tracks[e],o=r(n.timeScale*t);let i=a(n.samples,o,(e,n)=>{const t=e.dts+e.presentationOffset;return t-n});for(-1===i?i=0:0>i&&(i=-i-2);!n.samples[i].sync;)i--;return i}_generateFragment(e,t){const n=this._tracks[e];let r;if(r=void 0===t?n.currSample:this._findSampleBefore(e,t),r>=n.samples.length)return null;const o=n.samples[r].dts;let a=0;const i=[];for(var s=r;s<n.samples.length;s++){const e=n.samples[s];if(e.sync&&e.dts-o>=n.timeScale*1)break;a+=e.size;const t=i.length-1;0>t||i[t].end!==e.offset?i.push({start:e.offset,end:e.offset+e.size}):i[t].end+=e.size}return n.currSample=s,{moof:this._generateMoof(e,r,s),ranges:i,length:a}}_generateMoof(e,t,n){const r=this._tracks[e],o=[];let a=0;for(let i=t;i<n;i++){const e=r.samples[i];0>e.presentationOffset&&(a=1),o.push({sampleDuration:e.duration,sampleSize:e.size,sampleFlags:e.sync?33554432:16842752,sampleCompositionTimeOffset:e.presentationOffset})}const i={type:"moof",mfhd:{sequenceNumber:r.fragmentSequence++},trafs:[{tfhd:{flags:131072,trackId:r.trackId},tfdt:{baseMediaDecodeTime:r.samples[t].dts},trun:{flags:3841,dataOffset:8,entries:o,version:a}}]};return i.trafs[0].trun.dataOffset+=d.encodingLength(i),i}}}).call(this,e("buffer").Buffer)},{"binary-search":12,buffer:39,events:49,"mp4-box-encoding":79,"mp4-stream":82,"range-slice-stream":100}],190:[function(e,t){function n(e,t,o={}){return this instanceof n?void(this.detailedError=null,this._elem=t,this._elemWrapper=new r(t),this._waitingFired=!1,this._trackMeta=null,this._file=e,this._tracks=null,"none"!==this._elem.preload&&this._createMuxer(),this._onError=()=>{this.detailedError=this._elemWrapper.detailedError,this.destroy()},this._onWaiting=()=>{this._waitingFired=!0,this._muxer?this._tracks&&this._pump():this._createMuxer()},t.autoplay&&(t.preload="auto"),t.addEventListener("waiting",this._onWaiting),t.addEventListener("error",this._onError)):(console.warn("don't invoked VideoStream without 'new'"),new n(e,t,o))}const r=e("mediasource"),o=e("pump"),a=e("./mp4-remuxer");n.prototype={_createMuxer(){this._muxer=new a(this._file),this._muxer.on("ready",e=>{this._tracks=e.map(e=>{const t=this._elemWrapper.createWriteStream(e.mime);t.on("error",e=>{this._elemWrapper.error(e)});const n={muxed:null,mediaSource:t,initFlushed:!1,onInitFlushed:null};return t.write(e.init,e=>{n.initFlushed=!0,n.onInitFlushed&&n.onInitFlushed(e)}),n}),(this._waitingFired||"auto"===this._elem.preload)&&this._pump()}),this._muxer.on("error",e=>{this._elemWrapper.error(e)})},_pump(){const e=this._muxer.seek(this._elem.currentTime,!this._tracks);this._tracks.forEach((t,n)=>{const r=()=>{t.muxed&&(t.muxed.destroy(),t.mediaSource=this._elemWrapper.createWriteStream(t.mediaSource),t.mediaSource.on("error",e=>{this._elemWrapper.error(e)})),t.muxed=e[n],o(t.muxed,t.mediaSource)};t.initFlushed?r():t.onInitFlushed=e=>e?void this._elemWrapper.error(e):void r()})},destroy(){this.destroyed||(this.destroyed=!0,this._elem.removeEventListener("waiting",this._onWaiting),this._elem.removeEventListener("error",this._onError),this._tracks&&this._tracks.forEach(e=>{e.muxed&&e.muxed.destroy()}),this._elem.src="")}},t.exports=n},{"./mp4-remuxer":189,mediasource:75,pump:93}],191:[function(e,t){function n(e,t){function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),o=t[t.length-1];return"function"==typeof r&&r!==o&&Object.keys(o).forEach(function(e){r[e]=o[e]}),r}if(e&&t)return n(e)(t);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(t){r[t]=e[t]}),r}t.exports=n},{}],192:[function(e,t){t.exports=function(){for(var e={},t=0,r;t<arguments.length;t++)for(var o in r=arguments[t],r)n.call(r,o)&&(e[o]=r[o]);return e};var n=Object.prototype.hasOwnProperty},{}],193:[function(e,t){t.exports={version:"0.105.1"}},{}],194:[function(e,t){(function(n,r){function o(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}function a(e){return"undefined"!=typeof FileList&&e instanceof FileList}const{Buffer:i}=e("safe-buffer"),{EventEmitter:s}=e("events"),d=e("simple-concat"),l=e("create-torrent"),c=e("debug")("webtorrent"),u=e("bittorrent-dht/client"),p=e("load-ip-set"),f=e("run-parallel"),h=e("parse-torrent"),m=e("path"),g=e("simple-peer"),_=e("randombytes"),b=e("speedometer"),y=e("./lib/tcp-pool"),w=e("./lib/torrent"),k=e("./package.json").version,x=k.replace(/\d*./g,e=>`0${e%100}`.slice(-2)).slice(0,4);class S extends s{constructor(e={}){super(),this.peerId="string"==typeof e.peerId?e.peerId:i.isBuffer(e.peerId)?e.peerId.toString("hex"):i.from(`-WW${x}-`+_(9).toString("base64")).toString("hex"),this.peerIdBuffer=i.from(this.peerId,"hex"),this.nodeId="string"==typeof e.nodeId?e.nodeId:i.isBuffer(e.nodeId)?e.nodeId.toString("hex"):_(20).toString("hex"),this.nodeIdBuffer=i.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=e.torrentPort||0,this.dhtPort=e.dhtPort||0,this.tracker=e.tracker===void 0?{}:e.tracker,this.torrents=[],this.maxConns=+e.maxConns||55,this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),e.rtcConfig&&(console.warn("WebTorrent: opts.rtcConfig is deprecated. Use opts.tracker.rtcConfig instead"),this.tracker.rtcConfig=e.rtcConfig),e.wrtc&&(console.warn("WebTorrent: opts.wrtc is deprecated. Use opts.tracker.wrtc instead"),this.tracker.wrtc=e.wrtc),r.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=r.WRTC)),"function"==typeof y?this._tcpPool=new y(this):n.nextTick(()=>{this._onListening()}),this._downloadSpeed=b(),this._uploadSpeed=b(),!1!==e.dht&&"function"==typeof u?(this.dht=new u(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.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 p&&null!=e.blocklist?p(e.blocklist,{headers:{"user-agent":`WebTorrent/${k} (https://webtorrent.io)`}},(e,n)=>e?this.error(`Failed to load blocklist: ${e.message}`):void(this.blocked=n,t())):n.nextTick(t)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter(e=>1!==e.progress),t=e.reduce((e,t)=>e+t.downloaded,0),n=e.reduce((e,t)=>e+(t.length||0),0)||1;return t/n}get ratio(){const e=this.torrents.reduce((e,t)=>e+t.uploaded,0),t=this.torrents.reduce((e,t)=>e+t.received,0)||1;return e/t}get(e){if(!(e instanceof w)){let t;try{t=h(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}else if(this.torrents.includes(e))return e;return null}download(e,t,n){return console.warn("WebTorrent: client.download() is deprecated. Use client.add() instead"),this.add(e,t,n)}add(e,t={},n){function r(){i.removeListener("_infoHash",o),i.removeListener("ready",a),i.removeListener("close",r)}if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]);const o=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===i.infoHash&&e!==i)return void i._destroy(new Error(`Cannot add duplicate torrent ${i.infoHash}`))},a=()=>{this.destroyed||("function"==typeof n&&n(i),this.emit("torrent",i))};this._debug("add"),t=t?Object.assign({},t):{};const i=new w(e,this,t);return this.torrents.push(i),i.once("_infoHash",o),i.once("ready",a),i.once("close",r),i}seed(e,t,n){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]),this._debug("seed"),t=t?Object.assign({},t):{},t.skipVerify=!0;const r="string"==typeof e;r&&(t.path=m.dirname(e)),t.createdBy||(t.createdBy=`WebTorrent/${x}`);const i=e=>{this._debug("on seed"),"function"==typeof n&&n(e),e.emit("seed"),this.emit("seed",e)},s=this.add(null,t,e=>{const t=[t=>r?t():void e.load(c,t)];this.dht&&t.push(t=>{e.once("dhtAnnounce",t)}),f(t,t=>this.destroyed?void 0:t?e._destroy(t):void i(e))});let c;return a(e)?e=Array.from(e):!Array.isArray(e)&&(e=[e]),f(e.map(e=>t=>{o(e)?d(e,t):t(null,e)}),(e,n)=>this.destroyed?void 0:e?s._destroy(e):void l.parseInput(n,t,(e,r)=>this.destroyed?void 0:e?s._destroy(e):void(c=r.map(e=>e.getStream),l(n,t,(e,t)=>{if(!this.destroyed){if(e)return s._destroy(e);const n=this.get(t);n?s._destroy(new Error(`Cannot add duplicate torrent ${n.infoHash}`)):s._onTorrentId(t)}})))),s}remove(e,t){this._debug("remove");const n=this.get(e);if(!n)throw new Error(`No torrent with id ${e}`);this._remove(e,t)}_remove(e,t){const n=this.get(e);n&&(this.torrents.splice(this.torrents.indexOf(n),1),n.destroy(t))}address(){return this.listening?this._tcpPool?this._tcpPool.server.address():{address:"0.0.0.0",family:"IPv4",port:0}:null}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 n=this.torrents.map(e=>t=>{e.destroy(t)});this._tcpPool&&n.push(e=>{this._tcpPool.destroy(e)}),this.dht&&n.push(e=>{this.dht.destroy(e)}),f(n,t),e&&this.emit("error",e),this.torrents=[],this._tcpPool=null,this.dht=null}_onListening(){if(this._debug("listening"),this.listening=!0,this._tcpPool){const e=this._tcpPool.server.address();e&&(this.torrentPort=e.port)}this.emit("listening")}_debug(){const e=[].slice.call(arguments);e[0]=`[${this._debugId}] ${e[0]}`,c(...e)}}S.WEBRTC_SUPPORT=g.WEBRTC_SUPPORT,S.VERSION=k,t.exports=S}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"./lib/tcp-pool":33,"./lib/torrent":5,"./package.json":193,_process:92,"bittorrent-dht/client":33,"create-torrent":44,debug:45,events:49,"load-ip-set":33,"parse-torrent":88,path:89,randombytes:99,"run-parallel":119,"safe-buffer":121,"simple-concat":122,"simple-peer":124,speedometer:151}]},{},[194])(194)}); \ No newline at end of file
+ */t.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},{}],70:[function(e,t){'use strict';function n(e){return r.existsSync(e)&&r.statSync(e).isFile()}var r=e("fs");t.exports=function(e,t){return t?void r.stat(e,function(e,n){return e?t(e):t(null,n.isFile())}):n(e)},t.exports.sync=n},{fs:34}],71:[function(e,t){function n(e){return r(e)||o(e)}function r(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return i[a.call(e)]}t.exports=n,n.strict=r,n.loose=o;var a=Object.prototype.toString,i={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},{}],72:[function(e,t){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},{}],73:[function(e,t,n){'use strict';n.re=()=>{throw new Error("`junk.re` was renamed to `junk.regex`")},n.regex=new RegExp(["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^Desktop\\.ini$","@eaDir$"].join("|")),n.is=e=>n.regex.test(e),n.not=e=>!n.is(e),n.default=t.exports},{}],74:[function(e,t){(function(n){function r(e){const t={},r=e.split("magnet:?")[1],i=r&&0<=r.length?r.split("&"):[];i.forEach(e=>{const n=e.split("=");if(2!==n.length)return;const r=n[0];let o=n[1];if("dn"===r&&(o=decodeURIComponent(o).replace(/\+/g," ")),("tr"===r||"xs"===r||"as"===r||"ws"===r)&&(o=decodeURIComponent(o)),"kt"===r&&(o=decodeURIComponent(o).split("+")),"ix"===r&&(o=+o),!t[r])t[r]=o;else if(Array.isArray(t[r]))t[r].push(o);else{const e=t[r];t[r]=[e,o]}});let s;if(t.xt){const e=Array.isArray(t.xt)?t.xt:[t.xt];e.forEach(e=>{if(s=e.match(/^urn:btih:(.{40})/))t.infoHash=s[1].toLowerCase();else if(s=e.match(/^urn:btih:(.{32})/)){const e=o.decode(s[1]);t.infoHash=n.from(e,"binary").toString("hex")}})}return t.infoHash&&(t.infoHashBuffer=n.from(t.infoHash,"hex")),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce="string"==typeof t.tr?[t.tr]:Array.isArray(t.tr)?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)),a(t.announce),a(t.urlList),t}t.exports=r,t.exports.decode=r,t.exports.encode=function(e){e=Object.assign({},e),e.infoHashBuffer&&(e.xt=`urn:btih:${e.infoHashBuffer.toString("hex")}`),e.infoHash&&(e.xt=`urn:btih:${e.infoHash}`),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);let t="magnet:?";return Object.keys(e).filter(e=>2===e.length).forEach((n,r)=>{const o=Array.isArray(e[n])?e[n]:[e[n]];o.forEach((e,o)=>{(0<r||0<o)&&("kt"!==n||0===o)&&(t+="&"),"dn"===n&&(e=encodeURIComponent(e).replace(/%20/g,"+")),("tr"===n||"xs"===n||"as"===n||"ws"===n)&&(e=encodeURIComponent(e)),"kt"===n&&(e=encodeURIComponent(e)),t+="kt"===n&&0<o?`+${e}`:`${n}=${e}`})}),t};const o=e("thirty-two"),a=e("uniq")}).call(this,e("buffer").Buffer)},{buffer:39,"thirty-two":172,uniq:182}],75:[function(e,t){function n(e,t){var r=this;if(!(r instanceof n))return new n(e,t);if(!d)throw new Error("web browser lacks MediaSource support");t||(t={}),r._debug=t.debug,r._bufferDuration=t.bufferDuration||60,r._elem=e,r._mediaSource=new d,r._streams=[],r.detailedError=null,r._errorHandler=function(){r._elem.removeEventListener("error",r._errorHandler);var e=r._streams.slice();e.forEach(function(e){e.destroy(r._elem.error)})},r._elem.addEventListener("error",r._errorHandler),r._elem.src=window.URL.createObjectURL(r._mediaSource)}function r(e,t){var n=this;if(i.Writable.call(n),n._wrapper=e,n._elem=e._elem,n._mediaSource=e._mediaSource,n._allStreams=e._streams,n._allStreams.push(n),n._bufferDuration=e._bufferDuration,n._sourceBuffer=null,n._debugBuffers=[],n._openHandler=function(){n._onSourceOpen()},n._flowHandler=function(){n._flow()},n._errorHandler=function(e){n.destroyed||n.emit("error",e)},"string"==typeof t)n._type=t,"open"===n._mediaSource.readyState?n._createSourceBuffer():n._mediaSource.addEventListener("sourceopen",n._openHandler);else if(null===t._sourceBuffer)t.destroy(),n._type=t._type,n._mediaSource.addEventListener("sourceopen",n._openHandler);else if(t._sourceBuffer)t.destroy(),n._type=t._type,n._sourceBuffer=t._sourceBuffer,n._debugBuffers=t._debugBuffers,n._sourceBuffer.addEventListener("updateend",n._flowHandler),n._sourceBuffer.addEventListener("error",n._errorHandler);else throw new Error("The argument to MediaElementWrapper.createWriteStream must be a string or a previous stream returned from that function");n._elem.addEventListener("timeupdate",n._flowHandler),n.on("error",function(e){n._wrapper.error(e)}),n.on("finish",function(){if(!n.destroyed&&(n._finished=!0,n._allStreams.every(function(e){return e._finished}))){n._wrapper._dumpDebugData();try{n._mediaSource.endOfStream()}catch(e){}}})}function o(e,t){var n=document.createElement("a");n.href=window.URL.createObjectURL(new window.Blob(e)),n.download=t,n.click()}t.exports=n;var a=e("inherits"),i=e("readable-stream"),s=e("to-arraybuffer"),d="undefined"!=typeof window&&window.MediaSource;n.prototype.createWriteStream=function(e){var t=this;return new r(t,e)},n.prototype.error=function(e){var t=this;t.detailedError||(t.detailedError=e),t._dumpDebugData();try{t._mediaSource.endOfStream("decode")}catch(e){}try{window.URL.revokeObjectURL(t._elem.src)}catch(e){}},n.prototype._dumpDebugData=function(){var e=this;e._debug&&(e._debug=!1,e._streams.forEach(function(e,t){o(e._debugBuffers,"mediasource-stream-"+t)}))},a(r,i.Writable),r.prototype._onSourceOpen=function(){var e=this;e.destroyed||(e._mediaSource.removeEventListener("sourceopen",e._openHandler),e._createSourceBuffer())},r.prototype.destroy=function(e){var t=this;t.destroyed||(t.destroyed=!0,t._allStreams.splice(t._allStreams.indexOf(t),1),t._mediaSource.removeEventListener("sourceopen",t._openHandler),t._elem.removeEventListener("timeupdate",t._flowHandler),t._sourceBuffer&&(t._sourceBuffer.removeEventListener("updateend",t._flowHandler),t._sourceBuffer.removeEventListener("error",t._errorHandler),"open"===t._mediaSource.readyState&&t._sourceBuffer.abort()),e&&t.emit("error",e),t.emit("close"))},r.prototype._createSourceBuffer=function(){var e=this;if(!e.destroyed)if(!d.isTypeSupported(e._type))e.destroy(new Error("The provided type is not supported"));else if(e._sourceBuffer=e._mediaSource.addSourceBuffer(e._type),e._sourceBuffer.addEventListener("updateend",e._flowHandler),e._sourceBuffer.addEventListener("error",e._errorHandler),e._cb){var t=e._cb;e._cb=null,t()}},r.prototype._write=function(e,t,n){var r=this;if(!r.destroyed){if(!r._sourceBuffer)return void(r._cb=function(o){return o?n(o):void r._write(e,t,n)});if(r._sourceBuffer.updating)return n(new Error("Cannot append buffer while source buffer updating"));var o=s(e);r._wrapper._debug&&r._debugBuffers.push(o);try{r._sourceBuffer.appendBuffer(o)}catch(e){return void r.destroy(e)}r._cb=n}},r.prototype._flow=function(){var e=this;if(!(e.destroyed||!e._sourceBuffer||e._sourceBuffer.updating)&&!("open"===e._mediaSource.readyState&&e._getBufferDuration()>e._bufferDuration)&&e._cb){var t=e._cb;e._cb=null,t()}};r.prototype._getBufferDuration=function(){for(var e=this,t=e._sourceBuffer.buffered,n=e._elem.currentTime,r=-1,o=0;o<t.length;o++){var a=t.start(o),s=t.end(o)+0;if(a>n)break;else(0<=r||n<=s)&&(r=s)}var d=r-n;return 0>d&&(d=0),d}},{inherits:67,"readable-stream":115,"to-arraybuffer":175}],76:[function(e,t){(function(e){function n(e,t){if(!(this instanceof n))return new n(e,t);if(t||(t={}),this.chunkLength=+e,!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=+t.length||1/0,this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=a(this.length/this.chunkLength)-1)}function r(t,n,r){e.nextTick(function(){t&&t(n,r)})}t.exports=n,n.prototype.put=function(e,t,n){if(this.closed)return r(n,new Error("Storage is closed"));var o=e===this.lastChunkIndex;return o&&t.length!==this.lastChunkLength?r(n,new Error("Last chunk length must be "+this.lastChunkLength)):o||t.length===this.chunkLength?void(this.chunks[e]=t,r(n,null)):r(n,new Error("Chunk length must be "+this.chunkLength))},n.prototype.get=function(e,t,n){if("function"==typeof t)return this.get(e,null,t);if(this.closed)return r(n,new Error("Storage is closed"));var o=this.chunks[e];if(!o){var a=new Error("Chunk not found");return a.notFound=!0,r(n,a)}if(!t)return r(n,null,o);var i=t.offset||0,s=t.length||o.length-i;r(n,null,o.slice(i,s+i))},n.prototype.close=n.prototype.destroy=function(e){return this.closed?r(e,new Error("Storage is closed")):void(this.closed=!0,this.chunks=null,r(e,null))}}).call(this,e("_process"))},{_process:92}],77:[function(e,t,n){function o(e,t,n){for(var r=t;r<n;r++)e[r]=0}function a(e,t,n){t.writeUInt32BE(r((e.getTime()+2082844800000)/1e3),n)}function i(e,t,n){t.writeUIntBE(r((e.getTime()+2082844800000)/1e3),n,6)}function s(e,t,n){t.writeUInt16BE(r(e)%65536,n),t.writeUInt16BE(r(256*(256*e))%65536,n+2)}function l(e,t,n){t[n]=r(e)%256,t[n+1]=r(256*e)%256}function c(e,t,n){e||(e=[0,0,0,0,0,0,0,0,0]);for(var r=0;r<e.length;r++)s(e[r],t,n+4*r)}function u(e,t,n){var r=k(e,"utf8");r.copy(t,n),t[n+r.length]=0}function p(e){for(var t=Array(e.length/4),n=0;n<t.length;n++)t[n]=m(e,4*n);return t}function f(e,t){return new Date(1e3*e.readUIntBE(t,6)-2082844800000)}function h(e,t){return new Date(1e3*e.readUInt32BE(t)-2082844800000)}function m(e,t){return e.readUInt16BE(t)+e.readUInt16BE(t+2)/65536}function g(e,t){return e[t]+e[t+1]/256}function _(e,t,n){var r;for(r=0;r<n&&!(0===e[t+r]);r++);return e.toString("utf8",t,t+r)}var b=e("./index"),y=e("./descriptor"),w=e("buffer-alloc"),k=e("buffer-from"),x=e("uint64be");n.fullBoxes={};["mvhd","tkhd","mdhd","vmhd","smhd","stsd","esds","stsz","stco","co64","stss","stts","ctts","stsc","dref","elst","hdlr","mehd","trex","mfhd","tfhd","tfdt","trun"].forEach(function(e){n.fullBoxes[e]=!0}),n.ftyp={},n.ftyp.encode=function(e,t,r){t=t?t.slice(r):w(n.ftyp.encodingLength(e));var o=e.compatibleBrands||[];t.write(e.brand,0,4,"ascii"),t.writeUInt32BE(e.brandVersion,4);for(var a=0;a<o.length;a++)t.write(o[a],8+4*a,4,"ascii");return n.ftyp.encode.bytes=8+4*o.length,t},n.ftyp.decode=function(e,t){e=e.slice(t);for(var n=e.toString("ascii",0,4),r=e.readUInt32BE(4),o=[],a=8;a<e.length;a+=4)o.push(e.toString("ascii",a,a+4));return{brand:n,brandVersion:r,compatibleBrands:o}},n.ftyp.encodingLength=function(e){return 8+4*(e.compatibleBrands||[]).length},n.mvhd={},n.mvhd.encode=function(e,t,r){return t=t?t.slice(r):w(96),a(e.ctime||new Date,t,0),a(e.mtime||new Date,t,4),t.writeUInt32BE(e.timeScale||0,8),t.writeUInt32BE(e.duration||0,12),s(e.preferredRate||0,t,16),l(e.preferredVolume||0,t,20),o(t,22,32),c(e.matrix,t,32),t.writeUInt32BE(e.previewTime||0,68),t.writeUInt32BE(e.previewDuration||0,72),t.writeUInt32BE(e.posterTime||0,76),t.writeUInt32BE(e.selectionTime||0,80),t.writeUInt32BE(e.selectionDuration||0,84),t.writeUInt32BE(e.currentTime||0,88),t.writeUInt32BE(e.nextTrackId||0,92),n.mvhd.encode.bytes=96,t},n.mvhd.decode=function(e,t){return e=e.slice(t),{ctime:h(e,0),mtime:h(e,4),timeScale:e.readUInt32BE(8),duration:e.readUInt32BE(12),preferredRate:m(e,16),preferredVolume:g(e,20),matrix:p(e.slice(32,68)),previewTime:e.readUInt32BE(68),previewDuration:e.readUInt32BE(72),posterTime:e.readUInt32BE(76),selectionTime:e.readUInt32BE(80),selectionDuration:e.readUInt32BE(84),currentTime:e.readUInt32BE(88),nextTrackId:e.readUInt32BE(92)}},n.mvhd.encodingLength=function(){return 96},n.tkhd={},n.tkhd.encode=function(e,t,r){return t=t?t.slice(r):w(80),a(e.ctime||new Date,t,0),a(e.mtime||new Date,t,4),t.writeUInt32BE(e.trackId||0,8),o(t,12,16),t.writeUInt32BE(e.duration||0,16),o(t,20,28),t.writeUInt16BE(e.layer||0,28),t.writeUInt16BE(e.alternateGroup||0,30),t.writeUInt16BE(e.volume||0,32),c(e.matrix,t,36),t.writeUInt32BE(e.trackWidth||0,72),t.writeUInt32BE(e.trackHeight||0,76),n.tkhd.encode.bytes=80,t},n.tkhd.decode=function(e,t){return e=e.slice(t),{ctime:h(e,0),mtime:h(e,4),trackId:e.readUInt32BE(8),duration:e.readUInt32BE(16),layer:e.readUInt16BE(28),alternateGroup:e.readUInt16BE(30),volume:e.readUInt16BE(32),matrix:p(e.slice(36,72)),trackWidth:e.readUInt32BE(72),trackHeight:e.readUInt32BE(76)}},n.tkhd.encodingLength=function(){return 80},n.mdhd={},n.mdhd.encode=function(e,t,r){return 1===e.version?(t=t?t.slice(r):w(32),i(e.ctime||new Date,t,0),i(e.mtime||new Date,t,8),t.writeUInt32BE(e.timeScale||0,16),t.writeUIntBE(e.duration||0,20,6),t.writeUInt16BE(e.language||0,28),t.writeUInt16BE(e.quality||0,30),n.mdhd.encode.bytes=32,t):(t=t?t.slice(r):w(20),a(e.ctime||new Date,t,0),a(e.mtime||new Date,t,4),t.writeUInt32BE(e.timeScale||0,8),t.writeUInt32BE(e.duration||0,12),t.writeUInt16BE(e.language||0,16),t.writeUInt16BE(e.quality||0,18),n.mdhd.encode.bytes=20,t)},n.mdhd.decode=function(e,t,n){e=e.slice(t);return 20!=n-t?{ctime:f(e,0),mtime:f(e,8),timeScale:e.readUInt32BE(16),duration:e.readUIntBE(20,6),language:e.readUInt16BE(28),quality:e.readUInt16BE(30)}:{ctime:h(e,0),mtime:h(e,4),timeScale:e.readUInt32BE(8),duration:e.readUInt32BE(12),language:e.readUInt16BE(16),quality:e.readUInt16BE(18)}},n.mdhd.encodingLength=function(e){return 1===e.version?32:20},n.vmhd={},n.vmhd.encode=function(e,t,r){t=t?t.slice(r):w(8),t.writeUInt16BE(e.graphicsMode||0,0);var o=e.opcolor||[0,0,0];return t.writeUInt16BE(o[0],2),t.writeUInt16BE(o[1],4),t.writeUInt16BE(o[2],6),n.vmhd.encode.bytes=8,t},n.vmhd.decode=function(e,t){return e=e.slice(t),{graphicsMode:e.readUInt16BE(0),opcolor:[e.readUInt16BE(2),e.readUInt16BE(4),e.readUInt16BE(6)]}},n.vmhd.encodingLength=function(){return 8},n.smhd={},n.smhd.encode=function(e,t,r){return t=t?t.slice(r):w(4),t.writeUInt16BE(e.balance||0,0),o(t,2,4),n.smhd.encode.bytes=4,t},n.smhd.decode=function(e,t){return e=e.slice(t),{balance:e.readUInt16BE(0)}},n.smhd.encodingLength=function(){return 4},n.stsd={},n.stsd.encode=function(e,t,r){t=t?t.slice(r):w(n.stsd.encodingLength(e));var o=e.entries||[];t.writeUInt32BE(o.length,0);for(var a=4,s=0,d;s<o.length;s++)d=o[s],b.encode(d,t,a),a+=b.encode.bytes;return n.stsd.encode.bytes=a,t},n.stsd.decode=function(e,t,n){e=e.slice(t);for(var r=e.readUInt32BE(0),o=Array(r),a=4,s=0,d;s<r;s++)d=b.decode(e,a,n),o[s]=d,a+=d.length;return{entries:o}},n.stsd.encodingLength=function(e){var t=4;if(!e.entries)return t;for(var n=0;n<e.entries.length;n++)t+=b.encodingLength(e.entries[n]);return t},n.avc1=n.VisualSampleEntry={},n.VisualSampleEntry.encode=function(e,t,r){t=t?t.slice(r):w(n.VisualSampleEntry.encodingLength(e)),o(t,0,6),t.writeUInt16BE(e.dataReferenceIndex||0,6),o(t,8,24),t.writeUInt16BE(e.width||0,24),t.writeUInt16BE(e.height||0,26),t.writeUInt32BE(e.hResolution||4718592,28),t.writeUInt32BE(e.vResolution||4718592,32),o(t,36,40),t.writeUInt16BE(e.frameCount||1,40);var a=e.compressorName||"",i=d(a.length,31);t.writeUInt8(i,42),t.write(a,43,i,"utf8"),t.writeUInt16BE(e.depth||24,74),t.writeInt16BE(-1,76);var s=78,l=e.children||[];l.forEach(function(e){b.encode(e,t,s),s+=b.encode.bytes}),n.VisualSampleEntry.encode.bytes=s},n.VisualSampleEntry.decode=function(e,t,n){e=e.slice(t);for(var r=n-t,o=d(e.readUInt8(42),31),a={dataReferenceIndex:e.readUInt16BE(6),width:e.readUInt16BE(24),height:e.readUInt16BE(26),hResolution:e.readUInt32BE(28),vResolution:e.readUInt32BE(32),frameCount:e.readUInt16BE(40),compressorName:e.toString("utf8",43,43+o),depth:e.readUInt16BE(74),children:[]},i=78;8<=r-i;){var s=b.decode(e,i,r);a.children.push(s),a[s.type]=s,i+=s.length}return a},n.VisualSampleEntry.encodingLength=function(e){var t=78,n=e.children||[];return n.forEach(function(e){t+=b.encodingLength(e)}),t},n.avcC={},n.avcC.encode=function(e,t,r){t=t?t.slice(r):w(e.buffer.length),e.buffer.copy(t),n.avcC.encode.bytes=e.buffer.length},n.avcC.decode=function(e,t,n){return e=e.slice(t,n),{mimeCodec:e.toString("hex",1,4),buffer:k(e)}},n.avcC.encodingLength=function(e){return e.buffer.length},n.mp4a=n.AudioSampleEntry={},n.AudioSampleEntry.encode=function(e,t,r){t=t?t.slice(r):w(n.AudioSampleEntry.encodingLength(e)),o(t,0,6),t.writeUInt16BE(e.dataReferenceIndex||0,6),o(t,8,16),t.writeUInt16BE(e.channelCount||2,16),t.writeUInt16BE(e.sampleSize||16,18),o(t,20,24),t.writeUInt32BE(e.sampleRate||0,24);var a=28,i=e.children||[];i.forEach(function(e){b.encode(e,t,a),a+=b.encode.bytes}),n.AudioSampleEntry.encode.bytes=a},n.AudioSampleEntry.decode=function(e,t,n){e=e.slice(t,n);for(var r=n-t,o={dataReferenceIndex:e.readUInt16BE(6),channelCount:e.readUInt16BE(16),sampleSize:e.readUInt16BE(18),sampleRate:e.readUInt32BE(24),children:[]},a=28;8<=r-a;){var i=b.decode(e,a,r);o.children.push(i),o[i.type]=i,a+=i.length}return o},n.AudioSampleEntry.encodingLength=function(e){var t=28,n=e.children||[];return n.forEach(function(e){t+=b.encodingLength(e)}),t},n.esds={},n.esds.encode=function(e,t,r){t=t?t.slice(r):w(e.buffer.length),e.buffer.copy(t,0),n.esds.encode.bytes=e.buffer.length},n.esds.decode=function(e,t,n){e=e.slice(t,n);var r=y.Descriptor.decode(e,0,e.length),o="ESDescriptor"===r.tagName?r:{},a=o.DecoderConfigDescriptor||{},i=a.oti||0,s=a.DecoderSpecificInfo,d=s?(248&s.buffer.readUInt8(0))>>3:0,l=null;return i&&(l=i.toString(16),d&&(l+="."+d)),{mimeCodec:l,buffer:k(e.slice(0))}},n.esds.encodingLength=function(e){return e.buffer.length},n.stsz={},n.stsz.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.stsz.encodingLength(e)),t.writeUInt32BE(0,0),t.writeUInt32BE(o.length,4);for(var a=0;a<o.length;a++)t.writeUInt32BE(o[a],4*a+8);return n.stsz.encode.bytes=8+4*o.length,t},n.stsz.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=e.readUInt32BE(4),o=Array(r),a=0;a<r;a++)o[a]=0===n?e.readUInt32BE(4*a+8):n;return{entries:o}},n.stsz.encodingLength=function(e){return 8+4*e.entries.length},n.stss=n.stco={},n.stco.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.stco.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0;a<o.length;a++)t.writeUInt32BE(o[a],4*a+4);return n.stco.encode.bytes=4+4*o.length,t},n.stco.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0;o<n;o++)r[o]=e.readUInt32BE(4*o+4);return{entries:r}},n.stco.encodingLength=function(e){return 4+4*e.entries.length},n.co64={},n.co64.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.co64.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0;a<o.length;a++)x.encode(o[a],t,8*a+4);return n.co64.encode.bytes=4+8*o.length,t},n.co64.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0;o<n;o++)r[o]=x.decode(e,8*o+4);return{entries:r}},n.co64.encodingLength=function(e){return 4+8*e.entries.length},n.stts={},n.stts.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.stts.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0,s;a<o.length;a++)s=8*a+4,t.writeUInt32BE(o[a].count||0,s),t.writeUInt32BE(o[a].duration||0,s+4);return n.stts.encode.bytes=4+8*e.entries.length,t},n.stts.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0,a;o<n;o++)a=8*o+4,r[o]={count:e.readUInt32BE(a),duration:e.readUInt32BE(a+4)};return{entries:r}},n.stts.encodingLength=function(e){return 4+8*e.entries.length},n.ctts={},n.ctts.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.ctts.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0,s;a<o.length;a++)s=8*a+4,t.writeUInt32BE(o[a].count||0,s),t.writeUInt32BE(o[a].compositionOffset||0,s+4);return n.ctts.encode.bytes=4+8*o.length,t},n.ctts.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0,a;o<n;o++)a=8*o+4,r[o]={count:e.readUInt32BE(a),compositionOffset:e.readInt32BE(a+4)};return{entries:r}},n.ctts.encodingLength=function(e){return 4+8*e.entries.length},n.stsc={},n.stsc.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.stsc.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0,s;a<o.length;a++)s=12*a+4,t.writeUInt32BE(o[a].firstChunk||0,s),t.writeUInt32BE(o[a].samplesPerChunk||0,s+4),t.writeUInt32BE(o[a].sampleDescriptionId||0,s+8);return n.stsc.encode.bytes=4+12*o.length,t},n.stsc.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0,a;o<n;o++)a=12*o+4,r[o]={firstChunk:e.readUInt32BE(a),samplesPerChunk:e.readUInt32BE(a+4),sampleDescriptionId:e.readUInt32BE(a+8)};return{entries:r}},n.stsc.encodingLength=function(e){return 4+12*e.entries.length},n.dref={},n.dref.encode=function(e,t,r){t=t?t.slice(r):w(n.dref.encodingLength(e));var o=e.entries||[];t.writeUInt32BE(o.length,0);for(var a=4,s=0;s<o.length;s++){var d=o[s],l=(d.buf?d.buf.length:0)+4+4;t.writeUInt32BE(l,a),a+=4,t.write(d.type,a,4,"ascii"),a+=4,d.buf&&(d.buf.copy(t,a),a+=d.buf.length)}return n.dref.encode.bytes=a,t},n.dref.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=4,a=0;a<n;a++){var s=e.readUInt32BE(o),d=e.toString("ascii",o+4,o+8),l=e.slice(o+8,o+s);o+=s,r[a]={type:d,buf:l}}return{entries:r}},n.dref.encodingLength=function(e){var t=4;if(!e.entries)return t;for(var n=0,r;n<e.entries.length;n++)r=e.entries[n].buf,t+=(r?r.length:0)+4+4;return t},n.elst={},n.elst.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.elst.encodingLength(e)),t.writeUInt32BE(o.length,0);for(var a=0,d;a<o.length;a++)d=12*a+4,t.writeUInt32BE(o[a].trackDuration||0,d),t.writeUInt32BE(o[a].mediaTime||0,d+4),s(o[a].mediaRate||0,t,d+8);return n.elst.encode.bytes=4+12*o.length,t},n.elst.decode=function(e,t){e=e.slice(t);for(var n=e.readUInt32BE(0),r=Array(n),o=0,a;o<n;o++)a=12*o+4,r[o]={trackDuration:e.readUInt32BE(a),mediaTime:e.readInt32BE(a+4),mediaRate:m(e,a+8)};return{entries:r}},n.elst.encodingLength=function(e){return 4+12*e.entries.length},n.hdlr={},n.hdlr.encode=function(e,t,r){t=t?t.slice(r):w(n.hdlr.encodingLength(e));var o=21+(e.name||"").length;return t.fill(0,0,o),t.write(e.handlerType||"",4,4,"ascii"),u(e.name||"",t,20),n.hdlr.encode.bytes=o,t},n.hdlr.decode=function(e,t,n){return e=e.slice(t),{handlerType:e.toString("ascii",4,8),name:_(e,20,n)}},n.hdlr.encodingLength=function(e){return 21+(e.name||"").length},n.mehd={},n.mehd.encode=function(e,t,r){return t=t?t.slice(r):w(4),t.writeUInt32BE(e.fragmentDuration||0,0),n.mehd.encode.bytes=4,t},n.mehd.decode=function(e,t){return e=e.slice(t),{fragmentDuration:e.readUInt32BE(0)}},n.mehd.encodingLength=function(){return 4},n.trex={},n.trex.encode=function(e,t,r){return t=t?t.slice(r):w(20),t.writeUInt32BE(e.trackId||0,0),t.writeUInt32BE(e.defaultSampleDescriptionIndex||0,4),t.writeUInt32BE(e.defaultSampleDuration||0,8),t.writeUInt32BE(e.defaultSampleSize||0,12),t.writeUInt32BE(e.defaultSampleFlags||0,16),n.trex.encode.bytes=20,t},n.trex.decode=function(e,t){return e=e.slice(t),{trackId:e.readUInt32BE(0),defaultSampleDescriptionIndex:e.readUInt32BE(4),defaultSampleDuration:e.readUInt32BE(8),defaultSampleSize:e.readUInt32BE(12),defaultSampleFlags:e.readUInt32BE(16)}},n.trex.encodingLength=function(){return 20},n.mfhd={},n.mfhd.encode=function(e,t,r){return t=t?t.slice(r):w(4),t.writeUInt32BE(e.sequenceNumber||0,0),n.mfhd.encode.bytes=4,t},n.mfhd.decode=function(e){return{sequenceNumber:e.readUInt32BE(0)}},n.mfhd.encodingLength=function(){return 4},n.tfhd={},n.tfhd.encode=function(e,t,r){return t=t?t.slice(r):w(4),t.writeUInt32BE(e.trackId,0),n.tfhd.encode.bytes=4,t},n.tfhd.decode=function(){},n.tfhd.encodingLength=function(){return 4},n.tfdt={},n.tfdt.encode=function(e,t,r){return t=t?t.slice(r):w(4),t.writeUInt32BE(e.baseMediaDecodeTime||0,0),n.tfdt.encode.bytes=4,t},n.tfdt.decode=function(){},n.tfdt.encodingLength=function(){return 4},n.trun={},n.trun.encode=function(e,t,r){t=t?t.slice(r):w(8+16*e.entries.length),t.writeUInt32BE(e.entries.length,0),t.writeInt32BE(e.dataOffset,4);for(var o=8,a=0,s;a<e.entries.length;a++)s=e.entries[a],t.writeUInt32BE(s.sampleDuration,o),o+=4,t.writeUInt32BE(s.sampleSize,o),o+=4,t.writeUInt32BE(s.sampleFlags,o),o+=4,0===(e.version||0)?t.writeUInt32BE(s.sampleCompositionTimeOffset,o):t.writeInt32BE(s.sampleCompositionTimeOffset,o),o+=4;n.trun.encode.bytes=o},n.trun.decode=function(){},n.trun.encodingLength=function(e){return 8+16*e.entries.length},n.mdat={},n.mdat.encode=function(e,t,r){e.buffer?(e.buffer.copy(t,r),n.mdat.encode.bytes=e.buffer.length):n.mdat.encode.bytes=n.mdat.encodingLength(e)},n.mdat.decode=function(e,t,n){return{buffer:k(e.slice(t,n))}},n.mdat.encodingLength=function(e){return e.buffer?e.buffer.length:e.contentLength}},{"./descriptor":78,"./index":79,"buffer-alloc":36,"buffer-from":38,uint64be:181}],78:[function(e,t,n){var r=e("buffer-from"),o={3:"ESDescriptor",4:"DecoderConfigDescriptor",5:"DecoderSpecificInfo",6:"SLConfigDescriptor"};n.Descriptor={},n.Descriptor.decode=function(e,t,a){var i=e.readUInt8(t),s=t+1,d=0,l;do l=e.readUInt8(s++),d=d<<7|127&l;while(128&l);var c=o[i],u;return u=n[c]?n[c].decode(e,s,a):{buffer:r(e.slice(s,s+d))},u.tag=i,u.tagName=c,u.length=s-t+d,u.contentsLen=d,u},n.DescriptorArray={},n.DescriptorArray.decode=function(e,t,r){for(var a=t,i={};a+2<=r;){var s=n.Descriptor.decode(e,a,r);a+=s.length;var d=o[s.tag]||"Descriptor"+s.tag;i[d]=s}return i},n.ESDescriptor={},n.ESDescriptor.decode=function(e,t,r){var o=e.readUInt8(t+2),a=t+3;if(128&o&&(a+=2),64&o){var i=e.readUInt8(a);a+=i+1}return 32&o&&(a+=2),n.DescriptorArray.decode(e,a,r)},n.DecoderConfigDescriptor={},n.DecoderConfigDescriptor.decode=function(e,t,r){var o=e.readUInt8(t),a=n.DescriptorArray.decode(e,t+13,r);return a.oti=o,a}},{"buffer-from":38}],79:[function(e,t,n){var r=e("uint64be"),o=e("buffer-alloc"),a=e("buffer-from"),i=e("./boxes"),s=4294967295,d=n,l=n.containers={moov:["mvhd","meta","traks","mvex"],trak:["tkhd","tref","trgr","edts","meta","mdia","udta"],edts:["elst"],mdia:["mdhd","hdlr","elng","minf"],minf:["vmhd","smhd","hmhd","sthd","nmhd","dinf","stbl"],dinf:["dref"],stbl:["stsd","stts","ctts","cslg","stsc","stsz","stz2","stco","co64","stss","stsh","padb","stdp","sdtp","sbgps","sgpds","subss","saizs","saios"],mvex:["mehd","trexs","leva"],moof:["mfhd","meta","trafs"],traf:["tfhd","tfdt","trun","sbgps","sgpds","subss","saizs","saios","meta"]};d.encode=function(e,t,n){return d.encodingLength(e),n=n||0,t=t||o(e.length),d._encode(e,t,n)},d._encode=function(e,t,n){var o=e.type,a=e.length;a>s&&(a=1),t.writeUInt32BE(a,n),t.write(e.type,n+4,4,"ascii");var c=n+8;if(1===a&&(r.encode(e.length,t,c),c+=8),i.fullBoxes[o]&&(t.writeUInt32BE(e.flags||0,c),t.writeUInt8(e.version||0,c),c+=4),l[o]){var u=l[o];u.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){d._encode(e,t,c),c+=d.encode.bytes})}else e[n]&&(d._encode(e[n],t,c),c+=d.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){d._encode(e,t,c),c+=d.encode.bytes})}else if(i[o]){var p=i[o].encode;p(e,t,c),c+=p.bytes}else if(e.buffer){var f=e.buffer;f.copy(t,c),c+=e.buffer.length}else throw new Error("Either `type` must be set to a known type (not'"+o+"') or `buffer` must be set");return d.encode.bytes=c-n,t},d.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,8>n-t)return 8;var o=e.readUInt32BE(t),a=e.toString("ascii",t+4,t+8),s=t+8;if(1===o){if(16>n-t)return 16;o=r.decode(e,s),s+=8}var d,l;return i.fullBoxes[a]&&(d=e.readUInt8(s),l=16777215&e.readUInt32BE(s),s+=4),{length:o,headersLen:s-t,contentLen:o-(s-t),type:a,version:d,flags:l}},d.decode=function(e,t,n){t=t||0,n=n||e.length;var r=d.readHeaders(e,t,n);if(!r||r.length>n-t)throw new Error("Data too short");return d.decodeWithoutHeaders(r,e,t+r.headersLen,t+r.length)},d.decodeWithoutHeaders=function(e,t,n,r){n=n||0,r=r||t.length;var o=e.type,s={};if(l[o]){s.otherBoxes=[];for(var c=l[o],u=n,p;8<=r-u;)if(p=d.decode(t,u,r),u+=p.length,0<=c.indexOf(p.type))s[p.type]=p;else if(0<=c.indexOf(p.type+"s")){var f=p.type+"s",h=s[f]=s[f]||[];h.push(p)}else s.otherBoxes.push(p)}else if(i[o]){var m=i[o].decode;s=m(t,n,r)}else s.buffer=a(t.slice(n,r));return s.length=e.length,s.contentLen=e.contentLen,s.type=e.type,s.version=e.version,s.flags=e.flags,s},d.encodingLength=function(e){var t=e.type,n=8;if(i.fullBoxes[t]&&(n+=4),l[t]){var r=l[t];r.forEach(function(t){if(5===t.length){var r=e[t]||[];t=t.substr(0,4),r.forEach(function(e){e.type=t,n+=d.encodingLength(e)})}else if(e[t]){var o=e[t];o.type=t,n+=d.encodingLength(o)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){n+=d.encodingLength(e)})}else if(i[t])n+=i[t].encodingLength(e);else if(e.buffer)n+=e.buffer.length;else throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");return n>s&&(n+=8),e.length=n,n}},{"./boxes":77,"buffer-alloc":36,"buffer-from":38,uint64be:181}],80:[function(e,t){(function(n){function r(){return this instanceof r?void(a.Writable.call(this),this.destroyed=!1,this._pending=0,this._missing=0,this._ignoreEmpty=!1,this._buf=null,this._str=null,this._cb=null,this._ondrain=null,this._writeBuffer=null,this._writeCb=null,this._ondrain=null,this._kick()):new r}function o(e){this._parent=e,this.destroyed=!1,a.PassThrough.call(this)}var a=e("readable-stream"),i=e("inherits"),s=e("next-event"),d=e("mp4-box-encoding"),l=e("buffer-alloc"),c=l(0);t.exports=r,i(r,a.Writable),r.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))},r.prototype._write=function(e,t,n){if(!this.destroyed){for(var r=!this._str||!this._str._writableState.needDrain;e.length&&!this.destroyed;){if(!this._missing&&!this._ignoreEmpty)return this._writeBuffer=e,void(this._writeCb=n);var o=e.length<this._missing?e.length:this._missing;if(this._buf?e.copy(this._buf,this._buf.length-this._missing):this._str&&(r=this._str.write(o===e.length?e:e.slice(0,o))),this._missing-=o,!this._missing){var a=this._buf,i=this._cb,s=this._str;this._buf=this._cb=this._str=this._ondrain=null,r=!0,this._ignoreEmpty=!1,s&&s.end(),i&&i(a)}e=o===e.length?c:e.slice(o)}return this._pending&&!this._missing?(this._writeBuffer=e,void(this._writeCb=n)):void(r?n():this._ondrain(n))}},r.prototype._buffer=function(e,t){this._missing=e,this._buf=l(e),this._cb=t},r.prototype._stream=function(e,t){var n=this;return this._missing=e,this._str=new o(this),this._ondrain=s(this._str,"drain"),this._pending++,this._str.on("end",function(){n._pending--,n._kick()}),this._cb=t,this._str},r.prototype._readBox=function(){function e(r,o){t._buffer(r,function(r){o=o?n.concat([o,r]):r;var a=d.readHeaders(o);"number"==typeof a?e(a-o.length,o):(t._pending++,t._headers=a,t.emit("box",a))})}var t=this;e(8)},r.prototype.stream=function(){var e=this;if(!e._headers)throw new Error("this function can only be called once after 'box' is emitted");var t=e._headers;return e._headers=null,e._stream(t.contentLen,null)},r.prototype.decode=function(e){var t=this;if(!t._headers)throw new Error("this function can only be called once after 'box' is emitted");var n=t._headers;t._headers=null,t._buffer(n.contentLen,function(r){var o=d.decodeWithoutHeaders(n,r);e(o),t._pending--,t._kick()})},r.prototype.ignore=function(){var e=this;if(!e._headers)throw new Error("this function can only be called once after 'box' is emitted");var t=e._headers;e._headers=null,this._missing=t.contentLen,0===this._missing&&(this._ignoreEmpty=!0),this._cb=function(){e._pending--,e._kick()}},r.prototype._kick=function(){if(!this._pending&&(this._buf||this._str||this._readBox(),this._writeBuffer)){var e=this._writeCb,t=this._writeBuffer;this._writeBuffer=null,this._writeCb=null,this._write(t,null,e)}},i(o,a.PassThrough),o.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._parent.destroy(e),e&&this.emit("error",e),this.emit("close"))}}).call(this,e("buffer").Buffer)},{buffer:39,"buffer-alloc":36,inherits:67,"mp4-box-encoding":79,"next-event":85,"readable-stream":115}],81:[function(e,t){(function(n){function r(){}function o(){if(!(this instanceof o))return new o;i.Readable.call(this),this.destroyed=!1,this._finalized=!1,this._reading=!1,this._stream=null,this._drain=null,this._want=!1,this._onreadable=function(){e._want&&(e._want=!1,e._read())},this._onend=function(){e._stream=null};var e=this}function a(e){this._parent=e,this.destroyed=!1,i.PassThrough.call(this)}var i=e("readable-stream"),s=e("inherits"),d=e("mp4-box-encoding"),l=e("buffer-alloc");t.exports=o,s(o,i.Readable),o.prototype.mediaData=o.prototype.mdat=function(e,t){var n=new a(this);return this.box({type:"mdat",contentLength:e,encodeBufferLen:8,stream:n},t),n},o.prototype.box=function(e,t){if(t||(t=r),this.destroyed)return t(new Error("Encoder is destroyed"));var o;if(e.encodeBufferLen&&(o=l(e.encodeBufferLen)),e.stream)e.buffer=null,o=d.encode(e,o),this.push(o),this._stream=e.stream,this._stream.on("readable",this._onreadable),this._stream.on("end",this._onend),this._stream.on("end",t),this._forward();else{o=d.encode(e,o);var a=this.push(o);if(a)return n.nextTick(t);this._drain=t}},o.prototype.destroy=function(e){if(!this.destroyed){if(this.destroyed=!0,this._stream&&this._stream.destroy&&this._stream.destroy(),this._stream=null,this._drain){var t=this._drain;this._drain=null,t(e)}e&&this.emit("error",e),this.emit("close")}},o.prototype.finalize=function(){this._finalized=!0,this._stream||this._drain||this.push(null)},o.prototype._forward=function(){if(this._stream)for(;!this.destroyed;){var e=this._stream.read();if(!e)return void(this._want=!!this._stream);if(!this.push(e))return}},o.prototype._read=function(){if(!(this._reading||this.destroyed)){if(this._reading=!0,this._stream&&this._forward(),this._drain){var e=this._drain;this._drain=null,e()}this._reading=!1,this._finalized&&this.push(null)}},s(a,i.PassThrough),a.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._parent.destroy(e),e&&this.emit("error",e),this.emit("close"))}}).call(this,e("_process"))},{_process:92,"buffer-alloc":36,inherits:67,"mp4-box-encoding":79,"readable-stream":115}],82:[function(e,t,n){n.decode=e("./decode"),n.encode=e("./encode")},{"./decode":80,"./encode":81}],83:[function(e,n){var s=Math.round;function r(e){if(e+="",!(100<e.length)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();return"years"===n||"year"===n||"yrs"===n||"yr"===n||"y"===n?31557600000*r:"weeks"===n||"week"===n||"w"===n?604800000*r:"days"===n||"day"===n||"d"===n?86400000*r:"hours"===n||"hour"===n||"hrs"===n||"hr"===n||"h"===n?3600000*r:"minutes"===n||"minute"===n||"mins"===n||"min"===n||"m"===n?60000*r:"seconds"===n||"second"===n||"secs"===n||"sec"===n||"s"===n?1000*r:"milliseconds"===n||"millisecond"===n||"msecs"===n||"msec"===n||"ms"===n?r:void 0}}}function o(e){var n=t(e);return 86400000<=n?s(e/86400000)+"d":3600000<=n?s(e/3600000)+"h":60000<=n?s(e/60000)+"m":1000<=n?s(e/1000)+"s":e+"ms"}function a(e){var n=t(e);return 86400000<=n?i(e,n,86400000,"day"):3600000<=n?i(e,n,3600000,"hour"):60000<=n?i(e,n,60000,"minute"):1000<=n?i(e,n,1000,"second"):e+" ms"}function i(e,t,r,n){return s(e/r)+" "+n+(t>=1.5*r?"s":"")}var l=24*(60*60000);n.exports=function(e,t){t=t||{};var n=typeof e;if("string"==n&&0<e.length)return r(e);if("number"==n&&isFinite(e))return t.long?a(e):o(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],84:[function(e,t){function n(e,t){var a=this;return a instanceof n?void(d.Readable.call(a,t),a.destroyed=!1,a._drained=!1,a._forwarding=!1,a._current=null,a._toStreams2=t&&t.objectMode?r:o,"function"==typeof e?a._queue=e:(a._queue=e.map(a._toStreams2),a._queue.forEach(function(e){"function"!=typeof e&&a._attachErrorListener(e)})),a._next()):new n(e,t)}function r(e){return a(e,{objectMode:!0,highWaterMark:16})}function o(e){return a(e)}function a(e,t){if(!e||"function"==typeof e||e._readableState)return e;var n=new d.Readable(t).wrap(e);return e.destroy&&(n.destroy=e.destroy.bind(e)),n}t.exports=n;var i=e("inherits"),d=e("readable-stream");i(n,d.Readable),n.obj=function(e){return new n(e,{objectMode:!0,highWaterMark:16})},n.prototype._read=function(){this._drained=!0,this._forward()},n.prototype._forward=function(){if(!this._forwarding&&this._drained&&this._current){this._forwarding=!0;for(var e;null!==(e=this._current.read());)this._drained=this.push(e);this._forwarding=!1}},n.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._current&&this._current.destroy&&this._current.destroy(),"function"!=typeof this._queue&&this._queue.forEach(function(e){e.destroy&&e.destroy()}),e&&this.emit("error",e),this.emit("close"))},n.prototype._next=function(){var e=this;if(e._current=null,"function"==typeof e._queue)e._queue(function(t,n){return t?e.destroy(t):void(n=e._toStreams2(n),e._attachErrorListener(n),e._gotNextStream(n))});else{var t=e._queue.shift();"function"==typeof t&&(t=e._toStreams2(t()),e._attachErrorListener(t)),e._gotNextStream(t)}},n.prototype._gotNextStream=function(e){function t(){o._forward()}function n(){e._readableState.ended||o.destroy()}function r(){o._current=null,e.removeListener("readable",t),e.removeListener("end",r),e.removeListener("close",n),o._next()}var o=this;return e?void(o._current=e,o._forward(),e.on("readable",t),e.once("end",r),e.once("close",n)):(o.push(null),void o.destroy())},n.prototype._attachErrorListener=function(e){function t(r){e.removeListener("error",t),n.destroy(r)}var n=this;e&&e.once("error",t)}},{inherits:67,"readable-stream":115}],85:[function(e,t){t.exports=function(e,t){var n=null;return e.on(t,function(e){if(n){var t=n;n=null,t(e)}}),function(e){n=e}}},{}],86:[function(e,t){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)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}var o=e("wrappy");t.exports=o(n),t.exports.strict=o(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})})},{wrappy:191}],87:[function(e,t){function n(e){if(/^-?\d+$/.test(e))return parseInt(e,10);var t;if(t=e.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){var n=t[1],r=t[2],o=t[3];if(n&&o){n=parseInt(n),o=parseInt(o);var a=[],s=n<o?1:-1;("-"==r||".."==r||"\u2025"==r)&&(o+=s);for(var d=n;d!=o;d+=s)a.push(d);return a}}return[]}t.exports.parse=function(e){var t=e.split(","),r=t.map(function(e){return n(e)});return 0===r.length?[]:1===r.length?Array.isArray(r[0])?r[0]:r:r.reduce(function(e,t){return Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.concat(t)})}},{}],88:[function(e,t){(function(n,r){function o(e){if("string"==typeof e&&/^(stream-)?magnet:/.test(e))return h(e);if("string"==typeof e&&(/^[a-f0-9]{40}$/i.test(e)||/^[a-z2-7]{32}$/i.test(e)))return h(`magnet:?xt=urn:btih:${e}`);if(r.isBuffer(e)&&20===e.length)return h(`magnet:?xt=urn:btih:${e.toString("hex")}`);if(r.isBuffer(e))return a(e);if(e&&e.infoHash)return e.infoHash=e.infoHash.toLowerCase(),e.announce||(e.announce=[]),"string"==typeof e.announce&&(e.announce=[e.announce]),e.urlList||(e.urlList=[]),e;throw new Error("Invalid torrent identifier")}function a(e){r.isBuffer(e)&&(e=c.decode(e)),l(e.info,"info"),l(e.info["name.utf-8"]||e.info.name,"info.name"),l(e.info["piece length"],"info['piece length']"),l(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(e=>{l("number"==typeof e.length,"info.files[0].length"),l(e["path.utf-8"]||e.path,"info.files[0].path")}):l("number"==typeof e.info.length,"info.length");const t={info:e.info,infoBuffer:c.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};t.infoHash=g.sync(t.infoBuffer),t.infoHashBuffer=r.from(t.infoHash,"hex"),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=e["created by"].toString()),r.isBuffer(e.comment)&&(t.comment=e.comment.toString()),Array.isArray(e["announce-list"])&&0<e["announce-list"].length?e["announce-list"].forEach(e=>{e.forEach(e=>{t.announce.push(e.toString())})}):e.announce&&t.announce.push(e.announce.toString()),r.isBuffer(e["url-list"])&&(e["url-list"]=0<e["url-list"].length?[e["url-list"]]:[]),t.urlList=(e["url-list"]||[]).map(e=>e.toString()),_(t.announce),_(t.urlList);const n=e.info.files||[e.info];t.files=n.map((e,r)=>{const o=[].concat(t.name,e["path.utf-8"]||e.path||[]).map(e=>e.toString());return{path:m.join.apply(null,[m.sep].concat(o)).slice(1),name:o[o.length-1],length:e.length,offset:n.slice(0,r).reduce(s,0)}}),t.length=n.reduce(s,0);const o=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(o.offset+o.length)%t.pieceLength||t.pieceLength,t.pieces=d(e.info.pieces),t}function i(e){return"undefined"!=typeof Blob&&e instanceof Blob}function s(e,t){return e+t.length}function d(e){const t=[];for(let n=0;n<e.length;n+=20)t.push(e.slice(n,n+20).toString("hex"));return t}function l(e,t){if(!e)throw new Error(`Torrent is missing required field: ${t}`)}const c=e("bencode"),u=e("blob-to-buffer"),p=e("fs"),f=e("simple-get"),h=e("magnet-uri"),m=e("path"),g=e("simple-sha1"),_=e("uniq");t.exports=o,t.exports.remote=function(e,t){function r(e){try{a=o(e)}catch(e){return t(e)}a&&a.infoHash?t(null,a):t(new Error("Invalid torrent identifier"))}let a;if("function"!=typeof t)throw new Error("second argument must be a Function");try{a=o(e)}catch(e){}a&&a.infoHash?n.nextTick(()=>{t(null,a)}):i(e)?u(e,(e,n)=>e?t(new Error(`Error converting Blob: ${e.message}`)):void r(n)):"function"==typeof f&&/^https?:/.test(e)?f.concat({url:e,timeout:30000,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},(e,n,o)=>e?t(new Error(`Error downloading torrent: ${e.message}`)):void r(o)):"function"==typeof p.readFile&&"string"==typeof e?p.readFile(e,(e,n)=>e?t(new Error("Invalid torrent identifier")):void r(n)):n.nextTick(()=>{t(new Error("Invalid torrent identifier"))})},t.exports.toMagnetURI=h.encode,t.exports.toTorrentFile=function(e){const t={info:e.info};return t["announce-list"]=(e.announce||[]).map(e=>(t.announce||(t.announce=e),e=r.from(e,"utf8"),[e])),t["url-list"]=e.urlList||[],void 0!==e.private&&(t["private"]=+e.private),e.created&&(t["creation date"]=0|e.created.getTime()/1e3),e.createdBy&&(t["created by"]=e.createdBy),e.comment&&(t.comment=e.comment),c.encode(t)};(()=>{r.alloc(0)})()}).call(this,e("_process"),e("buffer").Buffer)},{_process:92,bencode:11,"blob-to-buffer":20,buffer:39,fs:34,"magnet-uri":74,path:89,"simple-get":123,"simple-sha1":136,uniq:182}],89:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1,o;0<=r;r--)o=e[r],"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--);if(t)for(;n--;n)e.unshift("..");return e}function r(e){"string"!=typeof e&&(e+="");var t=0,n=-1,r=!0,o;for(o=e.length-1;0<=o;--o)if(!(47===e.charCodeAt(o)))-1===n&&(r=!1,n=o+1);else if(!r){t=o+1;break}return-1===n?"":e.slice(t,n)}function o(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}n.resolve=function(){for(var n="",r=!1,a=arguments.length-1,s;-1<=a&&!r;a--){if(s=0<=a?arguments[a]:e.cwd(),"string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");else if(!s)continue;n=s+"/"+n,r="/"===s.charAt(0)}return n=t(o(n.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+n||"."},n.normalize=function(e){var r=n.isAbsolute(e),i="/"===a(e,-1);return e=t(o(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(o(e,function(e){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;0<=n&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var o=r(e.split("/")),a=r(t.split("/")),s=d(o.length,a.length),l=s,c=0;c<s;c++)if(o[c]!==a[c]){l=c;break}for(var u=[],c=l;c<o.length;c++)u.push("..");return u=u.concat(a.slice(l)),u.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,r=-1,o=!0,a=e.length-1;1<=a;--a)if(t=e.charCodeAt(a),47!==t)o=!1;else if(!o){r=a;break}return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},n.basename=function(e,t){var n=r(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,o=!0,a=0,s=e.length-1,d;0<=s;--s){if(d=e.charCodeAt(s),47===d){if(!o){n=s+1;break}continue}-1===r&&(o=!1,r=s+1),46===d?-1===t?t=s:1!==a&&(a=1):-1!==t&&(a=-1)}return-1===t||-1===r||0===a||1===a&&t===r-1&&t===n+1?"":e.slice(t,r)};var a=function(e,t,n){return e.substr(t,n)}}).call(this,e("_process"))},{_process:92}],90:[function(e,t){for(var r=e("closest-to"),o=n(2,10),a=13,i=[];22>a++;)i.push(n(2,a));t.exports=function(e){return r(e/o,i)}},{"closest-to":42}],91:[function(e,t){(function(e){'use strict';t.exports="undefined"!=typeof e&&e.version&&0!==e.version.indexOf("v0.")&&(0!==e.version.indexOf("v1.")||0===e.version.indexOf("v1.8."))?e:{nextTick:function(t,n,r,o){if("function"!=typeof t)throw new TypeError("\"callback\" argument must be a function");var a=arguments.length,s,d;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,o)});default:for(s=Array(a-1),d=0;d<s.length;)s[d++]=arguments[d];return e.nextTick(function(){t.apply(null,s)});}}}}).call(this,e("_process"))},{_process:92}],92:[function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(t){if(u===setTimeout)return setTimeout(t,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(n){try{return u.call(null,t,0)}catch(n){return u.call(this,t,0)}}}function a(t){if(p===clearTimeout)return clearTimeout(t);if((p===r||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(n){try{return p.call(null,t)}catch(n){return p.call(this,t)}}}function i(){h&&g&&(h=!1,g.length?f=g.concat(f):m=-1,f.length&&s())}function s(){if(!h){var e=o(i);h=!0;for(var t=f.length;t;){for(g=f,f=[];++m<t;)g&&g[m].run();m=-1,t=f.length}g=null,h=!1,a(e)}}function d(e,t){this.fun=e,this.array=t}function l(){}var c=t.exports={},u,p;(function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(t){u=n}try{p="function"==typeof clearTimeout?clearTimeout:r}catch(t){p=r}})();var f=[],h=!1,m=-1,g;c.nextTick=function(e){var t=Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new d(e,t)),1!==f.length||h||o(s)},d.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=l,c.addListener=l,c.once=l,c.off=l,c.removeListener=l,c.removeAllListeners=l,c.emit=l,c.prependListener=l,c.prependOnceListener=l,c.listeners=function(){return[]},c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],93:[function(e,t){(function(n){var r=e("once"),o=e("end-of-stream"),a=e("fs"),i=function(){},s=/^v?\.0/.test(n.version),d=function(e){return"function"==typeof e},l=function(e){return!!s&&!!a&&(e instanceof(a.ReadStream||i)||e instanceof(a.WriteStream||i))&&d(e.close)},c=function(e){return e.setHeader&&d(e.abort)},u=function(e,t,n,a){a=r(a);var s=!1;e.on("close",function(){s=!0}),o(e,{readable:t,writable:n},function(e){return e?a(e):void(s=!0,a())});var u=!1;return function(t){if(!s)return u?void 0:(u=!0,l(e)?e.close(i):c(e)?e.abort():d(e.destroy)?e.destroy():void a(t||new Error("stream was destroyed")))}},p=function(e){e()},f=function(e,t){return e.pipe(t)};t.exports=function(){var e=Array.prototype.slice.call(arguments),t=d(e[e.length-1]||i)&&e.pop()||i;if(Array.isArray(e[0])&&(e=e[0]),2>e.length)throw new Error("pump requires two streams per minimum");var n=e.map(function(o,a){var i=a<e.length-1;return u(o,i,0<a,function(e){r||(r=e),e&&n.forEach(p),i||(n.forEach(p),t(r))})}),r;return e.reduce(f)}}).call(this,e("_process"))},{_process:92,"end-of-stream":48,fs:33,once:86}],94:[function(e,t,n){(function(e){/*! https://mths.be/punycode v1.4.1 by @mathias */(function(a){function s(e){throw new RangeError(E[e])}function d(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function c(e,t){var n=e.split("@"),r="";1<n.length&&(r=n[0]+"@",e=n[1]),e=e.replace(S,".");var o=e.split("."),a=d(o,t).join(".");return r+a}function u(e){for(var t=[],n=0,r=e.length,o,a;n<r;)o=e.charCodeAt(n++),55296<=o&&56319>=o&&n<r?(a=e.charCodeAt(n++),56320==(64512&a)?t.push(((1023&o)<<10)+(1023&a)+65536):(t.push(o),n--)):t.push(o);return t}function p(e){return d(e,function(e){var t="";return 65535<e&&(e-=65536,t+=v(55296|1023&e>>>10),e=56320|1023&e),t+=v(e),t}).join("")}function f(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:36}function h(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function m(e,t,n){var r=0;for(e=n?C(e/700):e>>1,e+=C(e/t);455<e;r+=36)e=C(e/35);return C(r+36*e/(e+38))}function g(e){var r=[],o=e.length,a=0,d=128,l=72,c,u,h,g,_,b,y,x,S,E;for(u=e.lastIndexOf("-"),0>u&&(u=0),h=0;h<u;++h)128<=e.charCodeAt(h)&&s("not-basic"),r.push(e.charCodeAt(h));for(g=0<u?u+1:0;g<o;){for(_=a,b=1,y=36;;y+=36){if(g>=o&&s("invalid-input"),x=f(e.charCodeAt(g++)),(36<=x||x>C((2147483647-a)/b))&&s("overflow"),a+=x*b,S=y<=l?1:y>=l+26?26:y-l,x<S)break;E=36-S,b>C(2147483647/E)&&s("overflow"),b*=E}c=r.length+1,l=m(a-_,c,0==_),C(a/c)>2147483647-d&&s("overflow"),d+=C(a/c),a%=c,r.splice(a++,0,d)}return p(r)}function _(e){var r=[],o,a,i,d,l,c,p,f,g,_,b,y,w,x,S;for(e=u(e),y=e.length,o=128,a=0,l=72,c=0;c<y;++c)b=e[c],128>b&&r.push(v(b));for(i=d=r.length,d&&r.push("-");i<y;){for(p=2147483647,c=0;c<y;++c)b=e[c],b>=o&&b<p&&(p=b);for(w=i+1,p-o>C((2147483647-a)/w)&&s("overflow"),a+=(p-o)*w,o=p,c=0;c<y;++c)if(b=e[c],b<o&&2147483647<++a&&s("overflow"),b==o){for(f=a,g=36;;g+=36){if(_=g<=l?1:g>=l+26?26:g-l,f<_)break;S=f-_,x=36-_,r.push(v(h(_+S%x,0))),f=C(S/x)}r.push(v(h(f,0))),l=m(a,w,i==d),a=0,++i}++a,++o}return r.join("")}var b="object"==typeof n&&n&&!n.nodeType&&n,y="object"==typeof t&&t&&!t.nodeType&&t,w="object"==typeof e&&e;(w.global===w||w.window===w||w.self===w)&&(a=w);var k=/^xn--/,x=/[^\x20-\x7E]/,S=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=r,v=o,L,I;if(L={version:"1.4.1",ucs2:{decode:u,encode:p},decode:g,encode:_,toASCII:function(e){return c(e,function(e){return x.test(e)?"xn--"+_(e):e})},toUnicode:function(e){return c(e,function(e){return k.test(e)?g(e.slice(4).toLowerCase()):e})}},"function"==typeof l&&"object"==typeof l.amd&&l.amd)l("punycode",function(){return L});else if(!(b&&y))a.punycode=L;else if(t.exports==b)y.exports=L;else for(I in L)L.hasOwnProperty(I)&&(b[I]=L[I])})(this)}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],95:[function(e,t){'use strict';function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,o,a){t=t||"&",o=o||"=";var s={};if("string"!=typeof e||0===e.length)return s;var d=/\+/g;e=e.split(t);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var c=e.length;0<l&&c>l&&(c=l);for(var u=0;u<c;++u){var p=e[u].replace(d,"%20"),f=p.indexOf(o),h,m,g,_;0<=f?(h=p.substr(0,f),m=p.substr(f+1)):(h=p,m=""),g=decodeURIComponent(h),_=decodeURIComponent(m),n(s,g)?r(s[g])?s[g].push(_):s[g]=[s[g],_]:s[g]=_}return s};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],96:[function(e,t){'use strict';function n(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return"";}};t.exports=function(e,t,i,s){return t=t||"&",i=i||"=",null===e&&(e=void 0),"object"==typeof e?n(a(e),function(a){var s=encodeURIComponent(r(a))+i;return o(e[a])?n(e[a],function(e){return s+encodeURIComponent(r(e))}).join(t):s+encodeURIComponent(r(e[a]))}).join(t):s?encodeURIComponent(r(s))+i+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},{}],97:[function(e,t,n){'use strict';n.decode=n.parse=e("./decode"),n.encode=n.stringify=e("./encode")},{"./decode":95,"./encode":96}],98:[function(e,t){t.exports=function(e){var t=0;return function(){if(t===e.length)return null;var n=e.length-t,r=0|Math.random()*n,o=e[t+r],a=e[t];return e[t]=o,e[t+r]=a,t++,o}}},{}],99:[function(e,t){(function(n,r){'use strict';var o=e("safe-buffer").Buffer,a=r.crypto||r.msCrypto;t.exports=a&&a.getRandomValues?function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=o.allocUnsafe(e);if(0<e)if(65536<e)for(var i=0;i<e;i+=65536)a.getRandomValues(r.slice(i,i+65536));else a.getRandomValues(r);return"function"==typeof t?n.nextTick(function(){t(null,r)}):r}:function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{_process:92,"safe-buffer":121}],100:[function(e,t){const{Writable:n,PassThrough:r}=e("readable-stream");t.exports=class extends n{constructor(e,t={}){super(t),this.destroyed=!1,this._queue=[],this._position=e||0,this._cb=null,this._buffer=null,this._out=null}_write(e,t,n){let r=!0;for(;;){if(this.destroyed)return;if(0===this._queue.length)return this._buffer=e,void(this._cb=n);this._buffer=null;var o=this._queue[0];const t=s(o.start-this._position,0),a=o.end-this._position;if(t>=e.length)return this._position+=e.length,n(null);let i;if(a>e.length){this._position+=e.length,i=0===t?e:e.slice(t),r=o.stream.write(i)&&r;break}this._position+=a,i=0===t&&a===e.length?e:e.slice(t,a),r=o.stream.write(i)&&r,o.last&&o.stream.end(),e=e.slice(a),this._queue.shift()}r?n(null):o.stream.once("drain",n.bind(null,null))}slice(e){if(this.destroyed)return null;Array.isArray(e)||(e=[e]);const t=new r;return e.forEach((n,r)=>{this._queue.push({start:n.start,end:n.end,stream:t,last:r===e.length-1})}),this._buffer&&this._write(this._buffer,null,this._cb),t}destroy(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e))}}},{"readable-stream":115}],101:[function(e,t){'use strict';function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function r(e,t,r){function o(e,n,r){return"string"==typeof t?t:t(e,n,r)}r||(r=Error);var a=function(e){function t(t,n,r){return e.call(this,o(t,n,r))||this}return n(t,e),t}(r);a.prototype.name=r.name,a.prototype.code=e,d[e]=a}function o(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return e+""}),2<n?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(e+"")}function a(e,t,n){return e.substr(!n||0>n?0:+n,t.length)===t}function i(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function s(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}var d={};r("ERR_INVALID_OPT_VALUE",function(e,t){return"The value \""+t+"\" is invalid for option \""+e+"\""},TypeError),r("ERR_INVALID_ARG_TYPE",function(e,t,n){var r;"string"==typeof t&&a(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be";var d;if(i(e," argument"))d="The ".concat(e," ").concat(r," ").concat(o(t,"type"));else{var l=s(e,".")?"property":"argument";d="The \"".concat(e,"\" ").concat(l," ").concat(r," ").concat(o(t,"type"))}return d+=". Received type ".concat(typeof n),d},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" 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(e){return"Unknown encoding: "+e},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=d},{}],102:[function(e,t){(function(e){'use strict';var n=new Set;t.exports.emitExperimentalWarning=e.emitWarning?function(t){if(!n.has(t)){n.add(t),e.emitWarning(t+" is an experimental feature. This feature could change at any time","ExperimentalWarning")}}:function(){}}).call(this,e("_process"))},{_process:92}],103:[function(e,t){(function(n){'use strict';function r(e){return this instanceof r?void(s.call(this,e),d.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",o)))):new r(e)}function o(){this._writableState.ended||n.nextTick(a,this)}function a(e){e.end()}var i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var s=e("./_stream_readable"),d=e("./_stream_writable");e("inherits")(r,s);for(var l=i(d.prototype),c=0,u;c<l.length;c++)u=l[c],r.prototype[u]||(r.prototype[u]=d.prototype[u]);Object.defineProperty(r.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(r.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(r.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(r.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0===this._readableState||void 0===this._writableState||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this,e("_process"))},{"./_stream_readable":105,"./_stream_writable":107,_process:92,inherits:67}],104:[function(e,t){'use strict';function n(e){return this instanceof n?void r.call(this,e):new n(e)}t.exports=n;var r=e("./_stream_transform");e("inherits")(n,r),n.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":106,inherits:67}],105:[function(e,t){(function(n,r){'use strict';function o(e){return U.from(e)}function a(e){return U.isBuffer(e)||e instanceof P}function i(e,t,n){return"function"==typeof e.prependListener?e.prependListener(t,n):void(e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n))}function s(t,n,r){T=T||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof T),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=q(this,t,"readableHighWaterMark",r),this.buffer=new j,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.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(!Y&&(Y=e("string_decoder/").StringDecoder),this.decoder=new Y(t.encoding),this.encoding=t.encoding)}function d(t){if(T=T||e("./_stream_duplex"),!(this instanceof d))return new d(t);var n=this instanceof T;this._readableState=new s(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),A.call(this)}function l(e,t,n,r,a){O("readableAddChunk",t);var i=e._readableState;if(null===t)i.reading=!1,h(e,i);else{var s;if(a||(s=u(i,t)),s)e.emit("error",s);else if(!(i.objectMode||t&&0<t.length))r||(i.reading=!1,_(e,i));else if("string"==typeof t||i.objectMode||Object.getPrototypeOf(t)===U.prototype||(t=o(t)),r)i.endEmitted?e.emit("error",new V):c(e,i,t,!0);else if(i.ended)e.emit("error",new W);else{if(i.destroyed)return!1;i.reading=!1,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||0!==t.length?c(e,i,t,!1):_(e,i)):c(e,i,t,!1)}}return!i.ended&&(i.length<i.highWaterMark||0===i.length)}function c(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&m(e)),_(e,t)}function u(e,t){var n;return a(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new D("chunk",["string","Buffer","Uint8Array"],t)),n}function p(e){return 8388608<=e?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=p(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function h(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?m(e):(t.needReadable=!1,!t.emittedReadable&&(t.emittedReadable=!0,g(e)))}}function m(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(O("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(g,e))}function g(e){var t=e._readableState;O("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,E(e)}function _(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(b,e,t))}function b(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(O("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function y(e){return function(){var t=e._readableState;O("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&R(e,"data")&&(t.flowing=!0,E(e))}}function w(e){var t=e._readableState;t.readableListening=0<e.listenerCount("readable"),t.resumeScheduled&&!t.paused?t.flowing=!0:0<e.listenerCount("data")&&e.resume()}function k(e){O("readable nexttick read 0"),e.read(0)}function x(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(S,e,t))}function S(e,t){O("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),E(e),t.flowing&&!t.reading&&e.read(0)}function E(e){var t=e._readableState;for(O("flow",t.flowing);t.flowing&&null!==e.read(););}function C(e,t){if(0===t.length)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function v(e){var t=e._readableState;O("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(L,t,e))}function L(e,t){O("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function I(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}t.exports=d;var T;d.ReadableState=s;var B=e("events").EventEmitter,R=function(e,t){return e.listeners(t).length},A=e("./internal/streams/stream"),U=e("buffer").Buffer,P=r.Uint8Array||function(){},M=e("util"),O;O=M&&M.debuglog?M.debuglog("stream"):function(){};var j=e("./internal/streams/buffer_list"),N=e("./internal/streams/destroy"),F=e("./internal/streams/state"),q=F.getHighWaterMark,H=e("../errors").codes,D=H.ERR_INVALID_ARG_TYPE,W=H.ERR_STREAM_PUSH_AFTER_EOF,z=H.ERR_METHOD_NOT_IMPLEMENTED,V=H.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,G=e("../experimentalWarning"),K=G.emitExperimentalWarning,Y,$;e("inherits")(d,A);var X=["error","close","destroy","pause","resume"];Object.defineProperty(d.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),d.prototype.destroy=N.destroy,d.prototype._undestroy=N.undestroy,d.prototype._destroy=function(e,t){t(e)},d.prototype.push=function(e,t){var n=this._readableState,r;return n.objectMode?r=!0:"string"==typeof e&&(t=t||n.defaultEncoding,t!==n.encoding&&(e=U.from(e,t),t=""),r=!0),l(this,e,t,!1,r)},d.prototype.unshift=function(e){return l(this,e,null,!0,!1)},d.prototype.isPaused=function(){return!1===this._readableState.flowing},d.prototype.setEncoding=function(t){return Y||(Y=e("string_decoder/").StringDecoder),this._readableState.decoder=new Y(t),this._readableState.encoding=this._readableState.decoder.encoding,this};d.prototype.read=function(e){O("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0===t.highWaterMark?0<t.length:t.length>=t.highWaterMark)||t.ended))return O("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?v(this):m(this),null;if(e=f(e,t),0===e&&t.ended)return 0===t.length&&v(this),null;var o=t.needReadable;O("need readable",o),(0===t.length||t.length-e<t.highWaterMark)&&(o=!0,O("length less than watermark",o)),t.ended||t.reading?(o=!1,O("reading or ended",o)):o&&(O("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,!t.reading&&(e=f(r,t)));var a;return a=0<e?C(e,t):null,null===a?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(!t.ended&&(t.needReadable=!0),r!==e&&t.ended&&v(this)),null!==a&&this.emit("data",a),a},d.prototype._read=function(){this.emit("error",new z("_read()"))},d.prototype.pipe=function(e,t){function r(e,t){O("onunpipe"),e===p&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,a())}function o(){O("onend"),e.end()}function a(){O("cleanup"),e.removeListener("close",l),e.removeListener("finish",c),e.removeListener("drain",g),e.removeListener("error",d),e.removeListener("unpipe",r),p.removeListener("end",o),p.removeListener("end",u),p.removeListener("data",s),_=!0,f.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&g()}function s(t){O("ondata");var n=e.write(t);O("dest.write",n),!1===n&&((1===f.pipesCount&&f.pipes===e||1<f.pipesCount&&-1!==I(f.pipes,e))&&!_&&(O("false write response, pause",f.awaitDrain),f.awaitDrain++),p.pause())}function d(t){O("onerror",t),u(),e.removeListener("error",d),0===R(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",c),u()}function c(){O("onfinish"),e.removeListener("close",l),u()}function u(){O("unpipe"),p.unpipe(e)}var p=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e);}f.pipesCount+=1,O("pipe count=%d opts=%j",f.pipesCount,t);var h=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,m=h?o:u;f.endEmitted?n.nextTick(m):p.once("end",m),e.on("unpipe",r);var g=y(p);e.on("drain",g);var _=!1;return p.on("data",s),i(e,"error",d),e.once("close",l),e.once("finish",c),e.emit("pipe",p),f.flowing||(O("pipe resume"),p.resume()),e},d.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<o;a++)r[a].emit("unpipe",this,{hasUnpiped:!1});return this}var s=I(t.pipes,e);return-1===s?this:(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)},d.prototype.on=function(e,t){var r=A.prototype.on.call(this,e,t),o=this._readableState;return"data"===e?(o.readableListening=0<this.listenerCount("readable"),!1!==o.flowing&&this.resume()):"readable"==e&&!o.endEmitted&&!o.readableListening&&(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,O("on readable",o.length,o.reading),o.length?m(this):!o.reading&&n.nextTick(k,this)),r},d.prototype.addListener=d.prototype.on,d.prototype.removeListener=function(e,t){var r=A.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(w,this),r},d.prototype.removeAllListeners=function(e){var t=A.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&n.nextTick(w,this),t},d.prototype.resume=function(){var e=this._readableState;return e.flowing||(O("resume"),e.flowing=!e.readableListening,x(this,e)),e.paused=!1,this},d.prototype.pause=function(){return O("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(O("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},d.prototype.wrap=function(e){var t=this,r=this._readableState,o=!1;for(var a in e.on("end",function(){if(O("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(n){if((O("wrapped data"),r.decoder&&(n=r.decoder.write(n)),!(r.objectMode&&(null===n||void 0===n)))&&(r.objectMode||n&&n.length)){var a=t.push(n);a||(o=!0,e.pause())}}),e)void 0===this[a]&&"function"==typeof e[a]&&(this[a]=function(t){return function(){return e[t].apply(e,arguments)}}(a));for(var i=0;i<X.length;i++)e.on(X[i],this.emit.bind(this,X[i]));return this._read=function(t){O("wrapped _read",t),o&&(o=!1,e.resume())},this},"function"==typeof Symbol&&(d.prototype[Symbol.asyncIterator]=function(){return K("Readable[Symbol.asyncIterator]"),void 0===$&&($=e("./internal/streams/async_iterator")),$(this)}),Object.defineProperty(d.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(d.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(d.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),d._fromList=C,Object.defineProperty(d.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}})}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"../errors":101,"../experimentalWarning":102,"./_stream_duplex":103,"./internal/streams/async_iterator":108,"./internal/streams/buffer_list":109,"./internal/streams/destroy":110,"./internal/streams/state":113,"./internal/streams/stream":114,_process:92,buffer:39,events:49,inherits:67,"string_decoder/":170,util:33}],106:[function(e,t){'use strict';function n(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new d);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function r(e){return this instanceof r?void(u.call(this,e),this._transformState={afterTransform:n.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",o)):new r(e)}function o(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?a(this,null,null):this._flush(function(t,n){a(e,t,n)})}function a(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new c;if(e._transformState.transforming)throw new l;return e.push(null)}t.exports=r;var i=e("../errors").codes,s=i.ERR_METHOD_NOT_IMPLEMENTED,d=i.ERR_MULTIPLE_CALLBACK,l=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=i.ERR_TRANSFORM_WITH_LENGTH_0,u=e("./_stream_duplex");e("inherits")(r,u),r.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},r.prototype._transform=function(e,t,n){n(new s("_transform()"))},r.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var o=this._readableState;(r.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},r.prototype._read=function(){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},r.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,function(e){t(e)})}},{"../errors":101,"./_stream_duplex":103,inherits:67}],107:[function(e,t){(function(n,r){'use strict';function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){v(t,e)}}function a(e){return B.from(e)}function i(e){return B.isBuffer(e)||e instanceof R}function s(){}function d(t,n,r){L=L||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof L),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=P(this,t,"writableHighWaterMark",r),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(e){_(n,e)},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.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function l(t){L=L||e("./_stream_duplex");var n=this instanceof L;return n||z.call(l,this)?void(this._writableState=new d(t,this,n),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)),T.call(this)):new l(t)}function c(e,t){var r=new D;e.emit("error",r),n.nextTick(t,r)}function u(e,t,r,o){var a;return null===r?a=new H:"string"!=typeof r&&!t.objectMode&&(a=new O("chunk",["string","Buffer"],r)),!a||(e.emit("error",a),n.nextTick(o,a),!1)}function p(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=B.from(t,n)),t}function f(e,t,n,r,o,a){if(!n){var i=p(t,r,o);r!==i&&(n=!0,o="buffer",r=i)}var s=t.objectMode?1:r.length;t.length+=s;var d=t.length<t.highWaterMark;if(d||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:o,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else h(e,t,!1,s,r,o,a);return d}function h(e,t,n,r,o,a,i){t.writelen=r,t.writecb=i,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new q("write")):n?e._writev(o,t.onwrite):e._write(o,a,t.onwrite),t.sync=!1}function m(e,t,r,o,a){--t.pendingcb,r?(n.nextTick(a,o),n.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",o)):(a(o),e._writableState.errorEmitted=!0,e.emit("error",o),E(e,t))}function g(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function _(e,t){var r=e._writableState,o=r.sync,a=r.writecb;if("function"!=typeof a)throw new N;if(g(r),t)m(e,r,o,t,a);else{var i=k(r)||e.destroyed;i||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),o?n.nextTick(b,e,r,i,a):b(e,r,i,a)}}function b(e,t,n,r){n||y(e,t),t.pendingcb--,r(),E(e,t)}function y(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function w(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,a=Array(r),i=t.corkedRequestsFree;i.entry=n;for(var s=0,d=!0;n;)a[s]=n,n.isBuf||(d=!1),n=n.next,s+=1;a.allBuffers=d,h(e,t,!0,t.length,a,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,u=n.callback,p=t.objectMode?1:l.length;if(h(e,t,!1,p,l,c,u),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function k(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function x(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),E(e,t)})}function S(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(x,e,t)))}function E(e,t){var n=k(t);return n&&(S(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}function C(e,t,r){t.ending=!0,E(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function v(e,t,n){var r=e.entry;for(e.entry=null;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree.next=e}t.exports=l;var L;l.WritableState=d;var I={deprecate:e("util-deprecate")},T=e("./internal/streams/stream"),B=e("buffer").Buffer,R=r.Uint8Array||function(){},A=e("./internal/streams/destroy"),U=e("./internal/streams/state"),P=U.getHighWaterMark,M=e("../errors").codes,O=M.ERR_INVALID_ARG_TYPE,j=M.ERR_METHOD_NOT_IMPLEMENTED,N=M.ERR_MULTIPLE_CALLBACK,F=M.ERR_STREAM_CANNOT_PIPE,q=M.ERR_STREAM_DESTROYED,H=M.ERR_STREAM_NULL_VALUES,D=M.ERR_STREAM_WRITE_AFTER_END,W=M.ERR_UNKNOWN_ENCODING;e("inherits")(l,T),d.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(d.prototype,"buffer",{get:I.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}();var z;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(z=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function(e){return!!z.call(this,e)||!(this!==l)&&e&&e._writableState instanceof d}})):z=function(e){return e instanceof this},l.prototype.pipe=function(){this.emit("error",new F)},l.prototype.write=function(e,t,n){var r=this._writableState,o=!1,d=!r.objectMode&&i(e);return d&&!B.isBuffer(e)&&(e=a(e)),"function"==typeof t&&(n=t,t=null),d?t="buffer":!t&&(t=r.defaultEncoding),"function"!=typeof n&&(n=s),r.ending?c(this,n):(d||u(this,r,e,n))&&(r.pendingcb++,o=f(this,r,d,e,t,n)),o},l.prototype.cork=function(){this._writableState.corked++},l.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&w(this,e))},l.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())))throw new W(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),l.prototype._write=function(e,t,n){n(new j("_write()"))},l.prototype._writev=null,l.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||C(this,r,n),this},Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),l.prototype.destroy=A.destroy,l.prototype._undestroy=A.undestroy,l.prototype._destroy=function(e,t){t(e)}}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"../errors":101,"./_stream_duplex":103,"./internal/streams/destroy":110,"./internal/streams/state":113,"./internal/streams/stream":114,_process:92,buffer:39,inherits:67,"util-deprecate":188}],108:[function(e,t){(function(n){'use strict';function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return{value:e,done:t}}function a(e){var t=e[l];if(null!==t){var n=e[m].read();null!==n&&(e[f]=null,e[l]=null,e[c]=null,t(o(n,!1)))}}function i(e){n.nextTick(a,e)}function s(e,t){return function(n,r){e.then(function(){return t[p]?void n(o(void 0,!0)):void t[h](n,r)},r)}}var d=e("./end-of-stream"),l=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),p=Symbol("ended"),f=Symbol("lastPromise"),h=Symbol("handlePromise"),m=Symbol("stream"),g=Object.getPrototypeOf(function(){}),_=Object.setPrototypeOf((b={get stream(){return this[m]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[p])return Promise.resolve(o(void 0,!0));if(this[m].destroyed)return new Promise(function(t,r){n.nextTick(function(){e[u]?r(e[u]):t(o(void 0,!0))})});var r=this[f],a;if(r)a=new Promise(s(r,this));else{var i=this[m].read();if(null!==i)return Promise.resolve(o(i,!1));a=new Promise(this[h])}return this[f]=a,a}},r(b,Symbol.asyncIterator,function(){return this}),r(b,"return",function(){var e=this;return new Promise(function(t,n){e[m].destroy(null,function(e){return e?void n(e):void t(o(void 0,!0))})})}),b),g),b;t.exports=function(e){var t=Object.create(_,(n={},r(n,m,{value:e,writable:!0}),r(n,l,{value:null,writable:!0}),r(n,c,{value:null,writable:!0}),r(n,u,{value:null,writable:!0}),r(n,p,{value:e._readableState.endEmitted,writable:!0}),r(n,h,{value:function(e,n){var r=t[m].read();r?(t[f]=null,t[l]=null,t[c]=null,e(o(r,!1))):(t[l]=e,t[c]=n)},writable:!0}),n)),n;return t[f]=null,d(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var n=t[c];return null!==n&&(t[f]=null,t[l]=null,t[c]=null,n(e)),void(t[u]=e)}var r=t[l];null!==r&&(t[f]=null,t[l]=null,t[c]=null,r(o(void 0,!0))),t[p]=!0}),e.on("readable",i.bind(null,t)),t}}).call(this,e("_process"))},{"./end-of-stream":111,_process:92}],109:[function(e,t){'use strict';function n(e){for(var t=1;t<arguments.length;t++){var n=null==arguments[t]?{}:arguments[t],o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){r(e,t,n[t])})}return e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t,n){s.prototype.copy.call(e,t,n)}var a=e("buffer"),s=a.Buffer,d=e("util"),l=d.inspect,c=l&&l.custom||"inspect";t.exports=function(){function e(){this.head=null,this.tail=null,this.length=0}var t=e.prototype;return t.push=function(e){var t={data:e,next:null};0<this.length?this.tail.next=t:this.head=t,this.tail=t,++this.length},t.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},t.shift=function(){if(0!==this.length){var e=this.head.data;return this.head=1===this.length?this.tail=null:this.head.next,--this.length,e}},t.clear=function(){this.head=this.tail=null,this.length=0},t.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},t.concat=function(e){if(0===this.length)return s.alloc(0);for(var t=s.allocUnsafe(e>>>0),n=this.head,r=0;n;)o(n.data,t,r),r+=n.data.length,n=n.next;return t},t.consume=function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):e===this.head.data.length?n=this.shift():n=t?this._getString(e):this._getBuffer(e),n},t.first=function(){return this.head.data},t._getString=function(e){var t=this.head,r=1,o=t.data;for(e-=o.length;t=t.next;){var a=t.data,i=e>a.length?a.length:e;if(o+=i===a.length?a:a.slice(0,e),e-=i,0===e){i===a.length?(++r,this.head=t.next?t.next:this.tail=null):(this.head=t,t.data=a.slice(i));break}++r}return this.length-=r,o},t._getBuffer=function(e){var t=s.allocUnsafe(e),r=this.head,o=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(t,t.length-e,0,i),e-=i,0===e){i===a.length?(++o,this.head=r.next?r.next:this.tail=null):(this.head=r,r.data=a.slice(i));break}++o}return this.length-=o,t},t[c]=function(e,t){return l(this,n({},t,{depth:0,customInspect:!1}))},e}()},{buffer:39,util:33}],110:[function(e,t){(function(e){'use strict';function n(e,t){o(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(e,t){e.emit("error",t)}t.exports={destroy:function(t,a){var i=this,s=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return s||d?(a?a(t):t&&(!this._writableState||!this._writableState.errorEmitted)&&e.nextTick(o,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!a&&t?(e.nextTick(n,i,t),i._writableState&&(i._writableState.errorEmitted=!0)):a?(e.nextTick(r,i),a(t)):e.nextTick(r,i)}),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)}}}).call(this,e("_process"))},{_process:92}],111:[function(e,t){'use strict';function n(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];e.apply(this,r)}}}function r(){}function o(e){return e.setHeader&&"function"==typeof e.abort}function a(e,t,s){if("function"==typeof t)return a(e,null,t);t||(t={}),s=n(s||r);var d=t.readable||!1!==t.readable&&e.readable,l=t.writable||!1!==t.writable&&e.writable,c=function(){e.writable||p()},u=e._writableState&&e._writableState.finished,p=function(){l=!1,u=!0,d||s.call(e)},f=e._readableState&&e._readableState.endEmitted,h=function(){d=!1,f=!0,l||s.call(e)},m=function(t){s.call(e,t)},g=function(){var t;return d&&!f?(e._readableState&&e._readableState.ended||(t=new i),s.call(e,t)):l&&!u?(e._writableState&&e._writableState.ended||(t=new i),s.call(e,t)):void 0},_=function(){e.req.on("finish",p)};return o(e)?(e.on("complete",p),e.on("abort",g),e.req?_():e.on("request",_)):l&&!e._writableState&&(e.on("end",c),e.on("close",c)),e.on("end",h),e.on("finish",p),!1!==t.error&&e.on("error",m),e.on("close",g),function(){e.removeListener("complete",p),e.removeListener("abort",g),e.removeListener("request",_),e.req&&e.req.removeListener("finish",p),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",p),e.removeListener("end",h),e.removeListener("error",m),e.removeListener("close",g)}}var i=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;t.exports=a},{"../../../errors":101}],112:[function(e,t){'use strict';function n(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}function r(e){if(e)throw e}function o(e){return e.setHeader&&"function"==typeof e.abort}function a(t,r,a,i){i=n(i);var s=!1;t.on("close",function(){s=!0}),p===void 0&&(p=e("./end-of-stream")),p(t,{readable:r,writable:a},function(e){return e?i(e):void(s=!0,i())});var d=!1;return function(e){if(!s)return d?void 0:(d=!0,o(t)?t.abort():"function"==typeof t.destroy?t.destroy():void i(e||new u("pipe")))}}function i(e){e()}function s(e,t){return e.pipe(t)}function d(e){return e.length?"function"==typeof e[e.length-1]?e.pop():r:r}var l=e("../../../errors").codes,c=l.ERR_MISSING_ARGS,u=l.ERR_STREAM_DESTROYED,p;t.exports=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=d(t);if(Array.isArray(t[0])&&(t=t[0]),2>t.length)throw new c("streams");var o=t.map(function(e,n){var s=n<t.length-1;return a(e,s,0<n,function(e){l||(l=e),e&&o.forEach(i),s||(o.forEach(i),r(l))})}),l;return t.reduce(s)}},{"../../../errors":101,"./end-of-stream":111}],113:[function(e,t){'use strict';function n(e,t,n){return null==e.highWaterMark?t?e[n]:null:e.highWaterMark}var o=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,a,i){var s=n(t,i,a);if(null!=s){if(!(isFinite(s)&&r(s)===s)||0>s){var d=i?a:"highWaterMark";throw new o(d,s)}return r(s)}return e.objectMode?16:16384}}},{"../../../errors":101}],114:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29,events:49}],115:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),n.Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js"),n.finished=e("./lib/internal/streams/end-of-stream.js"),n.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":103,"./lib/_stream_passthrough.js":104,"./lib/_stream_readable.js":105,"./lib/_stream_transform.js":106,"./lib/_stream_writable.js":107,"./lib/internal/streams/end-of-stream.js":111,"./lib/internal/streams/pipeline.js":112}],116:[function(e,t,n){function r(e,t,n,r){function a(){E.removeEventListener("loadstart",a),n.autoplay&&E.play()}function s(){E.removeEventListener("canplay",s),r(null,E)}function p(){o(e,function(e,n){return e?k(e):void(".pdf"===x?(E=t("object"),E.setAttribute("typemustmatch",!0),E.setAttribute("type","application/pdf"),E.setAttribute("data",n)):(E=t("iframe"),E.sandbox="allow-forms allow-scripts",E.src=n),r(null,E))})}function k(t){t.message="Error rendering file \""+e.name+"\": "+t.message,d(t.message),r(t)}var x=u.extname(e.name).toLowerCase(),S=0,E;0<=g.indexOf(x)?function(){function r(){d("Use `videostream` package for "+e.name),_(),E.addEventListener("error",p),E.addEventListener("loadstart",a),E.addEventListener("canplay",s),f(e,E)}function l(){d("Use MediaSource API for "+e.name),_(),E.addEventListener("error",g),E.addEventListener("loadstart",a),E.addEventListener("canplay",s);var t=new c(E),n=t.createWriteStream(i(e.name));e.createReadStream().pipe(n),S&&(E.currentTime=S)}function u(){d("Use Blob URL for "+e.name),_(),E.addEventListener("error",k),E.addEventListener("loadstart",a),E.addEventListener("canplay",s),o(e,function(e,t){return e?k(e):void(E.src=t,S&&(E.currentTime=S))})}function p(e){d("videostream error: fallback to MediaSource API: %o",e.message||e),E.removeEventListener("error",p),E.removeEventListener("canplay",s),l()}function g(t){return d("MediaSource API error: fallback to Blob URL: %o",t.message||t),"number"==typeof e.length&&e.length>n.maxBlobLength?(d("File length too large for Blob URL approach: %d (max: %d)",e.length,n.maxBlobLength),k(new Error("File length too large for Blob URL approach: "+e.length+" (max: "+n.maxBlobLength+")"))):void(E.removeEventListener("error",g),E.removeEventListener("canplay",s),u())}function _(){E||(E=t(b),E.addEventListener("progress",function(){S=E.currentTime}))}var b=0<=m.indexOf(x)?"video":"audio";w?0<=h.indexOf(x)?r():l():u()}():0<=_.indexOf(x)?function(){E=t("audio"),o(e,function(e,t){return e?k(e):void(E.addEventListener("error",k),E.addEventListener("loadstart",a),E.addEventListener("canplay",s),E.src=t)})}():0<=b.indexOf(x)?function(){E=t("img"),o(e,function(t,n){return t?k(t):void(E.src=n,E.alt=e.name,r(null,E))})}():0<=y.indexOf(x)?p():function(){function t(){l(n)?(d("File extension \"%s\" appears ascii, so will render.",x),p()):(d("File extension \"%s\" appears non-ascii, will not render.",x),r(new Error("Unsupported file type \""+x+"\": Cannot append to DOM")))}d("Unknown file extension \"%s\" - will attempt to render into iframe",x);var n="";e.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",function(e){n+=e}).on("end",t).on("error",r)}()}function o(e,t){var r=u.extname(e.name).toLowerCase();p(e.createReadStream(),n.mime[r],t)}function a(e){if(null==e)throw new Error("file cannot be null or undefined");if("string"!=typeof e.name)throw new Error("missing or invalid file.name property");if("function"!=typeof e.createReadStream)throw new Error("missing or invalid file.createReadStream property")}function i(e){var t=u.extname(e).toLowerCase();return{".m4a":"audio/mp4; codecs=\"mp4a.40.5\"",".m4v":"video/mp4; codecs=\"avc1.640029, mp4a.40.5\"",".mkv":"video/webm; codecs=\"avc1.640029, mp4a.40.5\"",".mp3":"audio/mpeg",".mp4":"video/mp4; codecs=\"avc1.640029, mp4a.40.5\"",".webm":"video/webm; codecs=\"vorbis, vp8\""}[t]}function s(e){null==e.autoplay&&(e.autoplay=!1),null==e.muted&&(e.muted=!1),null==e.controls&&(e.controls=!0),null==e.maxBlobLength&&(e.maxBlobLength=200000000)}n.render=function(e,t,n,o){"function"==typeof n&&(o=n,n={}),n||(n={}),o||(o=function(){}),a(e),s(n),"string"==typeof t&&(t=document.querySelector(t)),r(e,function(n){if(t.nodeName!==n.toUpperCase()){var r=u.extname(e.name).toLowerCase();throw new Error("Cannot render \""+r+"\" inside a \""+t.nodeName.toLowerCase()+"\" element, expected \""+n+"\"")}return t},n,o)},n.append=function(e,t,n,o){function i(e){var r=d(e);return n.autoplay&&(r.autoplay=!0),n.muted&&(r.muted=!0),n.controls&&(r.controls=!0),t.appendChild(r),r}function d(e){var n=document.createElement(e);return t.appendChild(n),n}function l(e,t){e&&t&&t.remove(),o(e,t)}if("function"==typeof n&&(o=n,n={}),n||(n={}),o||(o=function(){}),a(e),s(n),"string"==typeof t&&(t=document.querySelector(t)),t&&("VIDEO"===t.nodeName||"AUDIO"===t.nodeName))throw new Error("Invalid video/audio node argument. Argument must be root element that video/audio tag will be appended to.");r(e,function(e){return"video"===e||"audio"===e?i(e):d(e)},n,l)},n.mime=e("./lib/mime.json");var d=e("debug")("render-media"),l=e("is-ascii"),c=e("mediasource"),u=e("path"),p=e("stream-to-blob-url"),f=e("videostream"),h=[".m4a",".m4v",".mp4"],m=[".m4v",".mkv",".mp4",".webm"],g=[].concat(m,[".m4a",".mp3"]),_=[".aac",".oga",".ogg",".wav",".flac"],b=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],y=[".css",".html",".js",".md",".pdf",".txt"],w="undefined"!=typeof window&&window.MediaSource},{"./lib/mime.json":117,debug:45,"is-ascii":68,mediasource:75,path:89,"stream-to-blob-url":167,videostream:190}],117:[function(e,t){t.exports={".3gp":"video/3gpp",".aac":"audio/aac",".aif":"audio/x-aiff",".aiff":"audio/x-aiff",".atom":"application/atom+xml",".avi":"video/x-msvideo",".bmp":"image/bmp",".bz2":"application/x-bzip2",".conf":"text/plain",".css":"text/css",".csv":"text/plain",".diff":"text/x-diff",".doc":"application/msword",".flv":"video/x-flv",".gif":"image/gif",".gz":"application/x-gzip",".htm":"text/html",".html":"text/html",".ico":"image/vnd.microsoft.icon",".ics":"text/calendar",".iso":"application/octet-stream",".jar":"application/java-archive",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"application/javascript",".json":"application/json",".less":"text/css",".log":"text/plain",".m3u":"audio/x-mpegurl",".m4a":"audio/mp4",".m4v":"video/mp4",".manifest":"text/cache-manifest",".markdown":"text/x-markdown",".mathml":"application/mathml+xml",".md":"text/x-markdown",".mid":"audio/midi",".midi":"audio/midi",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".mp4v":"video/mp4",".mpeg":"video/mpeg",".mpg":"video/mpeg",".odp":"application/vnd.oasis.opendocument.presentation",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odt":"application/vnd.oasis.opendocument.text",".oga":"audio/ogg",".ogg":"application/ogg",".pdf":"application/pdf",".png":"image/png",".pps":"application/vnd.ms-powerpoint",".ppt":"application/vnd.ms-powerpoint",".ps":"application/postscript",".psd":"image/vnd.adobe.photoshop",".qt":"video/quicktime",".rar":"application/x-rar-compressed",".rdf":"application/rdf+xml",".rss":"application/rss+xml",".rtf":"application/rtf",".svg":"image/svg+xml",".svgz":"image/svg+xml",".swf":"application/x-shockwave-flash",".tar":"application/x-tar",".tbz":"application/x-bzip-compressed-tar",".text":"text/plain",".tif":"image/tiff",".tiff":"image/tiff",".torrent":"application/x-bittorrent",".ttf":"application/x-font-ttf",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".wma":"audio/x-ms-wma",".wmv":"video/x-ms-wmv",".xls":"application/vnd.ms-excel",".xml":"application/xml",".yaml":"text/yaml",".yml":"text/yaml",".zip":"application/zip"}},{}],118:[function(e,t){(function(e){t.exports=function(t,n,r){function o(t){function n(){r&&r(t,s),r=null}i?e.nextTick(n):n()}function a(e,n,r){if(s[e]=r,n&&(u=!0),0==--l||n)o(n);else if(!u&&p<d){var i;c?(i=c[p],p+=1,t[i](function(e,t){a(i,e,t)})):(i=p,p+=1,t[i](function(e,t){a(i,e,t)}))}}if("number"!=typeof n)throw new Error("second argument must be a Number");var i=!0,s,d,l,c,u;Array.isArray(t)?(s=[],l=d=t.length):(c=Object.keys(t),s={},l=d=c.length);var p=n;l?c?c.some(function(e,r){if(t[e](function(t,n){a(e,t,n)}),r===n-1)return!0}):t.some(function(e,t){if(e(function(e,n){a(t,e,n)}),t===n-1)return!0}):o(null),i=!1}}).call(this,e("_process"))},{_process:92}],119:[function(e,t){(function(e){t.exports=function(t,n){function r(t){function r(){n&&n(t,s),n=null}a?e.nextTick(r):r()}function o(e,t,n){s[e]=n,(0==--d||t)&&r(t)}var a=!0,s,d,l;Array.isArray(t)?(s=[],d=t.length):(l=Object.keys(t),s={},d=l.length),d?l?l.forEach(function(e){t[e](function(t,n){o(e,t,n)})}):t.forEach(function(e,t){e(function(e,n){o(t,e,n)})}):r(null),a=!1}}).call(this,e("_process"))},{_process:92}],120:[function(e,t,n){(function(e,r){"object"==typeof n&&"object"==typeof t?t.exports=r():"function"==typeof l&&l.amd?l([],r):"object"==typeof n?n.Rusha=r():e.Rusha=r()})("undefined"==typeof self?this:self,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(5),a=n(1),i=a.toHex,s=a.ceilHeapSize,l=n(6),c=function(e){for(e+=9;0<e%64;e+=1);return e},u=function(e,t){var n=new Uint8Array(e.buffer),r=t%4,o=t-r;switch(r){case 0:n[o+3]=0;case 1:n[o+2]=0;case 2:n[o+1]=0;case 3:n[o+0]=0;}for(var a=(t>>2)+1;a<e.length;a++)e[a]=0},p=function(e,t,n){e[t>>2]|=128<<24-(t%4<<3),e[(-16&(t>>2)+2)+14]=0|n/536870912,e[(-16&(t>>2)+2)+15]=n<<3},f=function(e,t){var n=new Int32Array(e,t+320,5),r=new Int32Array(5),o=new DataView(r.buffer);return o.setInt32(0,n[0],!1),o.setInt32(4,n[1],!1),o.setInt32(8,n[2],!1),o.setInt32(12,n[3],!1),o.setInt32(16,n[4],!1),r},h=function(){function e(t){if(r(this,e),t=t||65536,0<t%64)throw new Error("Chunk size must be a multiple of 128 bit");this._offset=0,this._maxChunkLen=t,this._padMaxChunkLen=c(t),this._heap=new ArrayBuffer(s(this._padMaxChunkLen+320+20)),this._h32=new Int32Array(this._heap),this._h8=new Int8Array(this._heap),this._core=new o({Int32Array:Int32Array},{},this._heap)}return e.prototype._initState=function(e,t){this._offset=0;var n=new Int32Array(e,t+320,5);n[0]=1732584193,n[1]=-271733879,n[2]=-1732584194,n[3]=271733878,n[4]=-1009589776},e.prototype._padChunk=function(e,t){var n=c(e),r=new Int32Array(this._heap,0,n>>2);return u(r,e),p(r,e,t),n},e.prototype._write=function(e,t,n,r){l(e,this._h8,this._h32,t,n,r||0)},e.prototype._coreCall=function(e,t,n,r,o){var a=n;this._write(e,t,n),o&&(a=this._padChunk(n,r)),this._core.hash(a,this._padMaxChunkLen)},e.prototype.rawDigest=function(e){var t=e.byteLength||e.length||e.size||0;this._initState(this._heap,this._padMaxChunkLen);var n=0,r=this._maxChunkLen;for(n=0;t>n+r;n+=r)this._coreCall(e,n,r,t,!1);return this._coreCall(e,n,t-n,t,!0),f(this._heap,this._padMaxChunkLen)},e.prototype.digest=function(e){return i(this.rawDigest(e).buffer)},e.prototype.digestFromString=function(e){return this.digest(e)},e.prototype.digestFromBuffer=function(e){return this.digest(e)},e.prototype.digestFromArrayBuffer=function(e){return this.digest(e)},e.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},e.prototype.append=function(e){var t=0,n=e.byteLength||e.length||e.size||0,r=this._offset%this._maxChunkLen,o=void 0;for(this._offset+=n;t<n;)o=d(n-t,this._maxChunkLen-r),this._write(e,t,o,r),r+=o,t+=o,r===this._maxChunkLen&&(this._core.hash(this._maxChunkLen,this._padMaxChunkLen),r=0);return this},e.prototype.getState=function(){var e=this._offset%this._maxChunkLen,t=void 0;if(!e){var n=new Int32Array(this._heap,this._padMaxChunkLen+320,5);t=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}else t=this._heap.slice(0);return{offset:this._offset,heap:t}},e.prototype.setState=function(e){if(this._offset=e.offset,20===e.heap.byteLength){var t=new Int32Array(this._heap,this._padMaxChunkLen+320,5);t.set(new Int32Array(e.heap))}else this._h32.set(new Int32Array(e.heap));return this},e.prototype.rawEnd=function(){var e=this._offset,t=e%this._maxChunkLen,n=this._padChunk(t,e);this._core.hash(n,this._padMaxChunkLen);var r=f(this._heap,this._padMaxChunkLen);return this._initState(this._heap,this._padMaxChunkLen),r},e.prototype.end=function(){return i(this.rawEnd().buffer)},e}();e.exports=h,e.exports._core=o},function(e){for(var t=Array(256),n=0;256>n;n++)t[n]=(16>n?"0":"")+n.toString(16);e.exports.toHex=function(e){for(var n=new Uint8Array(e),r=Array(e.byteLength),o=0;o<r.length;o++)r[o]=t[n[o]];return r.join("")},e.exports.ceilHeapSize=function(e){var t=0;if(65536>=e)return 65536;if(16777216>e)for(t=1;t<e;t<<=1);else for(t=16777216;t<e;t+=16777216);return t},e.exports.isDedicatedWorkerScope=function(e){var t="WorkerGlobalScope"in e&&e instanceof e.WorkerGlobalScope,n="SharedWorkerGlobalScope"in e&&e instanceof e.SharedWorkerGlobalScope,r="ServiceWorkerGlobalScope"in e&&e instanceof e.ServiceWorkerGlobalScope;return t&&!n&&!r}},function(e,t,n){e.exports=function(){var e=n(0),t=function(e,t,n){try{return n(null,e.digest(t))}catch(t){return n(t)}},r=function(e,t,n,o,a){var i=new self.FileReader;i.onloadend=function(){if(i.error)return a(i.error);var s=i.result;t+=i.result.byteLength;try{e.append(s)}catch(t){return void a(t)}t<o.size?r(e,t,n,o,a):a(null,e.end())},i.readAsArrayBuffer(o.slice(t,t+n))},o=!0;return self.onmessage=function(n){if(o){var a=n.data.data,i=n.data.file,s=n.data.id;if("undefined"!=typeof s&&(i||a)){var d=n.data.blockSize||4194304,l=new e(d);l.resetState();var c=function(e,t){e?self.postMessage({id:s,error:e.name}):self.postMessage({id:s,hash:t})};a&&t(l,a,c),i&&r(l,0,d,i,c)}}},function(){o=!1}}},function(e,t,n){var r=n(4),o=n(0),a=n(7),i=n(2),s=n(1),d=s.isDedicatedWorkerScope,l="undefined"!=typeof self&&d(self);o.disableWorkerBehaviour=l?i():function(){},o.createWorker=function(){var e=r(2),t=e.terminate;return e.terminate=function(){URL.revokeObjectURL(e.objectURL),t.call(e)},e},o.createHash=a,e.exports=o},function(e,t,n){function r(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t.oe=function(e){throw console.error(e),e};var r=t(t.s=ENTRY_MODULE);return r.default||r}function o(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,r){var a={};a[r]=[];var i=t.toString(),s=i.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return a;for(var d=s[1],l=new RegExp("(\\\\n|\\W)"+o(d)+"\\((/\\*.*?\\*/)?s?.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g"),c;c=l.exec(i);)"dll-reference"!==c[3]&&a[r].push(c[3]);for(l=new RegExp("\\("+o(d)+"\\(\"(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))\"\\)\\)\\((/\\*.*?\\*/)?s?.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");c=l.exec(i);)e[c[2]]||(a[r].push(c[1]),e[c[2]]=n(c[1]).m),a[c[2]]=a[c[2]]||[],a[c[2]].push(c[4]);return a}function s(e){var t=Object.keys(e);return t.reduce(function(t,n){return t||0<e[n].length},!1)}function d(e,t){for(var n={main:[t]},r={main:[]},o={main:{}};s(n);)for(var d=Object.keys(n),l=0;l<d.length;l++){var c=d[l],u=n[c],p=u.pop();if(o[c]=o[c]||{},!o[c][p]&&e[c][p]){o[c][p]=!0,r[c]=r[c]||[],r[c].push(p);for(var f=a(e,e[c][p],c),h=Object.keys(f),m=0;m<h.length;m++)n[h[m]]=n[h[m]]||[],n[h[m]]=n[h[m]].concat(f[h[m]])}}return r}e.exports=function(e,t){t=t||{};var o={main:n.m},a=t.all?{main:Object.keys(o)}:d(o,e),i="";Object.keys(a).filter(function(e){return"main"!==e}).forEach(function(e){for(var t=0;a[e][t];)t++;a[e].push(t),o[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",i=i+"var "+e+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+a[e].map(function(t){return""+JSON.stringify(t)+": "+o[e][t].toString()}).join(",")+"});\n"}),i=i+"("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+a.main.map(function(e){return""+JSON.stringify(e)+": "+o.main[e].toString()}).join(",")+"})(self);";var s=new window.Blob([i],{type:"text/javascript"});if(t.bare)return s;var l=window.URL||window.webkitURL||window.mozURL||window.msURL,c=l.createObjectURL(s),u=new window.Worker(c);return u.objectURL=c,u}},function(e){e.exports=function(e,t,n){'use asm';var r=new e.Int32Array(n);return{hash:function(e,t){e|=0,t|=0;var n=0,o=0,a=0,i=0,s=0,d=0,l=0,c=0,u=0,p=0,f=0,h=0,m=0,g=0;for(a=0|r[t+320>>2],s=0|r[t+324>>2],l=0|r[t+328>>2],u=0|r[t+332>>2],f=0|r[t+336>>2],n=0;(0|n)<(0|e);n=0|n+64){for(i=a,d=s,c=l,p=u,h=f,o=0;64>(0|o);o=0|o+4)g=0|r[n+o>>2],m=0|(0|(a<<5|a>>>27)+(s&l|~s&u))+(0|(0|g+f)+1518500249),f=u,u=l,l=s<<30|s>>>2,s=a,a=m,r[e+o>>2]=g;for(o=0|e+64;(0|o)<(0|e+80);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(a<<5|a>>>27)+(s&l|~s&u))+(0|(0|g+f)+1518500249),f=u,u=l,l=s<<30|s>>>2,s=a,a=m,r[o>>2]=g;for(o=0|e+80;(0|o)<(0|e+160);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(a<<5|a>>>27)+(s^l^u))+(0|(0|g+f)+1859775393),f=u,u=l,l=s<<30|s>>>2,s=a,a=m,r[o>>2]=g;for(o=0|e+160;(0|o)<(0|e+240);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(a<<5|a>>>27)+(s&l|s&u|l&u))+(0|(0|g+f)-1894007588),f=u,u=l,l=s<<30|s>>>2,s=a,a=m,r[o>>2]=g;for(o=0|e+240;(0|o)<(0|e+320);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(a<<5|a>>>27)+(s^l^u))+(0|(0|g+f)-899497514),f=u,u=l,l=s<<30|s>>>2,s=a,a=m,r[o>>2]=g;a=0|a+i,s=0|s+d,l=0|l+c,u=0|u+p,f=0|f+h}r[t+320>>2]=a,r[t+324>>2]=s,r[t+328>>2]=l,r[t+332>>2]=u,r[t+336>>2]=f}}}},function(e){var t=this,n=void 0;"undefined"!=typeof self&&"undefined"!=typeof self.FileReaderSync&&(n=new self.FileReaderSync);var r=function(e,t,n,r,o,a){var s=a%4,d=(o+s)%4,l=o-d,c;switch(s){case 0:t[a]=e.charCodeAt(r+3);case 1:t[0|a+1-(s<<1)]=e.charCodeAt(r+2);case 2:t[0|a+2-(s<<1)]=e.charCodeAt(r+1);case 3:t[0|a+3-(s<<1)]=e.charCodeAt(r);}if(!(o<d+(4-s))){for(c=4-s;c<l;c=0|c+4)n[a+c>>2]=e.charCodeAt(r+c)<<24|e.charCodeAt(r+c+1)<<16|e.charCodeAt(r+c+2)<<8|e.charCodeAt(r+c+3);switch(d){case 3:t[0|a+l+1]=e.charCodeAt(r+l+2);case 2:t[0|a+l+2]=e.charCodeAt(r+l+1);case 1:t[0|a+l+3]=e.charCodeAt(r+l);}}},o=function(e,t,n,r,o,a){var s=a%4,d=(o+s)%4,l=o-d,c;switch(s){case 0:t[a]=e[r+3];case 1:t[0|a+1-(s<<1)]=e[r+2];case 2:t[0|a+2-(s<<1)]=e[r+1];case 3:t[0|a+3-(s<<1)]=e[r];}if(!(o<d+(4-s))){for(c=4-s;c<l;c=0|c+4)n[0|a+c>>2]=e[r+c]<<24|e[r+c+1]<<16|e[r+c+2]<<8|e[r+c+3];switch(d){case 3:t[0|a+l+1]=e[r+l+2];case 2:t[0|a+l+2]=e[r+l+1];case 1:t[0|a+l+3]=e[r+l];}}},a=function(e,t,r,o,a,s){var d=void 0,l=s%4,c=(a+l)%4,u=a-c,p=new Uint8Array(n.readAsArrayBuffer(e.slice(o,o+a)));switch(l){case 0:t[s]=p[3];case 1:t[0|s+1-(l<<1)]=p[2];case 2:t[0|s+2-(l<<1)]=p[1];case 3:t[0|s+3-(l<<1)]=p[0];}if(!(a<c+(4-l))){for(d=4-l;d<u;d=0|d+4)r[0|s+d>>2]=p[d]<<24|p[d+1]<<16|p[d+2]<<8|p[d+3];switch(c){case 3:t[0|s+u+1]=p[u+2];case 2:t[0|s+u+2]=p[u+1];case 1:t[0|s+u+3]=p[u];}}};e.exports=function(e,n,i,s,d,l){if("string"==typeof e)return r(e,n,i,s,d,l);if(e instanceof Array)return o(e,n,i,s,d,l);if(t&&t.Buffer&&t.Buffer.isBuffer(e))return o(e,n,i,s,d,l);if(e instanceof ArrayBuffer)return o(new Uint8Array(e),n,i,s,d,l);if(e.buffer instanceof ArrayBuffer)return o(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n,i,s,d,l);if(e instanceof Blob)return a(e,n,i,s,d,l);throw new Error("Unsupported data type.")}},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(0),a=n(1),i=a.toHex,s=function(){function e(){r(this,e),this._rusha=new o,this._rusha.resetState()}return e.prototype.update=function(e){return this._rusha.append(e),this},e.prototype.digest=function e(t){var e=this._rusha.rawEnd().buffer;if(!t)return e;if("hex"===t)return i(e);throw new Error("unsupported digest encoding")},e}();e.exports=function(){return new s}}])})},{}],121:[function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}var a=e("buffer"),i=a.Buffer;i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=a:(r(a,n),n.Buffer=o),o.prototype=Object.create(i.prototype),r(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0===t?r.fill(0):"string"==typeof n?r.fill(t,n):r.fill(t),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},{buffer:39}],122:[function(e,t){(function(e){t.exports=function(t,n){var r=[];t.on("data",function(e){r.push(e)}),t.once("end",function(){n&&n(null,e.concat(r)),n=null}),t.once("error",function(e){n&&n(e),n=null})}}).call(this,e("buffer").Buffer)},{buffer:39}],123:[function(e,t){(function(n){function r(e,t){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),t=d(t),e.url){const{hostname:t,port:n,protocol:r,auth:o,path:a}=c.parse(e.url);delete e.url,t||n||r||o?Object.assign(e,{hostname:t,port:n,protocol:r,auth:o,path:a}):e.path=a}const o={"accept-encoding":"gzip, deflate"};e.headers&&Object.keys(e.headers).forEach(t=>o[t.toLowerCase()]=e.headers[t]),e.headers=o;let p;e.body?p=e.json&&!u(e.body)?JSON.stringify(e.body):e.body:e.form&&(p="string"==typeof e.form?e.form:l.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),p&&(!e.method&&(e.method="POST"),!u(p)&&(e.headers["content-length"]=n.byteLength(p)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const f="https:"===e.protocol?s:i,h=f.request(e,n=>{if(300<=n.statusCode&&400>n.statusCode&&n.headers.location)return e.url=n.headers.location,delete e.headers.host,n.resume(),"POST"===e.method&&[301,302].includes(n.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?t(new Error("too many redirects")):r(e,t);const o="function"==typeof a&&"HEAD"!==e.method;t(null,o?a(n):n)});return h.on("timeout",()=>{h.abort(),t(new Error("Request timed out"))}),h.on("error",t),u(p)?p.on("error",t).pipe(h):h.end(p),h}t.exports=r;const o=e("simple-concat"),a=e("decompress-response"),i=e("http"),s=e("https"),d=e("once"),l=e("querystring"),c=e("url"),u=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;r.concat=(e,t)=>r(e,(n,r)=>n?t(n):void o(r,(n,o)=>{if(n)return t(n);if(e.json)try{o=JSON.parse(o.toString())}catch(e){return t(e,r,o)}t(null,r,o)})),["get","post","put","patch","head","delete"].forEach(e=>{r[e]=(t,n)=>("string"==typeof t&&(t={url:t}),r(Object.assign({method:e.toUpperCase()},t),n))})}).call(this,e("buffer").Buffer)},{buffer:39,"decompress-response":33,http:152,https:64,once:86,querystring:97,"simple-concat":122,url:184}],124:[function(e,t){(function(n){function r(e){var t=this;if(!(t instanceof r))return new r(e);if(t._id=l(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),c.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||l(20).toString("hex"):null,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||r.channelConfig,t.config=Object.assign({},r.config,e.config),t.offerOptions=e.offerOptions||{},t.answerOptions=e.answerOptions||{},t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,t.iceCompleteTimeout=e.iceCompleteTimeout||5000,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localFamily=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:s(),!t._wrtc)if("undefined"==typeof window)throw a("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT");else throw a("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._iceCompleteTimer=null,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!t.initiator,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new Map,t._firstStable=!0,t._closingInterval=null,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null;try{t._pc=new t._wrtc.RTCPeerConnection(t.config)}catch(e){t.destroy(e)}t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)},t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function o(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function a(e,t){var n=new Error(e);return n.code=t,n}t.exports=r;var i=e("debug")("simple-peer"),s=e("get-browser-rtc"),d=e("inherits"),l=e("randombytes"),c=e("readable-stream"),u=65536;d(r,c.Duplex),r.WEBRTC_SUPPORT=!!s(),r.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}],sdpSemantics:"unified-plan"},r.channelConfig={},Object.defineProperty(r.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}}),r.prototype.address=function(){var e=this;return{port:e.localPort,family:e.localFamily,address:e.localAddress}},r.prototype.signal=function(e){var t=this;if(t.destroyed)throw a("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&t.initiator&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.transceiverRequest&&t.initiator&&(t._debug("got request for transceiver"),t.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(t._pc.localDescription&&t._pc.localDescription.type&&t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e)).then(function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())}).catch(function(e){t.destroy(a(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||t.destroy(a("signal() called with invalid signal data","ERR_SIGNALING"))},r.prototype._addIceCandidate=function(e){var t=this;t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e)).catch(function(e){t.destroy(a(e,"ERR_ADD_ICE_CANDIDATE"))})},r.prototype.send=function(e){var t=this;t._channel.send(e)},r.prototype.addTransceiver=function(e,t){var n=this;if(n._debug("addTransceiver()"),n.initiator)try{n._pc.addTransceiver(e,t),n._needsNegotiation()}catch(e){n.destroy(e)}else n.emit("signal",{transceiverRequest:{kind:e,init:t}})},r.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(n){t.addTrack(n,e)})},r.prototype.addTrack=function(e,t){var n=this;n._debug("addTrack()");var r=n._senderMap.get(e)||new Map,o=r.get(t);o?o.removed?n.destroy(a("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):n.destroy(a("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED"):(o=n._pc.addTrack(e,t),r.set(t,o),n._senderMap.set(e,r),n._needsNegotiation())},r.prototype.replaceTrack=function(e,t,n){var r=this;r._debug("replaceTrack()");var o=r._senderMap.get(e),i=o?o.get(n):null;i||r.destroy(a("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED"),t&&r._senderMap.set(t,o),null==i.replaceTrack?r.destroy(a("replaceTrack is not supported in this browser","ERR_UNSUPPORTED_REPLACETRACK")):i.replaceTrack(t)},r.prototype.removeTrack=function(e,t){var n=this;n._debug("removeSender()");var r=n._senderMap.get(e),o=r?r.get(t):null;o||n.destroy(a("Cannot remove track that was never added.","ERR_TRACK_NOT_ADDED"));try{o.removed=!0,n._pc.removeTrack(o)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?n._sendersAwaitingStable.push(o):n.destroy(e)}n._needsNegotiation()},r.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(n){t.removeTrack(n,e)})},r.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation");e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},r.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?(e._queuedNegotiation=!0,e._debug("already negotiating, queueing")):(e._debug("start negotiation"),setTimeout(()=>{e._createOffer()},0)):!e._isNegotiating&&(e._debug("requesting negotiation from initiator"),e.emit("signal",{renegotiate:!0})),e._isNegotiating=!0},r.prototype.destroy=function(e){var t=this;t._destroy(e,function(){})},r.prototype._destroy=function(e,t){var n=this;if(!n.destroyed){if(n._debug("destroy (error: %s)",e&&(e.message||e)),n.readable=n.writable=!1,n._readableState.ended||n.push(null),n._writableState.finished||n.end(),n.destroyed=!0,n.connected=!1,n._pcReady=!1,n._channelReady=!1,n._remoteTracks=null,n._remoteStreams=null,n._senderMap=null,clearInterval(n._closingInterval),n._closingInterval=null,clearInterval(n._interval),n._interval=null,n._chunk=null,n._cb=null,n._onFinishBound&&n.removeListener("finish",n._onFinishBound),n._onFinishBound=null,n._channel){try{n._channel.close()}catch(e){}n._channel.onmessage=null,n._channel.onopen=null,n._channel.onclose=null,n._channel.onerror=null}if(n._pc){try{n._pc.close()}catch(e){}n._pc.oniceconnectionstatechange=null,n._pc.onicegatheringstatechange=null,n._pc.onsignalingstatechange=null,n._pc.onicecandidate=null,n._pc.ontrack=null,n._pc.ondatachannel=null}n._pc=null,n._channel=null,e&&n.emit("error",e),n.emit("close"),t()}},r.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(a("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=u),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(a(e,"ERR_DATA_CHANNEL"))};var n=!1;t._closingInterval=setInterval(function(){t._channel&&"closing"===t._channel.readyState?(n&&t._onChannelClose(),n=!0):n=!1},5000)},r.prototype._read=function(){},r.prototype._write=function(e,t,n){var r=this;if(r.destroyed)return n(a("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(r.connected){try{r.send(e)}catch(e){return r.destroy(a(e,"ERR_DATA_CHANNEL"))}r._channel.bufferedAmount>u?(r._debug("start backpressure: bufferedAmount %d",r._channel.bufferedAmount),r._cb=n):n(null)}else r._debug("write before connect"),r._chunk=e,r._cb=n},r.prototype._onFinish=function(){function e(){setTimeout(function(){t.destroy()},1e3)}var t=this;t.destroyed||(t.connected?e():t.once("connect",e))},r.prototype._startIceCompleteTimeout=function(){var e=this;e.destroyed||e._iceCompleteTimer||(e._debug("started iceComplete timeout"),e._iceCompleteTimer=setTimeout(function(){e._iceComplete||(e._iceComplete=!0,e._debug("iceComplete timeout completed"),e.emit("iceTimeout"),e.emit("_iceComplete"))},e.iceCompleteTimeout))},r.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(e.offerOptions).then(function(t){function n(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}}e.destroyed||(!e.trickle&&!e.allowHalfTrickle&&(t.sdp=o(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(function(){e._debug("createOffer success");e.destroyed||(e.trickle||e._iceComplete?n():e.once("_iceComplete",n))}).catch(function(t){e.destroy(a(t,"ERR_SET_LOCAL_DESCRIPTION"))}))}).catch(function(t){e.destroy(a(t,"ERR_CREATE_OFFER"))})},r.prototype._requestMissingTransceivers=function(){var e=this;e._pc.getTransceivers&&e._pc.getTransceivers().forEach(t=>{t.mid||!t.sender.track||t.requested||(t.requested=!0,e.addTransceiver(t.sender.track.kind))})},r.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(e.answerOptions).then(function(t){function n(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp}),e.initiator||e._requestMissingTransceivers()}}e.destroyed||(!e.trickle&&!e.allowHalfTrickle&&(t.sdp=o(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(function(){e.destroyed||(e.trickle||e._iceComplete?n():e.once("_iceComplete",n))}).catch(function(t){e.destroy(a(t,"ERR_SET_LOCAL_DESCRIPTION"))}))}).catch(function(t){e.destroy(a(t,"ERR_CREATE_ANSWER"))})},r.prototype._onIceStateChange=function(){var e=this;if(!e.destroyed){var t=e._pc.iceConnectionState,n=e._pc.iceGatheringState;e._debug("iceStateChange (connection: %s) (gathering: %s)",t,n),e.emit("iceStateChange",t,n),("connected"===t||"completed"===t)&&(e._pcReady=!0,e._maybeReady()),"failed"===t&&e.destroy(a("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&e.destroy(a("Ice connection closed.","ERR_ICE_CONNECTION_CLOSED"))}},r.prototype.getStats=function(e){function t(e){return"[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(function(t){Object.assign(e,t)}),e}var n=this;0===n._pc.getStats.length?n._pc.getStats().then(function(n){var r=[];n.forEach(function(e){r.push(t(e))}),e(null,r)},function(t){e(t)}):n._isReactNativeWebrtc?n._pc.getStats(null,function(n){var r=[];n.forEach(function(e){r.push(t(e))}),e(null,r)},function(t){e(t)}):0<n._pc.getStats.length?n._pc.getStats(function(r){if(!n.destroyed){var o=[];r.result().forEach(function(e){var n={};e.names().forEach(function(t){n[t]=e.stat(t)}),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,o.push(t(n))}),e(null,o)}},function(t){e(t)}):e(null,[])},r.prototype._maybeReady=function(){function e(){t.destroyed||t.getStats(function(n,r){function o(e){l=!0;var n=s[e.localCandidateId];n&&(n.ip||n.address)?(t.localAddress=n.ip||n.address,t.localPort=+n.port):n&&n.ipAddress?(t.localAddress=n.ipAddress,t.localPort=+n.portNumber):"string"==typeof e.googLocalAddress&&(n=e.googLocalAddress.split(":"),t.localAddress=n[0],t.localPort=+n[1]),t.localAddress&&(t.localFamily=t.localAddress.includes(":")?"IPv6":"IPv4");var r=i[e.remoteCandidateId];r&&(r.ip||r.address)?(t.remoteAddress=r.ip||r.address,t.remotePort=+r.port):r&&r.ipAddress?(t.remoteAddress=r.ipAddress,t.remotePort=+r.portNumber):"string"==typeof e.googRemoteAddress&&(r=e.googRemoteAddress.split(":"),t.remoteAddress=r[0],t.remotePort=+r[1]),t.remoteAddress&&(t.remoteFamily=t.remoteAddress.includes(":")?"IPv6":"IPv4"),t._debug("connect local: %s:%s remote: %s:%s",t.localAddress,t.localPort,t.remoteAddress,t.remotePort)}if(!t.destroyed){n&&(r=[]);var i={},s={},d={},l=!1;if(r.forEach(function(e){("remotecandidate"===e.type||"remote-candidate"===e.type)&&(i[e.id]=e),("localcandidate"===e.type||"local-candidate"===e.type)&&(s[e.id]=e),("candidatepair"===e.type||"candidate-pair"===e.type)&&(d[e.id]=e)}),r.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&o(d[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&o(e)}),!l&&(!Object.keys(d).length||Object.keys(s).length))return void setTimeout(e,100);if(t._connecting=!1,t.connected=!0,t._chunk){try{t.send(t._chunk)}catch(e){return t.destroy(a(e,"ERR_DATA_CHANNEL"))}t._chunk=null,t._debug("sent chunk from \"write before connect\"");var c=t._cb;t._cb=null,c(null)}"number"!=typeof t._channel.bufferedAmountLowThreshold&&(t._interval=setInterval(function(){t._onInterval()},150),t._interval.unref&&t._interval.unref()),t._debug("connect"),t.emit("connect")}})}var t=this;t._debug("maybeReady pc %s channel %s",t._pcReady,t._channelReady);t.connected||t._connecting||!t._pcReady||!t._channelReady||(t._connecting=!0,e())},r.prototype._onInterval=function(){var e=this;e._cb&&e._channel&&!(e._channel.bufferedAmount>u)&&e._onChannelBufferedAmountLow()},r.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"===e._pc.signalingState&&!e._firstStable&&(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._firstStable=!1,e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},r.prototype._onIceCandidate=function(e){var t=this;t.destroyed||(e.candidate&&t.trickle?t.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):!e.candidate&&!t._iceComplete&&(t._iceComplete=!0,t.emit("_iceComplete")),e.candidate&&t._startIceCompleteTimeout())},r.prototype._onChannelMessage=function(e){var t=this;if(!t.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=n.from(r)),t.push(r)}},r.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!e.destroyed&&e._cb){e._debug("ending backpressure: bufferedAmount %d",e._channel.bufferedAmount);var t=e._cb;e._cb=null,t(null)}},r.prototype._onChannelOpen=function(){var e=this;e.connected||e.destroyed||(e._debug("on channel open"),e._channelReady=!0,e._maybeReady())},r.prototype._onChannelClose=function(){var e=this;e.destroyed||(e._debug("on channel close"),e.destroy())},r.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n});t._remoteStreams.some(function(e){return e.id===n.id})||(t._remoteStreams.push(n),setTimeout(function(){t.emit("stream",n)},0))})},r.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+e._id+"] "+t[0],i.apply(null,t)}}).call(this,e("buffer").Buffer)},{buffer:39,debug:45,"get-browser-rtc":63,inherits:67,randombytes:99,"readable-stream":133}],125:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{"./_stream_readable":127,"./_stream_writable":129,"core-util-is":43,dup:22,inherits:67,"process-nextick-args":91}],126:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./_stream_transform":128,"core-util-is":43,dup:23,inherits:67}],127:[function(e,t,n){arguments[4][24][0].apply(n,arguments)},{"./_stream_duplex":125,"./internal/streams/BufferList":130,"./internal/streams/destroy":131,"./internal/streams/stream":132,_process:92,"core-util-is":43,dup:24,events:49,inherits:67,isarray:72,"process-nextick-args":91,"safe-buffer":134,"string_decoder/":135,util:33}],128:[function(e,t,n){arguments[4][25][0].apply(n,arguments)},{"./_stream_duplex":125,"core-util-is":43,dup:25,inherits:67}],129:[function(e,t,n){arguments[4][26][0].apply(n,arguments)},{"./_stream_duplex":125,"./internal/streams/destroy":131,"./internal/streams/stream":132,_process:92,"core-util-is":43,dup:26,inherits:67,"process-nextick-args":91,"safe-buffer":134,timers:174,"util-deprecate":188}],130:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{dup:27,"safe-buffer":134,util:33}],131:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28,"process-nextick-args":91}],132:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29,events:49}],133:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./lib/_stream_duplex.js":125,"./lib/_stream_passthrough.js":126,"./lib/_stream_readable.js":127,"./lib/_stream_transform.js":128,"./lib/_stream_writable.js":129,dup:30}],134:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{buffer:39,dup:31}],135:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32,"safe-buffer":134}],136:[function(e,t){function n(e){return s.digest(e)}function r(e,t){return c?void("string"==typeof e&&(e=o(e)),c.digest({name:"sha-1"},e).then(function(e){t(a(new Uint8Array(e)))},function(){t(n(e))})):void setTimeout(t,0,n(e))}function o(e){for(var t=e.length,n=new Uint8Array(t),r=0;r<t;r++)n[r]=e.charCodeAt(r);return n}function a(e){for(var t=e.length,n=[],r=0,o;r<t;r++)o=e[r],n.push((o>>>4).toString(16)),n.push((15&o).toString(16));return n.join("")}var i=e("rusha"),s=new i,d="undefined"==typeof window?self:window,l=d.crypto||d.msCrypto||{},c=l.subtle||l.webkitSubtle;try{c.digest({name:"sha-1"},new Uint8Array).catch(function(){c=!1})}catch(e){c=!1}t.exports=r,t.exports.sync=n},{rusha:120}],137:[function(e,t){(function(n,r){function o(e){var t=this;if(!(t instanceof o))return new o(e);if(e||(e={}),"string"==typeof e&&(e={url:e}),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(t._id=s(4).toString("hex").slice(0,7),t._debug("new websocket: %o",e),e=Object.assign({allowHalfOpen:!1},e),d.Duplex.call(t,e),t.connected=!1,t.destroyed=!1,t._chunk=null,t._cb=null,t._interval=null,e.socket)t.url=e.socket.url,t._ws=e.socket;else{t.url=e.url;try{t._ws="function"==typeof l?new c(e.url,e):new c(e.url)}catch(e){return void n.nextTick(function(){t.destroy(e)})}}t._ws.binaryType="arraybuffer",t._ws.onopen=function(){t._onOpen()},t._ws.onmessage=function(e){t._onMessage(e)},t._ws.onclose=function(){t._onClose()},t._ws.onerror=function(){t.destroy(new Error("connection error to "+t.url))},t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}t.exports=o;var a=e("debug")("simple-websocket"),i=e("inherits"),s=e("randombytes"),d=e("readable-stream"),l=e("ws"),c="function"==typeof l?l:WebSocket,u=65536;i(o,d.Duplex),o.WEBSOCKET_SUPPORT=!!c,o.prototype.send=function(e){this._ws.send(e)},o.prototype.destroy=function(e){this._destroy(e,function(){})},o.prototype._destroy=function(e,t){var n=this;if(!n.destroyed){if(n._debug("destroy (error: %s)",e&&(e.message||e)),n.readable=n.writable=!1,n._readableState.ended||n.push(null),n._writableState.finished||n.end(),n.connected=!1,n.destroyed=!0,clearInterval(n._interval),n._interval=null,n._chunk=null,n._cb=null,n._onFinishBound&&n.removeListener("finish",n._onFinishBound),n._onFinishBound=null,n._ws){var r=n._ws,o=function(){r.onclose=null};if(r.readyState===c.CLOSED)o();else try{r.onclose=o,r.close()}catch(e){o()}r.onopen=null,r.onmessage=null,r.onerror=function(){}}if(n._ws=null,e){if("undefined"!=typeof DOMException&&e instanceof DOMException){var a=e.code;e=new Error(e.message),e.code=a}n.emit("error",e)}n.emit("close"),t()}},o.prototype._read=function(){},o.prototype._write=function(e,t,n){if(this.destroyed)return n(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof l&&this._ws.bufferedAmount>u?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n},o.prototype._onFinish=function(){function e(){setTimeout(function(){t.destroy()},1e3)}var t=this;t.destroyed||(t.connected?e():t.once("connect",e))},o.prototype._onMessage=function(e){if(!this.destroyed){var t=e.data;t instanceof ArrayBuffer&&(t=r.from(t)),this.push(t)}},o.prototype._onOpen=function(){var e=this;if(!(e.connected||e.destroyed)){if(e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(t){return e.destroy(t)}e._chunk=null,e._debug("sent chunk from \"write before connect\"");var t=e._cb;e._cb=null,t(null)}"function"!=typeof l&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}},o.prototype._onInterval=function(){if(this._cb&&this._ws&&!(this._ws.bufferedAmount>u)){this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);var e=this._cb;this._cb=null,e(null)}},o.prototype._onClose=function(){this.destroyed||(this._debug("on close"),this.destroy())},o.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],a.apply(null,e)}}).call(this,e("_process"),e("buffer").Buffer)},{_process:92,buffer:39,debug:138,inherits:67,randombytes:99,"readable-stream":148,ws:33}],138:[function(e,t,n){(function(o){"use strict";function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(){var e;return"object"===("undefined"==typeof console?"undefined":a(console))&&console.log&&(e=console).log.apply(e,arguments)}function s(){var e;try{e=n.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof o&&"env"in o&&(e=o.env.DEBUG),e}n.log=i,n.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){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"===e||(r++,"%c"===e&&(o=r))}),e.splice(o,0,n)}},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=s,n.useColors=function(){return!!("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},n.storage=function(){try{return localStorage}catch(e){}}(),n.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.exports=e("./common")(n);var d=t.exports.formatters;d.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,e("_process"))},{"./common":139,_process:92}],139:[function(e,n){"use strict";n.exports=function(n){function r(e){for(var n=0,r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r),n|=0;return o.colors[t(n)%o.colors.length]}function o(e){function t(){if(t.enabled){for(var e=arguments.length,r=Array(e),a=0;a<e;a++)r[a]=arguments[a];var i=t,s=+new Date,d=s-(n||s);i.diff=d,i.prev=n,i.curr=s,n=s,r[0]=o.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var l=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,function(e,t){if("%%"===e)return e;l++;var n=o.formatters[t];if("function"==typeof n){var a=r[l];e=n.call(i,a),r.splice(l,1),l--}return e}),o.formatArgs.call(i,r);var c=i.log||o.log;c.apply(i,r)}}var n;return t.namespace=e,t.enabled=o.enabled(e),t.useColors=o.useColors(),t.color=r(e),t.destroy=a,t.extend=i,"function"==typeof o.init&&o.init(t),o.instances.push(t),t}function a(){var e=o.instances.indexOf(this);return-1!==e&&(o.instances.splice(e,1),!0)}function i(e,t){return o(this.namespace+("undefined"==typeof t?":":t)+e)}return o.debug=o,o.default=o,o.coerce=function(e){return e instanceof Error?e.stack||e.message:e},o.disable=function(){o.enable("")},o.enable=function(e){o.save(e),o.names=[],o.skips=[];var t=("string"==typeof e?e:"").split(/[\s,]+/),n=t.length,r;for(r=0;r<n;r++)t[r]&&(e=t[r].replace(/\*/g,".*?"),"-"===e[0]?o.skips.push(new RegExp("^"+e.substr(1)+"$")):o.names.push(new RegExp("^"+e+"$")));for(r=0;r<o.instances.length;r++){var a=o.instances[r];a.enabled=o.enabled(a.namespace)}},o.enabled=function(e){if("*"===e[e.length-1])return!0;var t,n;for(t=0,n=o.skips.length;t<n;t++)if(o.skips[t].test(e))return!1;for(t=0,n=o.names.length;t<n;t++)if(o.names[t].test(e))return!0;return!1},o.humanize=e("ms"),Object.keys(n).forEach(function(e){o[e]=n[e]}),o.instances=[],o.names=[],o.skips=[],o.formatters={},o.selectColor=r,o.enable(o.load()),o}},{ms:83}],140:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{"./_stream_readable":142,"./_stream_writable":144,"core-util-is":43,dup:22,inherits:67,"process-nextick-args":91}],141:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./_stream_transform":143,"core-util-is":43,dup:23,inherits:67}],142:[function(e,t,n){arguments[4][24][0].apply(n,arguments)},{"./_stream_duplex":140,"./internal/streams/BufferList":145,"./internal/streams/destroy":146,"./internal/streams/stream":147,_process:92,"core-util-is":43,dup:24,events:49,inherits:67,isarray:72,"process-nextick-args":91,"safe-buffer":149,"string_decoder/":150,util:33}],143:[function(e,t,n){arguments[4][25][0].apply(n,arguments)},{"./_stream_duplex":140,"core-util-is":43,dup:25,inherits:67}],144:[function(e,t,n){arguments[4][26][0].apply(n,arguments)},{"./_stream_duplex":140,"./internal/streams/destroy":146,"./internal/streams/stream":147,_process:92,"core-util-is":43,dup:26,inherits:67,"process-nextick-args":91,"safe-buffer":149,timers:174,"util-deprecate":188}],145:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{dup:27,"safe-buffer":149,util:33}],146:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28,"process-nextick-args":91}],147:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29,events:49}],148:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./lib/_stream_duplex.js":140,"./lib/_stream_passthrough.js":141,"./lib/_stream_readable.js":142,"./lib/_stream_transform.js":143,"./lib/_stream_writable.js":144,dup:30}],149:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{buffer:39,dup:31}],150:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32,"safe-buffer":149}],151:[function(e,t){var n=1,r=65535,o=4,a=function(){n=n+1&r},i;t.exports=function(e){i||(i=setInterval(a,0|1e3/o),i.unref&&i.unref());var t=o*(e||5),s=[0],d=1,l=n-1&r;return function(e){var a=n-l&r;for(a>t&&(a=t),l=n;a--;)d===t&&(d=0),s[d]=s[0===d?t-1:d-1],d++;e&&(s[d-1]+=e);var i=s[d-1],c=s.length<t?0:s[d===t?0:d];return s.length<o?i:(i-c)*o/s.length}}},{}],152:[function(e,t,n){(function(t){var r=e("./lib/request"),o=e("./lib/response"),a=e("xtend"),i=e("builtin-status-codes"),s=e("url"),d=n;d.request=function(e,n){e="string"==typeof e?s.parse(e):a(e);var o=-1===t.location.protocol.search(/^https?:$/)?"http:":"",i=e.protocol||o,d=e.hostname||e.host,l=e.port,c=e.path||"/";d&&-1!==d.indexOf(":")&&(d="["+d+"]"),e.url=(d?i+"//"+d:"")+(l?":"+l:"")+c,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var u=new r(e);return n&&u.on("response",n),u},d.get=function(e,t){var n=d.request(e,t);return n.end(),n},d.ClientRequest=r,d.IncomingMessage=o.IncomingMessage,d.Agent=function(){},d.Agent.defaultMaxSockets=4,d.globalAgent=new d.Agent,d.STATUS_CODES=i,d.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"./lib/request":154,"./lib/response":155,"builtin-status-codes":40,url:184,xtend:192}],153:[function(e,t,n){(function(e){function t(){if(s!==void 0)return s;if(e.XMLHttpRequest){s=new e.XMLHttpRequest;try{s.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(t){s=null}}else s=null;return s}function r(e){var n=t();if(!n)return!1;try{return n.responseType=e,n.responseType===e}catch(t){}return!1}function o(e){return"function"==typeof e}n.fetch=o(e.fetch)&&o(e.ReadableStream),n.writableStream=o(e.WritableStream),n.abortController=o(e.AbortController),n.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),n.blobConstructor=!0}catch(t){}var a="undefined"!=typeof e.ArrayBuffer,i=a&&o(e.ArrayBuffer.prototype.slice),s;n.arraybuffer=n.fetch||a&&r("arraybuffer"),n.msstream=!n.fetch&&i&&r("ms-stream"),n.mozchunkedarraybuffer=!n.fetch&&a&&r("moz-chunked-arraybuffer"),n.overrideMimeType=n.fetch||!!t()&&o(t().overrideMimeType),n.vbArray=o(e.VBArray),s=null}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],154:[function(e,t){(function(n,r,o){function a(e,t){return s.fetch&&t?"fetch":s.mozchunkedarraybuffer?"moz-chunked-arraybuffer":s.msstream?"ms-stream":s.arraybuffer&&e?"arraybuffer":s.vbArray&&e?"text:vbarray":"text"}function i(e){try{var t=e.status;return null!==t&&0!==t}catch(t){return!1}}var s=e("./capability"),d=e("inherits"),l=e("./response"),c=e("readable-stream"),u=e("to-arraybuffer"),p=l.IncomingMessage,f=l.readyStates,h=t.exports=function(e){var t=this;c.Writable.call(t),t._opts=e,t._body=[],t._headers={},e.auth&&t.setHeader("Authorization","Basic "+new o(e.auth).toString("base64")),Object.keys(e.headers).forEach(function(n){t.setHeader(n,e.headers[n])});var n=!0,r;if("disable-fetch"===e.mode||"requestTimeout"in e&&!s.abortController)n=!1,r=!0;else if("prefer-streaming"===e.mode)r=!1;else if("allow-wrong-content-type"===e.mode)r=!s.overrideMimeType;else if(!e.mode||"default"===e.mode||"prefer-fast"===e.mode)r=!0;else throw new Error("Invalid value for opts.mode");t._mode=a(r,n),t._fetchTimer=null,t.on("finish",function(){t._onFinish()})};d(h,c.Writable),h.prototype.setHeader=function(e,t){var n=this,r=e.toLowerCase();-1!==m.indexOf(r)||(n._headers[r]={name:e,value:t})},h.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},h.prototype.removeHeader=function(e){var t=this;delete t._headers[e.toLowerCase()]},h.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t=e._opts,a=e._headers,i=null;"GET"!==t.method&&"HEAD"!==t.method&&(s.arraybuffer?i=u(o.concat(e._body)):s.blobConstructor?i=new r.Blob(e._body.map(function(e){return u(e)}),{type:(a["content-type"]||{}).value||""}):i=o.concat(e._body).toString());var d=[];if(Object.keys(a).forEach(function(e){var t=a[e].name,n=a[e].value;Array.isArray(n)?n.forEach(function(e){d.push([t,e])}):d.push([t,n])}),"fetch"===e._mode){var l=null;if(s.abortController){var c=new AbortController;l=c.signal,e._fetchAbortController=c,"requestTimeout"in t&&0!==t.requestTimeout&&(e._fetchTimer=r.setTimeout(function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()},t.requestTimeout))}r.fetch(e._opts.url,{method:e._opts.method,headers:d,body:i||void 0,mode:"cors",credentials:t.withCredentials?"include":"same-origin",signal:l}).then(function(t){e._fetchResponse=t,e._connect()},function(t){r.clearTimeout(e._fetchTimer),e._destroyed||e.emit("error",t)})}else{var p=e._xhr=new r.XMLHttpRequest;try{p.open(e._opts.method,e._opts.url,!0)}catch(t){return void n.nextTick(function(){e.emit("error",t)})}"responseType"in p&&(p.responseType=e._mode.split(":")[0]),"withCredentials"in p&&(p.withCredentials=!!t.withCredentials),"text"===e._mode&&"overrideMimeType"in p&&p.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in t&&(p.timeout=t.requestTimeout,p.ontimeout=function(){e.emit("requestTimeout")}),d.forEach(function(e){p.setRequestHeader(e[0],e[1])}),e._response=null,p.onreadystatechange=function(){switch(p.readyState){case f.LOADING:case f.DONE:e._onXHRProgress();}},"moz-chunked-arraybuffer"===e._mode&&(p.onprogress=function(){e._onXHRProgress()}),p.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{p.send(i)}catch(t){return void n.nextTick(function(){e.emit("error",t)})}}}},h.prototype._onXHRProgress=function(){var e=this;!i(e._xhr)||e._destroyed||(!e._response&&e._connect(),e._response._onXHRProgress())},h.prototype._connect=function(){var e=this;e._destroyed||(e._response=new p(e._xhr,e._fetchResponse,e._mode,e._fetchTimer),e._response.on("error",function(t){e.emit("error",t)}),e.emit("response",e._response))},h.prototype._write=function(e,t,n){var r=this;r._body.push(e),n()},h.prototype.abort=h.prototype.destroy=function(){var e=this;e._destroyed=!0,r.clearTimeout(e._fetchTimer),e._response&&(e._response._destroyed=!0),e._xhr?e._xhr.abort():e._fetchAbortController&&e._fetchAbortController.abort()},h.prototype.end=function(e,t,n){var r=this;"function"==typeof e&&(n=e,e=void 0),c.Writable.prototype.end.call(r,e,t,n)},h.prototype.flushHeaders=function(){},h.prototype.setTimeout=function(){},h.prototype.setNoDelay=function(){},h.prototype.setSocketKeepAlive=function(){};var m=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,e("buffer").Buffer)},{"./capability":153,"./response":155,_process:92,buffer:39,inherits:67,"readable-stream":164,"to-arraybuffer":175}],155:[function(e,t,n){(function(t,r,o){var a=e("./capability"),i=e("inherits"),s=e("readable-stream"),d=n.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=n.IncomingMessage=function(e,n,i,d){var l=this;if(s.Readable.call(l),l._mode=i,l.headers={},l.rawHeaders=[],l.trailers={},l.rawTrailers=[],l.on("end",function(){t.nextTick(function(){l.emit("close")})}),"fetch"===i){function e(){u.read().then(function(t){return l._destroyed?void 0:t.done?(r.clearTimeout(d),void l.push(null)):void(l.push(new o(t.value)),e())}).catch(function(e){r.clearTimeout(d),l._destroyed||l.emit("error",e)})}if(l._fetchResponse=n,l.url=n.url,l.statusCode=n.status,l.statusMessage=n.statusText,n.headers.forEach(function(e,t){l.headers[t.toLowerCase()]=e,l.rawHeaders.push(t,e)}),a.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){l._destroyed?n():l.push(new o(e))?t():l._resumeFetch=t})},close:function(){r.clearTimeout(d),l._destroyed||l.push(null)},abort:function(e){l._destroyed||l.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){r.clearTimeout(d),l._destroyed||l.emit("error",e)})}catch(t){}}var u=n.body.getReader();e()}else{l._xhr=e,l._pos=0,l.url=e.responseURL,l.statusCode=e.status,l.statusMessage=e.statusText;var p=e.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===l.headers[n]&&(l.headers[n]=[]),l.headers[n].push(t[2])):void 0===l.headers[n]?l.headers[n]=t[2]:l.headers[n]+=", "+t[2],l.rawHeaders.push(t[1],t[2])}}),l._charset="x-user-defined",!a.overrideMimeType){var f=l.rawHeaders["mime-type"];if(f){var h=f.match(/;\s*charset=([^;])(;|$)/);h&&(l._charset=h[1].toLowerCase())}l._charset||(l._charset="utf-8")}}};i(l,s.Readable),l.prototype._read=function(){var e=this,t=e._resumeFetch;t&&(e._resumeFetch=null,t())},l.prototype._onXHRProgress=function(){var t=this,n=t._xhr,a=null;switch(t._mode){case"text:vbarray":if(n.readyState!==d.DONE)break;try{a=new r.VBArray(n.responseBody).toArray()}catch(t){}if(null!==a){t.push(new o(a));break}case"text":try{a=n.responseText}catch(n){t._mode="text:vbarray";break}if(a.length>t._pos){var s=a.substr(t._pos);if("x-user-defined"===t._charset){for(var l=new o(s.length),c=0;c<s.length;c++)l[c]=255&s.charCodeAt(c);t.push(l)}else t.push(s,t._charset);t._pos=a.length}break;case"arraybuffer":if(n.readyState!==d.DONE||!n.response)break;a=n.response,t.push(new o(new Uint8Array(a)));break;case"moz-chunked-arraybuffer":if(a=n.response,n.readyState!==d.LOADING||!a)break;t.push(new o(new Uint8Array(a)));break;case"ms-stream":if(a=n.response,n.readyState!==d.LOADING)break;var e=new r.MSStreamReader;e.onprogress=function(){e.result.byteLength>t._pos&&(t.push(new o(new Uint8Array(e.result.slice(t._pos)))),t._pos=e.result.byteLength)},e.onload=function(){t.push(null)},e.readAsArrayBuffer(a);}t._xhr.readyState===d.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,e("buffer").Buffer)},{"./capability":153,_process:92,buffer:39,inherits:67,"readable-stream":164}],156:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{"./_stream_readable":158,"./_stream_writable":160,"core-util-is":43,dup:22,inherits:67,"process-nextick-args":91}],157:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./_stream_transform":159,"core-util-is":43,dup:23,inherits:67}],158:[function(e,t,n){arguments[4][24][0].apply(n,arguments)},{"./_stream_duplex":156,"./internal/streams/BufferList":161,"./internal/streams/destroy":162,"./internal/streams/stream":163,_process:92,"core-util-is":43,dup:24,events:49,inherits:67,isarray:72,"process-nextick-args":91,"safe-buffer":165,"string_decoder/":166,util:33}],159:[function(e,t,n){arguments[4][25][0].apply(n,arguments)},{"./_stream_duplex":156,"core-util-is":43,dup:25,inherits:67}],160:[function(e,t,n){arguments[4][26][0].apply(n,arguments)},{"./_stream_duplex":156,"./internal/streams/destroy":162,"./internal/streams/stream":163,_process:92,"core-util-is":43,dup:26,inherits:67,"process-nextick-args":91,"safe-buffer":165,timers:174,"util-deprecate":188}],161:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{dup:27,"safe-buffer":165,util:33}],162:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28,"process-nextick-args":91}],163:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29,events:49}],164:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./lib/_stream_duplex.js":156,"./lib/_stream_passthrough.js":157,"./lib/_stream_readable.js":158,"./lib/_stream_transform.js":159,"./lib/_stream_writable.js":160,dup:30}],165:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{buffer:39,dup:31}],166:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32,"safe-buffer":165}],167:[function(e,t){var n=e("stream-to-blob");t.exports=function e(t,r,o){return"function"==typeof r?e(t,null,r):void n(t,r,function(e,t){if(e)return o(e);var n=URL.createObjectURL(t);o(null,n)})}},{"stream-to-blob":168}],168:[function(e,t){var n=e("once");t.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);o=n(o);var a=[];t.on("data",function(e){a.push(e)}).on("end",function(){var e=r?new Blob(a,{type:r}):new Blob(a);o(null,e)}).on("error",o)}},{once:86}],169:[function(e,t){(function(n){var r=e("once");t.exports=function(e,t,o){o=r(o);var a=n.alloc(t),i=0;e.on("data",function(e){e.copy(a,i),i+=e.length}).on("end",function(){o(null,a)}).on("error",o)}}).call(this,e("buffer").Buffer)},{buffer:39,once:86}],170:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32,"safe-buffer":171}],171:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{buffer:39,dup:31}],172:[function(e,t,n){var r=e("./thirty-two");n.encode=r.encode,n.decode=r.decode},{"./thirty-two":173}],173:[function(e,t,n){(function(e){'use strict';function t(e){var t=r(e.length/5);return 0==e.length%5?t:t+1}var o=[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];n.encode=function(n){e.isBuffer(n)||(n=new e(n));for(var r=0,o=0,a=0,s=0,d=new e(8*t(n));r<n.length;){var l=n[r];3<a?(s=l&255>>a,a=(a+5)%8,s=s<<a|(r+1<n.length?n[r+1]:0)>>8-a,r++):(s=31&l>>8-(a+5),a=(a+5)%8,0===a&&r++),d[o]="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".charCodeAt(s),o++}for(r=o;r<d.length;r++)d[r]=61;return d},n.decode=function(t){var n=0,r=0,s=0,d;e.isBuffer(t)||(t=new e(t));for(var l=new e(a(5*t.length/8)),c=0;c<t.length&&!(61===t[c]);c++){var u=t[c]-48;if(u<o.length)r=o[u],3>=n?(n=(n+5)%8,0==n?(d|=r,l[s]=d,s++,d=0):d|=255&r<<8-n):(n=(n+5)%8,d|=255&r>>>n,l[s]=d,s++,d=255&r<<8-n);else throw new Error("Invalid input - it is not base32 encoded string")}return l.slice(0,s)}}).call(this,e("buffer").Buffer)},{buffer:39}],174:[function(e,t,n){(function(t,r){function o(e,t){this._id=e,this._clearFn=t}var a=e("process/browser.js").nextTick,i=Function.prototype.apply,s=Array.prototype.slice,d={},l=0;n.setTimeout=function(){return new o(i.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new o(i.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=l++,r=!(2>arguments.length)&&s.call(arguments,1);return d[t]=!0,a(function(){d[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof r?r:function(e){delete d[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":92,timers:174}],175:[function(e,t){var n=e("buffer").Buffer;t.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),r=e.length,o=0;o<r;o++)t[o]=e[o];return t.buffer}throw new Error("Argument must be a Buffer")}},{buffer:39}],176:[function(e,t){(function(n){const o=e("debug")("torrent-discovery"),a=e("bittorrent-dht/client"),i=e("events").EventEmitter,s=e("run-parallel"),d=e("bittorrent-tracker/client");t.exports=class extends i{constructor(e){if(super(),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!n.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||900000,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")};const t=(e,t)=>{const n=new a(t);return n.on("warning",this._onWarning),n.on("error",this._onError),n.listen(e),this._internalDHT=!0,n};!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(),this.dht=!1===e.dht||"function"!=typeof a?null:e.dht&&"function"==typeof e.dht.addNode?e.dht:e.dht&&"object"==typeof e.dht?t(e.dhtPort,e.dht):t(e.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce())}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){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)})),s(t,e),this.dht=null,this.tracker=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 d(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||(o("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,e=>{this._dhtAnnouncing=!1,o("dht announce complete"),e&&this.emit("warning",e),this.emit("dhtAnnounce"),this.destroyed||(this._dhtTimeout=setTimeout(()=>{this._dhtAnnounce()},this._intervalMs+r(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())}))}}}).call(this,e("_process"))},{_process:92,"bittorrent-dht/client":33,"bittorrent-tracker/client":16,debug:177,events:49,"run-parallel":119}],177:[function(e,t,n){arguments[4][138][0].apply(n,arguments)},{"./common":178,_process:92,dup:138}],178:[function(e,t,n){arguments[4][139][0].apply(n,arguments)},{dup:139,ms:83}],179:[function(e,t){(function(e){const n=16384;class r{constructor(e){this.length=e,this.missing=e,this.sources=null,this._chunks=a(e/n),this._remainder=e%n||n,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,this._flushed=!1}chunkLength(e){return e===this._chunks-1?this._remainder:n}chunkLengthRemaining(e){return this.length-e*n}chunkOffset(e){return e*n}reserve(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations<this._chunks?this._reservations++:-1:-1}reserveRemaining(){if(!this.init())return-1;if(this._reservations<this._chunks){const e=this._reservations;return this._reservations=this._chunks,e}return-1}cancel(e){this.init()&&this._cancellations.push(e)}cancelRemaining(e){this.init()&&(this._reservations=e)}get(e){return this.init()?this._buffer[e]:null}set(e,t,r){if(!this.init())return!1;const o=t.length,i=a(o/n);for(let o=0;o<i;o++)if(!this._buffer[e+o]){const a=o*n,i=t.slice(a,a+n);this._buffered++,this._buffer[e+o]=i,this.missing-=i.length,this.sources.includes(r)||this.sources.push(r)}return this._buffered===this._chunks}flush(){if(!this._buffer||this._chunks!==this._buffered)return null;const t=e.concat(this._buffer,this.length);return this._buffer=null,this._cancellations=null,this.sources=null,this._flushed=!0,t}init(){return!this._flushed&&(!!this._buffer||(this._buffer=Array(this._chunks),this._cancellations=[],this.sources=[],!0))}}Object.defineProperty(r,"BLOCK_LENGTH",{value:16384}),t.exports=r}).call(this,e("buffer").Buffer)},{buffer:39}],180:[function(e,t){(function(n){var r=e("is-typedarray").strict;t.exports=function(e){if(r(e)){var t=n.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(t=t.slice(e.byteOffset,e.byteOffset+e.byteLength)),t}return n.from(e)}}).call(this,e("buffer").Buffer)},{buffer:39,"is-typedarray":71}],181:[function(e,t,o){var a=e("buffer-alloc"),i=n(2,32);o.encodingLength=function(){return 8},o.encode=function(e,t,n){t||(t=a(8)),n||(n=0);var o=r(e/i);return t.writeUInt32BE(o,n),t.writeUInt32BE(e-o*i,n+4),t},o.decode=function(e,t){t||(t=0);var n=e.readUInt32BE(t),r=e.readUInt32BE(t+4);return n*i+r},o.encode.bytes=8,o.decode.bytes=8},{"buffer-alloc":36}],182:[function(e,t){"use strict";function n(e,t){for(var n=1,r=e.length,o=e[0],s=e[0],d=1;d<r;++d)if(s=o,o=e[d],t(o,s)){if(d===n){n++;continue}e[n++]=o}return e.length=n,e}function r(e){for(var t=1,n=e.length,r=e[0],o=e[0],s=1;s<n;++s,o=r)if(o=r,r=e[s],r!==o){if(s===t){t++;continue}e[t++]=r}return e.length=t,e}t.exports=function(e,t,o){return 0===e.length?e:t?(o||e.sort(t),n(e,t)):(o||e.sort(),r(e))}},{}],183:[function(e,t){t.exports=function(e,t){if(!(t>=e.length||0>t)){var n=e.pop();if(t<e.length){var r=e[t];return e[t]=n,r}return n}}},{}],184:[function(e,t,n){'use strict';function r(){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}function o(e,t,n){if(e&&d.isObject(e)&&e instanceof r)return e;var o=new r;return o.parse(e,t,n),o}var a=e("punycode"),d=e("./util");n.parse=o,n.resolve=function(e,t){return o(e,!1,!0).resolve(t)},n.resolveObject=function(e,t){return e?o(e,!1,!0).resolveObject(t):t},n.format=function(e){return d.isString(e)&&(e=o(e)),e instanceof r?e.format():r.prototype.format.call(e)},n.Url=r;var c=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["{","}","|","\\","^","`"].concat(["<",">","\"","`"," ","\r","\n","\t"]),h=["'"].concat(f),m=["%","/","?",";","#"].concat(h),g=["/","?","#"],_=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},S=e("querystring");r.prototype.parse=function(e,t,n){if(!d.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),o=-1!==r&&r<e.indexOf("#")?"?":"#",u=e.split(o),f=/\\/g;u[0]=u[0].replace(f,"/"),e=u.join(o);var E=e;if(E=E.trim(),!n&&1===e.split("#").length){var C=p.exec(E);if(C)return this.path=E,this.href=E,this.pathname=C[1],C[2]?(this.search=C[2],this.query=t?S.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var v=c.exec(E);if(v){v=v[0];var L=v.toLowerCase();this.protocol=L,E=E.substr(v.length)}if(n||v||E.match(/^\/\/[^@\/]+@[^@\/]+/)){var I="//"===E.substr(0,2);I&&!(v&&w[v])&&(E=E.substr(2),this.slashes=!0)}if(!w[v]&&(I||v&&!x[v])){for(var T=-1,B=0,R;B<g.length;B++)R=E.indexOf(g[B]),-1!==R&&(-1===T||R<T)&&(T=R);var A,U;U=-1===T?E.lastIndexOf("@"):E.lastIndexOf("@",T),-1!==U&&(A=E.slice(0,U),E=E.slice(U+1),this.auth=decodeURIComponent(A)),T=-1;for(var B=0,R;B<m.length;B++)R=E.indexOf(m[B]),-1!==R&&(-1===T||R<T)&&(T=R);-1===T&&(T=E.length),this.host=E.slice(0,T),E=E.slice(T),this.parseHost(),this.hostname=this.hostname||"";var P="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!P)for(var M=this.hostname.split(/\./),B=0,O=M.length,N;B<O;B++)if(N=M[B],N&&!N.match(_)){for(var F="",q=0,H=N.length;q<H;q++)F+=127<N.charCodeAt(q)?"x":N[q];if(!F.match(_)){var k=M.slice(0,B),D=M.slice(B+1),W=N.match(b);W&&(k.push(W[1]),D.unshift(W[2])),D.length&&(E="/"+D.join(".")+E),this.hostname=k.join(".");break}}this.hostname=255<this.hostname.length?"":this.hostname.toLowerCase(),P||(this.hostname=a.toASCII(this.hostname));var z=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+z,this.href+=this.host,P&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==E[0]&&(E="/"+E))}if(!y[L])for(var B=0,O=h.length,G;B<O;B++)if(G=h[B],-1!==E.indexOf(G)){var K=encodeURIComponent(G);K===G&&(K=escape(G)),E=E.split(G).join(K)}var Y=E.indexOf("#");-1!==Y&&(this.hash=E.substr(Y),E=E.slice(0,Y));var $=E.indexOf("?");if(-1===$?t&&(this.search="",this.query={}):(this.search=E.substr($),this.query=E.substr($+1),t&&(this.query=S.parse(this.query)),E=E.slice(0,$)),E&&(this.pathname=E),x[L]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var z=this.pathname||"",X=this.search||"";this.path=z+X}return this.href=this.format(),this},r.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,a="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&d.isObject(this.query)&&Object.keys(this.query).length&&(a=S.stringify(this.query));var i=this.search||a&&"?"+a||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||x[t])&&!1!=o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):!o&&(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),i&&"?"!==i.charAt(0)&&(i="?"+i),n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),i=i.replace("#","%23"),t+o+n+i+r},r.prototype.resolve=function(e){return this.resolveObject(o(e,!1,!0)).format()},r.prototype.resolveObject=function(e){if(d.isString(e)){var t=new r;t.parse(e,!1,!0),e=t}for(var n=new r,o=Object.keys(this),a=0,l;a<o.length;a++)l=o[a],n[l]=this[l];if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var c=Object.keys(e),u=0,f;u<c.length;u++)f=c[u],"protocol"!==f&&(n[f]=e[f]);return x[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!x[e.protocol]){for(var h=Object.keys(e),m=0,g;m<h.length;m++)g=h[m],n[g]=e[g];return n.href=n.format(),n}if(n.protocol=e.protocol,!e.host&&!w[e.protocol]){for(var _=(e.pathname||"").split("/");_.length&&!(e.host=_.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==_[0]&&_.unshift(""),2>_.length&&_.unshift(""),n.pathname=_.join("/")}else n.pathname=e.pathname;if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var b=n.pathname||"",p=n.search||"";n.path=b+p}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var s=n.pathname&&"/"===n.pathname.charAt(0),y=e.host||e.pathname&&"/"===e.pathname.charAt(0),S=y||s||n.host&&e.pathname,E=S,C=n.pathname&&n.pathname.split("/")||[],_=e.pathname&&e.pathname.split("/")||[],L=n.protocol&&!x[n.protocol];if(L&&(n.hostname="",n.port=null,n.host&&(""===C[0]?C[0]=n.host:C.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===_[0]?_[0]=e.host:_.unshift(e.host)),e.host=null),S=S&&(""===_[0]||""===C[0])),y)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,C=_;else if(_.length)C||(C=[]),C.pop(),C=C.concat(_),n.search=e.search,n.query=e.query;else if(!d.isNullOrUndefined(e.search)){if(L){n.hostname=n.host=C.shift();var I=!!(n.host&&0<n.host.indexOf("@"))&&n.host.split("@");I&&(n.auth=I.shift(),n.host=n.hostname=I.shift())}return n.search=e.search,n.query=e.query,d.isNull(n.pathname)&&d.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!C.length)return n.pathname=null,n.path=n.search?"/"+n.search:null,n.href=n.format(),n;for(var T=C.slice(-1)[0],B=(n.host||e.host||1<C.length)&&("."===T||".."===T)||""===T,R=0,A=C.length;0<=A;A--)T=C[A],"."===T?C.splice(A,1):".."===T?(C.splice(A,1),R++):R&&(C.splice(A,1),R--);if(!S&&!E)for(;R--;R)C.unshift("..");S&&""!==C[0]&&(!C[0]||"/"!==C[0].charAt(0))&&C.unshift(""),B&&"/"!==C.join("/").substr(-1)&&C.push("");var U=""===C[0]||C[0]&&"/"===C[0].charAt(0);if(L){n.hostname=n.host=U?"":C.length?C.shift():"";var I=!!(n.host&&0<n.host.indexOf("@"))&&n.host.split("@");I&&(n.auth=I.shift(),n.host=n.hostname=I.shift())}return S=S||n.host&&C.length,S&&!U&&C.unshift(""),C.length?n.pathname=C.join("/"):(n.pathname=null,n.path=null),d.isNull(n.pathname)&&d.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var e=this.host,t=u.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":185,punycode:94,querystring:97}],185:[function(e,t){'use strict';t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],186:[function(e,t){(function(n){const{EventEmitter:r}=e("events"),o=e("bencode"),i=e("bitfield"),s=e("debug")("ut_metadata"),d=e("simple-sha1"),l=1E3,c=16384;t.exports=e=>{class t extends r{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new i(0,{grow:l}),n.isBuffer(e)&&this.setMetadata(e)}onHandshake(e,t,n){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1E7<e.metadata_size||0>=e.metadata_size?this.emit("warning",new Error("Peer gave invalid metadata size")):void(this._metadataSize=e.metadata_size,this._numPieces=a(this._metadataSize/c),this._remainingRejects=2*this._numPieces,this._fetching&&this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(e){let t,n;try{const r=e.toString(),a=r.indexOf("ee")+2;t=o.decode(r.substring(0,a)),n=e.slice(a)}catch(e){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,n,t.total_size);break;case 2:this._onReject(t.piece);}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(e){if(this._metadataComplete)return!0;s("set metadata");try{const t=o.decode(e).info;t&&(e=o.encode(t))}catch(e){}return!(this._infoHash&&this._infoHash!==d.sync(e))&&(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",o.encode({info:o.decode(this.metadata)})),!0)}_send(e,t){let r=o.encode(e);n.isBuffer(t)&&(r=n.concat([r,t])),this._wire.extended("ut_metadata",r)}_request(e){this._send({msg_type:0,piece:e})}_data(e,t,n){const r={msg_type:1,piece:e};"number"==typeof n&&(r.total_size=n),this._send(r,t)}_reject(e){this._send({msg_type:2,piece:e})}_onRequest(e){if(!this._metadataComplete)return void this._reject(e);const t=e*c;let n=t+c;n>this._metadataSize&&(n=this._metadataSize);const r=this.metadata.slice(t,n);this._data(e,r,this._metadataSize)}_onData(e,t,n){t.length>c||(t.copy(this.metadata,e*c),this._bitfield.set(e),this._checkDone())}_onReject(e){0<this._remainingRejects&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error("Peer sent \"reject\" too much"))}_requestPieces(){this.metadata=n.alloc(this._metadataSize);for(let e=0;e<this._numPieces;e++)this._request(e)}_checkDone(){let e=!0;for(let t=0;t<this._numPieces;t++)if(!this._bitfield.get(t)){e=!1;break}if(e){const e=this.setMetadata(this.metadata);e||this._failedMetadata()}}_failedMetadata(){this._bitfield=new i(0,{grow:l}),this._remainingRejects-=this._numPieces,0<this._remainingRejects?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return t.prototype.name="ut_metadata",t}}).call(this,e("buffer").Buffer)},{bencode:11,bitfield:187,buffer:39,debug:45,events:49,"simple-sha1":136}],187:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],188:[function(e,t){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===(n+"").toLowerCase()}t.exports=function(e,t){function r(){if(!o){if(n("throwDeprecation"))throw new Error(t);else n("traceDeprecation")?console.trace(t):console.warn(t);o=!0}return e.apply(this,arguments)}if(n("noDeprecation"))return e;var o=!1;return r}}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],189:[function(e,t){(function(n){function o(){return{version:0,flags:0,entries:[]}}const a=e("binary-search"),i=e("events"),s=e("mp4-stream"),d=e("mp4-box-encoding"),l=e("range-slice-stream");class c{constructor(e,t){this._entries=e,this._countName=t||"count",this._index=0,this._offset=0,this.value=this._entries[0]}inc(){this._offset++,this._offset>=this._entries[this._index][this._countName]&&(this._index++,this._offset=0),this.value=this._entries[this._index]}}t.exports=class extends i{constructor(e){super(),this._tracks=[],this._file=e,this._decoder=null,this._findMoov(0)}_findMoov(e){this._decoder&&this._decoder.destroy();let t=0;this._decoder=s.decode();const n=this._file.createReadStream({start:e});n.pipe(this._decoder),this._decoder.on("box",r=>{"moov"===r.type?this._decoder.decode(e=>{n.destroy();try{this._processMoov(e)}catch(e){e.message=`Cannot parse mp4 file: ${e.message}`,this.emit("error",e)}}):r.length<4096?(t+=r.length,this._decoder.ignore()):(t+=r.length,n.destroy(),this._decoder.destroy(),this._findMoov(e+t))})}_processMoov(e){const t=e.traks;this._tracks=[],this._hasVideo=!1,this._hasAudio=!1;for(let n=0;n<t.length;n++){const a=t[n],i=a.mdia.minf.stbl,s=i.stsd.entries[0],d=a.mdia.hdlr.handlerType;let l,u;if("vide"===d&&"avc1"===s.type){if(this._hasVideo)continue;this._hasVideo=!0,l="avc1",s.avcC&&(l+=`.${s.avcC.mimeCodec}`),u=`video/mp4; codecs="${l}"`}else if("soun"===d&&"mp4a"===s.type){if(this._hasAudio)continue;this._hasAudio=!0,l="mp4a",s.esds&&s.esds.mimeCodec&&(l+=`.${s.esds.mimeCodec}`),u=`audio/mp4; codecs="${l}"`}else continue;const p=[];let f=0,h=0,m=0,g=0,_=0,b=0;const y=new c(i.stts.entries);let w=null;i.ctts&&(w=new c(i.ctts.entries));for(let e=0;;){var r=i.stsc.entries[_];const t=i.stsz.entries[f],n=y.value.duration,o=w?w.value.compositionOffset:0;let a=!0;i.stss&&(a=i.stss.entries[e]===f+1);const s=i.stco||i.co64;if(p.push({size:t,duration:n,dts:b,presentationOffset:o,sync:a,offset:g+s.entries[m]}),f++,f>=i.stsz.entries.length)break;if(h++,g+=t,h>=r.samplesPerChunk){h=0,g=0,m++;const e=i.stsc.entries[_+1];e&&m+1>=e.firstChunk&&_++}b+=n,y.inc(),w&&w.inc(),a&&e++}a.mdia.mdhd.duration=0,a.tkhd.duration=0;const k=r.sampleDescriptionId,x={type:"moov",mvhd:e.mvhd,traks:[{tkhd:a.tkhd,mdia:{mdhd:a.mdia.mdhd,hdlr:a.mdia.hdlr,elng:a.mdia.elng,minf:{vmhd:a.mdia.minf.vmhd,smhd:a.mdia.minf.smhd,dinf:a.mdia.minf.dinf,stbl:{stsd:i.stsd,stts:o(),ctts:o(),stsc:o(),stsz:o(),stco:o(),stss:o()}}}}],mvex:{mehd:{fragmentDuration:e.mvhd.duration},trexs:[{trackId:a.tkhd.trackId,defaultSampleDescriptionIndex:k,defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0}]}};this._tracks.push({fragmentSequence:1,trackId:a.tkhd.trackId,timeScale:a.mdia.mdhd.timeScale,samples:p,currSample:null,currTime:null,moov:x,mime:u})}if(0===this._tracks.length)return void this.emit("error",new Error("no playable tracks"));e.mvhd.duration=0,this._ftyp={type:"ftyp",brand:"iso5",brandVersion:0,compatibleBrands:["iso5"]};const a=d.encode(this._ftyp),i=this._tracks.map(e=>{const t=d.encode(e.moov);return{mime:e.mime,init:n.concat([a,t])}});this.emit("ready",i)}seek(e){if(!this._tracks)throw new Error("Not ready yet; wait for 'ready' event");this._fileStream&&(this._fileStream.destroy(),this._fileStream=null);let t=-1;if(this._tracks.map((n,r)=>{n.outStream&&n.outStream.destroy(),n.inStream&&(n.inStream.destroy(),n.inStream=null);const o=n.outStream=s.encode(),a=this._generateFragment(r,e);if(!a)return o.finalize();(-1===t||a.ranges[0].start<t)&&(t=a.ranges[0].start);const i=e=>{o.destroyed||o.box(e.moof,t=>{if(t)return this.emit("error",t);if(!o.destroyed){const t=n.inStream.slice(e.ranges);t.pipe(o.mediaData(e.length,e=>{if(e)return this.emit("error",e);if(!o.destroyed){const e=this._generateFragment(r);return e?void i(e):o.finalize()}}))}})};i(a)}),0<=t){const e=this._fileStream=this._file.createReadStream({start:t});this._tracks.forEach(n=>{n.inStream=new l(t,{highWaterMark:1e7}),e.pipe(n.inStream)})}return this._tracks.map(e=>e.outStream)}_findSampleBefore(e,t){const n=this._tracks[e],o=r(n.timeScale*t);let i=a(n.samples,o,(e,n)=>{const t=e.dts+e.presentationOffset;return t-n});for(-1===i?i=0:0>i&&(i=-i-2);!n.samples[i].sync;)i--;return i}_generateFragment(e,t){const n=this._tracks[e];let r;if(r=void 0===t?n.currSample:this._findSampleBefore(e,t),r>=n.samples.length)return null;const o=n.samples[r].dts;let a=0;const i=[];for(var s=r;s<n.samples.length;s++){const e=n.samples[s];if(e.sync&&e.dts-o>=n.timeScale*1)break;a+=e.size;const t=i.length-1;0>t||i[t].end!==e.offset?i.push({start:e.offset,end:e.offset+e.size}):i[t].end+=e.size}return n.currSample=s,{moof:this._generateMoof(e,r,s),ranges:i,length:a}}_generateMoof(e,t,n){const r=this._tracks[e],o=[];let a=0;for(let i=t;i<n;i++){const e=r.samples[i];0>e.presentationOffset&&(a=1),o.push({sampleDuration:e.duration,sampleSize:e.size,sampleFlags:e.sync?33554432:16842752,sampleCompositionTimeOffset:e.presentationOffset})}const i={type:"moof",mfhd:{sequenceNumber:r.fragmentSequence++},trafs:[{tfhd:{flags:131072,trackId:r.trackId},tfdt:{baseMediaDecodeTime:r.samples[t].dts},trun:{flags:3841,dataOffset:8,entries:o,version:a}}]};return i.trafs[0].trun.dataOffset+=d.encodingLength(i),i}}}).call(this,e("buffer").Buffer)},{"binary-search":12,buffer:39,events:49,"mp4-box-encoding":79,"mp4-stream":82,"range-slice-stream":100}],190:[function(e,t){function n(e,t,o={}){return this instanceof n?void(this.detailedError=null,this._elem=t,this._elemWrapper=new r(t),this._waitingFired=!1,this._trackMeta=null,this._file=e,this._tracks=null,"none"!==this._elem.preload&&this._createMuxer(),this._onError=()=>{this.detailedError=this._elemWrapper.detailedError,this.destroy()},this._onWaiting=()=>{this._waitingFired=!0,this._muxer?this._tracks&&this._pump():this._createMuxer()},t.autoplay&&(t.preload="auto"),t.addEventListener("waiting",this._onWaiting),t.addEventListener("error",this._onError)):(console.warn("don't invoked VideoStream without 'new'"),new n(e,t,o))}const r=e("mediasource"),o=e("pump"),a=e("./mp4-remuxer");n.prototype={_createMuxer(){this._muxer=new a(this._file),this._muxer.on("ready",e=>{this._tracks=e.map(e=>{const t=this._elemWrapper.createWriteStream(e.mime);t.on("error",e=>{this._elemWrapper.error(e)});const n={muxed:null,mediaSource:t,initFlushed:!1,onInitFlushed:null};return t.write(e.init,e=>{n.initFlushed=!0,n.onInitFlushed&&n.onInitFlushed(e)}),n}),(this._waitingFired||"auto"===this._elem.preload)&&this._pump()}),this._muxer.on("error",e=>{this._elemWrapper.error(e)})},_pump(){const e=this._muxer.seek(this._elem.currentTime,!this._tracks);this._tracks.forEach((t,n)=>{const r=()=>{t.muxed&&(t.muxed.destroy(),t.mediaSource=this._elemWrapper.createWriteStream(t.mediaSource),t.mediaSource.on("error",e=>{this._elemWrapper.error(e)})),t.muxed=e[n],o(t.muxed,t.mediaSource)};t.initFlushed?r():t.onInitFlushed=e=>e?void this._elemWrapper.error(e):void r()})},destroy(){this.destroyed||(this.destroyed=!0,this._elem.removeEventListener("waiting",this._onWaiting),this._elem.removeEventListener("error",this._onError),this._tracks&&this._tracks.forEach(e=>{e.muxed&&e.muxed.destroy()}),this._elem.src="")}},t.exports=n},{"./mp4-remuxer":189,mediasource:75,pump:93}],191:[function(e,t){function n(e,t){function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),o=t[t.length-1];return"function"==typeof r&&r!==o&&Object.keys(o).forEach(function(e){r[e]=o[e]}),r}if(e&&t)return n(e)(t);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(t){r[t]=e[t]}),r}t.exports=n},{}],192:[function(e,t){t.exports=function(){for(var e={},t=0,r;t<arguments.length;t++)for(var o in r=arguments[t],r)n.call(r,o)&&(e[o]=r[o]);return e};var n=Object.prototype.hasOwnProperty},{}],193:[function(e,t){t.exports={version:"0.105.2"}},{}],194:[function(e,t){(function(n,r){function o(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}function a(e){return"undefined"!=typeof FileList&&e instanceof FileList}const{Buffer:i}=e("safe-buffer"),{EventEmitter:s}=e("events"),d=e("simple-concat"),l=e("create-torrent"),c=e("debug")("webtorrent"),u=e("bittorrent-dht/client"),p=e("load-ip-set"),f=e("run-parallel"),h=e("parse-torrent"),m=e("path"),g=e("simple-peer"),_=e("randombytes"),b=e("speedometer"),y=e("./lib/tcp-pool"),w=e("./lib/torrent"),k=e("./package.json").version,x=k.replace(/\d*./g,e=>`0${e%100}`.slice(-2)).slice(0,4);class S extends s{constructor(e={}){super(),this.peerId="string"==typeof e.peerId?e.peerId:i.isBuffer(e.peerId)?e.peerId.toString("hex"):i.from(`-WW${x}-`+_(9).toString("base64")).toString("hex"),this.peerIdBuffer=i.from(this.peerId,"hex"),this.nodeId="string"==typeof e.nodeId?e.nodeId:i.isBuffer(e.nodeId)?e.nodeId.toString("hex"):_(20).toString("hex"),this.nodeIdBuffer=i.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=e.torrentPort||0,this.dhtPort=e.dhtPort||0,this.tracker=e.tracker===void 0?{}:e.tracker,this.torrents=[],this.maxConns=+e.maxConns||55,this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),e.rtcConfig&&(console.warn("WebTorrent: opts.rtcConfig is deprecated. Use opts.tracker.rtcConfig instead"),this.tracker.rtcConfig=e.rtcConfig),e.wrtc&&(console.warn("WebTorrent: opts.wrtc is deprecated. Use opts.tracker.wrtc instead"),this.tracker.wrtc=e.wrtc),r.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=r.WRTC)),"function"==typeof y?this._tcpPool=new y(this):n.nextTick(()=>{this._onListening()}),this._downloadSpeed=b(),this._uploadSpeed=b(),!1!==e.dht&&"function"==typeof u?(this.dht=new u(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.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 p&&null!=e.blocklist?p(e.blocklist,{headers:{"user-agent":`WebTorrent/${k} (https://webtorrent.io)`}},(e,n)=>e?this.error(`Failed to load blocklist: ${e.message}`):void(this.blocked=n,t())):n.nextTick(t)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter(e=>1!==e.progress),t=e.reduce((e,t)=>e+t.downloaded,0),n=e.reduce((e,t)=>e+(t.length||0),0)||1;return t/n}get ratio(){const e=this.torrents.reduce((e,t)=>e+t.uploaded,0),t=this.torrents.reduce((e,t)=>e+t.received,0)||1;return e/t}get(e){if(!(e instanceof w)){let t;try{t=h(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}else if(this.torrents.includes(e))return e;return null}download(e,t,n){return console.warn("WebTorrent: client.download() is deprecated. Use client.add() instead"),this.add(e,t,n)}add(e,t={},n){function r(){i.removeListener("_infoHash",o),i.removeListener("ready",a),i.removeListener("close",r)}if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]);const o=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===i.infoHash&&e!==i)return void i._destroy(new Error(`Cannot add duplicate torrent ${i.infoHash}`))},a=()=>{this.destroyed||("function"==typeof n&&n(i),this.emit("torrent",i))};this._debug("add"),t=t?Object.assign({},t):{};const i=new w(e,this,t);return this.torrents.push(i),i.once("_infoHash",o),i.once("ready",a),i.once("close",r),i}seed(e,t,n){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]),this._debug("seed"),t=t?Object.assign({},t):{},t.skipVerify=!0;const r="string"==typeof e;r&&(t.path=m.dirname(e)),t.createdBy||(t.createdBy=`WebTorrent/${x}`);const i=e=>{this._debug("on seed"),"function"==typeof n&&n(e),e.emit("seed"),this.emit("seed",e)},s=this.add(null,t,e=>{const t=[t=>r?t():void e.load(c,t)];this.dht&&t.push(t=>{e.once("dhtAnnounce",t)}),f(t,t=>this.destroyed?void 0:t?e._destroy(t):void i(e))});let c;return a(e)?e=Array.from(e):!Array.isArray(e)&&(e=[e]),f(e.map(e=>t=>{o(e)?d(e,t):t(null,e)}),(e,n)=>this.destroyed?void 0:e?s._destroy(e):void l.parseInput(n,t,(e,r)=>this.destroyed?void 0:e?s._destroy(e):void(c=r.map(e=>e.getStream),l(n,t,(e,t)=>{if(!this.destroyed){if(e)return s._destroy(e);const n=this.get(t);n?s._destroy(new Error(`Cannot add duplicate torrent ${n.infoHash}`)):s._onTorrentId(t)}})))),s}remove(e,t){this._debug("remove");const n=this.get(e);if(!n)throw new Error(`No torrent with id ${e}`);this._remove(e,t)}_remove(e,t){const n=this.get(e);n&&(this.torrents.splice(this.torrents.indexOf(n),1),n.destroy(t))}address(){return this.listening?this._tcpPool?this._tcpPool.server.address():{address:"0.0.0.0",family:"IPv4",port:0}:null}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 n=this.torrents.map(e=>t=>{e.destroy(t)});this._tcpPool&&n.push(e=>{this._tcpPool.destroy(e)}),this.dht&&n.push(e=>{this.dht.destroy(e)}),f(n,t),e&&this.emit("error",e),this.torrents=[],this._tcpPool=null,this.dht=null}_onListening(){if(this._debug("listening"),this.listening=!0,this._tcpPool){const e=this._tcpPool.server.address();e&&(this.torrentPort=e.port)}this.emit("listening")}_debug(){const e=[].slice.call(arguments);e[0]=`[${this._debugId}] ${e[0]}`,c(...e)}}S.WEBRTC_SUPPORT=g.WEBRTC_SUPPORT,S.VERSION=k,t.exports=S}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"./lib/tcp-pool":33,"./lib/torrent":5,"./package.json":193,_process:92,"bittorrent-dht/client":33,"create-torrent":44,debug:45,events:49,"load-ip-set":33,"parse-torrent":88,path:89,randombytes:99,"run-parallel":119,"safe-buffer":121,"simple-concat":122,"simple-peer":124,speedometer:151}]},{},[194])(194)}); \ No newline at end of file