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>2014-09-17 07:04:27 +0400
committerFeross Aboukhadijeh <feross@feross.org>2014-09-17 07:04:27 +0400
commit9476292466d53815f91314419e88ab55b7d22d32 (patch)
tree2bc6c1116771edab4e187866d75112fc66fff0bf
parent1840ae5625c1c19b63882f284ca5004177c43cb0 (diff)
bundle
-rw-r--r--webtorrent.min.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/webtorrent.min.js b/webtorrent.min.js
index f4e422e..9b73992 100644
--- a/webtorrent.min.js
+++ b/webtorrent.min.js
@@ -1,7 +1,5 @@
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.WebTorrent=e()}}(function(){return function e(t,n,o){function i(a,s){if(!n[a]){if(!t[a]){var d="function"==typeof require&&require;if(!s&&d)return d(a,!0);if(r)return r(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return i(n?n:e)},l,l.exports,e,t,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<o.length;a++)i(o[a]);return i}({"./":[function(e,t){(function(n){function o(e){var t=this;e||(e={}),r("new webtorrent"),i.call(t,e),t.listening=!1,e.list||(e.port!==!1&&"function"==typeof l&&(t.server=new l(t,e.port),t.server.on("listening",function(){t.listening=!0,t.emit("listening")})),t.on("torrent",t._onTorrent.bind(t)))}t.exports=o;var i=e("bittorrent-client"),r=e("debug")("webtorrent"),a=e("extend.js"),s=e("./lib/fs-storage"),d=e("inherits"),c=e("run-parallel"),l=e("./lib/server");d(o,i),o.prototype.add=o.prototype.download=function(e,t,o){var d=this;r("add %s",e),"function"==typeof t&&(o=t,t={}),t=a({storage:"function"==typeof s&&s},t),d.index=t.index;var c=i.prototype.add.call(d,e,t,o);return n.nextTick(function(){d.emit("add",c)}),d},o.prototype.destroy=function(e){var t=this;r("destroy");var n=[i.prototype.destroy.bind(t)];return t.server&&n.push(function(e){try{t.server.close(e)}catch(n){e(null)}}),c(n,e),t},o.prototype._onTorrent=function(e){var t=this;if(r("on torrent"),"number"!=typeof e.index){var n=e.files.reduce(function(e,t){return e.length>t.length?e:t});e.index=e.files.indexOf(n)}e.files[e.index].select(),t.index=e.index,t.torrent=e}}).call(this,e("_process"))},{"./lib/fs-storage":195,"./lib/server":195,_process:203,"bittorrent-client":1,debug:219,"extend.js":222,inherits:223,"run-parallel":224}],1:[function(e,t){(function(n,o){function i(e){function t(){r.ready=!0,r.emit("ready")}var r=this;return r instanceof i?(d.call(r),e||(e={}),c(r,{peerId:new o("-WW0001-"+l(48),"utf8"),nodeId:new o(l(160),"hex"),dht:"function"==typeof s,tracker:!0,torrentPort:void 0},e),r.peerId="string"==typeof r.peerId?new o(r.peerId,"utf8"):r.peerId,r.peerIdHex=r.peerId.toString("hex"),r.nodeId="string"==typeof r.nodeId?new o(r.nodeId,"hex"):r.nodeId,r.nodeIdHex=r.nodeId.toString("hex"),a("new client peerId %s nodeId %s",r.peerIdHex,r.nodeIdHex),r.torrents=[],r.downloadSpeed=m(),r.uploadSpeed=m(),r.dht&&(r.dht=new s(c({nodeId:r.nodeId},r.dht)),r.dht.listen(e.dhtPort)),void("function"==typeof u?u(e.blocklist,function(e,n){r.blocked=n,t()}):n.nextTick(t))):new i(e)}t.exports=i;var r=e("create-torrent"),a=e("debug")("bittorrent-client"),s=e("bittorrent-dht/client"),d=e("events").EventEmitter,c=e("extend.js"),l=e("hat"),p=e("inherits"),u=e("load-ip-set"),f=e("run-parallel"),h=e("parse-torrent"),m=e("speedometer"),_=e("./lib/storage"),v=e("./lib/torrent");p(i,d),i.Storage=_,Object.defineProperty(i.prototype,"ratio",{get:function(){var e=this,t=e.torrents.reduce(function(e,t){return e+t.uploaded},0),n=e.torrents.reduce(function(e,t){return e+t.downloaded},0);return 0===n?0:t/n}}),i.prototype.get=function(e){var t=this,n=h(e);if(!n||!n.infoHash)return null;for(var o=0,i=t.torrents.length;i>o;o++){var r=t.torrents[o];if(r.infoHash===n.infoHash)return r}return null},i.prototype.add=i.prototype.download=function(e,t,n){function o(e){r.infoHash===e.infoHash&&(n(r),i.removeListener("torrent",o))}var i=this;a("add %s",e),"function"==typeof t&&(n=t,t={});var r=new v(e,c({client:i},t));return i.torrents.push(r),n&&i.on("torrent",o),r.on("error",function(e){i.emit("error",e,r)}),r.on("listening",function(e){i.emit("listening",e,r)}),r.on("ready",function(){a("torrent"),i.emit("torrent",r)}),r},i.prototype.remove=function(e,t){var n=this,o=n.get(e);if(!o)throw new Error("No torrent with id "+e);a("remove"),n.torrents.splice(n.torrents.indexOf(o),1),o.destroy(t)},i.prototype.seed=function(e,t,n){function i(e){s.infoHash===e.infoHash&&(n(s),a.removeListener("seed",i))}var a=this;"function"==typeof t&&(n=t,t={});var s,d=o.concat(e.map(function(e){return e.buffer}));n&&a.on("seed",i),r(e,t,function(e,n){if(e)return a.emit("error",e);var o=h(n);a.add(n,t,function(e){s=e,_.writeToStorage(s.storage,d,o.pieceLength,function(e){return e?a.emit("error",e):void a.emit("seed",s)})})})},i.prototype.destroy=function(e){var t=this;a("destroy");var n=t.torrents.map(function(e){return function(n){t.remove(e.infoHash,n)}});t.dht&&n.push(function(e){t.dht.destroy(e)}),f(n,e)}}).call(this,e("_process"),e("buffer").Buffer)},{"./lib/storage":4,"./lib/torrent":5,_process:203,"bittorrent-dht/client":195,buffer:196,"create-torrent":8,debug:94,events:200,"extend.js":101,hat:103,inherits:104,"load-ip-set":195,"parse-torrent":105,"run-parallel":115,speedometer:116}],2:[function(e,t){function n(e,t){var i=this;if(!(i instanceof n))return new n(e,t);r.Readable.call(i,t),o("new filestream %s",JSON.stringify(t)),t||(t={}),t.start||(t.start=0),t.end||(t.end=e.length-1),i.length=t.end-t.start+1;var a=t.start+e.offset,s=t.pieceLength;i.startPiece=a/s|0,i.endPiece=(t.end+e.offset)/s|0,i._storage=e.storage,i._piece=i.startPiece,i._missing=i.length,i._reading=!1,i._notifying=!1,i._destroyed=!1,i._criticalLength=Math.min(1048576/s|0,2),i._offset=a-i.startPiece*s}t.exports=n;var o=e("debug")("bittorrent-client:file-stream"),i=e("inherits"),r=e("stream");i(n,r.Readable),n.prototype._read=function(){o("_read");var e=this;e._reading||(e._reading=!0,e.notify())},n.prototype.notify=function(){o("notify");var e=this;if(e._reading&&0!==e._missing){if(!e._storage.bitfield.get(e._piece))return e._storage.emit("critical",e._piece,e._piece+e._criticalLength);if(!e._notifying){e._notifying=!0;var t=e._piece;o("before read %s",t),e._storage.read(e._piece++,function(n,i){if(o("after read %s (buffer.length %s) (err %s)",t,i.length,n&&n.message||n),e._notifying=!1,!e._destroyed){if(n)return e._storage.emit("error",n),e.destroy(n);e._offset&&(i=i.slice(e._offset),e._offset=0),e._missing<i.length&&(i=i.slice(0,e._missing)),e._missing-=i.length,o("pushing buffer of length %s",i.length),e._reading=!1,e.push(i),0===e._missing&&e.push(null)}})}}},n.prototype.destroy=function(){var e=this;e._destroyed||(e._destroyed=!0)}},{debug:94,inherits:104,stream:216}],3:[function(e,t){function n(e,t){function o(e){e.on("have",function(e){i.pieces[e]++}),e.on("bitfield",i.recalculate.bind(i)),e.on("close",function(){for(var t=0;t<i.numPieces;++t)i.pieces[t]-=e.peerPieces.get(t)})}var i=this;return i instanceof n?(i.swarm=e,i.numPieces=t,i.swarm.wires.forEach(o),i.swarm.on("wire",function(e){i.recalculate(),o(e)}),void i.recalculate()):new n(e,t)}t.exports=n,n.prototype.recalculate=function(){var e=this;e.pieces=[];for(var t=0;t<e.numPieces;++t)e.pieces[t]=0;e.swarm.wires.forEach(function(t){for(var n=0;n<e.numPieces;++n)e.pieces[n]+=t.peerPieces.get(n)})},n.prototype.getRarestPiece=function(e){var t=this,n=[],o=1/0;e=e||function(){return!0};for(var i=0;i<t.numPieces;++i)if(e(i)){var r=t.pieces[i];r===o?n.push(i):o>r&&(n=[i],o=r)}return n.length>0?n[Math.random()*n.length|0]:-1}},{}],4:[function(e,t){(function(n,o){function i(){}function r(e,t,n){var o=this;f.call(o),o.index=e,o.hash=t,"number"==typeof n?(o.buffer=null,o.length=n):(o.buffer=n,o.length=n.length),o._reset()}function a(e,t,n,o){var i=this;f.call(i),i.storage=e,i.name=t.name,i.path=t.path,i.length=t.length,i.offset=t.offset,i.pieces=n,i.pieceLength=o,i.done=!1,i.pieces.forEach(function(e){e.on("done",function(){i._checkDone()})}),i._checkDone()}function s(e,t){var n=this;f.call(n),t=t||{},n.bitfield=new d(e.pieces.length),n.done=!1,n.closed=!1,n.readonly=!0,t.nobuffer||(n.buffer=new o(e.length));var i=e.pieceLength,s=e.lastPieceLength,c=e.pieces.length;n.pieces=e.pieces.map(function(e,t){var o=t*i,a=o+(t===c-1?s:i),d=n.buffer?n.buffer.slice(o,a):a-o,l=new r(t,e,d);return l.on("done",n._onPieceDone.bind(n,l)),l}),n.files=e.files.map(function(e){var t=e.offset,o=t+e.length-1,r=t/i|0,s=o/i|0,d=n.pieces.slice(r,s+1),c=new a(n,e,d,i);return c.on("done",n._onFileDone.bind(n,c)),c})}t.exports=s;var d=e("bitfield"),c=e("block-stream"),l=e("debug")("bittorrent-client:storage"),p=e("dezalgo"),u=e("end-of-stream"),f=e("events").EventEmitter,h=e("extend.js"),m=e("./file-stream"),_=e("inherits"),v=e("git-sha1"),g=e("stream"),b=16384,x=0,w=1,y=2;_(r,f),r.prototype.readBlock=function(e,t,n){var o=this;return n=p(n),o.buffer&&o._verifyOffset(e)?void n(null,o.buffer.slice(e,e+t)):n(new Error("invalid block offset "+e))},r.prototype.writeBlock=function(e,t,n){var o=this;if(n=p(n),!o._verifyOffset(e)||!o._verifyBlock(e,t))return n(new Error("invalid block "+e+":"+t.length));o._lazyAllocBuffer();var i=e/b;return o.blocks[i]===y?n(null):(t.copy(o.buffer,e),o.blocks[i]=y,o.blocksWritten+=1,o.blocksWritten===o.blocks.length&&o.verify(),void n(null))},r.prototype.reserveBlock=function(e){for(var t=this,n=t.blocks.length,o=0;n>o;o++)if((!t.blocks[o]||e)&&t.blocks[o]!==y)return t.blocks[o]=w,{offset:o*b,length:o===n-1?t.length-o*b:b};return null},r.prototype.cancelBlock=function(e){var t=this;if(!t.buffer||!t._verifyOffset(e))return!1;var n=e/b;return t.blocks[n]===w&&(t.blocks[n]=x),!0},r.prototype._reset=function(){var e=this;e.verified=!1,e.blocks=new o(Math.ceil(e.length/b)),e.blocks.fill(0),e.blocksWritten=0},r.prototype.verify=function(e){var t=this;e=e||t.buffer,!t.verified&&e&&(t.verified=v(e)===t.hash,t.verified?t.emit("done"):(t.emit("warning",new Error("piece "+t.index+" failed verification; "+v(e)+" expected "+t.hash)),t._reset()))},r.prototype._verifyOffset=function(e){var t=this;return e%b===0?!0:(t.emit("warning",new Error("piece "+t.index+" invalid offset "+e+" not multiple of "+b+" bytes")),!1)},r.prototype._verifyBlock=function(e,t){var n=this;return t.length===b?!0:t.length===n.length-e&&n.length-e<b?!0:(n.emit("warning",new Error("piece "+n.index+" invalid block of size "+t.length+" bytes")),!1)},r.prototype._lazyAllocBuffer=function(){var e=this;e.buffer||(e.buffer=new o(e.length))},_(a,f),a.prototype.select=function(){var e=this;e.pieces.length>0&&e.storage.emit("select",e.pieces[0].index,e.pieces[e.pieces.length-1].index,!1)},a.prototype.deselect=function(){var e=this;e.pieces.length>0&&e.storage.emit("deselect",e.pieces[0].index,e.pieces[e.pieces.length-1].index,!1)},a.prototype.createReadStream=function(e){var t=this;l("createReadStream"),e=h({pieceLength:t.pieceLength},e);var n=new m(t,e);return t.storage.emit("select",n.startPiece,n.endPiece,!0,n.notify.bind(n)),u(n,function(){t.storage.emit("deselect",n.startPiece,n.endPiece,!0)}),n},a.prototype._checkDone=function(){var e=this;e.done=e.pieces.every(function(e){return e.verified}),e.done&&n.nextTick(function(){e.emit("done")})},_(s,f),s.BLOCK_LENGTH=b,s.writeToStorage=function(e,t,n,o){var i=0,r=new g.Readable;r._read=function(){},r.pipe(new c(n,{nopad:!0})).on("data",function(t){var n=i;i+=1;var o=0,r=new c(b,{nopad:!0});r.on("data",function(t){var i=o*b;o+=1,e.writeBlock(n,i,t)}),r.write(t),r.end()}).on("end",function(){o(null)}).on("error",function(e){o(e)}),r.push(t),r.push(null)},Object.defineProperty(s.prototype,"downloaded",{get:function(){var e=this;return e.pieces.reduce(function(e,t){return e+(t.verified?t.length:t.blocksWritten*b)},0)}}),Object.defineProperty(s.prototype,"numMissing",{get:function(){for(var e=this,t=e.pieces.length,n=0,o=e.pieces.length;o>n;n++)t-=e.bitfield.get(n);return t}}),s.prototype.readBlock=function(e,t,n,o){var i=this;o=p(o);var r=i.pieces[e];return r?void r.readBlock(t,n,o):o(new Error("invalid piece index "+e))},s.prototype.writeBlock=function(e,t,n,o){var r=this;if(o||(o=i),o=p(o),r.readonly)return o(new Error("cannot write to readonly storage"));var a=r.pieces[e];return a?void a.writeBlock(t,n,o):o(new Error("invalid piece index "+e))},s.prototype.read=function(e,t,n,i){function r(){if(0>=c)return n(null,o.concat(l));var t=d,i=Math.min(b,c);d+=i,c-=i,a.readBlock(e,t,i,function(e,t){return e?n(e):(l.push(t),void r())})}var a=this;"function"==typeof t&&(i=n,n=t,t=null),n=p(n);var s=a.pieces[e];if(!s)return n(new Error("invalid piece index "+e));if(!s.verified&&!i)return n(new Error("Storage.read called on incomplete piece "+e));var d=0,c=s.length;if(t&&(d=t.offset||0,c=t.length||c),s.buffer)return n(null,s.buffer.slice(d,d+c));var l=[];r()},s.prototype.reserveBlock=function(e,t){var n=this,o=n.pieces[e];return o?o.reserveBlock(t):null},s.prototype.cancelBlock=function(e,t){var n=this,o=n.pieces[e];return o?o.cancelBlock(t):!1},s.prototype.remove=function(e){e&&p(e)(null)},s.prototype.close=function(e){var t=this;t.closed=!0,e&&p(e)(null)},s.prototype._onPieceDone=function(e){var t=this;t.bitfield.set(e.index),l("piece done "+e.index+" ("+t.numMissing+" still missing)"),t.emit("piece",e)},s.prototype._onFileDone=function(e){var t=this;l("file done "+e.name),t.emit("file",e),t._checkDone()},s.prototype._checkDone=function(){var e=this;!e.done&&e.files.every(function(e){return e.done})&&(e.done=!0,e.emit("done"))}}).call(this,e("_process"),e("buffer").Buffer)},{"./file-stream":2,_process:203,bitfield:6,"block-stream":7,buffer:196,debug:94,dezalgo:97,"end-of-stream":99,events:200,"extend.js":101,"git-sha1":102,inherits:104,stream:216}],5:[function(e,t){(function(n){function o(){}function i(e,t){function o(e){console.log(e),r=m(e),i.infoHash=r.infoHash,r.name&&(i.name=r.name),i.swarm=new b(i.infoHash,i.client.peerId,{handshake:{dht:!!i.client.dht}}),v(i.swarm,i,["warning","error"]),i.swarm.on("wire",i._onWire.bind(i)),i.swarm.on("download",i.client.downloadSpeed.bind(i.client)),i.swarm.on("upload",i.client.uploadSpeed.bind(i.client)),n.browser?i._onSwarmListening(r):i.swarm.listen(i.client.torrentPort,i._onSwarmListening.bind(i,r))}var i=this;l.call(i),d("new torrent"),i.client=t.client,i.hotswapEnabled="hotswap"in t?t.hotswap:!0,i.verify=t.verify,i.storageOpts=t.storageOpts,i.chokeTimeout=t.chokeTimeout||E,i.pieceTimeout=t.pieceTimeout||j,i.strategy=t.strategy||"sequential",i._rechokeNumSlots=t.uploads===!1||0===t.uploads?0:+t.uploads||10,i._rechokeOptimisticWire=null,i._rechokeOptimisticTime=0,i._rechokeIntervalId=null,i.ready=!1,i.files=[],i.metadata=null,i.parsedTorrent=null,i.storage=null,i.numBlockedPeers=0,i._amInterested=!1,i._destroyed=!1,i._selections=[],i._critical=[],i._storageImpl=t.storage||g;var r=m(e);if(r&&r.infoHash)o(r);else if("function"==typeof u.get&&/^https?:/.test(e))u.get(e,function(e){e.pipe(s(function(e){o(e)}))}).on("error",function(e){i.emit("error",new Error("error downloading torrent: "+e.message))});else{if("function"!=typeof p.readFile)throw new Error("invalid torrent id");p.readFile(e,function(e,t){return e?i.emit("error",new Error("invalid torrent id")):void o(t)})}}function r(e){return Math.random()*e|0}function a(e,t){for(var n=e.map(function(e,t){return t}),o=0,i=n.length;i>o;++o){var a=r(i),s=n[o];n[o]=n[a],n[a]=s}n.forEach(function(n){t(e[n],n,e)})}t.exports=i;var s=e("concat-stream"),d=e("debug")("bittorrent-client:torrent"),c=e("torrent-discovery"),l=e("events").EventEmitter,p=e("fs"),u=e("http-https"),f=e("inherits"),h=e("run-parallel"),m=e("parse-torrent"),_=e("./rarity-map"),v=e("re-emitter"),g=e("./storage"),b=e("bittorrent-swarm"),x=e("ut_metadata"),w=e("ut_pex"),y=131072,k=5,j=1e4,E=5e3,S=3*g.BLOCK_LENGTH,U=1e4,I=2;f(i,l),Object.defineProperty(i.prototype,"length",{get:function(){return this.parsedTorrent&&this.parsedTorrent.length||0}}),Object.defineProperty(i.prototype,"timeRemaining",{get:function(){return 0===this.swarm.downloadSpeed()?1/0:(this.length-this.downloaded)/this.swarm.downloadSpeed()*1e3}}),Object.defineProperty(i.prototype,"progress",{get:function(){return this.parsedTorrent&&this.downloaded/this.parsedTorrent.length||0}}),Object.defineProperty(i.prototype,"downloaded",{get:function(){return this.storage&&this.storage.downloaded||0}}),Object.defineProperty(i.prototype,"uploaded",{get:function(){return this.swarm.uploaded}}),Object.defineProperty(i.prototype,"ratio",{get:function(){return this.uploaded&&this.downloaded/this.uploaded||0}}),i.prototype._onSwarmListening=function(e,t){var n=this;n._destroyed||(n.client.torrentPort=t,n.discovery=new c({announce:e.announce,dht:n.client.dht,peerId:n.client.peerId,port:t}),n.discovery.setTorrent(n.infoHash),n.discovery.on("peer",n.addPeer.bind(n)),v(n.discovery,n,["dhtAnnounce","warning","error"]),e.info&&n._onMetadata(e),n.emit("listening",t))},i.prototype._onMetadata=function(e){var t=this;if(!t.metadata&&!t._destroyed){if(d("got metadata"),e&&e.infoHash)t.metadata=m.toBuffer(e),t.parsedTorrent=e;else{t.metadata=e;try{t.parsedTorrent=m(t.metadata)}catch(o){return t.emit("error",o)}}t.name=t.parsedTorrent.name,t.discovery.setTorrent(t.parsedTorrent),t.rarityMap=new _(t.swarm,t.parsedTorrent.pieces.length),t.storage=new t._storageImpl(t.parsedTorrent,t.storageOpts),t.storage.on("piece",t._onStoragePiece.bind(t)),t.storage.on("file",function(e){t.emit("file",e)}),t._reservations=t.storage.pieces.map(function(){return[]}),t.storage.on("done",function(){t.discovery.tracker&&t.discovery.tracker.complete(),d("torrent "+t.infoHash+" done"),t.emit("done")}),t.storage.on("select",t.select.bind(t)),t.storage.on("deselect",t.deselect.bind(t)),t.storage.on("critical",t.critical.bind(t)),t.storage.files.forEach(function(e){t.files.push(e)}),t.swarm.wires.forEach(function(e){e.ut_metadata&&e.ut_metadata.setMetadata(t.metadata),t._onWireWithMetadata(e)}),n.nextTick(t.verify?function(){d("verifying existing torrent data");var e=0,n=0;h(t.storage.pieces.map(function(o){return function(i){t.storage.read(o.index,function(r,a){e+=1,t.emit("verifying",{percentDone:100*e/t.storage.pieces.length,percentVerified:100*n/t.storage.pieces.length}),!r&&a&&(o.verify(a),n+=o.verified,d("piece "+(o.verified?"verified":"invalid")+" "+o.index)),i()},!0)}}),t._onStorage.bind(t))}:t._onStorage.bind(t)),n.nextTick(function(){t.emit("metadata")})}},i.prototype.destroy=function(e){var t=this;d("destroy"),t._destroyed=!0,clearInterval(t._rechokeIntervalId);var n=[];t.swarm&&n.push(function(e){t.swarm.destroy(e)}),t.discovery&&n.push(function(e){t.discovery.stop(e)}),t.storage&&n.push(function(e){t.storage.close(e)}),h(n,e)},i.prototype.addPeer=function(e){var t=this;"string"==typeof e&&t.client.blocked&&t.client.blocked.contains(e.split(":")[0])?(t.numBlockedPeers+=1,t.emit("blocked-peer",e)):(t.emit("peer",e),t.swarm.addPeer(e))},i.prototype.select=function(e,t,n,i){var r=this;if(e>t||0>e||t>=r.storage.pieces.length)throw new Error("invalid selection ",e,":",t);n=Number(n)||0,d("select %s-%s (priority %s)",e,t,n),r._selections.push({from:e,to:t,offset:0,priority:n,notify:i||o}),r._selections.sort(function(e,t){return t.priority-e.priority}),r._updateSelections()},i.prototype.deselect=function(e,t,n){var o=this;n=Number(n)||0,d("deselect %s-%s (priority %s)",e,t,n);for(var i=0;i<o._selections.length;++i){var r=o._selections[i];if(r.from===e&&r.to===t&&r.priority===n){o._selections.splice(i--,1);break}}o._updateSelections()},i.prototype.critical=function(e,t){var n=this;d("critical %s-%s",e,t);for(var o=e;t>=o;++o)n._critical[o]=!0;n._updateSelections()},i.prototype._onWire=function(e){var t=this;e.use(x(t.metadata)),t.metadata||(e.ut_metadata.on("metadata",function(e){d("got metadata via ut_metadata"),t._onMetadata(e)}),e.ut_metadata.fetch()),"function"==typeof w&&e.use(w()),e.ut_pex&&e.ut_pex.on("peer",function(e){d("got peer via ut_pex "+e),t.addPeer(e)}),e.ut_pex&&e.ut_pex.on("dropped",function(e){e in t.swarm._peers||t.swarm.removePeer(e)}),e.setKeepAlive(!0),e.peerExtensions.dht&&t.client.dht&&t.client.dht.port&&e.port(t.client.dht.port),e.on("port",function(){d("port message from "+e.remoteAddress)}),e.on("timeout",function(){d("wire timeout from "+e.remoteAddress),e.destroy()}),e.setTimeout(t.pieceTimeout),t.metadata&&t._onWireWithMetadata(e)},i.prototype._onWireWithMetadata=function(e){function t(){o._destroyed||e._destroyed||(o.swarm.numQueued>2*(o.swarm.numConns-o.swarm.numPeers)&&e.amInterested?e.destroy():i=setTimeout(t,r))}function n(){if(e.peerPieces.length===o.storage.pieces.length){for(;a<o.storage.pieces.length;++a)if(!e.peerPieces.get(a))return;e.isSeeder=!0,e.choke()}}var o=this,i=null,r=o.chokeTimeout,a=0;e.on("bitfield",function(){n(),o._update()}),e.on("have",function(){n(),o._update()}),e.once("interested",function(){e.unchoke()}),e.on("close",function(){clearTimeout(i)}),e.on("choke",function(){clearTimeout(i),i=setTimeout(t,r)}),e.on("unchoke",function(){clearTimeout(i),o._update()}),e.on("request",function(t,n,i,r){return i>y?(d(e.remoteAddress,"requested invalid block size",i),e.destroy()):void o.storage.readBlock(t,n,i,r)}),e.bitfield(o.storage.bitfield),e.interested(),i=setTimeout(t,r),e.isSeeder=!1,n(),o._updateSelections()},i.prototype._onStorage=function(){var e=this;d("on storage"),e.storage.readonly=!1,e.select(0,e.storage.pieces.length-1,!1),e._rechokeIntervalId=setInterval(e._rechoke.bind(e),U),e._rechokeIntervalId.unref&&e._rechokeIntervalId.unref(),n.nextTick(function(){e.ready=!0,e.emit("ready")})},i.prototype._onStoragePiece=function(e){var t=this;d("piece done %s",e.index),t._reservations[e.index]=null,t.swarm.wires.forEach(function(t){t.have(e.index)}),t._gcSelections()},i.prototype._updateSelections=function(){var e=this;if(e.swarm&&!e._destroyed){if(!e.metadata)return e.once("metadata",e._updateSelections.bind(e));n.nextTick(e._gcSelections.bind(e)),e._updateInterest(),e._update()}},i.prototype._gcSelections=function(){for(var e=this,t=0;t<e._selections.length;t++){for(var n=e._selections[t],o=n.offset;e.storage.bitfield.get(n.from+n.offset)&&n.from+n.offset<n.to;)n.offset++;o!==n.offset&&n.notify(),n.to===n.from+n.offset&&e.storage.bitfield.get(n.from+n.offset)&&(e._selections.splice(t--,1),n.notify(),e._updateInterest())}e._selections.length||e.emit("idle")},i.prototype._updateInterest=function(){var e=this,t=e._amInterested;e._amInterested=!!e._selections.length,e.swarm.wires.forEach(function(t){e._amInterested?t.interested():t.uninterested()}),t!==e._amInterested&&e.emit(e._amInterested?"interested":"uninterested")},i.prototype._update=function(){var e=this;e._destroyed||a(e.swarm.wires,e._updateWire.bind(e))},i.prototype._updateWire=function(e){function t(t,n,o,i){return function(r){return r>=t&&n>=r&&!(r in o)&&e.peerPieces.get(r)&&(!i||i(r))}}function n(){if(!e.requests.length)for(var n=a._selections.length;n--;){var o,i=a._selections[n];if("rarest"===a.strategy)for(var r=i.from+i.offset,s=i.to,d=s-r+1,c={},l=0,p=t(r,s,c);d>l&&(o=a.rarityMap.getRarestPiece(p),!(0>o));){if(a._request(e,o,!1))return;c[o]=!0,l+=1}else for(o=i.to;o>=i.from+i.offset;--o)if(e.peerPieces.get(o)&&a._request(e,o,!1))return}}function o(){var t=e.downloadSpeed()||1;if(t>S)return function(){return!0};var n=k*g.BLOCK_LENGTH/t,o=10,i=0;return function(e){if(!o||a.storage.bitfield.get(e))return!0;for(var r=a.storage.pieces[e],s=r.blocks.length-r.blocksWritten;i<a.swarm.wires.length;i++){var d=a.swarm.wires[i],c=d.downloadSpeed();if(!(S>c||t>=c||!d.peerPieces.get(e)||(s-=c*n)>0))return o--,!1}return!0}}function i(e){for(var t=e,n=e;n<a._selections.length&&a._selections[n].priority;n++)t=n;var o=a._selections[e];a._selections[e]=a._selections[t],a._selections[t]=o}function r(n){if(e.requests.length>=k)return!0;for(var r=o(),s=0;s<a._selections.length;s++){var d,c=a._selections[s];if("rarest"===a.strategy)for(var l=c.from+c.offset,p=c.to,u=p-l+1,f={},h=0,m=t(l,p,f,r);u>h&&(d=a.rarityMap.getRarestPiece(m),!(0>d));){for(;a._request(e,d,a._critical[d]||n););if(!(e.requests.length<k))return c.priority&&i(s),!0;f[d]=!0,h++}else for(d=c.from+c.offset;d<=c.to;d++)if(e.peerPieces.get(d)&&r(d)){for(;a._request(e,d,a._critical[d]||n););if(!(e.requests.length<k))return c.priority&&i(s),!0}}return!1}var a=this;if(!e.peerChoking)return e.downloaded?void(r(!1)||r(!0)):n()},i.prototype._rechoke=function(){function e(e,t){return e.downloadSpeed!==t.downloadSpeed?t.downloadSpeed-e.downloadSpeed:e.uploadSpeed!==t.uploadSpeed?t.uploadSpeed-e.uploadSpeed:e.wire.amChoking!==t.wire.amChoking?e.wire.amChoking?1:-1:e.salt-t.salt}var t=this;t._rechokeOptimisticTime>0?t._rechokeOptimisticTime-=1:t._rechokeOptimisticWire=null;var n=[];t.swarm.wires.forEach(function(e){e.isSeeder||e===t._rechokeOptimisticWire||n.push({wire:e,downloadSpeed:e.downloadSpeed(),uploadSpeed:e.uploadSpeed(),salt:Math.random(),isChoked:!0})}),n.sort(e);for(var o=0,i=0;i<n.length&&o<t._rechokeNumSlots;++i)n[i].isChoked=!1,n[i].wire.peerInterested&&(o+=1);if(!t._rechokeOptimisticWire&&i<n.length&&t._rechokeNumSlots){var a=n.slice(i).filter(function(e){return e.wire.peerInterested}),s=a[r(a.length)];s&&(s.isChoked=!1,t._rechokeOptimisticWire=s.wire,t._rechokeOptimisticTime=I)}n.forEach(function(e){e.wire.amChoking!==e.isChoked&&(e.isChoked?e.wire.choke():e.wire.unchoke())})},i.prototype._hotswap=function(e,t){var n=this;if(!n.hotswapEnabled)return!1;var o=e.downloadSpeed();if(o<g.BLOCK_LENGTH)return!1;if(!n._reservations[t])return!1;var i=n._reservations[t];if(!i)return!1;var r,a,s=1/0;for(a=0;a<i.length;a++){var d=i[a];if(d&&d!==e){var c=d.downloadSpeed();c>=S||2*c>o||c>s||(r=d,s=c)}}if(!r)return!1;for(a=0;a<i.length;a++)i[a]===r&&(i[a]=null);for(a=0;a<r.requests.length;a++){var l=r.requests[a];l.piece===t&&n.storage.cancelBlock(t,l.offset)}return n.emit("hotswap",r,e,t),!0},i.prototype._request=function(e,t,o){function i(o,a){return r.ready?(l[p]===e&&(l[p]=null),o?(d("error getting piece "+t+"(offset: "+c.offset+" length: "+c.length+") from "+e.remoteAddress+" "+o.message),r.storage.cancelBlock(t,c.offset),n.nextTick(r._update.bind(r)),!1):void r.storage.writeBlock(t,c.offset,a,function(e){e&&(d("error writing block"),r.storage.cancelBlock(t,c.offset)),n.nextTick(r._update.bind(r))})):void r.once("ready",function(){i(o,a)})}var r=this,a=e.requests.length;if(r.storage.bitfield.get(t))return!1;if(a>=k)return!1;var s=0===e.requests.length&&r.storage.numMissing<30,c=r.storage.reserveBlock(t,s);if(!c&&!s&&o&&r._hotswap(e,t)&&(c=r.storage.reserveBlock(t,!1)),!c)return!1;var l=r._reservations[t];l||(l=r._reservations[t]=[]);var p=l.indexOf(null);return-1===p&&(p=l.length),l[p]=e,e.request(t,c.offset,c.length,i),!0}}).call(this,e("_process"))},{"./rarity-map":3,"./storage":4,_process:203,"bittorrent-swarm":175,"concat-stream":195,debug:94,events:200,fs:193,"http-https":195,inherits:104,"parse-torrent":105,"re-emitter":114,"run-parallel":115,"torrent-discovery":117,ut_metadata:168,ut_pex:195}],6:[function(e,t){(function(e){function n(e,t){return this instanceof n?(0===arguments.length&&(e=0),this.grow=t&&(isFinite(t.grow)&&o(t.grow)||t.grow)||0,("number"==typeof e||void 0===e)&&(e=new i(o(e)),e.fill&&e.fill(0)),void(this.buffer=e)):new n(e)}function o(e){var t=e>>3;return e%8!==0&&t++,t}var i="undefined"!=typeof e?e:"undefined"!=typeof Int8Array?Int8Array:function(e){for(var t=new Array(e),n=0;e>n;n++)t[n]=0};n.prototype.get=function(e){var t=e>>3;return t<this.buffer.length&&!!(this.buffer[t]&128>>e%8)},n.prototype.set=function(e,t){var n=e>>3;t||1===arguments.length?(this._grow(n+1),this.buffer[n]|=128>>e%8):n<this.buffer.length&&(this.buffer[n]&=~(128>>e%8))},n.prototype._grow=function(e){if(this.buffer.length<e&&e<=this.grow){var t=new i(e);t.fill&&t.fill(0);for(var n=0;n<this.buffer.length;n++)t[n]=this.buffer[n];this.buffer=t}},"undefined"!=typeof t&&(t.exports=n)}).call(this,e("buffer").Buffer)},{buffer:196}],7:[function(e,t){(function(n,o){function i(e,t){if(this.writable=this.readable=!0,this._opt=t||{},this._chunkSize=e||512,this._offset=0,this._buffer=[],this._bufferLength=0,this._opt.nopad)this._zeroes=!1;else{this._zeroes=new o(this._chunkSize);for(var n=0;n<this._chunkSize;n++)this._zeroes[n]=0}}t.exports=i;{var r=e("stream").Stream,a=e("inherits"),s=e("assert").ok;n.env.DEBUG?console.error:function(){}}a(i,r),i.prototype.write=function(e){if(this._ended)throw new Error("BlockStream: write after end");if(e&&!o.isBuffer(e)&&(e=new o(e+"")),e.length&&(this._buffer.push(e),this._bufferLength+=e.length),this._bufferLength>=this._chunkSize){if(this._paused)return this._needDrain=!0,!1;this._emitChunk()}return!0},i.prototype.pause=function(){this._paused=!0},i.prototype.resume=function(){return this._paused=!1,this._emitChunk()},i.prototype.end=function(e){"function"==typeof e&&(cb=e,e=null),e&&this.write(e),this._ended=!0,this.flush()},i.prototype.flush=function(){this._emitChunk(!0)},i.prototype._emitChunk=function(e){if(e&&this._zeroes){var t=this._bufferLength%this._chunkSize;0!==t&&(t=this._chunkSize-t),t>0&&(this._buffer.push(this._zeroes.slice(0,t)),this._bufferLength+=t)}if(!this._emitting&&!this._paused){this._emitting=!0;for(var n=0;this._bufferLength>=this._chunkSize&&(e||!this._paused);){for(var i,r=0,a=this._chunkSize;a>0&&(e||!this._paused);){var d=this._buffer[n],c=d.length-this._offset;i||a>c?(i=i||new o(this._chunkSize),d.copy(i,r,this._offset,this._offset+Math.min(c,a))):i=d.length===a&&0===this._offset?d:d.slice(this._offset,this._offset+a),c>a?(this._offset+=a,a=0):(a-=c,r+=c,n++,this._offset=0)}this._bufferLength-=this._chunkSize,s(i.length===this._chunkSize),this.emit("data",i),i=null}if(this._buffer=this._buffer.slice(n),this._paused)return this._needsDrain=!0,void(this._emitting=!1);var l=this._buffer.length;if(e&&!this._zeroes&&l){if(1===l)this._offset?this.emit("data",this._buffer[0].slice(this._offset)):this.emit("data",this._buffer[0]);else{for(var a=this._bufferLength,i=new o(a),r=0,p=0;l>p;p++){var d=this._buffer[p],c=d.length-this._offset;d.copy(i,r,this._offset),this._offset=0,r+=c,this._bufferLength-=c}this.emit("data",i)}this._buffer.length=0,this._bufferLength=0,this._offset=0}this._needDrain&&(this._needDrain=!1,this.emit("drain")),0===this._bufferLength&&this._ended&&!this._endEmitted&&(this._endEmitted=!0,this.emit("end")),this._emitting=!1}}}).call(this,e("_process"),e("buffer").Buffer)},{_process:203,assert:194,buffer:196,inherits:104,stream:216}],8:[function(e,t){(function(n){function o(e,t,o){"function"==typeof t&&(o=t,t={});var i;if(l(e)&&(e=[e]),Array.isArray(e)&&e.length>0)t.name=t.name||e[0].name,i=e.map(function(e){if(e){var t={length:e.size,path:[e.name]};if(l(e))t.stream=new m(e);else{if(!n.isBuffer(e.buffer))throw new Error("Array must contain only File objects");t.stream=new y.PassThrough,t.stream.end(e.buffer)}return t}}),d(i,t,o);else{if("string"!=typeof e)throw new Error("invalid input type");t.name=t.name||h.basename(e),a(r,e,function(n,i){if(n)return o(n);i=Array.isArray(i)?_(i):[i];var r=h.normalize(e)+h.sep;i.forEach(function(e){e.stream=v.createReadStream(e.path),e.path=e.path.replace(r,"").split(h.sep)}),d(i,t,o)})}}function i(e,t,n){var o=e.map(function(e){return function(n){t(e,n)}});x(o,n)}function r(e,t){t=b(t),v.stat(e,function(n,o){if(n)return t(n);var i={length:o.size,path:e};t(null,i)})}function a(e,t,n){v.readdir(t,function(o,r){o&&"ENOTDIR"===o.code?e(t,n):o?n(o):i(r,function(n,o){a(e,h.join(t,n),o)},n)})}function s(e,t,o){o=b(o);var i="",r=e.map(function(e){return e.stream});new g(r).pipe(new u(t,{nopad:!0})).on("data",function(e){i+=w(e)}).on("end",function(){o(null,new n(i,"hex"))}).on("error",function(e){console.error(e),o(e)})}function d(e,t,n){var i=void 0!==t.announceList?t.announceList:o.announceList,r={info:{name:t.name},announce:i[0][0],"announce-list":i,"creation date":Number(t.creationDate)||Date.now(),encoding:"UTF-8"};void 0!==t.comment&&(r.info.comment=t.comment),void 0!==t.createdBy&&(r.info["created by"]=t.createdBy),void 0!==t.private&&(r.info.private=Number(t.private)),void 0!==t.urlList&&(r["url-list"]=t.urlList);var a=1===e.length,d=e.reduce(c,0),l=t.pieceLength||f(d);r.info["piece length"]=l,a&&(r.info.length=d),s(e,l,function(t,o){return t?n(t):(r.info.pieces=o,e.forEach(function(e){delete e.stream}),a||(r.info.files=e),void n(null,p.encode(r)))
-})}function c(e,t){return e+t.length}function l(e){return"undefined"!=typeof Blob&&e instanceof Blob}t.exports=o;var p=e("bencode"),u=e("block-stream"),f=e("piece-length"),h=e("path"),m=e("filestream/read"),_=e("lodash.flatten"),v=e("fs"),g=e("multistream"),b=e("once"),x=e("run-parallel"),w=e("git-sha1"),y=e("stream");o.announceList=[["udp://tracker.publicbt.com:80"],["udp://tracker.openbittorrent.com:80"],["udp://tracker.webtorrent.io:80"],["wss://tracker.webtorrent.io"]]}).call(this,e("buffer").Buffer)},{bencode:9,"block-stream":12,buffer:196,"filestream/read":16,fs:193,"git-sha1":17,"lodash.flatten":19,multistream:88,once:90,path:202,"piece-length":91,"run-parallel":93,stream:216}],9:[function(e,t){t.exports={encode:e("./lib/encode"),decode:e("./lib/decode")}},{"./lib/decode":10,"./lib/encode":11}],10:[function(e,t){(function(e){function n(t,o){return n.position=0,n.encoding=o||null,n.data=e.isBuffer(t)?t:new e(t),n.next()}n.position=0,n.data=null,n.encoding=null,n.next=function(){switch(n.data[n.position]){case 100:return n.dictionary();case 108:return n.list();case 105:return n.integer();default:return n.bytes()}},n.find=function(e){for(var t=n.position,o=n.data.length,i=n.data;o>t;){if(i[t]===e)return t;t++}throw new Error('Invalid data: Missing delimiter "'+String.fromCharCode(e)+'" [0x'+e.toString(16)+"]")},n.dictionary=function(){n.position++;for(var e={};101!==n.data[n.position];)e[n.bytes()]=n.next();return n.position++,e},n.list=function(){n.position++;for(var e=[];101!==n.data[n.position];)e.push(n.next());return n.position++,e},n.integer=function(){var e=n.find(101),t=n.data.toString("ascii",n.position+1,e);return n.position+=e+1-n.position,parseInt(t,10)},n.bytes=function(){var e=n.find(58),t=parseInt(n.data.toString("ascii",n.position,e),10),o=++e+t;return n.position=o,n.encoding?n.data.toString(n.encoding,e,o):n.data.slice(e,o)},t.exports=n}).call(this,e("buffer").Buffer)},{buffer:196}],11:[function(e,t){(function(e){function n(t){var o=[];return n._encode(o,t),e.concat(o)}n._floatConversionDetected=!1,n._encode=function(t,o){if(e.isBuffer(o))return t.push(new e(o.length+":")),void t.push(o);switch(typeof o){case"string":n.bytes(t,o);break;case"number":n.number(t,o);break;case"object":o.constructor===Array?n.list(t,o):n.dict(t,o)}};var o=new e("e"),i=new e("d"),r=new e("l");n.bytes=function(t,n){t.push(new e(e.byteLength(n)+":"+n))},n.number=function(t,o){var i=2147483648,r=o/i<<0,a=o%i<<0,s=r*i+a;t.push(new e("i"+s+"e")),s===o||n._floatConversionDetected||(n._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value "'+o+'":','Bencoding only defines support for integers, value was converted to "'+s+'"'),console.trace())},n.dict=function(e,t){e.push(i);for(var r,a=0,s=Object.keys(t).sort(),d=s.length;d>a;a++)r=s[a],n.bytes(e,r),n._encode(e,t[r]);e.push(o)},n.list=function(e,t){var i=0,a=t.length;for(e.push(r);a>i;i++)n._encode(e,t[i]);e.push(o)},t.exports=n}).call(this,e("buffer").Buffer)},{buffer:196}],12:[function(e,t){t.exports=e(7)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/block-stream/block-stream.js":7,_process:203,assert:194,buffer:196,inherits:18,stream:216}],13:[function(e,t){t.exports=function(e){for(var t,n=[].slice.call(arguments,1),o=0,i=n.length;i>o;o++){t=n[o];for(var r in t)e[r]=t[r]}return e}},{}],14:[function(e,t,n){var o=e("./types");n.types=o,n.lookup=function(e){return"."==e[0]&&(e=e.slice(1)),o[e]}},{"./types":15}],15:[function(e,t){t.exports={123:"application/vnd.lotus-1-2-3",ez:"application/andrew-inset",aw:"application/applixware",atom:"application/atom+xml",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",ccxml:"application/ccxml+xml",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",cu:"application/cu-seeme",davmount:"application/davmount+xml",dbk:"application/docbook+xml",dssc:"application/dssc+der",xdssc:"application/dssc+xml",ecma:"application/ecmascript",emma:"application/emma+xml",epub:"application/epub+zip",exi:"application/exi",pfr:"application/font-tdpfr",gml:"application/gml+xml",gpx:"application/gpx+xml",gxf:"application/gxf",stk:"application/hyperstudio",ink:"application/inkml+xml",inkml:"application/inkml+xml",ipfix:"application/ipfix",jar:"application/java-archive",ser:"application/java-serialized-object","class":"application/java-vm",js:"application/javascript",json:"application/json",jsonml:"application/jsonml+json",lostxml:"application/lost+xml",hqx:"application/mac-binhex40",cpt:"application/mac-compactpro",mads:"application/mads+xml",mrc:"application/marc",mrcx:"application/marcxml+xml",ma:"application/mathematica",nb:"application/mathematica",mb:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mscml:"application/mediaservercontrol+xml",metalink:"application/metalink+xml",meta4:"application/metalink4+xml",mets:"application/mets+xml",mods:"application/mods+xml",m21:"application/mp21",mp21:"application/mp21",mp4s:"application/mp4",doc:"application/msword",dot:"application/msword",mxf:"application/mxf",bin:"application/octet-stream",dms:"application/octet-stream",lrf:"application/octet-stream",mar:"application/octet-stream",so:"application/octet-stream",dist:"application/octet-stream",distz:"application/octet-stream",pkg:"application/octet-stream",bpk:"application/octet-stream",dump:"application/octet-stream",elc:"application/octet-stream",deploy:"application/octet-stream",oda:"application/oda",opf:"application/oebps-package+xml",ogx:"application/ogg",omdoc:"application/omdoc+xml",onetoc:"application/onenote",onetoc2:"application/onenote",onetmp:"application/onenote",onepkg:"application/onenote",oxps:"application/oxps",xer:"application/patch-ops-error+xml",pdf:"application/pdf",pgp:"application/pgp-encrypted",asc:"application/pgp-signature",sig:"application/pgp-signature",prf:"application/pics-rules",p10:"application/pkcs10",p7m:"application/pkcs7-mime",p7c:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p8:"application/pkcs8",ac:"application/pkix-attr-cert",cer:"application/pkix-cert",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",pki:"application/pkixcmp",pls:"application/pls+xml",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",cww:"application/prs.cww",pskcxml:"application/pskc+xml",rdf:"application/rdf+xml",rif:"application/reginfo+xml",rnc:"application/relax-ng-compact-syntax",rl:"application/resource-lists+xml",rld:"application/resource-lists-diff+xml",rs:"application/rls-services+xml",gbr:"application/rpki-ghostbusters",mft:"application/rpki-manifest",roa:"application/rpki-roa",rsd:"application/rsd+xml",rss:"application/rss+xml",rtf:"application/rtf",sbml:"application/sbml+xml",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",sdp:"application/sdp",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",shf:"application/shf+xml",smi:"application/smil+xml",smil:"application/smil+xml",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",sru:"application/sru+xml",ssdl:"application/ssdl+xml",ssml:"application/ssml+xml",tei:"application/tei+xml",teicorpus:"application/tei+xml",tfi:"application/thraud+xml",tsd:"application/timestamped-data",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap",pwn:"application/vnd.3m.post-it-notes",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",acutc:"application/vnd.acucorp",air:"application/vnd.adobe.air-application-installer-package+zip",fcdt:"application/vnd.adobe.formscentral.fcdt",fxp:"application/vnd.adobe.fxp",fxpl:"application/vnd.adobe.fxp",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",acc:"application/vnd.americandynamics.acc",ami:"application/vnd.amiga.ami",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",mpkg:"application/vnd.apple.installer+xml",m3u8:"application/vnd.apple.mpegurl",swi:"application/vnd.aristanetworks.swi",iota:"application/vnd.astraea-software.iota",aep:"application/vnd.audiograph",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",rep:"application/vnd.businessobjects",cdxml:"application/vnd.chemdraw+xml",mmd:"application/vnd.chipnuts.karaoke-mmd",cdy:"application/vnd.cinderella",cla:"application/vnd.claymore",rp9:"application/vnd.cloanto.rp9",c4g:"application/vnd.clonk.c4group",c4d:"application/vnd.clonk.c4group",c4f:"application/vnd.clonk.c4group",c4p:"application/vnd.clonk.c4group",c4u:"application/vnd.clonk.c4group",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",csp:"application/vnd.commonspace",cdbcmsg:"application/vnd.contact.cmsg",cmc:"application/vnd.cosmocaller",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",pml:"application/vnd.ctc-posml",ppd:"application/vnd.cups-ppd",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",dart:"application/vnd.dart",rdz:"application/vnd.data-vision.rdz",uvf:"application/vnd.dece.data",uvvf:"application/vnd.dece.data",uvd:"application/vnd.dece.data",uvvd:"application/vnd.dece.data",uvt:"application/vnd.dece.ttml+xml",uvvt:"application/vnd.dece.ttml+xml",uvx:"application/vnd.dece.unspecified",uvvx:"application/vnd.dece.unspecified",uvz:"application/vnd.dece.zip",uvvz:"application/vnd.dece.zip",fe_launch:"application/vnd.denovo.fcselayout-link",dna:"application/vnd.dna",mlp:"application/vnd.dolby.mlp",dpg:"application/vnd.dpgraph",dfac:"application/vnd.dreamfactory",kpxx:"application/vnd.ds-keypoint",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",geo:"application/vnd.dynageo",mag:"application/vnd.ecowin.chart",nml:"application/vnd.enliven",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",qam:"application/vnd.epson.quickanime",slt:"application/vnd.epson.salt",ssf:"application/vnd.epson.ssf",es3:"application/vnd.eszigno3+xml",et3:"application/vnd.eszigno3+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fdf:"application/vnd.fdf",mseed:"application/vnd.fdsn.mseed",seed:"application/vnd.fdsn.seed",dataless:"application/vnd.fdsn.seed",gph:"application/vnd.flographit",ftc:"application/vnd.fluxtime.clip",fm:"application/vnd.framemaker",frame:"application/vnd.framemaker",maker:"application/vnd.framemaker",book:"application/vnd.framemaker",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",fsc:"application/vnd.fsc.weblaunch",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",fzs:"application/vnd.fuzzysheet",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gex:"application/vnd.geometry-explorer",gre:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gmx:"application/vnd.gmx",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gqs:"application/vnd.grafeq",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",hal:"application/vnd.hal+xml",zmm:"application/vnd.handheld-entertainment+xml",hbci:"application/vnd.hbci",les:"application/vnd.hhe.lesson-player",hpgl:"application/vnd.hp-hpgl",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",pclxl:"application/vnd.hp-pclxl","sfd-hdstx":"application/vnd.hydrostatix.sof-data",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",listafp:"application/vnd.ibm.modcap",list3820:"application/vnd.ibm.modcap",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",icc:"application/vnd.iccprofile",icm:"application/vnd.iccprofile",igl:"application/vnd.igloader",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",igm:"application/vnd.insors.igm",xpw:"application/vnd.intercon.formnet",xpx:"application/vnd.intercon.formnet",i2g:"application/vnd.intergeo",qbo:"application/vnd.intu.qbo",qfx:"application/vnd.intu.qfx",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",xpr:"application/vnd.is-xpr",fcs:"application/vnd.isac.fcs",jam:"application/vnd.jam",rms:"application/vnd.jcp.javame.midlet-rms",jisp:"application/vnd.jisp",joda:"application/vnd.joost.joda-archive",ktz:"application/vnd.kahootz",ktr:"application/vnd.kahootz",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",kpt:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",kwt:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",knp:"application/vnd.kinar",skp:"application/vnd.koan",skd:"application/vnd.koan",skt:"application/vnd.koan",skm:"application/vnd.koan",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",portpkg:"application/vnd.macports.portpkg",mcd:"application/vnd.mcd",mc1:"application/vnd.medcalcdata",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",mif:"application/vnd.mif",daf:"application/vnd.mobius.daf",dis:"application/vnd.mobius.dis",mbk:"application/vnd.mobius.mbk",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",plc:"application/vnd.mobius.plc",txf:"application/vnd.mobius.txf",mpn:"application/vnd.mophun.application",mpc:"application/vnd.mophun.certificate",xul:"application/vnd.mozilla.xul+xml",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",xls:"application/vnd.ms-excel",xlm:"application/vnd.ms-excel",xla:"application/vnd.ms-excel",xlc:"application/vnd.ms-excel",xlt:"application/vnd.ms-excel",xlw:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",eot:"application/vnd.ms-fontobject",chm:"application/vnd.ms-htmlhelp",ims:"application/vnd.ms-ims",lrm:"application/vnd.ms-lrm",thmx:"application/vnd.ms-officetheme",cat:"application/vnd.ms-pki.seccat",stl:"application/vnd.ms-pki.stl",ppt:"application/vnd.ms-powerpoint",pps:"application/vnd.ms-powerpoint",pot:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",mpt:"application/vnd.ms-project",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wps:"application/vnd.ms-works",wks:"application/vnd.ms-works",wcm:"application/vnd.ms-works",wdb:"application/vnd.ms-works",wpl:"application/vnd.ms-wpl",xps:"application/vnd.ms-xpsdocument",mseq:"application/vnd.mseq",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",taglet:"application/vnd.mynfc",nlu:"application/vnd.neurolanguage.nlu",ntf:"application/vnd.nitf",nitf:"application/vnd.nitf",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",oth:"application/vnd.oasis.opendocument.text-web",xo:"application/vnd.olpc-sugar",dd2:"application/vnd.oma.dd2+xml",oxt:"application/vnd.openofficeorg.extension",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",mgp:"application/vnd.osgeo.mapguide.package",dp:"application/vnd.osgi.dp",esa:"application/vnd.osgi.subsystem",pdb:"application/vnd.palm",pqa:"application/vnd.palm",oprc:"application/vnd.palm",paw:"application/vnd.pawaafile",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",efif:"application/vnd.picsel",wg:"application/vnd.pmi.widget",plf:"application/vnd.pocketlearn",pbd:"application/vnd.powerbuilder6",box:"application/vnd.previewsystems.box",mgz:"application/vnd.proteus.magazine",qps:"application/vnd.publishare-delta-tree",ptid:"application/vnd.pvi.ptid1",qxd:"application/vnd.quark.quarkxpress",qxt:"application/vnd.quark.quarkxpress",qwd:"application/vnd.quark.quarkxpress",qwt:"application/vnd.quark.quarkxpress",qxl:"application/vnd.quark.quarkxpress",qxb:"application/vnd.quark.quarkxpress",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",cryptonote:"application/vnd.rig.cryptonote",cod:"application/vnd.rim.cod",rm:"application/vnd.rn-realmedia",rmvb:"application/vnd.rn-realmedia-vbr",link66:"application/vnd.route66.link66+xml",st:"application/vnd.sailingtracker.track",see:"application/vnd.seemail",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",twd:"application/vnd.simtech-mindmapper",twds:"application/vnd.simtech-mindmapper",mmf:"application/vnd.smaf",teacher:"application/vnd.smart.teacher",sdkm:"application/vnd.solent.sdkm+xml",sdkd:"application/vnd.solent.sdkm+xml",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",vor:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",smzip:"application/vnd.stepmania.package",sm:"application/vnd.stepmania.stepchart",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",sus:"application/vnd.sus-calendar",susp:"application/vnd.sus-calendar",svd:"application/vnd.svd",sis:"application/vnd.symbian.install",sisx:"application/vnd.symbian.install",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",tao:"application/vnd.tao.intent-module-archive",pcap:"application/vnd.tcpdump.pcap",cap:"application/vnd.tcpdump.pcap",dmp:"application/vnd.tcpdump.pcap",tmo:"application/vnd.tmobile-livetv",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",tra:"application/vnd.trueapp",ufd:"application/vnd.ufdl",ufdl:"application/vnd.ufdl",utz:"application/vnd.uiq.theme",umj:"application/vnd.umajin",unityweb:"application/vnd.unity",uoml:"application/vnd.uoml+xml",vcx:"application/vnd.vcx",vsd:"application/vnd.visio",vst:"application/vnd.visio",vss:"application/vnd.visio",vsw:"application/vnd.visio",vis:"application/vnd.visionary",vsf:"application/vnd.vsf",wbxml:"application/vnd.wap.wbxml",wmlc:"application/vnd.wap.wmlc",wmlsc:"application/vnd.wap.wmlscriptc",wtb:"application/vnd.webturbo",nbp:"application/vnd.wolfram.player",wpd:"application/vnd.wordperfect",wqd:"application/vnd.wqd",stf:"application/vnd.wt.stf",xar:"application/vnd.xara",xfdl:"application/vnd.xfdl",hvd:"application/vnd.yamaha.hv-dic",hvs:"application/vnd.yamaha.hv-script",hvp:"application/vnd.yamaha.hv-voice",osf:"application/vnd.yamaha.openscoreformat",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",saf:"application/vnd.yamaha.smaf-audio",spf:"application/vnd.yamaha.smaf-phrase",cmp:"application/vnd.yellowriver-custom-menu",zir:"application/vnd.zul",zirz:"application/vnd.zul",zaz:"application/vnd.zzazz.deck+xml",vxml:"application/voicexml+xml",wgt:"application/widget",hlp:"application/winhlp",wsdl:"application/wsdl+xml",wspolicy:"application/wspolicy+xml","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",dmg:"application/x-apple-diskimage",aab:"application/x-authorware-bin",x32:"application/x-authorware-bin",u32:"application/x-authorware-bin",vox:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",bcpio:"application/x-bcpio",torrent:"application/x-bittorrent",blb:"application/x-blorb",blorb:"application/x-blorb",bz:"application/x-bzip",bz2:"application/x-bzip2",boz:"application/x-bzip2",cbr:"application/x-cbr",cba:"application/x-cbr",cbt:"application/x-cbr",cbz:"application/x-cbr",cb7:"application/x-cbr",vcd:"application/x-cdlink",cfs:"application/x-cfs-compressed",chat:"application/x-chat",pgn:"application/x-chess-pgn",nsc:"application/x-conference",cpio:"application/x-cpio",csh:"application/x-csh",deb:"application/x-debian-package",udeb:"application/x-debian-package",dgc:"application/x-dgc-compressed",dir:"application/x-director",dcr:"application/x-director",dxr:"application/x-director",cst:"application/x-director",cct:"application/x-director",cxt:"application/x-director",w3d:"application/x-director",fgd:"application/x-director",swa:"application/x-director",wad:"application/x-doom",ncx:"application/x-dtbncx+xml",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",dvi:"application/x-dvi",evy:"application/x-envoy",eva:"application/x-eva",bdf:"application/x-font-bdf",gsf:"application/x-font-ghostscript",psf:"application/x-font-linux-psf",otf:"application/x-font-otf",pcf:"application/x-font-pcf",snf:"application/x-font-snf",ttf:"application/x-font-ttf",ttc:"application/x-font-ttf",pfa:"application/x-font-type1",pfb:"application/x-font-type1",pfm:"application/x-font-type1",afm:"application/x-font-type1",woff:"application/x-font-woff",arc:"application/x-freearc",spl:"application/x-futuresplash",gca:"application/x-gca-compressed",ulx:"application/x-glulx",gnumeric:"application/x-gnumeric",gramps:"application/x-gramps-xml",gtar:"application/x-gtar",hdf:"application/x-hdf",install:"application/x-install-instructions",iso:"application/x-iso9660-image",jnlp:"application/x-java-jnlp-file",latex:"application/x-latex",lzh:"application/x-lzh-compressed",lha:"application/x-lzh-compressed",mie:"application/x-mie",prc:"application/x-mobipocket-ebook",mobi:"application/x-mobipocket-ebook",application:"application/x-ms-application",lnk:"application/x-ms-shortcut",wmd:"application/x-ms-wmd",wmz:"application/x-msmetafile",xbap:"application/x-ms-xbap",mdb:"application/x-msaccess",obd:"application/x-msbinder",crd:"application/x-mscardfile",clp:"application/x-msclip",exe:"application/x-msdownload",dll:"application/x-msdownload",com:"application/x-msdownload",bat:"application/x-msdownload",msi:"application/x-msdownload",mvb:"application/x-msmediaview",m13:"application/x-msmediaview",m14:"application/x-msmediaview",wmf:"application/x-msmetafile",emf:"application/x-msmetafile",emz:"application/x-msmetafile",mny:"application/x-msmoney",pub:"application/x-mspublisher",scd:"application/x-msschedule",trm:"application/x-msterminal",wri:"application/x-mswrite",nc:"application/x-netcdf",cdf:"application/x-netcdf",nzb:"application/x-nzb",p12:"application/x-pkcs12",pfx:"application/x-pkcs12",p7b:"application/x-pkcs7-certificates",spc:"application/x-pkcs7-certificates",p7r:"application/x-pkcs7-certreqresp",rar:"application/x-rar-compressed",ris:"application/x-research-info-systems",sh:"application/x-sh",shar:"application/x-shar",swf:"application/x-shockwave-flash",xap:"application/x-silverlight-app",sql:"application/x-sql",sit:"application/x-stuffit",sitx:"application/x-stuffitx",srt:"application/x-subrip",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",t3:"application/x-t3vm-image",gam:"application/x-tads",tar:"application/x-tar",tcl:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",texinfo:"application/x-texinfo",texi:"application/x-texinfo",obj:"application/x-tgif",ustar:"application/x-ustar",src:"application/x-wais-source",der:"application/x-x509-ca-cert",crt:"application/x-x509-ca-cert",fig:"application/x-xfig",xlf:"application/x-xliff+xml",xpi:"application/x-xpinstall",xz:"application/x-xz",z1:"application/x-zmachine",z2:"application/x-zmachine",z3:"application/x-zmachine",z4:"application/x-zmachine",z5:"application/x-zmachine",z6:"application/x-zmachine",z7:"application/x-zmachine",z8:"application/x-zmachine",xaml:"application/xaml+xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xhtml:"application/xhtml+xml",xht:"application/xhtml+xml",xml:"application/xml",xsl:"application/xml",dtd:"application/xml-dtd",xop:"application/xop+xml",xpl:"application/xproc+xml",xslt:"application/xslt+xml",xspf:"application/xspf+xml",mxml:"application/xv+xml",xhvml:"application/xv+xml",xvml:"application/xv+xml",xvm:"application/xv+xml",yang:"application/yang",yin:"application/yin+xml",zip:"application/zip",adp:"audio/adpcm",au:"audio/basic",snd:"audio/basic",mid:"audio/midi",midi:"audio/midi",kar:"audio/midi",rmi:"audio/midi",mp4a:"audio/mp4",mpga:"audio/mpeg",mp2:"audio/mpeg",mp2a:"audio/mpeg",mp3:"audio/mpeg",m2a:"audio/mpeg",m3a:"audio/mpeg",oga:"audio/ogg",ogg:"audio/ogg",spx:"audio/ogg",s3m:"audio/s3m",sil:"audio/silk",uva:"audio/vnd.dece.audio",uvva:"audio/vnd.dece.audio",eol:"audio/vnd.digital-winds",dra:"audio/vnd.dra",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",lvp:"audio/vnd.lucent.voice",pya:"audio/vnd.ms-playready.media.pya",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",rip:"audio/vnd.rip",weba:"audio/webm",aac:"audio/x-aac",aif:"audio/x-aiff",aiff:"audio/x-aiff",aifc:"audio/x-aiff",caf:"audio/x-caf",flac:"audio/x-flac",mka:"audio/x-matroska",m3u:"audio/x-mpegurl",wax:"audio/x-ms-wax",wma:"audio/x-ms-wma",ram:"audio/x-pn-realaudio",ra:"audio/x-pn-realaudio",rmp:"audio/x-pn-realaudio-plugin",wav:"audio/x-wav",xm:"audio/xm",cdx:"chemical/x-cdx",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cml:"chemical/x-cml",csml:"chemical/x-csml",xyz:"chemical/x-xyz",bmp:"image/bmp",cgm:"image/cgm",g3:"image/g3fax",gif:"image/gif",ief:"image/ief",jpeg:"image/jpeg",jpg:"image/jpeg",jpe:"image/jpeg",ktx:"image/ktx",png:"image/png",btif:"image/prs.btif",sgi:"image/sgi",svg:"image/svg+xml",svgz:"image/svg+xml",tiff:"image/tiff",tif:"image/tiff",psd:"image/vnd.adobe.photoshop",uvi:"image/vnd.dece.graphic",uvvi:"image/vnd.dece.graphic",uvg:"image/vnd.dece.graphic",uvvg:"image/vnd.dece.graphic",sub:"text/vnd.dvb.subtitle",djvu:"image/vnd.djvu",djv:"image/vnd.djvu",dwg:"image/vnd.dwg",dxf:"image/vnd.dxf",fbs:"image/vnd.fastbidsheet",fpx:"image/vnd.fpx",fst:"image/vnd.fst",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",mdi:"image/vnd.ms-modi",wdp:"image/vnd.ms-photo",npx:"image/vnd.net-fpx",wbmp:"image/vnd.wap.wbmp",xif:"image/vnd.xiff",webp:"image/webp","3ds":"image/x-3ds",ras:"image/x-cmu-raster",cmx:"image/x-cmx",fh:"image/x-freehand",fhc:"image/x-freehand",fh4:"image/x-freehand",fh5:"image/x-freehand",fh7:"image/x-freehand",ico:"image/x-icon",sid:"image/x-mrsid-image",pcx:"image/x-pcx",pic:"image/x-pict",pct:"image/x-pict",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pgm:"image/x-portable-graymap",ppm:"image/x-portable-pixmap",rgb:"image/x-rgb",tga:"image/x-tga",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",eml:"message/rfc822",mime:"message/rfc822",igs:"model/iges",iges:"model/iges",msh:"model/mesh",mesh:"model/mesh",silo:"model/mesh",dae:"model/vnd.collada+xml",dwf:"model/vnd.dwf",gdl:"model/vnd.gdl",gtw:"model/vnd.gtw",mts:"model/vnd.mts",vtu:"model/vnd.vtu",wrl:"model/vrml",vrml:"model/vrml",x3db:"model/x3d+binary",x3dbz:"model/x3d+binary",x3dv:"model/x3d+vrml",x3dvz:"model/x3d+vrml",x3d:"model/x3d+xml",x3dz:"model/x3d+xml",appcache:"text/cache-manifest",ics:"text/calendar",ifb:"text/calendar",css:"text/css",csv:"text/csv",html:"text/html",htm:"text/html",n3:"text/n3",txt:"text/plain",text:"text/plain",conf:"text/plain",def:"text/plain",list:"text/plain",log:"text/plain","in":"text/plain",dsc:"text/prs.lines.tag",rtx:"text/richtext",sgml:"text/sgml",sgm:"text/sgml",tsv:"text/tab-separated-values",t:"text/troff",tr:"text/troff",roff:"text/troff",man:"text/troff",me:"text/troff",ms:"text/troff",ttl:"text/turtle",uri:"text/uri-list",uris:"text/uri-list",urls:"text/uri-list",vcard:"text/vcard",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",scurl:"text/vnd.curl.scurl",mcurl:"text/vnd.curl.mcurl",fly:"text/vnd.fly",flx:"text/vnd.fmi.flexstor",gv:"text/vnd.graphviz","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",jad:"text/vnd.sun.j2me.app-descriptor",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",s:"text/x-asm",asm:"text/x-asm",c:"text/x-c",cc:"text/x-c",cxx:"text/x-c",cpp:"text/x-c",h:"text/x-c",hh:"text/x-c",dic:"text/x-c",f:"text/x-fortran","for":"text/x-fortran",f77:"text/x-fortran",f90:"text/x-fortran",java:"text/x-java-source",opml:"text/x-opml",p:"text/x-pascal",pas:"text/x-pascal",nfo:"text/x-nfo",etx:"text/x-setext",sfv:"text/x-sfv",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard","3gp":"video/3gpp","3g2":"video/3gpp2",h261:"video/h261",h263:"video/h263",h264:"video/h264",jpgv:"video/jpeg",jpm:"video/jpm",jpgm:"video/jpm",mj2:"video/mj2",mjp2:"video/mj2",mp4:"video/mp4",mp4v:"video/mp4",mpg4:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",mpe:"video/mpeg",m1v:"video/mpeg",m2v:"video/mpeg",ogv:"video/ogg",qt:"video/quicktime",mov:"video/quicktime",uvh:"video/vnd.dece.hd",uvvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvvm:"video/vnd.dece.mobile",uvp:"video/vnd.dece.pd",uvvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",uvvv:"video/vnd.dece.video",dvb:"video/vnd.dvb.file",fvt:"video/vnd.fvt",mxu:"video/vnd.mpegurl",m4u:"video/vnd.mpegurl",pyv:"video/vnd.ms-playready.media.pyv",uvu:"video/vnd.uvvu.mp4",uvvu:"video/vnd.uvvu.mp4",viv:"video/vnd.vivo",webm:"video/webm",f4v:"video/x-f4v",fli:"video/x-fli",flv:"video/x-flv",m4v:"video/x-m4v",mkv:"video/x-matroska",mk3d:"video/x-matroska",mks:"video/x-matroska",mng:"video/x-mng",asf:"video/x-ms-asf",asx:"video/x-ms-asf",vob:"video/x-ms-vob",wm:"video/x-ms-wm",wmv:"video/x-ms-wmv",wmx:"video/x-ms-wmx",wvx:"video/x-ms-wvx",avi:"video/x-msvideo",movie:"video/x-sgi-movie",smv:"video/x-smv",ice:"x-conference/x-cooltalk"}
-},{}],16:[function(e,t){(function(n){"use strict";function o(e,t){return this instanceof o?(t=t||{},i.call(this,d({objectMode:!0},t)),this._offset=0,this._eof=!1,this._metasent=!t.meta,this._metadata={name:e.name,size:e.size,type:s.lookup(e.name.replace(a,"$1"))},this.reader=new FileReader,this.reader.onprogress=this._handleProgress.bind(this),this.reader.onload=this._handleLoad.bind(this),void this.reader.readAsArrayBuffer(e)):new o(e)}var i=e("stream").Readable,r=e("util"),a=/^.*\.(\w+)$/,s=e("mime-component"),d=e("extend.js");r.inherits(o,i),t.exports=o,o.prototype._read=function(e){function t(){var r,a=o._offset,s=o._offset+e,d=i.result&&i.result.byteLength,c=2===i.readyState&&s>d;return d&&(c||d>s)?(r=new Uint8Array(i.result,a,Math.min(e,i.result.byteLength-a)),o._offset=a+r.length,o._eof=0===r.length,o.push(r.length>0?new n(r):null)):void o.once("readable",t)}var o=this,i=this.reader;return this._metasent?void t():(this._metasent=!0,this.push("meta|"+JSON.stringify(this._metadata)))},o.prototype._handleLoad=function(){this.emit("readable")},o.prototype._handleProgress=function(){this.emit("readable")}}).call(this,e("buffer").Buffer)},{buffer:196,"extend.js":13,"mime-component":14,stream:216,util:218}],17:[function(e,t){(function(n){"use strict";function o(){var e=s.createHash("sha1");return{update:function(t){return e.update(t)},digest:function(){return e.digest("hex")}}}function i(e){function t(e){if("string"==typeof e)return n(e);var t=e.length;_+=8*t;for(var i=0;t>i;i++)o(e[i])}function n(e){var t=e.length;_+=8*t;for(var n=0;t>n;n++)o(e.charCodeAt(n))}function o(e){d[h]|=(255&e)<<m,m?m-=8:(h++,m=24),16===h&&a()}function i(){o(128),(h>14||14===h&&24>m)&&a(),h=14,m=24,o(0),o(0),o(_>0xffffffffff?_/1099511627776:0),o(_>4294967295?_/4294967296:0);for(var e=24;e>=0;e-=8)o(_>>e);return s(c)+s(l)+s(p)+s(u)+s(f)}function a(){for(var e=16;80>e;e++){var t=d[e-3]^d[e-8]^d[e-14]^d[e-16];d[e]=t<<1|t>>>31}var n,o,i=c,r=l,a=p,s=u,m=f;for(e=0;80>e;e++){20>e?(n=s^r&(a^s),o=1518500249):40>e?(n=r^a^s,o=1859775393):60>e?(n=r&a|s&(r|a),o=2400959708):(n=r^a^s,o=3395469782);var _=(i<<5|i>>>27)+n+m+o+(0|d[e]);m=s,s=a,a=r<<30|r>>>2,r=i,i=_}for(c=c+i|0,l=l+r|0,p=p+a|0,u=u+s|0,f=f+m|0,h=0,e=0;16>e;e++)d[e]=0}function s(e){for(var t="",n=28;n>=0;n-=4)t+=(e>>n&15).toString(16);return t}var d,c=1732584193,l=4023233417,p=2562383102,u=271733878,f=3285377520,h=0,m=24,_=0;return d=e?r:new Uint32Array(80),{update:t,digest:i}}var r,a,s,d="object"==typeof n&&"object"==typeof n.versions&&n.versions.node&&"renderer"!==n.__atom_type;if(d){var c=e;s=c("crypto"),a=o}else r=new Uint32Array(80),a=i;t.exports=function(e){if(void 0===e)return a(!1);var t=a(!0);return t.update(e),t.digest()}}).call(this,e("_process"))},{_process:203}],18:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],19:[function(e,t){function n(e,t,n,r){return"boolean"!=typeof t&&null!=t&&(r=n,n="function"!=typeof t&&r&&r[t]===e?null:t,t=!1),null!=n&&(e=i(e,n,r)),o(e,t)}var o=e("lodash._baseflatten"),i=e("lodash.map");t.exports=n},{"lodash._baseflatten":20,"lodash.map":24}],20:[function(e,t){function n(e,t,r,a){for(var s=(a||0)-1,d=e?e.length:0,c=[];++s<d;){var l=e[s];if(l&&"object"==typeof l&&"number"==typeof l.length&&(i(l)||o(l))){t||(l=n(l,t,r));var p=-1,u=l.length,f=c.length;for(c.length+=u;++p<u;)c[f++]=l[p]}else r||c.push(l)}return c}var o=e("lodash.isarguments"),i=e("lodash.isarray");t.exports=n},{"lodash.isarguments":21,"lodash.isarray":22}],21:[function(e,t){function n(e){return e&&"object"==typeof e&&"number"==typeof e.length&&r.call(e)==o||!1}var o="[object Arguments]",i=Object.prototype,r=i.toString;t.exports=n},{}],22:[function(e,t){var n=e("lodash._isnative"),o="[object Array]",i=Object.prototype,r=i.toString,a=n(a=Array.isArray)&&a,s=a||function(e){return e&&"object"==typeof e&&"number"==typeof e.length&&r.call(e)==o||!1};t.exports=s},{"lodash._isnative":23}],23:[function(e,t){function n(e){return"function"==typeof e&&r.test(e)}var o=Object.prototype,i=o.toString,r=RegExp("^"+String(i).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");t.exports=n},{}],24:[function(e,t){function n(e,t,n){var r=-1,a=e?e.length:0;if(t=o(t,n,3),"number"==typeof a)for(var s=Array(a);++r<a;)s[r]=t(e[r],r,e);else s=[],i(e,function(e,n,o){s[++r]=t(e,n,o)});return s}var o=e("lodash.createcallback"),i=e("lodash.forown");t.exports=n},{"lodash.createcallback":25,"lodash.forown":61}],25:[function(e,t){function n(e,t,n){var d=typeof e;if(null==e||"function"==d)return o(e,t,n);if("object"!=d)return s(e);var c=a(e),l=c[0],p=e[l];return 1!=c.length||p!==p||r(p)?function(t){for(var n=c.length,o=!1;n--&&(o=i(t[c[n]],e[c[n]],null,!0)););return o}:function(e){var t=e[l];return p===t&&(0!==p||1/p==1/t)}}var o=e("lodash._basecreatecallback"),i=e("lodash._baseisequal"),r=e("lodash.isobject"),a=e("lodash.keys"),s=e("lodash.property");t.exports=n},{"lodash._basecreatecallback":26,"lodash._baseisequal":45,"lodash.isobject":54,"lodash.keys":56,"lodash.property":60}],26:[function(e,t){function n(e,t,n){if("function"!=typeof e)return i;if("undefined"==typeof t||!("prototype"in e))return e;var l=e.__bindData__;if("undefined"==typeof l&&(a.funcNames&&(l=!e.name),l=l||!a.funcDecomp,!l)){var p=c.call(e);a.funcNames||(l=!s.test(p)),l||(l=d.test(p),r(e,l))}if(l===!1||l!==!0&&1&l[1])return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,o){return e.call(t,n,o)};case 3:return function(n,o,i){return e.call(t,n,o,i)};case 4:return function(n,o,i,r){return e.call(t,n,o,i,r)}}return o(e,t)}var o=e("lodash.bind"),i=e("lodash.identity"),r=e("lodash._setbinddata"),a=e("lodash.support"),s=/^\s*function[ \n\r\t]+\w/,d=/\bthis\b/,c=Function.prototype.toString;t.exports=n},{"lodash._setbinddata":27,"lodash.bind":30,"lodash.identity":42,"lodash.support":43}],27:[function(e,t){var n=e("lodash._isnative"),o=e("lodash.noop"),i={configurable:!1,enumerable:!1,value:null,writable:!1},r=function(){try{var e={},t=n(t=Object.defineProperty)&&t,o=t(e,e,e)&&t}catch(i){}return o}(),a=r?function(e,t){i.value=t,r(e,"__bindData__",i)}:o;t.exports=a},{"lodash._isnative":28,"lodash.noop":29}],28:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],29:[function(e,t){function n(){}t.exports=n},{}],30:[function(e,t){function n(e,t){return arguments.length>2?o(e,17,i(arguments,2),null,t):o(e,1,null,null,t)}var o=e("lodash._createwrapper"),i=e("lodash._slice");t.exports=n},{"lodash._createwrapper":31,"lodash._slice":41}],31:[function(e,t){function n(e,t,s,l,p,u){var f=1&t,h=2&t,m=4&t,_=16&t,v=32&t;if(!h&&!r(e))throw new TypeError;_&&!s.length&&(t&=-17,_=s=!1),v&&!l.length&&(t&=-33,v=l=!1);var g=e&&e.__bindData__;if(g&&g!==!0)return g=a(g),g[2]&&(g[2]=a(g[2])),g[3]&&(g[3]=a(g[3])),!f||1&g[1]||(g[4]=p),!f&&1&g[1]&&(t|=8),!m||4&g[1]||(g[5]=u),_&&d.apply(g[2]||(g[2]=[]),s),v&&c.apply(g[3]||(g[3]=[]),l),g[1]|=t,n.apply(null,g);var b=1==t||17===t?o:i;return b([e,t,s,l,p,u])}var o=e("lodash._basebind"),i=e("lodash._basecreatewrapper"),r=e("lodash.isfunction"),a=e("lodash._slice"),s=[],d=s.push,c=s.unshift;t.exports=n},{"lodash._basebind":32,"lodash._basecreatewrapper":36,"lodash._slice":41,"lodash.isfunction":40}],32:[function(e,t){function n(e){function t(){if(s){var e=a(s);d.apply(e,arguments)}if(this instanceof t){var r=o(n.prototype),l=n.apply(r,e||arguments);return i(l)?l:r}return n.apply(c,e||arguments)}var n=e[0],s=e[2],c=e[4];return r(t,e),t}var o=e("lodash._basecreate"),i=e("lodash.isobject"),r=e("lodash._setbinddata"),a=e("lodash._slice"),s=[],d=s.push;t.exports=n},{"lodash._basecreate":33,"lodash._setbinddata":27,"lodash._slice":41,"lodash.isobject":54}],33:[function(e,t){(function(n){function o(e){return r(e)?a(e):{}}var i=e("lodash._isnative"),r=e("lodash.isobject"),a=(e("lodash.noop"),i(a=Object.create)&&a);a||(o=function(){function e(){}return function(t){if(r(t)){e.prototype=t;var o=new e;e.prototype=null}return o||n.Object()}}()),t.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._isnative":34,"lodash.isobject":54,"lodash.noop":35}],34:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],35:[function(e,t){t.exports=e(29)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":29}],36:[function(e,t){function n(e){function t(){var e=h?u:this;if(l){var r=a(l);d.apply(r,arguments)}if((p||_)&&(r||(r=a(arguments)),p&&d.apply(r,p),_&&r.length<f))return c|=16,n([s,v?c:-4&c,r,null,u,f]);if(r||(r=arguments),m&&(s=e[g]),this instanceof t){e=o(s.prototype);var b=s.apply(e,r);return i(b)?b:e}return s.apply(e,r)}var s=e[0],c=e[1],l=e[2],p=e[3],u=e[4],f=e[5],h=1&c,m=2&c,_=4&c,v=8&c,g=s;return r(t,e),t}var o=e("lodash._basecreate"),i=e("lodash.isobject"),r=e("lodash._setbinddata"),a=e("lodash._slice"),s=[],d=s.push;t.exports=n},{"lodash._basecreate":37,"lodash._setbinddata":27,"lodash._slice":41,"lodash.isobject":54}],37:[function(e,t){t.exports=e(33)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/node_modules/lodash._basecreate/index.js":33,"lodash._isnative":38,"lodash.isobject":54,"lodash.noop":39}],38:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],39:[function(e,t){t.exports=e(29)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":29}],40:[function(e,t){function n(e){return"function"==typeof e}t.exports=n},{}],41:[function(e,t){function n(e,t,n){t||(t=0),"undefined"==typeof n&&(n=e?e.length:0);for(var o=-1,i=n-t||0,r=Array(0>i?0:i);++o<i;)r[o]=e[t+o];return r}t.exports=n},{}],42:[function(e,t){function n(e){return e}t.exports=n},{}],43:[function(e,t){(function(n){var o=e("lodash._isnative"),i=/\bthis\b/,r={};r.funcDecomp=!o(n.WinRTError)&&i.test(function(){return this}),r.funcNames="string"==typeof Function.name,t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._isnative":44}],44:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],45:[function(e,t){function n(e,t,_,b,x,w){if(_){var y=_(e,t);if("undefined"!=typeof y)return!!y}if(e===t)return 0!==e||1/e==1/t;var k=typeof e,j=typeof t;if(!(e!==e||e&&a[k]||t&&a[j]))return!1;if(null==e||null==t)return e===t;var E=v.call(e),S=v.call(t);if(E==d&&(E=f),S==d&&(S=f),E!=S)return!1;switch(E){case l:case p:return+e==+t;case u:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case h:case m:return e==String(t)}var U=E==c;if(!U){var I=g.call(e,"__wrapped__"),A=g.call(t,"__wrapped__");if(I||A)return n(I?e.__wrapped__:e,A?t.__wrapped__:t,_,b,x,w);if(E!=f)return!1;var L=e.constructor,T=t.constructor;if(L!=T&&!(r(L)&&L instanceof L&&r(T)&&T instanceof T)&&"constructor"in e&&"constructor"in t)return!1}var B=!x;x||(x=i()),w||(w=i());for(var z=x.length;z--;)if(x[z]==e)return w[z]==t;var R=0;if(y=!0,x.push(e),w.push(t),U){if(z=e.length,R=t.length,y=R==z,y||b)for(;R--;){var P=z,M=t[R];if(b)for(;P--&&!(y=n(e[P],M,_,b,x,w)););else if(!(y=n(e[R],M,_,b,x,w)))break}}else o(t,function(t,o,i){return g.call(i,o)?(R++,y=g.call(e,o)&&n(e[o],t,_,b,x,w)):void 0}),y&&!b&&o(e,function(e,t,n){return g.call(n,t)?y=--R>-1:void 0});return x.pop(),w.pop(),B&&(s(x),s(w)),y}var o=e("lodash.forin"),i=e("lodash._getarray"),r=e("lodash.isfunction"),a=e("lodash._objecttypes"),s=e("lodash._releasearray"),d="[object Arguments]",c="[object Array]",l="[object Boolean]",p="[object Date]",u="[object Number]",f="[object Object]",h="[object RegExp]",m="[object String]",_=Object.prototype,v=_.toString,g=_.hasOwnProperty;t.exports=n},{"lodash._getarray":46,"lodash._objecttypes":48,"lodash._releasearray":49,"lodash.forin":52,"lodash.isfunction":53}],46:[function(e,t){function n(){return o.pop()||[]}var o=e("lodash._arraypool");t.exports=n},{"lodash._arraypool":47}],47:[function(e,t){var n=[];t.exports=n},{}],48:[function(e,t){var n={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1};t.exports=n},{}],49:[function(e,t){function n(e){e.length=0,o.length<i&&o.push(e)}var o=e("lodash._arraypool"),i=e("lodash._maxpoolsize");t.exports=n},{"lodash._arraypool":50,"lodash._maxpoolsize":51}],50:[function(e,t){t.exports=e(47)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._baseisequal/node_modules/lodash._getarray/node_modules/lodash._arraypool/index.js":47}],51:[function(e,t){var n=40;t.exports=n},{}],52:[function(e,t){var n=e("lodash._basecreatecallback"),o=e("lodash._objecttypes"),i=function(e,t,i){var r,a=e,s=a;if(!a)return s;if(!o[typeof a])return s;t=t&&"undefined"==typeof i?t:n(t,i,3);for(r in a)if(t(a[r],r,e)===!1)return s;return s};t.exports=i},{"lodash._basecreatecallback":26,"lodash._objecttypes":48}],53:[function(e,t){t.exports=e(40)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash.isfunction/index.js":40}],54:[function(e,t){function n(e){return!(!e||!o[typeof e])}var o=e("lodash._objecttypes");t.exports=n},{"lodash._objecttypes":55}],55:[function(e,t){t.exports=e(48)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._baseisequal/node_modules/lodash._objecttypes/index.js":48}],56:[function(e,t){var n=e("lodash._isnative"),o=e("lodash.isobject"),i=e("lodash._shimkeys"),r=n(r=Object.keys)&&r,a=r?function(e){return o(e)?r(e):[]}:i;t.exports=a},{"lodash._isnative":57,"lodash._shimkeys":58,"lodash.isobject":54}],57:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],58:[function(e,t){var n=e("lodash._objecttypes"),o=Object.prototype,i=o.hasOwnProperty,r=function(e){var t,o=e,r=[];if(!o)return r;if(!n[typeof e])return r;for(t in o)i.call(o,t)&&r.push(t);return r};t.exports=r},{"lodash._objecttypes":59}],59:[function(e,t){t.exports=e(48)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._baseisequal/node_modules/lodash._objecttypes/index.js":48}],60:[function(e,t){function n(e){return function(t){return t[e]}}t.exports=n},{}],61:[function(e,t){var n=e("lodash._basecreatecallback"),o=e("lodash.keys"),i=e("lodash._objecttypes"),r=function(e,t,r){var a,s=e,d=s;if(!s)return d;if(!i[typeof s])return d;t=t&&"undefined"==typeof r?t:n(t,r,3);for(var c=-1,l=i[typeof s]&&o(s),p=l?l.length:0;++c<p;)if(a=l[c],t(s[a],a,e)===!1)return d;return d};t.exports=r},{"lodash._basecreatecallback":62,"lodash._objecttypes":83,"lodash.keys":84}],62:[function(e,t){t.exports=e(26)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/index.js":26,"lodash._setbinddata":63,"lodash.bind":66,"lodash.identity":80,"lodash.support":81}],63:[function(e,t){t.exports=e(27)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/index.js":27,"lodash._isnative":64,"lodash.noop":65}],64:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],65:[function(e,t){t.exports=e(29)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":29}],66:[function(e,t){t.exports=e(30)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/index.js":30,"lodash._createwrapper":67,"lodash._slice":79}],67:[function(e,t){t.exports=e(31)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/index.js":31,"lodash._basebind":68,"lodash._basecreatewrapper":73,"lodash._slice":79,"lodash.isfunction":78}],68:[function(e,t){t.exports=e(32)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/index.js":32,"lodash._basecreate":69,"lodash._setbinddata":63,"lodash._slice":79,"lodash.isobject":72}],69:[function(e,t){t.exports=e(33)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/node_modules/lodash._basecreate/index.js":33,"lodash._isnative":70,"lodash.isobject":72,"lodash.noop":71}],70:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],71:[function(e,t){t.exports=e(29)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":29}],72:[function(e,t){t.exports=e(54)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash.isobject/index.js":54,"lodash._objecttypes":83}],73:[function(e,t){t.exports=e(36)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basecreatewrapper/index.js":36,"lodash._basecreate":74,"lodash._setbinddata":63,"lodash._slice":79,"lodash.isobject":77}],74:[function(e,t){t.exports=e(33)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/node_modules/lodash._basecreate/index.js":33,"lodash._isnative":75,"lodash.isobject":77,"lodash.noop":76}],75:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],76:[function(e,t){t.exports=e(29)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":29}],77:[function(e,t){t.exports=e(54)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash.isobject/index.js":54,"lodash._objecttypes":83}],78:[function(e,t){t.exports=e(40)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash.isfunction/index.js":40}],79:[function(e,t){t.exports=e(41)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._slice/index.js":41}],80:[function(e,t){t.exports=e(42)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.identity/index.js":42}],81:[function(e,t){t.exports=e(43)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.support/index.js":43,"lodash._isnative":82}],82:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],83:[function(e,t){t.exports=e(48)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._baseisequal/node_modules/lodash._objecttypes/index.js":48}],84:[function(e,t){t.exports=e(56)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash.keys/index.js":56,"lodash._isnative":85,"lodash._shimkeys":86,"lodash.isobject":87}],85:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],86:[function(e,t){t.exports=e(58)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash.keys/node_modules/lodash._shimkeys/index.js":58,"lodash._objecttypes":83}],87:[function(e,t){t.exports=e(54)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash.isobject/index.js":54,"lodash._objecttypes":83}],88:[function(e,t){function n(e,t){return this instanceof n?(r.Readable.call(this,t),this.destroyed=!1,this._drained=!1,this._forwarding=!1,this._current=null,this._queue=e.map(o),void this._next()):new n(e,t)}function o(e){if(!e||"function"==typeof e||e._readableState)return e;var t=(new r.Readable).wrap(e);return e.destroy&&(t.destroy=e.destroy.bind(e)),t}t.exports=n;var i=e("inherits"),r=e("stream");i(n,r.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._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(),this._queue.forEach(function(e){e.destroy&&e.destroy()}),e&&this.emit("error",e),this.emit("close"))},n.prototype._next=function(){function e(){r._forward()}function t(){a._readableState.ended||r.destroy()}function n(){r._current=null,a.removeListener("readable",e),a.removeListener("end",n),a.removeListener("error",i),a.removeListener("close",t),r._next()}function i(e){r.destroy(e)}var r=this,a=this._queue.shift();return"function"==typeof a&&(a=o(a())),a?(this._current=a,a.on("readable",e),a.on("end",n),a.on("error",i),void a.on("close",t)):void this.push(null)}},{inherits:89,stream:216}],89:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],90:[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}t.exports=n,n.proto=n(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0})})},{}],91:[function(e,t){for(var n=e("closest-to"),o=[],i=14;22>=i;i++)o.push(Math.pow(2,i));t.exports=function(e){return n(e/Math.pow(2,10),o)}},{"closest-to":92}],92:[function(e,t){t.exports=function(e,t){var n=1/0,o=0,i=null;t.sort(function(e,t){return e-t});for(var r=0,a=t.length;a>r&&(o=Math.abs(e-t[r]),!(o>=n));r++)n=o,i=t[r];return i}},{}],93:[function(e,t){t.exports=function(e,t){function n(e,n,r){o[e]=r,(0===--i||n)&&(t&&t(n,o),t=null)}var o,i,r;Array.isArray(e)?(o=[],i=e.length):(r=Object.keys(e),o={},i=r.length),i?r?r.forEach(function(t){e[t](n.bind(void 0,t))}):e.forEach(function(e,t){e(n.bind(void 0,t))}):(t&&t(null,o),t=null)}},{}],94:[function(e,t,n){function o(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var o="color: "+this.color;e=[e[0],o,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,r=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(r=i))}),e.splice(r,0,o),e}function r(){return"object"==typeof console&&"function"==typeof console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?localStorage.removeItem("debug"):localStorage.debug=e}catch(t){}}function s(){var e;try{e=localStorage.debug}catch(t){}return e}n=t.exports=e("./debug"),n.log=r,n.formatArgs=i,n.save=a,n.load=s,n.useColors=o,n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(s())},{"./debug":95}],95:[function(e,t,n){function o(){return n.colors[l++%n.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,r=t-(c||t);e.diff=r,e.prev=c,e.curr=t,c=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=o());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,o){if("%%"===t)return t;s++;var i=n.formatters[o];if("function"==typeof i){var r=a[s];t=i.call(e,r),a.splice(s,1),s--}return t}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(e,a));var d=i.log||n.log||console.log.bind(console);d.apply(e,a)}t.enabled=!1,i.enabled=!0;var r=n.enabled(e)?i:t;return r.namespace=e,r}function r(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),o=t.length,i=0;o>i;i++)t[i]&&(e=t[i].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function a(){n.enable("")}function s(e){var t,o;for(t=0,o=n.skips.length;o>t;t++)if(n.skips[t].test(e))return!1;for(t=0,o=n.names.length;o>t;t++)if(n.names[t].test(e))return!0;return!1}function d(e){return e instanceof Error?e.stack||e.message:e}n=t.exports=i,n.coerce=d,n.disable=a,n.enable=r,n.enabled=s,n.humanize=e("ms"),n.names=[],n.skips=[],n.formatters={};var c,l=0},{ms:96}],96:[function(e,t){function n(e){var t=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),o=(t[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"h":return n*d;case"minutes":case"minute":case"m":return n*s;case"seconds":case"second":case"s":return n*a;case"ms":return n}}}function o(e){return e>=c?Math.round(e/c)+"d":e>=d?Math.round(e/d)+"h":e>=s?Math.round(e/s)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function i(e){return r(e,c,"day")||r(e,d,"hour")||r(e,s,"minute")||r(e,a,"second")||e+" ms"}function r(e,t,n){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var a=1e3,s=60*a,d=60*s,c=24*d,l=365.25*c;t.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t.long?i(e):o(e)}},{}],97:[function(e,t){function n(e){var t=!0;return o(function(){t=!1}),function(){var n=arguments,i=this;t?o(function(){e.apply(i,n)}):e.apply(i,n)}}t.exports=n;var o=e("asap")},{asap:98}],98:[function(e,t){(function(e){function n(){for(;i.next;){i=i.next;var e=i.task;i.task=void 0;var t=i.domain;t&&(i.domain=void 0,t.enter());try{e()}catch(o){if(d)throw t&&t.exit(),setTimeout(n,0),t&&t.enter(),o;setTimeout(function(){throw o},0)}t&&t.exit()}a=!1}function o(t){r=r.next={task:t,domain:d&&e.domain,next:null},a||(a=!0,s())}var i={task:void 0,next:null},r=i,a=!1,s=void 0,d=!1;if("undefined"!=typeof e&&e.nextTick)d=!0,s=function(){e.nextTick(n)};else if("function"==typeof setImmediate)s="undefined"!=typeof window?setImmediate.bind(window,n):function(){setImmediate(n)
-};else if("undefined"!=typeof MessageChannel){var c=new MessageChannel;c.port1.onmessage=n,s=function(){c.port2.postMessage(0)}}else s=function(){setTimeout(n,0)};t.exports=o}).call(this,e("_process"))},{_process:203}],99:[function(e,t){var n=e("once"),o=function(){},i=function(e){return e.setHeader&&"function"==typeof e.abort},r=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},a=function(e,t,s){if("function"==typeof t)return a(e,null,t);t||(t={}),s=n(s||o);var d=e._writableState,c=e._readableState,l=t.readable||t.readable!==!1&&e.readable,p=t.writable||t.writable!==!1&&e.writable,u=function(){e.writable||f()},f=function(){p=!1,l||s()},h=function(){l=!1,p||s()},m=function(e){s(e?new Error("exited with error code: "+e):null)},_=function(){return(!l||c&&c.ended)&&(!p||d&&d.ended)?void 0:s(new Error("premature close"))},v=function(){e.req.on("finish",f)};return i(e)?(e.on("complete",f),e.on("abort",_),e.req?v():e.on("request",v)):p&&!d&&(e.on("end",u),e.on("close",u)),r(e)&&e.on("exit",m),e.on("end",h),e.on("finish",f),t.error!==!1&&e.on("error",s),e.on("close",_),function(){e.removeListener("complete",f),e.removeListener("abort",_),e.removeListener("request",v),e.req&&e.req.removeListener("finish",f),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("exit",m),e.removeListener("end",h),e.removeListener("error",s),e.removeListener("close",_)}};t.exports=a},{once:100}],100:[function(e,t){t.exports=e(90)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/once/once.js":90}],101:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],102:[function(e,t){t.exports=e(17)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/git-sha1/git-sha1.js":17,_process:203}],103:[function(e,t){var n=t.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),0>=e)return"0";for(var o=Math.log(Math.pow(2,e))/Math.log(t),i=2;1/0===o;i*=2)o=Math.log(Math.pow(2,e/i))/Math.log(t)*i;for(var r=o-Math.floor(o),a="",i=0;i<Math.floor(o);i++){var s=Math.floor(Math.random()*t).toString(t);a=s+a}if(r){var d=Math.pow(t,r),s=Math.floor(Math.random()*d).toString(t);a=s+a}var c=parseInt(a,t);return 1/0!==c&&c>=Math.pow(2,e)?n(e,t):a};n.rack=function(e,t,o){var i=function(i){var a=0;do{if(a++>10){if(!o)throw new Error("too many ID collisions, use more bits");e+=o}var s=n(e,t)}while(Object.hasOwnProperty.call(r,s));return r[s]=i,s},r=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=t||16,i}},{}],104:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],105:[function(e,t){(function(n){var o=e("magnet-uri"),i=e("parse-torrent-file");t.exports=function(e){if("string"==typeof e&&/magnet:/.test(e))return o(e);if("string"==typeof e&&(40===e.length||32===e.length)){var t=o("magnet:?xt=urn:btih:"+e);return t?{infoHash:t.infoHash}:null}if(n.isBuffer(e)&&20===e.length)return{infoHash:e.toString("hex")};if(!n.isBuffer(e))return e&&e.infoHash?e:null;try{return i(e)}catch(r){return null}},t.exports.toBuffer=i.toBuffer}).call(this,e("buffer").Buffer)},{buffer:196,"magnet-uri":106,"parse-torrent-file":109}],106:[function(e,t){(function(n){var o=e("thirty-two");t.exports=function(e){var t={},i=e.split("magnet:?")[1];if(!i||0===i.length)return t;var r=i.split("&");r.forEach(function(e){var n=e.split("=");if(2===n.length){var o=n[0],i=n[1];if("dn"===o&&(i=decodeURIComponent(i).replace(/\+/g," ")),"tr"===o&&(i=decodeURIComponent(i)),"kt"===o&&(i=decodeURIComponent(i).split("+")),t[o])if(Array.isArray(t[o]))t[o].push(i);else{var r=t[o];t[o]=[r,i]}else t[o]=i}});var a;if(t.xt&&(a=t.xt.match(/^urn:btih:(.{40})/)))t.infoHash=new n(a[1],"hex").toString("hex");else if(t.xt&&(a=t.xt.match(/^urn:btih:(.{32})/))){var s=o.decode(a[1]);t.infoHash=new n(s,"binary").toString("hex")}return t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),"string"==typeof t.tr?t.announce=[t.tr]:Array.isArray(t.tr)&&(t.announce=t.tr),t}}).call(this,e("buffer").Buffer)},{buffer:196,"thirty-two":107}],107:[function(e,t,n){var o=e("./thirty-two");n.encode=o.encode,n.decode=o.decode},{"./thirty-two":108}],108:[function(e,t,n){(function(e){function t(e){var t=Math.floor(e.length/5);return e.length%5==0?t:t+1}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",i=[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){var i=0,r=0,a=0,s=0,d=new e(8*t(n));for(e.isBuffer(n)||(n=new e(n));i<n.length;){var c=n[i];a>3?(s=c&255>>a,a=(a+5)%8,s=s<<a|(i+1<n.length?n[i+1]:0)>>8-a,i++):(s=c>>8-(a+5)&31,a=(a+5)%8,0==a&&i++),d[r]=o.charCodeAt(s),r++}for(i=r;i<d.length;i++)d[i]=61;return d},n.decode=function(t){var n,o=0,r=0,a=0;e.isBuffer(t)||(t=new e(t));for(var s=new e(Math.ceil(5*t.length/8)),d=0;d<t.length&&61!=t[d];d++){var c=t[d]-48;if(!(c<i.length))throw new Error("Invalid input - it is not base32 encoded string");r=i[c],3>=o?(o=(o+5)%8,0==o?(n|=r,s[a]=n,a++,n=0):n|=255&r<<8-o):(o=(o+5)%8,n|=255&r>>>o,s[a]=n,a++,n=255&r<<8-o)}return s.slice(0,a)}}).call(this,e("buffer").Buffer)},{buffer:196}],109:[function(e,t){(function(n){function o(e){n.isBuffer(e)&&(e=d.decode(e)),s(e.info,"info"),s(e.info.name,"info.name"),s(e.info["piece length"],"info['piece length']"),s(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(function(e){s("number"==typeof e.length,"info.files[0].length"),s(e.path,"info.files[0].path")}):s(e.info.length,"info.length");var t={};t.info=e.info,t.infoBuffer=d.encode(e.info),t.infoHash=l(t.infoBuffer),t.name=e.info.name.toString(),t.private=!!e.info.private,e["creation date"]&&(t.created=new Date(1e3*e["creation date"])),n.isBuffer(e.comment)&&(t.comment=e.comment.toString());var o=e["announce-list"];o||(o=e.announce?[[e.announce]]:[]),t.announceList=o.map(function(e){return e.map(function(e){return e.toString()})}),t.announce=[].concat.apply([],t.announceList),t.urlList=(e["url-list"]||[]).map(function(e){return e.toString()});var i=e.info.files||[e.info];t.files=i.map(function(e,n){var o=[].concat(e.name||t.name,e.path||[]).map(function(e){return e.toString()});return{path:c.join.apply(null,[c.sep].concat(o)).slice(1),name:o[o.length-1],length:e.length,offset:i.slice(0,n).reduce(r,0)}}),t.length=i.reduce(r,0);var p=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(p.offset+p.length)%t.pieceLength||t.pieceLength,t.pieces=a(e.info.pieces),t}function i(e){var t={info:e.info};return e.announce&&e.announce[0]&&(t.announce=e.announce[0]),e.announceList&&(t["announce-list"]=e.announceList.map(function(e){return e.map(function(e){return e=new n(e,"utf8"),t.announce||(t.announce=e),e})})),e.created&&(t["creation date"]=e.created.getTime()/1e3|0),d.encode(t)}function r(e,t){return e+t.length}function a(e){for(var t=[],n=0;n<e.length;n+=20)t.push(e.slice(n,n+20).toString("hex"));return t}function s(e,t){if(!e)throw new Error("Torrent is missing required field: "+t)}t.exports=o,t.exports.toBuffer=i;var d=e("bencode"),c=e("path"),l=e("git-sha1")}).call(this,e("buffer").Buffer)},{bencode:110,buffer:196,"git-sha1":113,path:202}],110:[function(e,t){t.exports=e(9)},{"./lib/decode":111,"./lib/encode":112,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/bencode.js":9}],111:[function(e,t){t.exports=e(10)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/decode.js":10,buffer:196}],112:[function(e,t){t.exports=e(11)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/encode.js":11,buffer:196}],113:[function(e,t){t.exports=e(17)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/git-sha1/git-sha1.js":17,_process:203}],114:[function(e,t){function n(e,t,n){Array.isArray(n)||(n=[n]),n.forEach(function(n){e.on(n,function(){var e=[].slice.call(arguments);e.unshift(n),t.emit.apply(t,e)})})}function o(e,t){var o=new i;return n(e,o,t),o}t.exports=n,t.exports.filter=o;var i=e("events").EventEmitter},{events:200}],115:[function(e,t){t.exports=e(93)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/run-parallel/index.js":93}],116:[function(e,t){var n=1,o=65535,i=4,r=function(){n=n+1&o},a=setInterval(r,1e3/i|0);a.unref&&a.unref(),t.exports=function(e){var t=i*(e||5),r=[0],a=1,s=n-1&o;return function(e){var d=n-s&o;for(d>t&&(d=t),s=n;d--;)a===t&&(a=0),r[a]=r[0===a?t-1:a-1],a++;e&&(r[a-1]+=e);var c=r[a-1],l=r.length<t?0:r[a===t?0:a];return r.length<i?c:(c-l)*i/r.length}}},{}],117:[function(e,t){(function(n){function o(e){var t=this;if(!(t instanceof o))return new o(e);if(a.call(t),e||(e={}),t._performedDHTLookup=!1,s(t,{announce:[],dht:"function"==typeof r,externalDHT:!1,tracker:!0,port:null},e),!t.peerId)throw new Error("peerId required");if(!t.port&&!n.browser)throw new Error("port required");t._createDHT(e.dhtPort)}t.exports=o;var i=e("debug")("torrent-discovery"),r=e("bittorrent-dht/client"),a=e("events").EventEmitter,s=e("extend.js"),d=e("inherits"),c=e("re-emitter"),l=e("bittorrent-tracker/client");d(o,a),o.prototype.setTorrent=function(e){var t=this;if(!t.torrent){if(e&&e.infoHash)t.torrent=e,t.infoHash=e.infoHash;else{if(t.infoHash)return;t.infoHash=e}i("setTorrent %s",e),t.tracker&&t.tracker!==!0?t.tracker.torrentLength=e.length:t._createTracker(),t.dht&&(t.dht.ready?t._dhtLookupAndAnnounce():t.dht.on("ready",t._dhtLookupAndAnnounce.bind(t)))}},o.prototype.stop=function(e){var t=this;t.tracker&&t.tracker.stop&&t.tracker.stop(),!t.externalDHT&&t.dht&&t.dht.destroy?t.dht.destroy(e):n.nextTick(function(){e(null)})},o.prototype._createDHT=function(e){var t=this;t.dht&&(t.dht?t.externalDHT=!0:t.dht=new r,c(t.dht,t,["peer","error","warning"]),t.externalDHT||t.dht.listen(e))},o.prototype._createTracker=function(){var e=this;if(e.tracker){var t=e.torrent||{infoHash:e.infoHash,announce:e.announce};e.tracker=n.browser?new l(e.peerId,t):new l(e.peerId,e.port,t),c(e.tracker,e,["peer","warning","error"]),e.tracker.start()}},o.prototype._dhtLookupAndAnnounce=function(){var e=this;e._performedDHTLookup||(e._performedDHTLookup=!0,i("lookup"),e.dht.lookup(e.infoHash,function(t){!t&&e.port&&(i("dhtAnnounce"),e.dht.announce(e.infoHash,e.port,function(){e.emit("dhtAnnounce")}))}))}}).call(this,e("_process"))},{_process:203,"bittorrent-dht/client":195,"bittorrent-tracker/client":124,debug:118,events:200,"extend.js":121,inherits:122,"re-emitter":123}],118:[function(e,t){t.exports=e(94)},{"./debug":119,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":94}],119:[function(e,t){t.exports=e(95)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":95,ms:120}],120:[function(e,t){t.exports=e(96)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":96}],121:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],122:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],123:[function(e,t){t.exports=e(114)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/re-emitter/index.js":114,events:200}],124:[function(e,t){(function(n){function o(e,t,r){var d=this;return d instanceof o?(s.call(d),d._opts=r||{},d._peerId=n.isBuffer(e)?e:new n(e,"utf8"),d._infoHash=n.isBuffer(t.infoHash)?t.infoHash:new n(t.infoHash,"hex"),d.torrentLength=t.length,d._numWant=d._opts.numWant||h,d._intervalMs=d._opts.interval||18e5,a("new client %s",d._infoHash.toString("hex")),"string"==typeof t.announce&&(t.announce=[t.announce]),void(d._trackers=(t.announce||[]).filter(function(e){return 0===e.indexOf("ws://")||0===e.indexOf("wss://")}).map(function(e){return new i(d,e,d._opts)}))):new o(e,t,r)}function i(e,t,n){var o=this;s.call(o),o._opts=n||{},o._announceUrl=t,o._peers={},a("new tracker %s",t),o.client=e,o.ready=!1,o._socket=null,o._intervalMs=o.client._intervalMs,o._interval=null}function r(e){return new n(e,"binary").toString("hex")}t.exports=o;var a=e("debug")("webtorrent-tracker"),s=e("events").EventEmitter,d=e("extend.js"),c=e("hat"),l=e("inherits"),p=e("lodash.times"),u=e("simple-peer"),f=e("simple-websocket"),h=15;l(o,s);var m={};o.prototype.start=function(e){var t=this;t._trackers.forEach(function(t){t.start(e)})},o.prototype.stop=function(e){var t=this;t._trackers.forEach(function(t){t.stop(e)})},o.prototype.complete=function(e){var t=this;t._trackers.forEach(function(t){t.complete(e)})},o.prototype.update=function(e){var t=this;t._trackers.forEach(function(t){t.update(e)})},o.prototype.setInterval=function(e){var t=this;t._intervalMs=e,t._trackers.forEach(function(t){t.setInterval(e)})},l(i,s),i.prototype.start=function(e){var t=this;e=e||{},e.event="started",a("sent `start` %s %s",t._announceUrl,JSON.stringify(e)),t._announce(e),t.setInterval(t._intervalMs)},i.prototype.stop=function(e){var t=this;e=e||{},e.event="stopped",a("sent `stop` %s %s",t._announceUrl,JSON.stringify(e)),t._announce(e),t.setInterval(0)},i.prototype.complete=function(e){var t=this;e=e||{},e.event="completed",e.downloaded=e.downloaded||t.torrentLength||0,a("sent `complete` %s %s",t._announceUrl,JSON.stringify(e)),t._announce(e)},i.prototype.update=function(e){var t=this;e=e||{},a("sent `update` %s %s",t._announceUrl,JSON.stringify(e)),t._announce(e)},i.prototype._init=function(e){var t=this;e&&t.once("ready",e),t._socket||(m[t._announceUrl]?(t._socket=m[t._announceUrl],t._onSocketReady()):(t._socket=m[t._announceUrl]=new f(t._announceUrl),t._socket.on("ready",t._onSocketReady.bind(t))),t._socket.on("warning",t._onSocketWarning.bind(t)),t._socket.on("error",t._onSocketWarning.bind(t)),t._socket.on("message",t._onSocketMessage.bind(t)))},i.prototype._onSocketReady=function(){var e=this;e.ready=!0,e.emit("ready")},i.prototype._onSocketWarning=function(e){a("tracker warning %s",e.message)},i.prototype._onSocketMessage=function(e){var t=this;if("object"!=typeof e||null===e)return t.client.emit("warning",new Error("Invalid tracker response"));if(e.info_hash===t.client._infoHash.toString("binary")){a("received %s from %s",JSON.stringify(e),t._announceUrl);var n=e["failure reason"];if(n)return t.client.emit("warning",new Error(n));var o=e["warning message"];o&&t.client.emit("warning",new Error(o));var i=e.interval||e["min interval"];i&&!t._opts.interval&&0!==t._intervalMs&&t.setInterval(1e3*i);var s=e["tracker id"];s&&(t._trackerId=s),e.complete&&t.client.emit("update",{announce:t._announceUrl,complete:e.complete,incomplete:e.incomplete});var c;e.offer&&(c=new u({trickle:!1}),c.id=r(e.peer_id),c.once("signal",function(n){var o={info_hash:t.client._infoHash.toString("binary"),peer_id:t.client._peerId.toString("binary"),to_peer_id:e.peer_id};t._trackerId&&(o.trackerid=t._trackerId),t._send(d({answer:n,offer_id:e.offer_id},o))}),c.signal(e.offer),t.client.emit("peer",c)),e.answer&&(c=t._peers[e.offer_id],c&&(c.signal(e.answer),t.client.emit("peer",c)))}},i.prototype._announce=function(e){var t=this;return t.ready?void t._generateOffers(function(n){e=d({uploaded:0,downloaded:0,info_hash:t.client._infoHash.toString("binary"),peer_id:t.client._peerId.toString("binary"),offers:n},e),null!=t.client.torrentLength&&null==e.left&&(e.left=t.client.torrentLength-(e.downloaded||0)),t._trackerId&&(e.trackerid=t._trackerId),t._send(e)}):t._init(t._announce.bind(t,e))},i.prototype._send=function(e){var t=this;a("send %s",JSON.stringify(e)),t._socket.send(e)},i.prototype._generateOffers=function(e){function t(){o.length===n.client._numWant&&(a("got offers %s",n.client._numWant),e(o))}var n=this;a("get offers %s",n.client._numWant);var o=[];p(n.client._numWant,function(){var e=c(160),i=n._peers[e]=new u({initiator:!0,trickle:!1});i.once("signal",function(n){o.push({offer:n,offer_id:e}),t()})})},i.prototype.setInterval=function(e){var t=this;clearInterval(t._interval),t._intervalMs=e,e&&(t._interval=setInterval(t.update.bind(t),t._intervalMs))}}).call(this,e("buffer").Buffer)},{buffer:196,debug:125,events:200,"extend.js":128,hat:129,inherits:130,"lodash.times":131,"simple-peer":155,"simple-websocket":165}],125:[function(e,t){t.exports=e(94)},{"./debug":126,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":94}],126:[function(e,t){t.exports=e(95)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":95,ms:127}],127:[function(e,t){t.exports=e(96)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":96}],128:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],129:[function(e,t){t.exports=e(103)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/hat/index.js":103}],130:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],131:[function(e,t){function n(e,t,n){e=(e=+e)>-1?e:0;var i=-1,r=Array(e);for(t=o(t,n,1);++i<e;)r[i]=t(i);return r}var o=e("lodash._basecreatecallback");t.exports=n},{"lodash._basecreatecallback":132}],132:[function(e,t){t.exports=e(26)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/index.js":26,"lodash._setbinddata":133,"lodash.bind":136,"lodash.identity":152,"lodash.support":153}],133:[function(e,t){t.exports=e(27)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/index.js":27,"lodash._isnative":134,"lodash.noop":135}],134:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],135:[function(e,t){t.exports=e(29)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":29}],136:[function(e,t){t.exports=e(30)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/index.js":30,"lodash._createwrapper":137,"lodash._slice":151}],137:[function(e,t){t.exports=e(31)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/index.js":31,"lodash._basebind":138,"lodash._basecreatewrapper":144,"lodash._slice":151,"lodash.isfunction":150}],138:[function(e,t){t.exports=e(32)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/index.js":32,"lodash._basecreate":139,"lodash._setbinddata":133,"lodash._slice":151,"lodash.isobject":142}],139:[function(e,t){t.exports=e(33)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/node_modules/lodash._basecreate/index.js":33,"lodash._isnative":140,"lodash.isobject":142,"lodash.noop":141}],140:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],141:[function(e,t){t.exports=e(29)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":29}],142:[function(e,t){t.exports=e(54)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash.isobject/index.js":54,"lodash._objecttypes":143}],143:[function(e,t){t.exports=e(48)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._baseisequal/node_modules/lodash._objecttypes/index.js":48}],144:[function(e,t){t.exports=e(36)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basecreatewrapper/index.js":36,"lodash._basecreate":145,"lodash._setbinddata":133,"lodash._slice":151,"lodash.isobject":148}],145:[function(e,t){t.exports=e(33)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/node_modules/lodash._basecreate/index.js":33,"lodash._isnative":146,"lodash.isobject":148,"lodash.noop":147}],146:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],147:[function(e,t){t.exports=e(29)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":29}],148:[function(e,t){t.exports=e(54)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash.isobject/index.js":54,"lodash._objecttypes":149}],149:[function(e,t){t.exports=e(48)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._baseisequal/node_modules/lodash._objecttypes/index.js":48}],150:[function(e,t){t.exports=e(40)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash.isfunction/index.js":40}],151:[function(e,t){t.exports=e(41)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._slice/index.js":41}],152:[function(e,t){t.exports=e(42)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.identity/index.js":42}],153:[function(e,t){t.exports=e(43)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash.map/node_modules/lodash.createcallback/node_modules/lodash._basecreatecallback/node_modules/lodash.support/index.js":43,"lodash._isnative":154}],154:[function(e,t){t.exports=e(23)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/lodash.flatten/node_modules/lodash._baseflatten/node_modules/lodash.isarray/node_modules/lodash._isnative/index.js":23}],155:[function(e,t){function n(e){return this instanceof n?(r.call(this),e=a({initiator:!1,stream:!1,config:n.config,constraints:n.constraints,channelName:e&&e.initiator?"simple-peer-"+s(160):null,trickle:!0},e),a(this,e),i("new peer initiator: %s channelName: %s",this.initiator,this.channelName),this.destroyed=!1,this.ready=!1,this._pcReady=!1,this._channelReady=!1,this._dataStreams=[],this._iceComplete=!1,this._pc=new f(this.config,this.constraints),this._pc.oniceconnectionstatechange=this._onIceConnectionStateChange.bind(this),this._pc.onsignalingstatechange=this._onSignalingStateChange.bind(this),this._pc.onicecandidate=this._onIceCandidate.bind(this),this._channel=null,this.stream&&this._setupVideo(this.stream),void(this.initiator?(this._setupData({channel:this._pc.createDataChannel(this.channelName)}),this._pc.onnegotiationneeded=l(function(){this._pc.createOffer(function(e){this._pc.setLocalDescription(e);var t=function(){this.emit("signal",this._pc.localDescription||e)}.bind(this);this.trickle||this._iceComplete?t():this.once("_iceComplete",t)}.bind(this),this._onError.bind(this))}.bind(this)),window.mozRTCPeerConnection&&setTimeout(this._pc.onnegotiationneeded.bind(this._pc),0)):this._pc.ondatachannel=this._setupData.bind(this))):new n(e)}function o(e){p.Duplex.call(this,e),this._peer=e._peer,i("new stream")}t.exports=n;var i=e("debug")("simple-peer"),r=e("events").EventEmitter,a=e("extend.js"),s=e("hat"),d=e("inherits"),c=e("is-typedarray"),l=e("once"),p=e("stream"),u=e("typedarray-to-buffer"),f="undefined"!=typeof window&&(window.mozRTCPeerConnection||window.RTCPeerConnection||window.webkitRTCPeerConnection),h="undefined"!=typeof window&&(window.mozRTCSessionDescription||window.RTCSessionDescription||window.webkitRTCSessionDescription),m="undefined"!=typeof window&&(window.mozRTCIceCandidate||window.RTCIceCandidate||window.webkitRTCIceCandidate);d(n,r),n.config={iceServers:[{url:"stun:23.21.150.121"}]},n.constraints={},n.prototype.send=function(e,t){return this._channelReady?(i("send %s",e),this._channel.send(c.strict(e)||e instanceof ArrayBuffer||e instanceof Blob||"string"==typeof e?e:JSON.stringify(e)),void(t&&t(null))):this.once("ready",this.send.bind(this,e,t))},n.prototype.signal=function(e){if(!this.destroyed){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}if(i("signal %s",JSON.stringify(e)),e.sdp&&this._pc.setRemoteDescription(new h(e),function(){var e="offer"===this._pc.remoteDescription.type;e&&this._pc.createAnswer(function(e){this._pc.setLocalDescription(e);var t=function(){this.emit("signal",this._pc.localDescription||e)}.bind(this);this.trickle||this._iceComplete?t():this.once("_iceComplete",t)}.bind(this),this._onError.bind(this))}.bind(this),this._onError.bind(this)),e.candidate)try{this._pc.addIceCandidate(new m(e.candidate))}catch(t){this.destroy(new Error("error adding candidate, "+t.message))}e.sdp||e.candidate||this.destroy(new Error("signal() called with invalid signal data"))}},n.prototype.destroy=function(e,t){if(!this.destroyed){if(i("destroy (error: %s)",e&&e.message),this.destroyed=!0,this.ready=!1,"function"==typeof e&&(t=e,e=null),t&&this.once("close",t),this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null}if(this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null}this._pc=null,this._channel=null,this._dataStreams.forEach(function(t){e&&t.emit("error",e),t._readableState.ended||t.push(null),t._writableState.finished||t.end()}),this._dataStreams=[],e&&this.emit("error",e),this.emit("close")}},n.prototype.getDataStream=function(e){if(this.destroyed)throw new Error("peer is destroyed");var t=new o(a({_peer:this},e));return this._dataStreams.push(t),t},n.prototype._setupData=function(e){this._channel=e.channel,this.channelName=this._channel.label,this._channel.binaryType="arraybuffer",this._channel.onmessage=this._onChannelMessage.bind(this),this._channel.onopen=this._onChannelOpen.bind(this),this._channel.onclose=this._onChannelClose.bind(this)},n.prototype._setupVideo=function(e){this._pc.addStream(e),this._pc.onaddstream=this._onAddStream.bind(this)},n.prototype._onIceConnectionStateChange=function(){var e=this._pc.iceGatheringState,t=this._pc.iceConnectionState;this.emit("iceConnectionStateChange",e,t),i("iceConnectionStateChange %s %s",e,t),("connected"===t||"completed"===t)&&(this._pcReady=!0,this._maybeReady()),("disconnected"===t||"closed"===t)&&this.destroy()},n.prototype._maybeReady=function(){i("maybeReady pc %s channel %s",this._pcReady,this._channelReady),!this.ready&&this._pcReady&&this._channelReady&&(i("ready"),this.ready=!0,this.emit("ready"))},n.prototype._onSignalingStateChange=function(){this.emit("signalingStateChange",this._pc.signalingState),i("signalingStateChange %s",this._pc.signalingState)},n.prototype._onIceCandidate=function(e){e.candidate&&this.trickle?this.emit("signal",{candidate:e.candidate}):e.candidate||(this._iceComplete=!0,this.emit("_iceComplete"))},n.prototype._onChannelMessage=function(e){if(!this.destroyed){var t=e.data;if(i("receive %s",t),t instanceof ArrayBuffer)t=u(new Uint8Array(t)),this.emit("message",t);else try{this.emit("message",JSON.parse(t))}catch(n){this.emit("message",t)}this._dataStreams.forEach(function(e){e.push(t)})}},n.prototype._onChannelOpen=function(){this._channelReady=!0,this._maybeReady()},n.prototype._onChannelClose=function(){this._channelReady=!1,this.destroy()},n.prototype._onAddStream=function(e){this.emit("stream",e.stream)},n.prototype._onError=function(e){i("error %s",e.message),this.destroy(e)},d(o,p.Duplex),o.prototype.destroy=function(){this._peer.destroy()},o.prototype._read=function(){},o.prototype._write=function(e,t,n){this._peer.send(e,n)}},{debug:156,events:200,"extend.js":159,hat:160,inherits:161,"is-typedarray":162,once:163,stream:216,"typedarray-to-buffer":164}],156:[function(e,t){t.exports=e(94)},{"./debug":157,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":94}],157:[function(e,t){t.exports=e(95)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":95,ms:158}],158:[function(e,t){t.exports=e(96)
-},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":96}],159:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],160:[function(e,t){t.exports=e(103)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/hat/index.js":103}],161:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],162:[function(e,t){function n(e){return o(e)||i(e)}function o(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function i(e){return a[r.call(e)]}t.exports=n,n.strict=o,n.loose=i;var r=Object.prototype.toString,a={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},{}],163:[function(e,t){t.exports=e(90)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/once/once.js":90}],164:[function(e,t){(function(e){t.exports=function(t){return"function"==typeof e._augment&&e.TYPED_ARRAY_SUPPORT?e._augment(t):new e(t)}}).call(this,e("buffer").Buffer)},{buffer:196}],165:[function(e,t){function n(e,t){return this instanceof n?(o.call(this),t||(t={}),this._url=e,this._reconnect=void 0!==t.reconnect?t.reconnect:a,void this._init()):new n(e,t)}t.exports=n;var o=e("events").EventEmitter,i=e("inherits"),r=e("once"),a=5e3;i(n,o),n.prototype.send=function(e){this._ws&&this._ws.readyState===WebSocket.OPEN&&("object"==typeof e&&(e=JSON.stringify(e)),this._ws.send(e))},n.prototype.destroy=function(e){e&&this.once("close",e);try{this._ws.close()}catch(t){this._onclose()}},n.prototype._init=function(){this._errored=!1,this._ws=new WebSocket(this._url),this._ws.onopen=this._onopen.bind(this),this._ws.onmessage=this._onmessage.bind(this),this._ws.onclose=this._onclose.bind(this),this._ws.onerror=r(this._onerror.bind(this))},n.prototype._onopen=function(){this.emit("ready")},n.prototype._onerror=function(e){this._errored=!0,this.destroy(),this._reconnect?(this._timeout=setTimeout(this._init.bind(this),this._reconnect),this.emit("warning",e)):this.emit("error",e)},n.prototype._onmessage=function(e){var t=e.data;try{t=JSON.parse(e.data)}catch(n){}this.emit("message",t)},n.prototype._onclose=function(){clearTimeout(this._timeout),this._ws&&(this._ws.onopen=null,this._ws.onerror=null,this._ws.onmessage=null,this._ws.onclose=null),this._ws=null,this._errored||this.emit("close")}},{events:200,inherits:166,once:167}],166:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],167:[function(e,t){t.exports=e(90)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/once/once.js":90}],168:[function(e,t){(function(n){var o=e("bencode"),i=e("bitfield"),r=e("events").EventEmitter,a=e("inherits"),s=e("git-sha1"),d=1e7,c=1e3,l=16384;t.exports=function(e){function t(t){r.call(this),this._wire=t,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._fetching=!1,this._bitfield=new i(0,{grow:c}),n.isBuffer(e)&&this.setMetadata(e)}return a(t,r),t.prototype.name="ut_metadata",t.prototype.onHandshake=function(e){this._infoHash=e,this._infoHashHex=e.toString("hex")},t.prototype.onExtendedHandshake=function(e){return e.m&&e.m.ut_metadata?e.metadata_size?e.metadata_size>d?this.emit("warning",new Error("Peer gave maliciously large metadata size")):(this._metadataSize=e.metadata_size,this._numPieces=Math.ceil(this._metadataSize/l),this._remainingRejects=2*this._numPieces,void(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"))},t.prototype.onMessage=function(e){var t,n;try{var i=e.toString(),r=i.indexOf("ee")+2;t=o.decode(i.substring(0,r)),n=e.slice(r)}catch(a){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)}},t.prototype.fetch=function(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())},t.prototype.cancel=function(){this._fetching=!1},t.prototype.setMetadata=function(e){if(this._metadataComplete)return!0;try{var t=o.decode(e).info;t&&(e=o.encode(t))}catch(n){}return this._infoHashHex&&this._infoHashHex!==s(e)?!1:(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)},t.prototype._send=function(e,t){var i=o.encode(e);n.isBuffer(t)&&(i=n.concat([i,t])),this._wire.extended("ut_metadata",i)},t.prototype._request=function(e){this._send({msg_type:0,piece:e})},t.prototype._data=function(e,t,n){var o={msg_type:1,piece:e};"number"==typeof n&&(o.total_size=n),this._send(o,t)},t.prototype._reject=function(e){this._send({msg_type:2,piece:e})},t.prototype._onRequest=function(e){if(!this._metadataComplete)return void this._reject(e);var t=e*l,n=t+l;n>this._metadataSize&&(n=this._metadataSize);var o=this.metadata.slice(t,n);this._data(e,o,this._metadataSize)},t.prototype._onData=function(e,t){t.length>l||(t.copy(this.metadata,e*l),this._bitfield.set(e),this._checkDone())},t.prototype._onReject=function(e){this._remainingRejects>0&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error('Peer sent "reject" too much'))},t.prototype._requestPieces=function(){this.metadata=new n(this._metadataSize);for(var e=0;e<this._numPieces;e++)this._request(e)},t.prototype._checkDone=function(){for(var e=!0,t=0;t<this._numPieces;t++)if(!this._bitfield.get(t)){e=!1;break}if(e){var n=this.setMetadata(this.metadata);n||this._failedMetadata()}},t.prototype._failedMetadata=function(){this._bitfield=new i(0,{grow:c}),this._remainingRejects-=this._numPieces,this._remainingRejects>0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))},t}}).call(this,e("buffer").Buffer)},{bencode:169,bitfield:172,buffer:196,events:200,"git-sha1":173,inherits:174}],169:[function(e,t){t.exports=e(9)},{"./lib/decode":170,"./lib/encode":171,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/bencode.js":9}],170:[function(e,t){t.exports=e(10)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/decode.js":10,buffer:196}],171:[function(e,t){t.exports=e(11)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/encode.js":11,buffer:196}],172:[function(e,t){t.exports=e(6)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/bitfield/index.js":6,buffer:196}],173:[function(e,t){t.exports=e(17)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/git-sha1/git-sha1.js":17,_process:203}],174:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],175:[function(e,t){(function(n){function o(e,t,n){this.swarm=e,this.stream=t,this.id=n;var o=this.wire=new l;this.timeout=null,this.handshaked=!1,this.paused=!0;var i=d(function(){this.handshaked&&this.swarm.wires.splice(this.swarm.wires.indexOf(this.wire),1),this.destroy(),this.swarm._drain(),this.swarm._peers[this.id]=null}.bind(this));t.once("end",i),t.once("error",i),t.once("close",i),t.once("finish",i),o.once("end",i),o.once("close",i),o.once("error",i),o.once("finish",i),o.on("handshake",this._onHandshake.bind(this)),t.pipe(o).pipe(t)}function i(e,t,o){return this instanceof i?(a.call(this),o||(o={}),this.infoHash="string"==typeof e?new n(e,"hex"):e,this.infoHashHex=this.infoHash.toString("hex"),this.peerId="string"==typeof t?new n(t,"utf8"):t,this.peerIdHex=this.peerId.toString("hex"),r("new swarm i %s p %s",this.infoHashHex,this.peerIdHex),this.handshake=o.handshake,this.maxPeers=o.maxPeers||p,this.downloaded=0,this.uploaded=0,this.downloadSpeed=c(),this.uploadSpeed=c(),this.wires=[],this._queue=[],this._peers={},this.paused=!1,void(this.destroyed=!1)):new i(e,t,o)}t.exports=i;var r=e("debug")("webtorrent-swarm"),a=e("events").EventEmitter,s=e("inherits"),d=e("once"),c=e("speedometer"),l=e("bittorrent-protocol"),p=30,u=25e3;o.prototype.destroy=function(){r("peer destroy"),this.stream&&this.stream.destroy(),this.wire&&this.wire.destroy(),this.timeout&&clearTimeout(this.timeout),this.stream=null,this.wire=null,this.timeout=null},o.prototype.handshake=function(){this.paused=!1,this.wire.handshake(this.swarm.infoHash,this.swarm.peerId,this.swarm.handshake),r("sent handshake i %s p %s",this.swarm.infoHashHex,this.swarm.peerIdHex),this.handshaked||(this.timeout=setTimeout(function(){this.destroy()}.bind(this),u))},o.prototype._onHandshake=function(e){var t=e.toString("hex");return r("got handshake %s",t),this.swarm.destroyed||t!==this.swarm.infoHashHex?this.destroy():(this.handshaked=!0,clearTimeout(this.timeout),this.wire.on("download",function(e){this.swarm.downloaded+=e,this.swarm.downloadSpeed(e),this.swarm.emit("download",e)}.bind(this)),this.wire.on("upload",function(e){this.swarm.uploaded+=e,this.swarm.uploadSpeed(e),this.swarm.emit("upload",e)}.bind(this)),this.swarm.wires.push(this.wire),void this.swarm.emit("wire",this.wire))},s(i,a),Object.defineProperty(i.prototype,"ratio",{get:function(){return 0===this.downloaded?0:this.uploaded/this.downloaded}}),Object.defineProperty(i.prototype,"numQueued",{get:function(){return this._queue.length}}),Object.defineProperty(i.prototype,"numPeers",{get:function(){return this.wires.length}}),i.prototype.addPeer=function(e){if(!this.destroyed&&!this._peers[e.id]){var t=new o(this,e.getDataStream(),e.id);this._peers[e.id]=t,this._queue.push(t),this._drain()}},i.prototype.pause=function(){r("pause"),this.paused=!0},i.prototype.resume=function(){r("resume"),this.paused=!1,this._drain()},i.prototype.removePeer=function(e){r("removePeer %s",e),this._removePeer(e),this._drain()},i.prototype._removePeer=function(e){r("_removePeer %s",e),e.destroy()},i.prototype.destroy=function(e){if(!this.destroyed){this.destroyed=!0,e&&this.once("close",e),r("destroy");for(var t in this._peers)this._removePeer(t);this.emit("close")}},i.prototype._drain=function(){if(!(this.paused||this.destroyed||this.numPeers>=this.maxPeers)){r("drain %s queued %s peers %s max",this.numQueued,this.numPeers,this.maxPeers);var e=this._queue.shift();e&&e.handshake()}}}).call(this,e("buffer").Buffer)},{"bittorrent-protocol":176,buffer:196,debug:187,events:200,inherits:190,once:191,speedometer:192}],176:[function(e,t){(function(n){function o(e,t,n,o){this.piece=e,this.offset=t,this.length=n,this.callback=o}function i(){return this instanceof i?(f.Duplex.call(this),c("new wire"),this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new s(0,{grow:h}),this.peerExtensions={},this.requests=[],this.peerRequests=[],this.extendedMapping={},this.peerExtendedMapping={},this.extendedHandshake={},this.peerExtendedHandshake={},this._ext={},this._nextExt=1,this.uploaded=0,this.downloaded=0,this.uploadSpeed=u(),this.downloadSpeed=u(),this._keepAlive=null,this._timeout=null,this._timeoutMs=0,this.destroyed=!1,this._finished=!1,this._buffer=[],this._bufferSize=0,this._parser=null,this._parserSize=0,this.on("finish",this._onfinish),void this._parseHandshake()):new i}function r(e,t,n,o){for(var i=0;i<e.length;i++){var r=e[i];if(r.piece===t&&r.offset===n&&r.length===o)return 0===i?e.shift():e.splice(i,1),r}return null}function a(e){try{return d.decode(e)}catch(t){console.warn(t)}}t.exports=i;var s=e("bitfield"),d=e("bencode"),c=e("debug")("bittorrent-protocol"),l=e("extend.js"),p=e("inherits"),u=e("speedometer"),f=e("stream"),h=4e5,m=new n("BitTorrent protocol"),_=new n([0,0,0,0]),v=new n([0,0,0,1,0]),g=new n([0,0,0,1,1]),b=new n([0,0,0,1,2]),x=new n([0,0,0,1,3]),w=[0,0,0,0,0,0,0,0],y=[0,0,0,3,9,0,0];p(i,f.Duplex),i.prototype.setKeepAlive=function(e){clearInterval(this._keepAlive),e!==!1&&(this._keepAlive=setInterval(this._push.bind(this,_),6e4))},i.prototype.setTimeout=function(e){this._clearTimeout(),this._timeoutMs=e,this._updateTimeout()},i.prototype.destroy=function(){this.destroyed=!0,this.end()},i.prototype.end=function(){this._onUninterested(),this._onChoke(),f.Duplex.prototype.end.apply(this,arguments)},i.prototype.use=function(e){function t(){}var n=e.name||e.prototype.name;if(!n)throw new Error("Extension API requires a named function, e.g. function name() {}");var o=this._nextExt,i=new e(this);"function"!=typeof i.onHandshake&&(i.onHandshake=t),"function"!=typeof i.onExtendedHandshake&&(i.onExtendedHandshake=t),"function"!=typeof i.onMessage&&(i.onMessage=t),this.extendedMapping[o]=n,this._ext[n]=i,this[n]=i,this._nextExt+=1},i.prototype.handshake=function(e,t,o){if("string"==typeof e&&(e=new n(e,"hex")),"string"==typeof t&&(t=new n(t,"hex")),20!==e.length||20!==t.length)throw new Error("infoHash and peerId MUST have length 20");var i=new n(w);i[5]|=16,o&&o.dht&&(i[7]|=1),this._push(n.concat([m,i,e,t]))},i.prototype.choke=function(){if(!this.amChoking){for(this.amChoking=!0;this.peerRequests.length;)this.peerRequests.pop();this._push(v)}},i.prototype.unchoke=function(){this.amChoking&&(this.amChoking=!1,this._push(g))},i.prototype.interested=function(){this.amInterested||(this.amInterested=!0,this._push(b))},i.prototype.uninterested=function(){this.amInterested&&(this.amInterested=!1,this._push(x))},i.prototype.have=function(e){this._message(4,[e],null)},i.prototype.bitfield=function(e){n.isBuffer(e)||(e=e.buffer),this._message(5,[],e)},i.prototype.request=function(e,t,n,i){return i||(i=function(){}),this._finished?i(new Error("wire is closed")):this.peerChoking?i(new Error("peer is choking")):(this.requests.push(new o(e,t,n,i)),this._updateTimeout(),void this._message(6,[e,t,n],null))},i.prototype.piece=function(e,t,n){this.uploaded+=n.length,this.uploadSpeed(n.length),this.emit("upload",n.length),this._message(7,[e,t],n)},i.prototype.cancel=function(e,t,n){this._callback(r(this.requests,e,t,n),new Error("request was cancelled"),null),this._message(8,[e,t,n],null)},i.prototype.port=function(e){var t=new n(y);t.writeUInt16BE(e,5),this._push(t)},i.prototype.extended=function(e,t){if("string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"==typeof e){var o=new n([e]),i=n.isBuffer(t)?t:d.encode(t);this._message(20,[],n.concat([o,i]))}else console.warn("Skipping extension",e)},i.prototype._onKeepAlive=function(){this.emit("keep-alive")},i.prototype._onHandshake=function(e,t,n){this.peerId=t,this.peerExtensions=n,this.emit("handshake",e,t,n);var o;for(o in this._ext)this._ext[o].onHandshake(e,t,n);if(n.extended){var i=l({},this.extendedHandshake);i.m={};for(var r in this.extendedMapping)o=this.extendedMapping[r],i.m[o]=Number(r);this.extended(0,d.encode(i))}},i.prototype._onChoke=function(){for(this.peerChoking=!0,this.emit("choke");this.requests.length;)this._callback(this.requests.shift(),new Error("peer is choking"),null)},i.prototype._onUnchoke=function(){this.peerChoking=!1,this.emit("unchoke")},i.prototype._onInterested=function(){this.peerInterested=!0,this.emit("interested")},i.prototype._onUninterested=function(){this.peerInterested=!1,this.emit("uninterested")},i.prototype._onHave=function(e){this.peerPieces.get(e)||(this.peerPieces.set(e,!0),this.emit("have",e))},i.prototype._onBitField=function(e){this.peerPieces=new s(e),this.emit("bitfield",this.peerPieces)},i.prototype._onRequest=function(e,t,n){if(!this.amChoking){var i=function(o,i){a===r(this.peerRequests,e,t,n)&&(o||this.piece(e,t,i))}.bind(this),a=new o(e,t,n,i);this.peerRequests.push(a),this.emit("request",e,t,n,i)}},i.prototype._onPiece=function(e,t,n){this._callback(r(this.requests,e,t,n.length),null,n),this.downloaded+=n.length,this.downloadSpeed(n.length),this.emit("download",n.length),this.emit("piece",e,t,n)},i.prototype._onCancel=function(e,t,n){r(this.peerRequests,e,t,n),this.emit("cancel",e,t,n)},i.prototype._onPort=function(e){this.emit("port",e)},i.prototype._onExtended=function(e,t){var n,o;if(0===e&&(n=a(t))){if(this.peerExtendedHandshake=n,"object"==typeof n.m)for(o in n.m)this.peerExtendedMapping[o]=Number(n.m[o].toString());for(o in this._ext)this.peerExtendedMapping[o]&&this._ext[o].onExtendedHandshake(this.peerExtendedHandshake);this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this.emit("extended",e,t)},i.prototype._onTimeout=function(){this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")},i.prototype._push=function(e){return this._finished?void 0:this.push(e)},i.prototype._write=function(e,t,o){for(this._bufferSize+=e.length,this._buffer.push(e);this._bufferSize>=this._parserSize;){var i=1===this._buffer.length?this._buffer[0]:n.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[i.slice(this._parserSize)]:[],this._parser(i.slice(0,this._parserSize))}o(null)},i.prototype._read=function(){},i.prototype._callback=function(e,t,n){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,n))},i.prototype._clearTimeout=function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)},i.prototype._updateTimeout=function(){this._timeoutMs&&this.requests.length&&!this._timeout&&(this._timeout=setTimeout(this._onTimeout.bind(this),this._timeoutMs))},i.prototype._parse=function(e,t){this._parserSize=e,this._parser=t},i.prototype._message=function(e,t,o){var i=o?o.length:0,r=new n(5+4*t.length);r.writeUInt32BE(r.length+i-4,0),r[4]=e;for(var a=0;a<t.length;a++)r.writeUInt32BE(t[a],5+4*a);this._push(r),o&&this._push(o)},i.prototype._onmessagelength=function(e){var t=e.readUInt32BE(0);t>0?this._parse(t,this._onmessage):(this._onKeepAlive(),this._parse(4,this._onmessagelength))},i.prototype._onmessage=function(e){switch(this._parse(4,this._onmessagelength),e[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.readUInt32BE(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 7:return this._onPiece(e.readUInt32BE(1),e.readUInt32BE(5),e.slice(9));case 8:return this._onCancel(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 9:return this._onPort(e.readUInt16BE(1));case 20:return this._onExtended(e.readUInt8(1),e.slice(2))}this.emit("unknownmessage",e)},i.prototype._parseHandshake=function(){this._parse(1,function(e){var t=e.readUInt8(0);this._parse(t+48,function(e){var n=e.slice(0,t);return"BitTorrent protocol"!==n.toString()?(c("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void this.end()):(e=e.slice(t),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),extended:!!(16&e[5])}),void this._parse(4,this._onmessagelength))}.bind(this))}.bind(this))},i.prototype._onfinish=function(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAlive),this._parse(Number.MAX_VALUE,function(){}),this.peerRequests=[];this.requests.length;)this._callback(this.requests.shift(),new Error("wire was closed"),null)}}).call(this,e("buffer").Buffer)},{bencode:177,bitfield:180,buffer:196,debug:181,"extend.js":184,inherits:185,speedometer:186,stream:216}],177:[function(e,t){t.exports=e(9)},{"./lib/decode":178,"./lib/encode":179,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/bencode.js":9}],178:[function(e,t){t.exports=e(10)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/decode.js":10,buffer:196}],179:[function(e,t){t.exports=e(11)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/encode.js":11,buffer:196}],180:[function(e,t){t.exports=e(6)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/bitfield/index.js":6,buffer:196}],181:[function(e,t){t.exports=e(94)},{"./debug":182,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":94}],182:[function(e,t){t.exports=e(95)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":95,ms:183}],183:[function(e,t){t.exports=e(96)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":96}],184:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],185:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],186:[function(e,t){t.exports=e(116)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/speedometer/index.js":116}],187:[function(e,t){t.exports=e(94)},{"./debug":188,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":94}],188:[function(e,t){t.exports=e(95)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":95,ms:189}],189:[function(e,t){t.exports=e(96)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":96}],190:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],191:[function(e,t){t.exports=e(90)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/once/once.js":90}],192:[function(e,t){t.exports=e(116)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/speedometer/index.js":116}],193:[function(){},{}],194:[function(e,t){function n(e,t){return u.isUndefined(t)?""+t:!u.isNumber(t)||!isNaN(t)&&isFinite(t)?u.isFunction(t)||u.isRegExp(t)?t.toString():t:t.toString()}function o(e,t){return u.isString(e)?e.length<t?e:e.slice(0,t):e}function i(e){return o(JSON.stringify(e.actual,n),128)+" "+e.operator+" "+o(JSON.stringify(e.expected,n),128)}function r(e,t,n,o,i){throw new m.AssertionError({message:n,actual:e,expected:t,operator:o,stackStartFunction:i})}function a(e,t){e||r(e,!0,t,"==",m.ok)}function s(e,t){if(e===t)return!0;if(u.isBuffer(e)&&u.isBuffer(t)){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return u.isDate(e)&&u.isDate(t)?e.getTime()===t.getTime():u.isRegExp(e)&&u.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:u.isObject(e)||u.isObject(t)?c(e,t):e==t}function d(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function c(e,t){if(u.isNullOrUndefined(e)||u.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(d(e))return d(t)?(e=f.call(e),t=f.call(t),s(e,t)):!1;try{var n,o,i=_(e),r=_(t)}catch(a){return!1}if(i.length!=r.length)return!1;for(i.sort(),r.sort(),o=i.length-1;o>=0;o--)if(i[o]!=r[o])return!1;for(o=i.length-1;o>=0;o--)if(n=i[o],!s(e[n],t[n]))return!1;return!0}function l(e,t){return e&&t?"[object RegExp]"==Object.prototype.toString.call(t)?t.test(e):e instanceof t?!0:t.call({},e)===!0?!0:!1:!1}function p(e,t,n,o){var i;u.isString(n)&&(o=n,n=null);try{t()}catch(a){i=a}if(o=(n&&n.name?" ("+n.name+").":".")+(o?" "+o:"."),e&&!i&&r(i,n,"Missing expected exception"+o),!e&&l(i,n)&&r(i,n,"Got unwanted exception"+o),e&&i&&n&&!l(i,n)||!e&&i)throw i}var u=e("util/"),f=Array.prototype.slice,h=Object.prototype.hasOwnProperty,m=t.exports=a;m.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=i(this),this.generatedMessage=!0);var t=e.stackStartFunction||r;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var o=n.stack,a=t.name,s=o.indexOf("\n"+a);if(s>=0){var d=o.indexOf("\n",s+1);o=o.substring(d+1)}this.stack=o}}},u.inherits(m.AssertionError,Error),m.fail=r,m.ok=a,m.equal=function(e,t,n){e!=t&&r(e,t,n,"==",m.equal)},m.notEqual=function(e,t,n){e==t&&r(e,t,n,"!=",m.notEqual)},m.deepEqual=function(e,t,n){s(e,t)||r(e,t,n,"deepEqual",m.deepEqual)},m.notDeepEqual=function(e,t,n){s(e,t)&&r(e,t,n,"notDeepEqual",m.notDeepEqual)},m.strictEqual=function(e,t,n){e!==t&&r(e,t,n,"===",m.strictEqual)},m.notStrictEqual=function(e,t,n){e===t&&r(e,t,n,"!==",m.notStrictEqual)},m.throws=function(){p.apply(this,[!0].concat(f.call(arguments)))},m.doesNotThrow=function(){p.apply(this,[!1].concat(f.call(arguments)))},m.ifError=function(e){if(e)throw e};var _=Object.keys||function(e){var t=[];for(var n in e)h.call(e,n)&&t.push(n);return t}},{"util/":218}],195:[function(e,t){t.exports=e(193)},{"/Users/feross/code/webtorrent/node_modules/browserify/lib/_empty.js":193}],196:[function(e,t,n){function o(e,t,n){if(!(this instanceof o))return new o(e,t,n);var i,r=typeof e;if("number"===r)i=e>0?e>>>0:0;else if("string"===r)"base64"===t&&(e=k(e)),i=o.byteLength(e,t);else{if("object"!==r||null===e)throw new TypeError("must start with number, buffer, array or string");"Buffer"===e.type&&P(e.data)&&(e=e.data),i=+e.length>0?Math.floor(+e.length):0}if(this.length>M)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+M.toString(16)+" bytes");var a;o.TYPED_ARRAY_SUPPORT?a=o._augment(new Uint8Array(i)):(a=this,a.length=i,a._isBuffer=!0);var s;if(o.TYPED_ARRAY_SUPPORT&&"number"==typeof e.byteLength)a._set(e);else if(E(e))if(o.isBuffer(e))for(s=0;i>s;s++)a[s]=e.readUInt8(s);else for(s=0;i>s;s++)a[s]=(e[s]%256+256)%256;else if("string"===r)a.write(e,0,t);else if("number"===r&&!o.TYPED_ARRAY_SUPPORT&&!n)for(s=0;i>s;s++)a[s]=0;return a}function i(e,t,n,o){n=Number(n)||0;var i=e.length-n;o?(o=Number(o),o>i&&(o=i)):o=i;var r=t.length;if(r%2!==0)throw new Error("Invalid hex string");o>r/2&&(o=r/2);for(var a=0;o>a;a++){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");e[n+a]=s}return a}function r(e,t,n,o){var i=T(U(t),e,n,o);return i}function a(e,t,n,o){var i=T(I(t),e,n,o);return i}function s(e,t,n,o){return a(e,t,n,o)}function d(e,t,n,o){var i=T(L(t),e,n,o);return i}function c(e,t,n,o){var i=T(A(t),e,n,o);return i}function l(e,t,n){return z.fromByteArray(0===t&&n===e.length?e:e.slice(t,n))}function p(e,t,n){var o="",i="";n=Math.min(e.length,n);for(var r=t;n>r;r++)e[r]<=127?(o+=B(i)+String.fromCharCode(e[r]),i=""):i+="%"+e[r].toString(16);return o+B(i)}function u(e,t,n){var o="";n=Math.min(e.length,n);for(var i=t;n>i;i++)o+=String.fromCharCode(e[i]);return o}function f(e,t,n){return u(e,t,n)}function h(e,t,n){var o=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>o)&&(n=o);for(var i="",r=t;n>r;r++)i+=S(e[r]);return i}function m(e,t,n){for(var o=e.slice(t,n),i="",r=0;r<o.length;r+=2)i+=String.fromCharCode(o[r]+256*o[r+1]);return i}function _(e,t,n){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function v(e,t,n,i,r,a){if(!o.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>r||a>t)throw new TypeError("value is out of bounds");if(n+i>e.length)throw new TypeError("index out of range")}function g(e,t,n,o){0>t&&(t=65535+t+1);for(var i=0,r=Math.min(e.length-n,2);r>i;i++)e[n+i]=(t&255<<8*(o?i:1-i))>>>8*(o?i:1-i)}function b(e,t,n,o){0>t&&(t=4294967295+t+1);for(var i=0,r=Math.min(e.length-n,4);r>i;i++)e[n+i]=t>>>8*(o?i:3-i)&255}function x(e,t,n,o,i,r){if(t>i||r>t)throw new TypeError("value is out of bounds");if(n+o>e.length)throw new TypeError("index out of range")}function w(e,t,n,o,i){return i||x(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),R.write(e,t,n,o,23,4),n+4}function y(e,t,n,o,i){return i||x(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),R.write(e,t,n,o,52,8),n+8}function k(e){for(e=j(e).replace(O,"");e.length%4!==0;)e+="=";return e}function j(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function E(e){return P(e)||o.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function S(e){return 16>e?"0"+e.toString(16):e.toString(16)}function U(e){for(var t=[],n=0;n<e.length;n++){var o=e.charCodeAt(n);if(127>=o)t.push(o);else{var i=n;o>=55296&&57343>=o&&n++;for(var r=encodeURIComponent(e.slice(i,n+1)).substr(1).split("%"),a=0;a<r.length;a++)t.push(parseInt(r[a],16))}}return t}function I(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}function A(e){for(var t,n,o,i=[],r=0;r<e.length;r++)t=e.charCodeAt(r),n=t>>8,o=t%256,i.push(o),i.push(n);return i}function L(e){return z.toByteArray(e)}function T(e,t,n,o){for(var i=0;o>i&&!(i+n>=t.length||i>=e.length);i++)t[i+n]=e[i];return i}function B(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}var z=e("base64-js"),R=e("ieee754"),P=e("is-array");n.Buffer=o,n.SlowBuffer=o,n.INSPECT_MAX_BYTES=50,o.poolSize=8192;var M=1073741823;o.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(n){return!1}}(),o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");for(var n=e.length,i=t.length,r=0,a=Math.min(n,i);a>r&&e[r]===t[r];r++);return r!==a&&(n=e[r],i=t[r]),i>n?-1:n>i?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!P(e))throw new TypeError("Usage: Buffer.concat(list[, length])");if(0===e.length)return new o(0);if(1===e.length)return e[0];var n;if(void 0===t)for(t=0,n=0;n<e.length;n++)t+=e[n].length;var i=new o(t),r=0;for(n=0;n<e.length;n++){var a=e[n];a.copy(i,r),r+=a.length}return i},o.byteLength=function(e,t){var n;switch(e+="",t||"utf8"){case"ascii":case"binary":case"raw":n=e.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;case"hex":n=e.length>>>1;break;case"utf8":case"utf-8":n=U(e).length;break;case"base64":n=L(e).length;break;default:n=e.length}return n},o.prototype.length=void 0,o.prototype.parent=void 0,o.prototype.toString=function(e,t,n){var o=!1;if(t>>>=0,n=void 0===n||1/0===n?this.length:n>>>0,e||(e="utf8"),0>t&&(t=0),n>this.length&&(n=this.length),t>=n)return"";for(;;)switch(e){case"hex":return h(this,t,n);case"utf8":case"utf-8":return p(this,t,n);case"ascii":return u(this,t,n);case"binary":return f(this,t,n);case"base64":return l(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}},o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return 0===o.compare(this,e)
-},o.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},o.prototype.compare=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return o.compare(this,e)},o.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},o.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},o.prototype.write=function(e,t,n,o){if(isFinite(t))isFinite(n)||(o=n,n=void 0);else{var l=o;o=t,t=n,n=l}t=Number(t)||0;var p=this.length-t;n?(n=Number(n),n>p&&(n=p)):n=p,o=String(o||"utf8").toLowerCase();var u;switch(o){case"hex":u=i(this,e,t,n);break;case"utf8":case"utf-8":u=r(this,e,t,n);break;case"ascii":u=a(this,e,t,n);break;case"binary":u=s(this,e,t,n);break;case"base64":u=d(this,e,t,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":u=c(this,e,t,n);break;default:throw new TypeError("Unknown encoding: "+o)}return u},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var n=this.length;if(e=~~e,t=void 0===t?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),e>t&&(t=e),o.TYPED_ARRAY_SUPPORT)return o._augment(this.subarray(e,t));for(var i=t-e,r=new o(i,void 0,!0),a=0;i>a;a++)r[a]=this[a+e];return r},o.prototype.readUInt8=function(e,t){return t||_(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||_(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||_(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||_(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readInt8=function(e,t){return t||_(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||_(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){t||_(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||_(e,4,this.length),R.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||_(e,4,this.length),R.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||_(e,8,this.length),R.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||_(e,8,this.length),R.read(this,e,!1,52,8)},o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||v(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||v(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8):g(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||v(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e):g(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||v(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e):b(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||v(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e):b(this,e,t,!1),t+4},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||v(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||v(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8):g(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||v(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e):g(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||v(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):b(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||v(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e):b(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,n){return w(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return w(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return y(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return y(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,i){var r=this;if(n||(n=0),i||0===i||(i=this.length),t||(t=0),i!==n&&0!==e.length&&0!==r.length){if(n>i)throw new TypeError("sourceEnd < sourceStart");if(0>t||t>=e.length)throw new TypeError("targetStart out of bounds");if(0>n||n>=r.length)throw new TypeError("sourceStart out of bounds");if(0>i||i>r.length)throw new TypeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var a=i-n;if(100>a||!o.TYPED_ARRAY_SUPPORT)for(var s=0;a>s;s++)e[s+t]=this[s+n];else e._set(this.subarray(n,n+a),t)}},o.prototype.fill=function(e,t,n){if(e||(e=0),t||(t=0),n||(n=this.length),t>n)throw new TypeError("end < start");if(n!==t&&0!==this.length){if(0>t||t>=this.length)throw new TypeError("start out of bounds");if(0>n||n>this.length)throw new TypeError("end out of bounds");var o;if("number"==typeof e)for(o=t;n>o;o++)this[o]=e;else{var i=U(e.toString()),r=i.length;for(o=t;n>o;o++)this[o]=i[o%r]}return this}},o.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(o.TYPED_ARRAY_SUPPORT)return new o(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;n>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var C=o.prototype;o._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=C.get,e.set=C.set,e.write=C.write,e.toString=C.toString,e.toLocaleString=C.toString,e.toJSON=C.toJSON,e.equals=C.equals,e.compare=C.compare,e.copy=C.copy,e.slice=C.slice,e.readUInt8=C.readUInt8,e.readUInt16LE=C.readUInt16LE,e.readUInt16BE=C.readUInt16BE,e.readUInt32LE=C.readUInt32LE,e.readUInt32BE=C.readUInt32BE,e.readInt8=C.readInt8,e.readInt16LE=C.readInt16LE,e.readInt16BE=C.readInt16BE,e.readInt32LE=C.readInt32LE,e.readInt32BE=C.readInt32BE,e.readFloatLE=C.readFloatLE,e.readFloatBE=C.readFloatBE,e.readDoubleLE=C.readDoubleLE,e.readDoubleBE=C.readDoubleBE,e.writeUInt8=C.writeUInt8,e.writeUInt16LE=C.writeUInt16LE,e.writeUInt16BE=C.writeUInt16BE,e.writeUInt32LE=C.writeUInt32LE,e.writeUInt32BE=C.writeUInt32BE,e.writeInt8=C.writeInt8,e.writeInt16LE=C.writeInt16LE,e.writeInt16BE=C.writeInt16BE,e.writeInt32LE=C.writeInt32LE,e.writeInt32BE=C.writeInt32BE,e.writeFloatLE=C.writeFloatLE,e.writeFloatBE=C.writeFloatBE,e.writeDoubleLE=C.writeDoubleLE,e.writeDoubleBE=C.writeDoubleBE,e.fill=C.fill,e.inspect=C.inspect,e.toArrayBuffer=C.toArrayBuffer,e};var O=/[^+\/0-9A-z]/g},{"base64-js":197,ieee754:198,"is-array":199}],197:[function(e,t,n){var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===a?62:t===s?63:d>t?-1:d+10>t?t-d+26+26:l+26>t?t-l:c+26>t?t-c+26:void 0}function n(e){function n(e){c[p++]=e}var o,i,a,s,d,c;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var l=e.length;d="="===e.charAt(l-2)?2:"="===e.charAt(l-1)?1:0,c=new r(3*e.length/4-d),a=d>0?e.length-4:e.length;var p=0;for(o=0,i=0;a>o;o+=4,i+=3)s=t(e.charAt(o))<<18|t(e.charAt(o+1))<<12|t(e.charAt(o+2))<<6|t(e.charAt(o+3)),n((16711680&s)>>16),n((65280&s)>>8),n(255&s);return 2===d?(s=t(e.charAt(o))<<2|t(e.charAt(o+1))>>4,n(255&s)):1===d&&(s=t(e.charAt(o))<<10|t(e.charAt(o+1))<<4|t(e.charAt(o+2))>>2,n(s>>8&255),n(255&s)),c}function i(e){function t(e){return o.charAt(e)}function n(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var i,r,a,s=e.length%3,d="";for(i=0,a=e.length-s;a>i;i+=3)r=(e[i]<<16)+(e[i+1]<<8)+e[i+2],d+=n(r);switch(s){case 1:r=e[e.length-1],d+=t(r>>2),d+=t(r<<4&63),d+="==";break;case 2:r=(e[e.length-2]<<8)+e[e.length-1],d+=t(r>>10),d+=t(r>>4&63),d+=t(r<<2&63),d+="="}return d}var r="undefined"!=typeof Uint8Array?Uint8Array:Array,a="+".charCodeAt(0),s="/".charCodeAt(0),d="0".charCodeAt(0),c="a".charCodeAt(0),l="A".charCodeAt(0);e.toByteArray=n,e.fromByteArray=i}("undefined"==typeof n?this.base64js={}:n)},{}],198:[function(e,t,n){n.read=function(e,t,n,o,i){var r,a,s=8*i-o-1,d=(1<<s)-1,c=d>>1,l=-7,p=n?i-1:0,u=n?-1:1,f=e[t+p];for(p+=u,r=f&(1<<-l)-1,f>>=-l,l+=s;l>0;r=256*r+e[t+p],p+=u,l-=8);for(a=r&(1<<-l)-1,r>>=-l,l+=o;l>0;a=256*a+e[t+p],p+=u,l-=8);if(0===r)r=1-c;else{if(r===d)return a?0/0:1/0*(f?-1:1);a+=Math.pow(2,o),r-=c}return(f?-1:1)*a*Math.pow(2,r-o)},n.write=function(e,t,n,o,i,r){var a,s,d,c=8*r-i-1,l=(1<<c)-1,p=l>>1,u=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:r-1,h=o?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-a))<1&&(a--,d*=2),t+=a+p>=1?u/d:u*Math.pow(2,1-p),t*d>=2&&(a++,d/=2),a+p>=l?(s=0,a=l):a+p>=1?(s=(t*d-1)*Math.pow(2,i),a+=p):(s=t*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=h,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=h,a/=256,c-=8);e[n+f-h]|=128*m}},{}],199:[function(e,t){var n=Array.isArray,o=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==o.call(e)}},{}],200:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function o(e){return"function"==typeof e}function i(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,s,d,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],a(n))return!1;if(o(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,s=new Array(i-1),d=1;i>d;d++)s[d-1]=arguments[d];n.apply(this,s)}else if(r(n)){for(i=arguments.length,s=new Array(i-1),d=1;i>d;d++)s[d-1]=arguments[d];for(c=n.slice(),i=c.length,d=0;i>d;d++)c[d].apply(this,s)}return!0},n.prototype.addListener=function(e,t){var i;if(!o(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,o(t.listener)?t.listener:t),this._events[e]?r(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,r(this._events[e])&&!this._events[e].warned){var i;i=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,a,s;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,i=-1,n===t||o(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(r(n)){for(s=a;s-->0;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(0>i)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],o(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?o(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?o(e._events[t])?1:e._events[t].length:0}},{}],201:[function(e,t){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],202:[function(e,t,n){(function(e){function t(e,t){for(var n=0,o=e.length-1;o>=0;o--){var i=e[o];"."===i?e.splice(o,1):".."===i?(e.splice(o,1),n++):n&&(e.splice(o,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function o(e,t){if(e.filter)return e.filter(t);for(var n=[],o=0;o<e.length;o++)t(e[o],o,e)&&n.push(e[o]);return n}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,r=function(e){return i.exec(e).slice(1)};n.resolve=function(){for(var n="",i=!1,r=arguments.length-1;r>=-1&&!i;r--){var a=r>=0?arguments[r]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(n=a+"/"+n,i="/"===a.charAt(0))}return n=t(o(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),r="/"===a(e,-1);return e=t(o(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&r&&(e+="/"),(i?"/":"")+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 o(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===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 i=o(e.split("/")),r=o(t.split("/")),a=Math.min(i.length,r.length),s=a,d=0;a>d;d++)if(i[d]!==r[d]){s=d;break}for(var c=[],d=s;d<i.length;d++)c.push("..");return c=c.concat(r.slice(s)),c.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=r(e),n=t[0],o=t[1];return n||o?(o&&(o=o.substr(0,o.length-1)),n+o):"."},n.basename=function(e,t){var n=r(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return r(e)[3]};var a="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return 0>t&&(t=e.length+t),e.substr(t,n)}}).call(this,e("_process"))},{_process:203}],203:[function(e,t){function n(){}var o=t.exports={};o.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var o=n.shift();o()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),o.title="browser",o.browser=!0,o.env={},o.argv=[],o.on=n,o.addListener=n,o.once=n,o.off=n,o.removeListener=n,o.removeAllListeners=n,o.emit=n,o.binding=function(){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(){throw new Error("process.chdir is not supported")}},{}],204:[function(e,t){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":205}],205:[function(e,t){(function(n){function o(e){return this instanceof o?(d.call(this,e),c.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new o(e)}function i(){this.allowHalfOpen||this._writableState.ended||n.nextTick(this.end.bind(this))}function r(e,t){for(var n=0,o=e.length;o>n;n++)t(e[n],n)}t.exports=o;var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},s=e("core-util-is");s.inherits=e("inherits");var d=e("./_stream_readable"),c=e("./_stream_writable");s.inherits(o,d),r(a(c.prototype),function(e){o.prototype[e]||(o.prototype[e]=c.prototype[e])})}).call(this,e("_process"))},{"./_stream_readable":207,"./_stream_writable":209,_process:203,"core-util-is":210,inherits:223}],206:[function(e,t){function n(e){return this instanceof n?void o.call(this,e):new n(e)}t.exports=n;var o=e("./_stream_transform"),i=e("core-util-is");i.inherits=e("inherits"),i.inherits(n,o),n.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":208,"core-util-is":210,inherits:223}],207:[function(e,t){(function(n){function o(t){t=t||{};var n=t.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!t.objectMode,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(I||(I=e("string_decoder/").StringDecoder),this.decoder=new I(t.encoding),this.encoding=t.encoding)}function i(e){return this instanceof i?(this._readableState=new o(e,this),this.readable=!0,void S.call(this)):new i(e)}function r(e,t,n,o,i){var r=c(t,n);if(r)e.emit("error",r);else if(null===n||void 0===n)t.reading=!1,t.ended||l(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||i||o||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&p(e),f(e,t);else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function s(e){if(e>=A)e=A;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function d(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e,t){var n=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?p(e):x(e)}function p(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){u(e)}):u(e))}function u(e){e.emit("readable")}function f(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){h(e,t)}))}function h(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function m(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&_(e)}}function _(e){function t(e){var t=e.write(n);!1===t&&o.awaitDrain++}var n,o=e._readableState;for(o.awaitDrain=0;o.pipesCount&&null!==(n=e.read());)if(1===o.pipesCount?t(o.pipes,0,null):w(o.pipes,t),e.emit("data",n),o.awaitDrain>0)return;return 0===o.pipesCount?(o.flowing=!1,void(E.listenerCount(e,"data")>0&&g(e))):void(o.ranOut=!0)}function v(){this._readableState.ranOut&&(this._readableState.ranOut=!1,_(this))}function g(e,t){var o=e._readableState;if(o.flowing)throw new Error("Cannot switch to old mode now.");var i=t||!1,r=!1;e.readable=!0,e.pipe=S.prototype.pipe,e.on=e.addListener=S.prototype.on,e.on("readable",function(){r=!0;for(var t;!i&&null!==(t=e.read());)e.emit("data",t);null===t&&(r=!1,e._readableState.needReadable=!0)}),e.pause=function(){i=!0,this.emit("pause")},e.resume=function(){i=!1,r?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function b(e,t){var n,o=t.buffer,i=t.length,r=!!t.decoder,a=!!t.objectMode;if(0===o.length)return null;if(0===i)n=null;else if(a)n=o.shift();else if(!e||e>=i)n=r?o.join(""):j.concat(o,i),o.length=0;else if(e<o[0].length){var s=o[0];n=s.slice(0,e),o[0]=s.slice(e)}else if(e===o[0].length)n=o.shift();else{n=r?"":new j(e);for(var d=0,c=0,l=o.length;l>c&&e>d;c++){var s=o[0],p=Math.min(e-d,s.length);r?n+=s.slice(0,p):s.copy(n,d,0,p),p<s.length?o[0]=s.slice(p):o.shift(),d+=p}}return n}function x(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,o=e.length;o>n;n++)t(e[n],n)}function y(e,t){for(var n=0,o=e.length;o>n;n++)if(e[n]===t)return n;return-1}t.exports=i;var k=e("isarray"),j=e("buffer").Buffer;i.ReadableState=o;var E=e("events").EventEmitter;E.listenerCount||(E.listenerCount=function(e,t){return e.listeners(t).length});var S=e("stream"),U=e("core-util-is");U.inherits=e("inherits");var I;U.inherits(i,S),i.prototype.push=function(e,t){var n=this._readableState;return"string"!=typeof e||n.objectMode||(t=t||n.defaultEncoding,t!==n.encoding&&(e=new j(e,t),t="")),r(this,n,e,t,!1)},i.prototype.unshift=function(e){var t=this._readableState;return r(this,t,e,"",!0)},i.prototype.setEncoding=function(t){I||(I=e("string_decoder/").StringDecoder),this._readableState.decoder=new I(t),this._readableState.encoding=t};var A=8388608;i.prototype.read=function(e){var t=this._readableState;t.calledRead=!0;var n,o=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return p(this),null;if(e=d(e,t),0===e&&t.ended)return n=null,t.length>0&&t.decoder&&(n=b(e,t),t.length-=n.length),0===t.length&&x(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=d(o,t)),n=e>0?b(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&x(this),n},i.prototype._read=function(){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function o(e){e===l&&r()}function i(){e.end()}function r(){e.removeListener("close",s),e.removeListener("finish",d),e.removeListener("drain",h),e.removeListener("error",a),e.removeListener("unpipe",o),l.removeListener("end",i),l.removeListener("end",r),(!e._writableState||e._writableState.needDrain)&&h()}function a(t){c(),e.removeListener("error",a),0===E.listenerCount(e,"error")&&e.emit("error",t)}function s(){e.removeListener("finish",d),c()}function d(){e.removeListener("close",s),c()}function c(){l.unpipe(e)}var l=this,p=this._readableState;switch(p.pipesCount){case 0:p.pipes=e;break;case 1:p.pipes=[p.pipes,e];break;default:p.pipes.push(e)}p.pipesCount+=1;var u=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,f=u?i:r;p.endEmitted?n.nextTick(f):l.once("end",f),e.on("unpipe",o);var h=m(l);return e.on("drain",h),e._events&&e._events.error?k(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a),e.once("close",s),e.once("finish",d),e.emit("pipe",l),p.flowing||(this.on("readable",v),p.flowing=!0,n.nextTick(function(){_(l)})),e},i.prototype.unpipe=function(e){var t=this._readableState;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,this.removeListener("readable",v),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",v),t.flowing=!1;for(var i=0;o>i;i++)n[i].emit("unpipe",this);return this}var i=y(t.pipes,e);return-1===i?this:(t.pipes.splice(i,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},i.prototype.on=function(e,t){var n=S.prototype.on.call(this,e,t);if("data"!==e||this._readableState.flowing||g(this),"readable"===e&&this.readable){var o=this._readableState;o.readableListening||(o.readableListening=!0,o.emittedReadable=!1,o.needReadable=!0,o.reading?o.length&&p(this,o):this.read(0))}return n},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){g(this),this.read(0),this.emit("resume")},i.prototype.pause=function(){g(this,!0),this.emit("pause")},i.prototype.wrap=function(e){var t=this._readableState,n=!1,o=this;e.on("end",function(){if(t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&o.push(e)}o.push(null)}),e.on("data",function(i){if(t.decoder&&(i=t.decoder.write(i)),(!t.objectMode||null!==i&&void 0!==i)&&(t.objectMode||i&&i.length)){var r=o.push(i);r||(n=!0,e.pause())}});for(var i in e)"function"==typeof e[i]&&"undefined"==typeof this[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));var r=["error","close","destroy","pause","resume"];return w(r,function(t){e.on(t,o.emit.bind(o,t))}),o._read=function(){n&&(n=!1,e.resume())},o},i._fromList=b}).call(this,e("_process"))},{_process:203,buffer:196,"core-util-is":210,events:200,inherits:223,isarray:201,stream:216,"string_decoder/":211}],208:[function(e,t){function n(e,t){this.afterTransform=function(e,n){return o(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function o(e,t,n){var o=e._transformState;o.transforming=!1;var i=o.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));o.writechunk=null,o.writecb=null,null!==n&&void 0!==n&&e.push(n),i&&i(t);var r=e._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&e._read(r.highWaterMark)}function i(e){if(!(this instanceof i))return new i(e);a.call(this,e);var t=(this._transformState=new n(e,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(e){r(t,e)}):r(t)})}function r(e,t){if(t)return e.emit("error",t);var n=e._writableState,o=(e._readableState,e._transformState);if(n.length)throw new Error("calling transform done when ws.length != 0");if(o.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}t.exports=i;var a=e("./_stream_duplex"),s=e("core-util-is");s.inherits=e("inherits"),s.inherits(i,a),i.prototype.push=function(e,t){return this._transformState.needTransform=!1,a.prototype.push.call(this,e,t)},i.prototype._transform=function(){throw new Error("not implemented")},i.prototype._write=function(e,t,n){var o=this._transformState;if(o.writecb=n,o.writechunk=e,o.writeencoding=t,!o.transforming){var i=this._readableState;(o.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},i.prototype._read=function(){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0}},{"./_stream_duplex":205,"core-util-is":210,inherits:223}],209:[function(e,t){(function(n){function o(e,t,n){this.chunk=e,this.encoding=t,this.callback=n}function i(e,t){e=e||{};var n=e.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var o=e.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){f(t,e)},this.writecb=null,this.writelen=0,this.buffer=[],this.errorEmitted=!1}function r(t){var n=e("./_stream_duplex");return this instanceof r||this instanceof n?(this._writableState=new i(t,this),this.writable=!0,void y.call(this)):new r(t)}function a(e,t,o){var i=new Error("write after end");e.emit("error",i),n.nextTick(function(){o(i)})}function s(e,t,o,i){var r=!0;if(!x.isBuffer(o)&&"string"!=typeof o&&null!==o&&void 0!==o&&!t.objectMode){var a=new TypeError("Invalid non-string/buffer chunk");e.emit("error",a),n.nextTick(function(){i(a)}),r=!1}return r}function d(e,t,n){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new x(t,n)),t}function c(e,t,n,i,r){n=d(t,n,i),x.isBuffer(n)&&(i="buffer");var a=t.objectMode?1:n.length;t.length+=a;var s=t.length<t.highWaterMark;return s||(t.needDrain=!0),t.writing?t.buffer.push(new o(n,i,r)):l(e,t,a,n,i,r),s}function l(e,t,n,o,i,r){t.writelen=n,t.writecb=r,t.writing=!0,t.sync=!0,e._write(o,i,t.onwrite),t.sync=!1}function p(e,t,o,i,r){o?n.nextTick(function(){r(i)}):r(i),e._writableState.errorEmitted=!0,e.emit("error",i)}function u(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function f(e,t){var o=e._writableState,i=o.sync,r=o.writecb;if(u(o),t)p(e,o,i,t,r);else{var a=v(e,o);a||o.bufferProcessing||!o.buffer.length||_(e,o),i?n.nextTick(function(){h(e,o,a,r)}):h(e,o,a,r)}}function h(e,t,n,o){n||m(e,t),o(),n&&g(e,t)}function m(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function _(e,t){t.bufferProcessing=!0;for(var n=0;n<t.buffer.length;n++){var o=t.buffer[n],i=o.chunk,r=o.encoding,a=o.callback,s=t.objectMode?1:i.length;if(l(e,t,s,i,r,a),t.writing){n++;break}}t.bufferProcessing=!1,n<t.buffer.length?t.buffer=t.buffer.slice(n):t.buffer.length=0}function v(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function g(e,t){var n=v(e,t);return n&&(t.finished=!0,e.emit("finish")),n}function b(e,t,o){t.ending=!0,g(e,t),o&&(t.finished?n.nextTick(o):e.once("finish",o)),t.ended=!0}t.exports=r;var x=e("buffer").Buffer;r.WritableState=i;var w=e("core-util-is");w.inherits=e("inherits");var y=e("stream");w.inherits(r,y),r.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},r.prototype.write=function(e,t,n){var o=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),x.isBuffer(e)?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=function(){}),o.ended?a(this,o,n):s(this,o,e,n)&&(i=c(this,o,e,t,n)),i},r.prototype._write=function(e,t,n){n(new Error("not implemented"))},r.prototype.end=function(e,t,n){var o=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),"undefined"!=typeof e&&null!==e&&this.write(e,t),o.ending||o.finished||b(this,o,n)}}).call(this,e("_process"))},{"./_stream_duplex":205,_process:203,buffer:196,"core-util-is":210,inherits:223,stream:216}],210:[function(e,t,n){(function(e){function t(e){return Array.isArray(e)}function o(e){return"boolean"==typeof e}function i(e){return null===e}function r(e){return null==e}function a(e){return"number"==typeof e}function s(e){return"string"==typeof e}function d(e){return"symbol"==typeof e}function c(e){return void 0===e}function l(e){return p(e)&&"[object RegExp]"===v(e)
-}function p(e){return"object"==typeof e&&null!==e}function u(e){return p(e)&&"[object Date]"===v(e)}function f(e){return p(e)&&("[object Error]"===v(e)||e instanceof Error)}function h(e){return"function"==typeof e}function m(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function _(t){return e.isBuffer(t)}function v(e){return Object.prototype.toString.call(e)}n.isArray=t,n.isBoolean=o,n.isNull=i,n.isNullOrUndefined=r,n.isNumber=a,n.isString=s,n.isSymbol=d,n.isUndefined=c,n.isRegExp=l,n.isObject=p,n.isDate=u,n.isError=f,n.isFunction=h,n.isPrimitive=m,n.isBuffer=_}).call(this,e("buffer").Buffer)},{buffer:196}],211:[function(e,t,n){function o(e){if(e&&!d(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function r(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function a(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var s=e("buffer").Buffer,d=s.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},c=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),o(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=r;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};c.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";e=e.slice(n,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var o=t.charCodeAt(t.length-1);if(!(o>=55296&&56319>=o)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,o=t.charCodeAt(i);if(o>=55296&&56319>=o){var r=this.surrogateSize;return this.charLength+=r,this.charReceived+=r,this.charBuffer.copy(this.charBuffer,r,0,r),e.copy(this.charBuffer,0,0,r),t.substring(0,i)}return t},c.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(2>=t&&n>>4==14){this.charLength=3;break}if(3>=t&&n>>3==30){this.charLength=4;break}}this.charReceived=t},c.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,o=this.charBuffer,i=this.encoding;t+=o.slice(0,n).toString(i)}return t}},{buffer:196}],212:[function(e,t){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":206}],213:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),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")},{"./lib/_stream_duplex.js":205,"./lib/_stream_passthrough.js":206,"./lib/_stream_readable.js":207,"./lib/_stream_transform.js":208,"./lib/_stream_writable.js":209}],214:[function(e,t){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":208}],215:[function(e,t){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":209}],216:[function(e,t){function n(){o.call(this)}t.exports=n;var o=e("events").EventEmitter,i=e("inherits");i(n,o),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),n.Stream=n,n.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&c.pause&&c.pause()}function i(){c.readable&&c.resume&&c.resume()}function r(){l||(l=!0,e.end())}function a(){l||(l=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(d(),0===o.listenerCount(this,"error"))throw e}function d(){c.removeListener("data",n),e.removeListener("drain",i),c.removeListener("end",r),c.removeListener("close",a),c.removeListener("error",s),e.removeListener("error",s),c.removeListener("end",d),c.removeListener("close",d),e.removeListener("close",d)}var c=this;c.on("data",n),e.on("drain",i),e._isStdio||t&&t.end===!1||(c.on("end",r),c.on("close",a));var l=!1;return c.on("error",s),e.on("error",s),c.on("end",d),c.on("close",d),e.on("close",d),e.emit("pipe",c),e}},{events:200,inherits:223,"readable-stream/duplex.js":204,"readable-stream/passthrough.js":212,"readable-stream/readable.js":213,"readable-stream/transform.js":214,"readable-stream/writable.js":215}],217:[function(e,t){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],218:[function(e,t,n){(function(t,o){function i(e,t){var o={seen:[],stylize:a};return arguments.length>=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),m(t)?o.showHidden=t:t&&n._extend(o,t),w(o.showHidden)&&(o.showHidden=!1),w(o.depth)&&(o.depth=2),w(o.colors)&&(o.colors=!1),w(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=r),d(o,e,o.depth)}function r(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e){return e}function s(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function d(e,t,o){if(e.customInspect&&t&&S(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(o,e);return b(i)||(i=d(e,i,o)),i}var r=c(e,t);if(r)return r;var a=Object.keys(t),m=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),E(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(t);if(0===a.length){if(S(t)){var _=t.name?": "+t.name:"";return e.stylize("[Function"+_+"]","special")}if(y(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(j(t))return e.stylize(Date.prototype.toString.call(t),"date");if(E(t))return l(t)}var v="",g=!1,x=["{","}"];if(h(t)&&(g=!0,x=["[","]"]),S(t)){var w=t.name?": "+t.name:"";v=" [Function"+w+"]"}if(y(t)&&(v=" "+RegExp.prototype.toString.call(t)),j(t)&&(v=" "+Date.prototype.toUTCString.call(t)),E(t)&&(v=" "+l(t)),0===a.length&&(!g||0==t.length))return x[0]+v+x[1];if(0>o)return y(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var k;return k=g?p(e,t,o,m,a):a.map(function(n){return u(e,t,o,m,n,g)}),e.seen.pop(),f(k,v,x)}function c(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return g(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):_(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,n,o,i){for(var r=[],a=0,s=t.length;s>a;++a)r.push(T(t,String(a))?u(e,t,n,o,String(a),!0):"");return i.forEach(function(i){i.match(/^\d+$/)||r.push(u(e,t,n,o,i,!0))}),r}function u(e,t,n,o,i,r){var a,s,c;if(c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},c.get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),T(o,i)||(a="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=_(n)?d(e,c.value,null):d(e,c.value,n-1),s.indexOf("\n")>-1&&(s=r?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(r&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function f(e,t,n){var o=0,i=e.reduce(function(e,t){return o++,t.indexOf("\n")>=0&&o++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function _(e){return null===e}function v(e){return null==e}function g(e){return"number"==typeof e}function b(e){return"string"==typeof e}function x(e){return"symbol"==typeof e}function w(e){return void 0===e}function y(e){return k(e)&&"[object RegExp]"===I(e)}function k(e){return"object"==typeof e&&null!==e}function j(e){return k(e)&&"[object Date]"===I(e)}function E(e){return k(e)&&("[object Error]"===I(e)||e instanceof Error)}function S(e){return"function"==typeof e}function U(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function I(e){return Object.prototype.toString.call(e)}function A(e){return 10>e?"0"+e.toString(10):e.toString(10)}function L(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),P[e.getMonth()],t].join(" ")}function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var B=/%[sdj%]/g;n.format=function(e){if(!b(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(i(arguments[n]));return t.join(" ")}for(var n=1,o=arguments,r=o.length,a=String(e).replace(B,function(e){if("%%"===e)return"%";if(n>=r)return e;switch(e){case"%s":return String(o[n++]);case"%d":return Number(o[n++]);case"%j":try{return JSON.stringify(o[n++])}catch(t){return"[Circular]"}default:return e}}),s=o[n];r>n;s=o[++n])a+=_(s)||!k(s)?" "+s:" "+i(s);return a},n.deprecate=function(e,i){function r(){if(!a){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),a=!0}return e.apply(this,arguments)}if(w(o.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var a=!1;return r};var z,R={};n.debuglog=function(e){if(w(z)&&(z=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!R[e])if(new RegExp("\\b"+e+"\\b","i").test(z)){var o=t.pid;R[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,o,t)}}else R[e]=function(){};return R[e]},n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=h,n.isBoolean=m,n.isNull=_,n.isNullOrUndefined=v,n.isNumber=g,n.isString=b,n.isSymbol=x,n.isUndefined=w,n.isRegExp=y,n.isObject=k,n.isDate=j,n.isError=E,n.isFunction=S,n.isPrimitive=U,n.isBuffer=e("./support/isBuffer");var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",L(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!k(t))return e;for(var n=Object.keys(t),o=n.length;o--;)e[n[o]]=t[n[o]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":217,_process:203,inherits:223}],219:[function(e,t){t.exports=e(94)},{"./debug":220,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":94}],220:[function(e,t){t.exports=e(95)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":95,ms:221}],221:[function(e,t){t.exports=e(96)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":96}],222:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],223:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],224:[function(e,t){t.exports=e(93)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/run-parallel/index.js":93}]},{},[])("./")}); \ No newline at end of file
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.WebTorrent=e()}}(function(){return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[s]={exports:{}};t[s][0].call(f.exports,function(e){var n=t[s][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t){(function(n,r){function i(e){function t(){o.ready=!0,o.emit("ready")}var o=this;return o instanceof i?(c.call(o),e||(e={}),u(o,{peerId:new r("-WW0001-"+f(48),"utf8"),nodeId:new r(f(160),"hex"),dht:"function"==typeof a,tracker:!0,torrentPort:void 0},e),o.peerId="string"==typeof o.peerId?new r(o.peerId,"utf8"):o.peerId,o.peerIdHex=o.peerId.toString("hex"),o.nodeId="string"==typeof o.nodeId?new r(o.nodeId,"hex"):o.nodeId,o.nodeIdHex=o.nodeId.toString("hex"),s("new client peerId %s nodeId %s",o.peerIdHex,o.nodeIdHex),o.torrents=[],o.downloadSpeed=m(),o.uploadSpeed=m(),o.dht&&(o.dht=new a(u({nodeId:o.nodeId},o.dht)),o.dht.listen(e.dhtPort)),void("function"==typeof h?h(e.blocklist,function(e,n){o.blocked=n,t()}):n.nextTick(t))):new i(e)}t.exports=i;var o=e("create-torrent"),s=e("debug")("bittorrent-client"),a=e("bittorrent-dht/client"),c=e("events").EventEmitter,u=e("extend.js"),f=e("hat"),d=e("inherits"),h=e("load-ip-set"),l=e("run-parallel"),p=e("parse-torrent"),m=e("speedometer"),g=e("./lib/storage"),_=e("./lib/torrent");d(i,c),i.Storage=g,Object.defineProperty(i.prototype,"ratio",{get:function(){var e=this,t=e.torrents.reduce(function(e,t){return e+t.uploaded},0),n=e.torrents.reduce(function(e,t){return e+t.downloaded},0);return 0===n?0:t/n}}),i.prototype.get=function(e){var t=this,n=p(e);if(!n||!n.infoHash)return null;for(var r=0,i=t.torrents.length;i>r;r++){var o=t.torrents[r];if(o.infoHash===n.infoHash)return o}return null},i.prototype.add=i.prototype.download=function(e,t,n){function r(e){o.infoHash===e.infoHash&&(n(o),i.removeListener("torrent",r))}var i=this;s("add %s",e),"function"==typeof t&&(n=t,t={});var o=new _(e,u({client:i},t));return i.torrents.push(o),n&&i.on("torrent",r),o.on("error",function(e){i.emit("error",e,o)}),o.on("listening",function(e){i.emit("listening",e,o)}),o.on("ready",function(){s("torrent"),i.emit("torrent",o)}),o},i.prototype.remove=function(e,t){var n=this,r=n.get(e);if(!r)throw new Error("No torrent with id "+e);s("remove"),n.torrents.splice(n.torrents.indexOf(r),1),r.destroy(t)},i.prototype.seed=function(e,t,n){function i(e){a.infoHash===e.infoHash&&(n(a),s.removeListener("seed",i))}var s=this;"function"==typeof t&&(n=t,t={});var a,c=r.concat(e.map(function(e){return e.buffer}));n&&s.on("seed",i),o(e,t,function(e,n){if(e)return s.emit("error",e);var r=p(n);s.add(n,t,function(e){a=e,g.writeToStorage(a.storage,c,r.pieceLength,function(e){return e?s.emit("error",e):void s.emit("seed",a)})})})},i.prototype.destroy=function(e){var t=this;s("destroy");var n=t.torrents.map(function(e){return function(n){t.remove(e.infoHash,n)}});t.dht&&n.push(function(e){t.dht.destroy(e)}),l(n,e)}}).call(this,e("_process"),e("buffer").Buffer)},{"./lib/storage":4,"./lib/torrent":5,_process:110,"bittorrent-dht/client":102,buffer:103,"create-torrent":8,debug:25,events:107,"extend.js":32,hat:34,inherits:35,"load-ip-set":102,"parse-torrent":36,"run-parallel":46,speedometer:47}],2:[function(e,t){function n(e,t){var i=this;if(!(i instanceof n))return new n(e,t);o.Readable.call(i,t),r("new filestream %s",JSON.stringify(t)),t||(t={}),t.start||(t.start=0),t.end||(t.end=e.length-1),i.length=t.end-t.start+1;var s=t.start+e.offset,a=t.pieceLength;i.startPiece=s/a|0,i.endPiece=(t.end+e.offset)/a|0,i._storage=e.storage,i._piece=i.startPiece,i._missing=i.length,i._reading=!1,i._notifying=!1,i._destroyed=!1,i._criticalLength=Math.min(1048576/a|0,2),i._offset=s-i.startPiece*a}t.exports=n;var r=e("debug")("bittorrent-client:file-stream"),i=e("inherits"),o=e("stream");i(n,o.Readable),n.prototype._read=function(){r("_read");var e=this;e._reading||(e._reading=!0,e.notify())},n.prototype.notify=function(){r("notify");var e=this;if(e._reading&&0!==e._missing){if(!e._storage.bitfield.get(e._piece))return e._storage.emit("critical",e._piece,e._piece+e._criticalLength);if(!e._notifying){e._notifying=!0;var t=e._piece;r("before read %s",t),e._storage.read(e._piece++,function(n,i){if(r("after read %s (buffer.length %s) (err %s)",t,i.length,n&&n.message||n),e._notifying=!1,!e._destroyed){if(n)return e._storage.emit("error",n),e.destroy(n);e._offset&&(i=i.slice(e._offset),e._offset=0),e._missing<i.length&&(i=i.slice(0,e._missing)),e._missing-=i.length,r("pushing buffer of length %s",i.length),e._reading=!1,e.push(i),0===e._missing&&e.push(null)}})}}},n.prototype.destroy=function(){var e=this;e._destroyed||(e._destroyed=!0)}},{debug:25,inherits:35,stream:123}],3:[function(e,t){function n(e,t){function r(e){e.on("have",function(e){i.pieces[e]++}),e.on("bitfield",i.recalculate.bind(i)),e.on("close",function(){for(var t=0;t<i.numPieces;++t)i.pieces[t]-=e.peerPieces.get(t)})}var i=this;return i instanceof n?(i.swarm=e,i.numPieces=t,i.swarm.wires.forEach(r),i.swarm.on("wire",function(e){i.recalculate(),r(e)}),void i.recalculate()):new n(e,t)}t.exports=n,n.prototype.recalculate=function(){var e=this;e.pieces=[];for(var t=0;t<e.numPieces;++t)e.pieces[t]=0;e.swarm.wires.forEach(function(t){for(var n=0;n<e.numPieces;++n)e.pieces[n]+=t.peerPieces.get(n)})},n.prototype.getRarestPiece=function(e){var t=this,n=[],r=1/0;e=e||function(){return!0};for(var i=0;i<t.numPieces;++i)if(e(i)){var o=t.pieces[i];o===r?n.push(i):r>o&&(n=[i],r=o)}return n.length>0?n[Math.random()*n.length|0]:-1}},{}],4:[function(e,t){(function(n,r){function i(){}function o(e,t,n){var r=this;l.call(r),r.index=e,r.hash=t,"number"==typeof n?(r.buffer=null,r.length=n):(r.buffer=n,r.length=n.length),r._reset()}function s(e,t,n,r){var i=this;l.call(i),i.storage=e,i.name=t.name,i.path=t.path,i.length=t.length,i.offset=t.offset,i.pieces=n,i.pieceLength=r,i.done=!1,i.pieces.forEach(function(e){e.on("done",function(){i._checkDone()})}),i._checkDone()}function a(e,t){var n=this;l.call(n),t=t||{},n.bitfield=new c(e.pieces.length),n.done=!1,n.closed=!1,n.readonly=!0,t.nobuffer||(n.buffer=new r(e.length));var i=e.pieceLength,a=e.lastPieceLength,u=e.pieces.length;n.pieces=e.pieces.map(function(e,t){var r=t*i,s=r+(t===u-1?a:i),c=n.buffer?n.buffer.slice(r,s):s-r,f=new o(t,e,c);return f.on("done",n._onPieceDone.bind(n,f)),f}),n.files=e.files.map(function(e){var t=e.offset,r=t+e.length-1,o=t/i|0,a=r/i|0,c=n.pieces.slice(o,a+1),u=new s(n,e,c,i);return u.on("done",n._onFileDone.bind(n,u)),u})}t.exports=a;var c=e("bitfield"),u=e("block-stream"),f=e("debug")("bittorrent-client:storage"),d=e("dezalgo"),h=e("end-of-stream"),l=e("events").EventEmitter,p=e("extend.js"),m=e("./file-stream"),g=e("inherits"),_=e("git-sha1"),b=e("stream"),v=16384,y=0,w=1,x=2;g(o,l),o.prototype.readBlock=function(e,t,n){var r=this;return n=d(n),r.buffer&&r._verifyOffset(e)?void n(null,r.buffer.slice(e,e+t)):n(new Error("invalid block offset "+e))},o.prototype.writeBlock=function(e,t,n){var r=this;if(n=d(n),!r._verifyOffset(e)||!r._verifyBlock(e,t))return n(new Error("invalid block "+e+":"+t.length));r._lazyAllocBuffer();var i=e/v;return r.blocks[i]===x?n(null):(t.copy(r.buffer,e),r.blocks[i]=x,r.blocksWritten+=1,r.blocksWritten===r.blocks.length&&r.verify(),void n(null))},o.prototype.reserveBlock=function(e){for(var t=this,n=t.blocks.length,r=0;n>r;r++)if((!t.blocks[r]||e)&&t.blocks[r]!==x)return t.blocks[r]=w,{offset:r*v,length:r===n-1?t.length-r*v:v};return null},o.prototype.cancelBlock=function(e){var t=this;if(!t.buffer||!t._verifyOffset(e))return!1;var n=e/v;return t.blocks[n]===w&&(t.blocks[n]=y),!0},o.prototype._reset=function(){var e=this;e.verified=!1,e.blocks=new r(Math.ceil(e.length/v)),e.blocks.fill(0),e.blocksWritten=0},o.prototype.verify=function(e){var t=this;e=e||t.buffer,!t.verified&&e&&(t.verified=_(e)===t.hash,t.verified?t.emit("done"):(t.emit("warning",new Error("piece "+t.index+" failed verification; "+_(e)+" expected "+t.hash)),t._reset()))},o.prototype._verifyOffset=function(e){var t=this;return e%v===0?!0:(t.emit("warning",new Error("piece "+t.index+" invalid offset "+e+" not multiple of "+v+" bytes")),!1)},o.prototype._verifyBlock=function(e,t){var n=this;return t.length===v?!0:t.length===n.length-e&&n.length-e<v?!0:(n.emit("warning",new Error("piece "+n.index+" invalid block of size "+t.length+" bytes")),!1)},o.prototype._lazyAllocBuffer=function(){var e=this;e.buffer||(e.buffer=new r(e.length))},g(s,l),s.prototype.select=function(){var e=this;e.pieces.length>0&&e.storage.emit("select",e.pieces[0].index,e.pieces[e.pieces.length-1].index,!1)},s.prototype.deselect=function(){var e=this;e.pieces.length>0&&e.storage.emit("deselect",e.pieces[0].index,e.pieces[e.pieces.length-1].index,!1)},s.prototype.createReadStream=function(e){var t=this;f("createReadStream"),e=p({pieceLength:t.pieceLength},e);var n=new m(t,e);return t.storage.emit("select",n.startPiece,n.endPiece,!0,n.notify.bind(n)),h(n,function(){t.storage.emit("deselect",n.startPiece,n.endPiece,!0)}),n},s.prototype._checkDone=function(){var e=this;e.done=e.pieces.every(function(e){return e.verified}),e.done&&n.nextTick(function(){e.emit("done")})},g(a,l),a.BLOCK_LENGTH=v,a.writeToStorage=function(e,t,n,r){var i=0,o=new b.Readable;o._read=function(){},o.pipe(new u(n,{nopad:!0})).on("data",function(t){var n=i;i+=1;var r=0,o=new u(v,{nopad:!0});o.on("data",function(t){var i=r*v;r+=1,e.writeBlock(n,i,t)}),o.write(t),o.end()}).on("end",function(){r(null)}).on("error",function(e){r(e)}),o.push(t),o.push(null)},Object.defineProperty(a.prototype,"downloaded",{get:function(){var e=this;return e.pieces.reduce(function(e,t){return e+(t.verified?t.length:t.blocksWritten*v)},0)}}),Object.defineProperty(a.prototype,"numMissing",{get:function(){for(var e=this,t=e.pieces.length,n=0,r=e.pieces.length;r>n;n++)t-=e.bitfield.get(n);return t}}),a.prototype.readBlock=function(e,t,n,r){var i=this;r=d(r);var o=i.pieces[e];return o?void o.readBlock(t,n,r):r(new Error("invalid piece index "+e))},a.prototype.writeBlock=function(e,t,n,r){var o=this;if(r||(r=i),r=d(r),o.readonly)return r(new Error("cannot write to readonly storage"));var s=o.pieces[e];return s?void s.writeBlock(t,n,r):r(new Error("invalid piece index "+e))},a.prototype.read=function(e,t,n,i){function o(){if(0>=u)return n(null,r.concat(f));var t=c,i=Math.min(v,u);c+=i,u-=i,s.readBlock(e,t,i,function(e,t){return e?n(e):(f.push(t),void o())})}var s=this;"function"==typeof t&&(i=n,n=t,t=null),n=d(n);var a=s.pieces[e];if(!a)return n(new Error("invalid piece index "+e));if(!a.verified&&!i)return n(new Error("Storage.read called on incomplete piece "+e));var c=0,u=a.length;if(t&&(c=t.offset||0,u=t.length||u),a.buffer)return n(null,a.buffer.slice(c,c+u));var f=[];o()},a.prototype.reserveBlock=function(e,t){var n=this,r=n.pieces[e];return r?r.reserveBlock(t):null},a.prototype.cancelBlock=function(e,t){var n=this,r=n.pieces[e];return r?r.cancelBlock(t):!1},a.prototype.remove=function(e){e&&d(e)(null)},a.prototype.close=function(e){var t=this;t.closed=!0,e&&d(e)(null)},a.prototype._onPieceDone=function(e){var t=this;t.bitfield.set(e.index),f("piece done "+e.index+" ("+t.numMissing+" still missing)"),t.emit("piece",e)},a.prototype._onFileDone=function(e){var t=this;f("file done "+e.name),t.emit("file",e),t._checkDone()},a.prototype._checkDone=function(){var e=this;!e.done&&e.files.every(function(e){return e.done})&&(e.done=!0,e.emit("done"))}}).call(this,e("_process"),e("buffer").Buffer)},{"./file-stream":2,_process:110,bitfield:6,"block-stream":7,buffer:103,debug:25,dezalgo:28,"end-of-stream":30,events:107,"extend.js":32,"git-sha1":33,inherits:35,stream:123}],5:[function(e,t){(function(n){function r(){}function i(e,t){function r(e){o=m(e),i.infoHash=o.infoHash,o.name&&(i.name=o.name),i.swarm=new v(i.infoHash,i.client.peerId,{handshake:{dht:!!i.client.dht}}),_(i.swarm,i,["warning","error"]),i.swarm.on("wire",i._onWire.bind(i)),i.swarm.on("download",i.client.downloadSpeed.bind(i.client)),i.swarm.on("upload",i.client.uploadSpeed.bind(i.client)),n.browser?i._onSwarmListening(o):i.swarm.listen(i.client.torrentPort,i._onSwarmListening.bind(i,o))}var i=this;f.call(i),c("new torrent"),i.client=t.client,i.hotswapEnabled="hotswap"in t?t.hotswap:!0,i.verify=t.verify,i.storageOpts=t.storageOpts,i.chokeTimeout=t.chokeTimeout||S,i.pieceTimeout=t.pieceTimeout||E,i.strategy=t.strategy||"sequential",i._rechokeNumSlots=t.uploads===!1||0===t.uploads?0:+t.uploads||10,i._rechokeOptimisticWire=null,i._rechokeOptimisticTime=0,i._rechokeIntervalId=null,i.ready=!1,i.files=[],i.metadata=null,i.parsedTorrent=null,i.storage=null,i.numBlockedPeers=0,i._amInterested=!1,i._destroyed=!1,i._selections=[],i._critical=[],i._storageImpl=t.storage||b;var o=m(e);if(o&&o.infoHash)r(o);else if("function"==typeof h.get&&/^https?:/.test(e))h.get(e,function(e){e.pipe(a(function(e){r(e)}))}).on("error",function(e){i.emit("error",new Error("error downloading torrent: "+e.message))});else{if("function"!=typeof d.readFile)throw new Error("invalid torrent id");d.readFile(e,function(e,t){return e?i.emit("error",new Error("invalid torrent id")):void r(t)})}}function o(e){return Math.random()*e|0}function s(e,t){for(var n=e.map(function(e,t){return t}),r=0,i=n.length;i>r;++r){var s=o(i),a=n[r];n[r]=n[s],n[s]=a}n.forEach(function(n){t(e[n],n,e)})}t.exports=i;var a=e("concat-stream"),c=e("debug")("bittorrent-client:torrent"),u=e("torrent-discovery"),f=e("events").EventEmitter,d=e("fs"),h=e("http-https"),l=e("inherits"),p=e("run-parallel"),m=e("parse-torrent"),g=e("./rarity-map"),_=e("re-emitter"),b=e("./storage"),v=e("bittorrent-swarm"),y=e("ut_metadata"),w=e("ut_pex"),x=131072,k=5,E=1e4,S=5e3,j=3*b.BLOCK_LENGTH,I=1e4,L=2;l(i,f),Object.defineProperty(i.prototype,"length",{get:function(){return this.parsedTorrent&&this.parsedTorrent.length||0}}),Object.defineProperty(i.prototype,"timeRemaining",{get:function(){return 0===this.swarm.downloadSpeed()?1/0:(this.length-this.downloaded)/this.swarm.downloadSpeed()*1e3}}),Object.defineProperty(i.prototype,"progress",{get:function(){return this.parsedTorrent&&this.downloaded/this.parsedTorrent.length||0}}),Object.defineProperty(i.prototype,"downloaded",{get:function(){return this.storage&&this.storage.downloaded||0}}),Object.defineProperty(i.prototype,"uploaded",{get:function(){return this.swarm.uploaded}}),Object.defineProperty(i.prototype,"ratio",{get:function(){return this.uploaded&&this.downloaded/this.uploaded||0}}),i.prototype._onSwarmListening=function(e,t){var n=this;n._destroyed||(n.client.torrentPort=t,n.discovery=new u({announce:e.announce,dht:n.client.dht,peerId:n.client.peerId,port:t}),n.discovery.setTorrent(n.infoHash),n.discovery.on("peer",n.addPeer.bind(n)),_(n.discovery,n,["dhtAnnounce","warning","error"]),e.info&&n._onMetadata(e),n.emit("listening",t))},i.prototype._onMetadata=function(e){var t=this;if(!t.metadata&&!t._destroyed){if(c("got metadata"),e&&e.infoHash)t.metadata=m.toBuffer(e),t.parsedTorrent=e;else{t.metadata=e;try{t.parsedTorrent=m(t.metadata)}catch(r){return t.emit("error",r)}}t.name=t.parsedTorrent.name,t.discovery.setTorrent(t.parsedTorrent),t.rarityMap=new g(t.swarm,t.parsedTorrent.pieces.length),t.storage=new t._storageImpl(t.parsedTorrent,t.storageOpts),t.storage.on("piece",t._onStoragePiece.bind(t)),t.storage.on("file",function(e){t.emit("file",e)}),t._reservations=t.storage.pieces.map(function(){return[]}),t.storage.on("done",function(){t.discovery.tracker&&t.discovery.tracker.complete(),c("torrent "+t.infoHash+" done"),t.emit("done")}),t.storage.on("select",t.select.bind(t)),t.storage.on("deselect",t.deselect.bind(t)),t.storage.on("critical",t.critical.bind(t)),t.storage.files.forEach(function(e){t.files.push(e)}),t.swarm.wires.forEach(function(e){e.ut_metadata&&e.ut_metadata.setMetadata(t.metadata),t._onWireWithMetadata(e)}),n.nextTick(t.verify?function(){c("verifying existing torrent data");var e=0,n=0;p(t.storage.pieces.map(function(r){return function(i){t.storage.read(r.index,function(o,s){e+=1,t.emit("verifying",{percentDone:100*e/t.storage.pieces.length,percentVerified:100*n/t.storage.pieces.length}),!o&&s&&(r.verify(s),n+=r.verified,c("piece "+(r.verified?"verified":"invalid")+" "+r.index)),i()},!0)}}),t._onStorage.bind(t))}:t._onStorage.bind(t)),n.nextTick(function(){t.emit("metadata")})}},i.prototype.destroy=function(e){var t=this;c("destroy"),t._destroyed=!0,clearInterval(t._rechokeIntervalId);var n=[];t.swarm&&n.push(function(e){t.swarm.destroy(e)}),t.discovery&&n.push(function(e){t.discovery.stop(e)}),t.storage&&n.push(function(e){t.storage.close(e)}),p(n,e)},i.prototype.addPeer=function(e){var t=this;"string"==typeof e&&t.client.blocked&&t.client.blocked.contains(e.split(":")[0])?(t.numBlockedPeers+=1,t.emit("blocked-peer",e)):(t.emit("peer",e),t.swarm.addPeer(e))},i.prototype.select=function(e,t,n,i){var o=this;if(e>t||0>e||t>=o.storage.pieces.length)throw new Error("invalid selection ",e,":",t);n=Number(n)||0,c("select %s-%s (priority %s)",e,t,n),o._selections.push({from:e,to:t,offset:0,priority:n,notify:i||r}),o._selections.sort(function(e,t){return t.priority-e.priority}),o._updateSelections()},i.prototype.deselect=function(e,t,n){var r=this;n=Number(n)||0,c("deselect %s-%s (priority %s)",e,t,n);for(var i=0;i<r._selections.length;++i){var o=r._selections[i];if(o.from===e&&o.to===t&&o.priority===n){r._selections.splice(i--,1);break}}r._updateSelections()},i.prototype.critical=function(e,t){var n=this;c("critical %s-%s",e,t);for(var r=e;t>=r;++r)n._critical[r]=!0;n._updateSelections()},i.prototype._onWire=function(e){var t=this;e.use(y(t.metadata)),t.metadata||(e.ut_metadata.on("metadata",function(e){c("got metadata via ut_metadata"),t._onMetadata(e)}),e.ut_metadata.fetch()),"function"==typeof w&&e.use(w()),e.ut_pex&&e.ut_pex.on("peer",function(e){c("got peer via ut_pex "+e),t.addPeer(e)}),e.ut_pex&&e.ut_pex.on("dropped",function(e){e in t.swarm._peers||t.swarm.removePeer(e)}),e.setKeepAlive(!0),e.peerExtensions.dht&&t.client.dht&&t.client.dht.port&&e.port(t.client.dht.port),e.on("port",function(){c("port message from "+e.remoteAddress)}),e.on("timeout",function(){c("wire timeout from "+e.remoteAddress),e.destroy()}),e.setTimeout(t.pieceTimeout),t.metadata&&t._onWireWithMetadata(e)},i.prototype._onWireWithMetadata=function(e){function t(){r._destroyed||e._destroyed||(r.swarm.numQueued>2*(r.swarm.numConns-r.swarm.numPeers)&&e.amInterested?e.destroy():i=setTimeout(t,o))}function n(){if(e.peerPieces.length===r.storage.pieces.length){for(;s<r.storage.pieces.length;++s)if(!e.peerPieces.get(s))return;e.isSeeder=!0,e.choke()}}var r=this,i=null,o=r.chokeTimeout,s=0;e.on("bitfield",function(){n(),r._update()}),e.on("have",function(){n(),r._update()}),e.once("interested",function(){e.unchoke()}),e.on("close",function(){clearTimeout(i)}),e.on("choke",function(){clearTimeout(i),i=setTimeout(t,o)}),e.on("unchoke",function(){clearTimeout(i),r._update()}),e.on("request",function(t,n,i,o){return i>x?(c(e.remoteAddress,"requested invalid block size",i),e.destroy()):void r.storage.readBlock(t,n,i,o)}),e.bitfield(r.storage.bitfield),e.interested(),i=setTimeout(t,o),e.isSeeder=!1,n(),r._updateSelections()},i.prototype._onStorage=function(){var e=this;c("on storage"),e.storage.readonly=!1,e.select(0,e.storage.pieces.length-1,!1),e._rechokeIntervalId=setInterval(e._rechoke.bind(e),I),e._rechokeIntervalId.unref&&e._rechokeIntervalId.unref(),n.nextTick(function(){e.ready=!0,e.emit("ready")})},i.prototype._onStoragePiece=function(e){var t=this;c("piece done %s",e.index),t._reservations[e.index]=null,t.swarm.wires.forEach(function(t){t.have(e.index)}),t._gcSelections()},i.prototype._updateSelections=function(){var e=this;if(e.swarm&&!e._destroyed){if(!e.metadata)return e.once("metadata",e._updateSelections.bind(e));n.nextTick(e._gcSelections.bind(e)),e._updateInterest(),e._update()}},i.prototype._gcSelections=function(){for(var e=this,t=0;t<e._selections.length;t++){for(var n=e._selections[t],r=n.offset;e.storage.bitfield.get(n.from+n.offset)&&n.from+n.offset<n.to;)n.offset++;r!==n.offset&&n.notify(),n.to===n.from+n.offset&&e.storage.bitfield.get(n.from+n.offset)&&(e._selections.splice(t--,1),n.notify(),e._updateInterest())}e._selections.length||e.emit("idle")},i.prototype._updateInterest=function(){var e=this,t=e._amInterested;e._amInterested=!!e._selections.length,e.swarm.wires.forEach(function(t){e._amInterested?t.interested():t.uninterested()}),t!==e._amInterested&&e.emit(e._amInterested?"interested":"uninterested")},i.prototype._update=function(){var e=this;e._destroyed||s(e.swarm.wires,e._updateWire.bind(e))},i.prototype._updateWire=function(e){function t(t,n,r,i){return function(o){return o>=t&&n>=o&&!(o in r)&&e.peerPieces.get(o)&&(!i||i(o))}}function n(){if(!e.requests.length)for(var n=s._selections.length;n--;){var r,i=s._selections[n];if("rarest"===s.strategy)for(var o=i.from+i.offset,a=i.to,c=a-o+1,u={},f=0,d=t(o,a,u);c>f&&(r=s.rarityMap.getRarestPiece(d),!(0>r));){if(s._request(e,r,!1))return;u[r]=!0,f+=1}else for(r=i.to;r>=i.from+i.offset;--r)if(e.peerPieces.get(r)&&s._request(e,r,!1))return}}function r(){var t=e.downloadSpeed()||1;if(t>j)return function(){return!0};var n=k*b.BLOCK_LENGTH/t,r=10,i=0;return function(e){if(!r||s.storage.bitfield.get(e))return!0;for(var o=s.storage.pieces[e],a=o.blocks.length-o.blocksWritten;i<s.swarm.wires.length;i++){var c=s.swarm.wires[i],u=c.downloadSpeed();if(!(j>u||t>=u||!c.peerPieces.get(e)||(a-=u*n)>0))return r--,!1}return!0}}function i(e){for(var t=e,n=e;n<s._selections.length&&s._selections[n].priority;n++)t=n;var r=s._selections[e];s._selections[e]=s._selections[t],s._selections[t]=r}function o(n){if(e.requests.length>=k)return!0;for(var o=r(),a=0;a<s._selections.length;a++){var c,u=s._selections[a];if("rarest"===s.strategy)for(var f=u.from+u.offset,d=u.to,h=d-f+1,l={},p=0,m=t(f,d,l,o);h>p&&(c=s.rarityMap.getRarestPiece(m),!(0>c));){for(;s._request(e,c,s._critical[c]||n););if(!(e.requests.length<k))return u.priority&&i(a),!0;l[c]=!0,p++}else for(c=u.from+u.offset;c<=u.to;c++)if(e.peerPieces.get(c)&&o(c)){for(;s._request(e,c,s._critical[c]||n););if(!(e.requests.length<k))return u.priority&&i(a),!0}}return!1}var s=this;if(!e.peerChoking)return e.downloaded?void(o(!1)||o(!0)):n()},i.prototype._rechoke=function(){function e(e,t){return e.downloadSpeed!==t.downloadSpeed?t.downloadSpeed-e.downloadSpeed:e.uploadSpeed!==t.uploadSpeed?t.uploadSpeed-e.uploadSpeed:e.wire.amChoking!==t.wire.amChoking?e.wire.amChoking?1:-1:e.salt-t.salt}var t=this;t._rechokeOptimisticTime>0?t._rechokeOptimisticTime-=1:t._rechokeOptimisticWire=null;var n=[];t.swarm.wires.forEach(function(e){e.isSeeder||e===t._rechokeOptimisticWire||n.push({wire:e,downloadSpeed:e.downloadSpeed(),uploadSpeed:e.uploadSpeed(),salt:Math.random(),isChoked:!0})}),n.sort(e);for(var r=0,i=0;i<n.length&&r<t._rechokeNumSlots;++i)n[i].isChoked=!1,n[i].wire.peerInterested&&(r+=1);if(!t._rechokeOptimisticWire&&i<n.length&&t._rechokeNumSlots){var s=n.slice(i).filter(function(e){return e.wire.peerInterested}),a=s[o(s.length)];a&&(a.isChoked=!1,t._rechokeOptimisticWire=a.wire,t._rechokeOptimisticTime=L)}n.forEach(function(e){e.wire.amChoking!==e.isChoked&&(e.isChoked?e.wire.choke():e.wire.unchoke())})},i.prototype._hotswap=function(e,t){var n=this;if(!n.hotswapEnabled)return!1;var r=e.downloadSpeed();if(r<b.BLOCK_LENGTH)return!1;if(!n._reservations[t])return!1;var i=n._reservations[t];if(!i)return!1;var o,s,a=1/0;for(s=0;s<i.length;s++){var c=i[s];if(c&&c!==e){var u=c.downloadSpeed();u>=j||2*u>r||u>a||(o=c,a=u)}}if(!o)return!1;for(s=0;s<i.length;s++)i[s]===o&&(i[s]=null);for(s=0;s<o.requests.length;s++){var f=o.requests[s];f.piece===t&&n.storage.cancelBlock(t,f.offset)}return n.emit("hotswap",o,e,t),!0},i.prototype._request=function(e,t,r){function i(r,s){return o.ready?(f[d]===e&&(f[d]=null),r?(c("error getting piece "+t+"(offset: "+u.offset+" length: "+u.length+") from "+e.remoteAddress+" "+r.message),o.storage.cancelBlock(t,u.offset),n.nextTick(o._update.bind(o)),!1):void o.storage.writeBlock(t,u.offset,s,function(e){e&&(c("error writing block"),o.storage.cancelBlock(t,u.offset)),n.nextTick(o._update.bind(o))})):void o.once("ready",function(){i(r,s)})}var o=this,s=e.requests.length;if(o.storage.bitfield.get(t))return!1;if(s>=k)return!1;var a=0===e.requests.length&&o.storage.numMissing<30,u=o.storage.reserveBlock(t,a);if(!u&&!a&&r&&o._hotswap(e,t)&&(u=o.storage.reserveBlock(t,!1)),!u)return!1;var f=o._reservations[t];f||(f=o._reservations[t]=[]);var d=f.indexOf(null);return-1===d&&(d=f.length),f[d]=e,e.request(t,u.offset,u.length,i),!0}}).call(this,e("_process"))},{"./rarity-map":3,"./storage":4,_process:110,"bittorrent-swarm":82,"concat-stream":102,debug:25,events:107,fs:100,"http-https":102,inherits:35,"parse-torrent":36,"re-emitter":45,"run-parallel":46,"torrent-discovery":48,ut_metadata:75,ut_pex:102}],6:[function(e,t){(function(e){function n(e,t){return this instanceof n?(0===arguments.length&&(e=0),this.grow=t&&(isFinite(t.grow)&&r(t.grow)||t.grow)||0,("number"==typeof e||void 0===e)&&(e=new i(r(e)),e.fill&&e.fill(0)),void(this.buffer=e)):new n(e)}function r(e){var t=e>>3;return e%8!==0&&t++,t}var i="undefined"!=typeof e?e:"undefined"!=typeof Int8Array?Int8Array:function(e){for(var t=new Array(e),n=0;e>n;n++)t[n]=0};n.prototype.get=function(e){var t=e>>3;return t<this.buffer.length&&!!(this.buffer[t]&128>>e%8)},n.prototype.set=function(e,t){var n=e>>3;t||1===arguments.length?(this._grow(n+1),this.buffer[n]|=128>>e%8):n<this.buffer.length&&(this.buffer[n]&=~(128>>e%8))},n.prototype._grow=function(e){if(this.buffer.length<e&&e<=this.grow){var t=new i(e);t.fill&&t.fill(0);for(var n=0;n<this.buffer.length;n++)t[n]=this.buffer[n];this.buffer=t}},"undefined"!=typeof t&&(t.exports=n)}).call(this,e("buffer").Buffer)},{buffer:103}],7:[function(e,t){(function(n,r){function i(e,t){if(this.writable=this.readable=!0,this._opt=t||{},this._chunkSize=e||512,this._offset=0,this._buffer=[],this._bufferLength=0,this._opt.nopad)this._zeroes=!1;else{this._zeroes=new r(this._chunkSize);for(var n=0;n<this._chunkSize;n++)this._zeroes[n]=0}}t.exports=i;{var o=e("stream").Stream,s=e("inherits"),a=e("assert").ok;n.env.DEBUG?console.error:function(){}}s(i,o),i.prototype.write=function(e){if(this._ended)throw new Error("BlockStream: write after end");if(e&&!r.isBuffer(e)&&(e=new r(e+"")),e.length&&(this._buffer.push(e),this._bufferLength+=e.length),this._bufferLength>=this._chunkSize){if(this._paused)return this._needDrain=!0,!1;this._emitChunk()}return!0},i.prototype.pause=function(){this._paused=!0},i.prototype.resume=function(){return this._paused=!1,this._emitChunk()},i.prototype.end=function(e){"function"==typeof e&&(cb=e,e=null),e&&this.write(e),this._ended=!0,this.flush()},i.prototype.flush=function(){this._emitChunk(!0)},i.prototype._emitChunk=function(e){if(e&&this._zeroes){var t=this._bufferLength%this._chunkSize;0!==t&&(t=this._chunkSize-t),t>0&&(this._buffer.push(this._zeroes.slice(0,t)),this._bufferLength+=t)}if(!this._emitting&&!this._paused){this._emitting=!0;for(var n=0;this._bufferLength>=this._chunkSize&&(e||!this._paused);){for(var i,o=0,s=this._chunkSize;s>0&&(e||!this._paused);){var c=this._buffer[n],u=c.length-this._offset;i||s>u?(i=i||new r(this._chunkSize),c.copy(i,o,this._offset,this._offset+Math.min(u,s))):i=c.length===s&&0===this._offset?c:c.slice(this._offset,this._offset+s),u>s?(this._offset+=s,s=0):(s-=u,o+=u,n++,this._offset=0)}this._bufferLength-=this._chunkSize,a(i.length===this._chunkSize),this.emit("data",i),i=null}if(this._buffer=this._buffer.slice(n),this._paused)return this._needsDrain=!0,void(this._emitting=!1);var f=this._buffer.length;if(e&&!this._zeroes&&f){if(1===f)this._offset?this.emit("data",this._buffer[0].slice(this._offset)):this.emit("data",this._buffer[0]);else{for(var s=this._bufferLength,i=new r(s),o=0,d=0;f>d;d++){var c=this._buffer[d],u=c.length-this._offset;c.copy(i,o,this._offset),this._offset=0,o+=u,this._bufferLength-=u}this.emit("data",i)}this._buffer.length=0,this._bufferLength=0,this._offset=0}this._needDrain&&(this._needDrain=!1,this.emit("drain")),0===this._bufferLength&&this._ended&&!this._endEmitted&&(this._endEmitted=!0,this.emit("end")),this._emitting=!1}}}).call(this,e("_process"),e("buffer").Buffer)},{_process:110,assert:101,buffer:103,inherits:35,stream:123}],8:[function(e,t){(function(n){function r(e,t,r){"function"==typeof t&&(r=t,t={});var i;if(f(e)&&(e=[e]),Array.isArray(e)&&e.length>0)t.name=t.name||e[0].name,i=e.map(function(e){if(e){var t={length:e.size,path:[e.name]};if(f(e))t.stream=new m(e);else{if(!n.isBuffer(e.buffer))throw new Error("Array must contain only File objects");t.stream=new x.PassThrough,t.stream.end(e.buffer)}return t}}),c(i,t,r);else{if("string"!=typeof e)throw new Error("invalid input type");t.name=t.name||p.basename(e),s(o,e,function(n,i){if(n)return r(n);i=Array.isArray(i)?g(i):[i];var o=p.normalize(e)+p.sep;i.forEach(function(e){e.stream=_.createReadStream(e.path),e.path=e.path.replace(o,"").split(p.sep)}),c(i,t,r)})}}function i(e,t,n){var r=e.map(function(e){return function(n){t(e,n)}});y(r,n)}function o(e,t){t=v(t),_.stat(e,function(n,r){if(n)return t(n);var i={length:r.size,path:e};t(null,i)})}function s(e,t,n){_.readdir(t,function(r,o){r&&"ENOTDIR"===r.code?e(t,n):r?n(r):i(o,function(n,r){s(e,p.join(t,n),r)},n)})}function a(e,t,r){r=v(r);var i="",o=e.map(function(e){return e.stream});new b(o).pipe(new h(t,{nopad:!0})).on("data",function(e){i+=w(e)}).on("end",function(){r(null,new n(i,"hex"))}).on("error",function(e){console.error(e),r(e)})}function c(e,t,n){var i=void 0!==t.announceList?t.announceList:r.announceList,o={info:{name:t.name},announce:i[0][0],"announce-list":i,"creation date":Number(t.creationDate)||Date.now(),encoding:"UTF-8"};void 0!==t.comment&&(o.info.comment=t.comment),void 0!==t.createdBy&&(o.info["created by"]=t.createdBy),void 0!==t.private&&(o.info.private=Number(t.private)),void 0!==t.urlList&&(o["url-list"]=t.urlList);var s=1===e.length,c=e.reduce(u,0),f=t.pieceLength||l(c);o.info["piece length"]=f,s&&(o.info.length=c),a(e,f,function(t,r){return t?n(t):(o.info.pieces=r,e.forEach(function(e){delete e.stream}),s||(o.info.files=e),void n(null,d.encode(o)))})}function u(e,t){return e+t.length}function f(e){return"undefined"!=typeof Blob&&e instanceof Blob}t.exports=r;var d=e("bencode"),h=e("block-stream"),l=e("piece-length"),p=e("path"),m=e("filestream/read"),g=e("flatten"),_=e("fs"),b=e("multistream"),v=e("once"),y=e("run-parallel"),w=e("git-sha1"),x=e("stream");r.announceList=[["udp://tracker.publicbt.com:80"],["udp://tracker.openbittorrent.com:80"],["udp://tracker.webtorrent.io:80"],["wss://tracker.webtorrent.io"]]}).call(this,e("buffer").Buffer)},{bencode:9,"block-stream":12,buffer:103,"filestream/read":15,flatten:16,fs:100,"git-sha1":17,multistream:19,once:21,path:109,"piece-length":22,"run-parallel":24,stream:123}],9:[function(e,t){t.exports={encode:e("./lib/encode"),decode:e("./lib/decode")}},{"./lib/decode":10,"./lib/encode":11}],10:[function(e,t){(function(e){function n(t,r){return n.position=0,n.encoding=r||null,n.data=e.isBuffer(t)?t:new e(t),n.next()}n.position=0,n.data=null,n.encoding=null,n.next=function(){switch(n.data[n.position]){case 100:return n.dictionary();case 108:return n.list();case 105:return n.integer();default:return n.bytes()}},n.find=function(e){for(var t=n.position,r=n.data.length,i=n.data;r>t;){if(i[t]===e)return t;t++}throw new Error('Invalid data: Missing delimiter "'+String.fromCharCode(e)+'" [0x'+e.toString(16)+"]")
+},n.dictionary=function(){n.position++;for(var e={};101!==n.data[n.position];)e[n.bytes()]=n.next();return n.position++,e},n.list=function(){n.position++;for(var e=[];101!==n.data[n.position];)e.push(n.next());return n.position++,e},n.integer=function(){var e=n.find(101),t=n.data.toString("ascii",n.position+1,e);return n.position+=e+1-n.position,parseInt(t,10)},n.bytes=function(){var e=n.find(58),t=parseInt(n.data.toString("ascii",n.position,e),10),r=++e+t;return n.position=r,n.encoding?n.data.toString(n.encoding,e,r):n.data.slice(e,r)},t.exports=n}).call(this,e("buffer").Buffer)},{buffer:103}],11:[function(e,t){(function(e){function n(t){var r=[];return n._encode(r,t),e.concat(r)}n._floatConversionDetected=!1,n._encode=function(t,r){if(e.isBuffer(r))return t.push(new e(r.length+":")),void t.push(r);switch(typeof r){case"string":n.bytes(t,r);break;case"number":n.number(t,r);break;case"object":r.constructor===Array?n.list(t,r):n.dict(t,r)}};var r=new e("e"),i=new e("d"),o=new e("l");n.bytes=function(t,n){t.push(new e(e.byteLength(n)+":"+n))},n.number=function(t,r){var i=2147483648,o=r/i<<0,s=r%i<<0,a=o*i+s;t.push(new e("i"+a+"e")),a===r||n._floatConversionDetected||(n._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value "'+r+'":','Bencoding only defines support for integers, value was converted to "'+a+'"'),console.trace())},n.dict=function(e,t){e.push(i);for(var o,s=0,a=Object.keys(t).sort(),c=a.length;c>s;s++)o=a[s],n.bytes(e,o),n._encode(e,t[o]);e.push(r)},n.list=function(e,t){var i=0,s=t.length;for(e.push(o);s>i;i++)n._encode(e,t[i]);e.push(r)},t.exports=n}).call(this,e("buffer").Buffer)},{buffer:103}],12:[function(e,t){t.exports=e(7)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/block-stream/block-stream.js":7,_process:110,assert:101,buffer:103,inherits:18,stream:123}],13:[function(e,t){t.exports=function(e){for(var t,n=[].slice.call(arguments,1),r=0,i=n.length;i>r;r++){t=n[r];for(var o in t)e[o]=t[o]}return e}},{}],14:[function(e,t){(function(e){t.exports=function(t){return"function"==typeof e._augment&&e.TYPED_ARRAY_SUPPORT?e._augment(t):new e(t)}}).call(this,e("buffer").Buffer)},{buffer:103}],15:[function(e,t){(function(n){"use strict";function r(e,t){return this instanceof r?(t=t||{},i.call(this,a({objectMode:!0},t)),this._offset=0,this._eof=!1,this._metasent=!t.meta,this._metadata={name:e.name,size:e.size,extension:e.name.replace(s,"$1")},this.reader=new FileReader,this.reader.onprogress=this._handleProgress.bind(this),this.reader.onload=this._handleLoad.bind(this),void this.reader.readAsArrayBuffer(e)):new r(e,t)}var i=e("stream").Readable,o=e("util"),s=/^.*\.(\w+)$/,a=e("extend.js"),c=e("typedarray-to-buffer");o.inherits(r,i),t.exports=r,r.prototype._read=function(e){function t(){var o,s=r._offset,a=r._offset+e,u=i.result&&i.result.byteLength,f=2===i.readyState&&a>u;return u&&(f||u>a)?(o=c(new Uint8Array(i.result,s,Math.min(e,i.result.byteLength-s))),r._offset=s+o.length,r._eof=0===o.length,r.push(o.length>0?new n(o):null)):void r.once("readable",t)}var r=this,i=this.reader;return this._metasent?void t():(this._metasent=!0,this.push("meta|"+JSON.stringify(this._metadata)))},r.prototype._handleLoad=function(){this.emit("readable")},r.prototype._handleProgress=function(){this.emit("readable")}}).call(this,e("buffer").Buffer)},{buffer:103,"extend.js":13,stream:123,"typedarray-to-buffer":14,util:125}],16:[function(e,t){t.exports=function(e,t){function n(e,r){return e.reduce(function(e,i){return e.concat(Array.isArray(i)&&t>r?n(i,r+1):i)},[])}return t="number"==typeof t?t:1/0,n(e,1)}},{}],17:[function(e,t){(function(n){"use strict";function r(){var e=a.createHash("sha1");return{update:function(t){return e.update(t)},digest:function(){return e.digest("hex")}}}function i(e){function t(e){if("string"==typeof e)return n(e);var t=e.length;g+=8*t;for(var i=0;t>i;i++)r(e[i])}function n(e){var t=e.length;g+=8*t;for(var n=0;t>n;n++)r(e.charCodeAt(n))}function r(e){c[p]|=(255&e)<<m,m?m-=8:(p++,m=24),16===p&&s()}function i(){r(128),(p>14||14===p&&24>m)&&s(),p=14,m=24,r(0),r(0),r(g>0xffffffffff?g/1099511627776:0),r(g>4294967295?g/4294967296:0);for(var e=24;e>=0;e-=8)r(g>>e);return a(u)+a(f)+a(d)+a(h)+a(l)}function s(){for(var e=16;80>e;e++){var t=c[e-3]^c[e-8]^c[e-14]^c[e-16];c[e]=t<<1|t>>>31}var n,r,i=u,o=f,s=d,a=h,m=l;for(e=0;80>e;e++){20>e?(n=a^o&(s^a),r=1518500249):40>e?(n=o^s^a,r=1859775393):60>e?(n=o&s|a&(o|s),r=2400959708):(n=o^s^a,r=3395469782);var g=(i<<5|i>>>27)+n+m+r+(0|c[e]);m=a,a=s,s=o<<30|o>>>2,o=i,i=g}for(u=u+i|0,f=f+o|0,d=d+s|0,h=h+a|0,l=l+m|0,p=0,e=0;16>e;e++)c[e]=0}function a(e){for(var t="",n=28;n>=0;n-=4)t+=(e>>n&15).toString(16);return t}var c,u=1732584193,f=4023233417,d=2562383102,h=271733878,l=3285377520,p=0,m=24,g=0;return c=e?o:new Uint32Array(80),{update:t,digest:i}}var o,s,a,c="object"==typeof n&&"object"==typeof n.versions&&n.versions.node&&"renderer"!==n.__atom_type;if(c){var u=e;a=u("crypto"),s=r}else o=new Uint32Array(80),s=i;t.exports=function(e){if(void 0===e)return s(!1);var t=s(!0);return t.update(e),t.digest()}}).call(this,e("_process"))},{_process:110}],18:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],19:[function(e,t){function n(e,t){return this instanceof n?(o.Readable.call(this,t),this.destroyed=!1,this._drained=!1,this._forwarding=!1,this._current=null,this._queue=e.map(r),void this._next()):new n(e,t)}function r(e){if(!e||"function"==typeof e||e._readableState)return e;var t=(new o.Readable).wrap(e);return e.destroy&&(t.destroy=e.destroy.bind(e)),t}t.exports=n;var i=e("inherits"),o=e("stream");i(n,o.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._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(),this._queue.forEach(function(e){e.destroy&&e.destroy()}),e&&this.emit("error",e),this.emit("close"))},n.prototype._next=function(){function e(){o._forward()}function t(){s._readableState.ended||o.destroy()}function n(){o._current=null,s.removeListener("readable",e),s.removeListener("end",n),s.removeListener("error",i),s.removeListener("close",t),o._next()}function i(e){o.destroy(e)}var o=this,s=this._queue.shift();return"function"==typeof s&&(s=r(s())),s?(this._current=s,s.on("readable",e),s.on("end",n),s.on("error",i),void s.on("close",t)):void this.push(null)}},{inherits:20,stream:123}],20:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],21:[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}t.exports=n,n.proto=n(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0})})},{}],22:[function(e,t){for(var n=e("closest-to"),r=[],i=14;22>=i;i++)r.push(Math.pow(2,i));t.exports=function(e){return n(e/Math.pow(2,10),r)}},{"closest-to":23}],23:[function(e,t){t.exports=function(e,t){var n=1/0,r=0,i=null;t.sort(function(e,t){return e-t});for(var o=0,s=t.length;s>o&&(r=Math.abs(e-t[o]),!(r>=n));o++)n=r,i=t[o];return i}},{}],24:[function(e,t){t.exports=function(e,t){function n(e,n,o){r[e]=o,(0===--i||n)&&(t&&t(n,r),t=null)}var r,i,o;Array.isArray(e)?(r=[],i=e.length):(o=Object.keys(e),r={},i=o.length),i?o?o.forEach(function(t){e[t](n.bind(void 0,t))}):e.forEach(function(e,t){e(n.bind(void 0,t))}):(t&&t(null,r),t=null)}},{}],25:[function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&"function"==typeof console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{null==e?localStorage.removeItem("debug"):localStorage.debug=e}catch(t){}}function a(){var e;try{e=localStorage.debug}catch(t){}return e}n=t.exports=e("./debug"),n.log=o,n.formatArgs=i,n.save=s,n.load=a,n.useColors=r,n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(a())},{"./debug":26}],26:[function(e,t,n){function r(){return n.colors[f++%n.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(u||t);e.diff=o,e.prev=u,e.curr=t,u=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var s=Array.prototype.slice.call(arguments);s[0]=n.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var a=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;a++;var i=n.formatters[r];if("function"==typeof i){var o=s[a];t=i.call(e,o),s.splice(a,1),a--}return t}),"function"==typeof n.formatArgs&&(s=n.formatArgs.apply(e,s));var c=i.log||n.log||console.log.bind(console);c.apply(e,s)}t.enabled=!1,i.enabled=!0;var o=n.enabled(e)?i:t;return o.namespace=e,o}function o(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,i=0;r>i;i++)t[i]&&(e=t[i].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function s(){n.enable("")}function a(e){var t,r;for(t=0,r=n.skips.length;r>t;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;r>t;t++)if(n.names[t].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}n=t.exports=i,n.coerce=c,n.disable=s,n.enable=o,n.enabled=a,n.humanize=e("ms"),n.names=[],n.skips=[],n.formatters={};var u,f=0},{ms:27}],27:[function(e,t){function n(e){var t=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"y":return n*f;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"h":return n*c;case"minutes":case"minute":case"m":return n*a;case"seconds":case"second":case"s":return n*s;case"ms":return n}}}function r(e){return e>=u?Math.round(e/u)+"d":e>=c?Math.round(e/c)+"h":e>=a?Math.round(e/a)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function i(e){return o(e,u,"day")||o(e,c,"hour")||o(e,a,"minute")||o(e,s,"second")||e+" ms"}function o(e,t,n){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var s=1e3,a=60*s,c=60*a,u=24*c,f=365.25*u;t.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t.long?i(e):r(e)}},{}],28:[function(e,t){function n(e){var t=!0;return r(function(){t=!1}),function(){var n=arguments,i=this;t?r(function(){e.apply(i,n)}):e.apply(i,n)}}t.exports=n;var r=e("asap")},{asap:29}],29:[function(e,t){(function(e){function n(){for(;i.next;){i=i.next;var e=i.task;i.task=void 0;var t=i.domain;t&&(i.domain=void 0,t.enter());try{e()}catch(r){if(c)throw t&&t.exit(),setTimeout(n,0),t&&t.enter(),r;setTimeout(function(){throw r},0)}t&&t.exit()}s=!1}function r(t){o=o.next={task:t,domain:c&&e.domain,next:null},s||(s=!0,a())}var i={task:void 0,next:null},o=i,s=!1,a=void 0,c=!1;if("undefined"!=typeof e&&e.nextTick)c=!0,a=function(){e.nextTick(n)};else if("function"==typeof setImmediate)a="undefined"!=typeof window?setImmediate.bind(window,n):function(){setImmediate(n)};else if("undefined"!=typeof MessageChannel){var u=new MessageChannel;u.port1.onmessage=n,a=function(){u.port2.postMessage(0)}}else a=function(){setTimeout(n,0)};t.exports=r}).call(this,e("_process"))},{_process:110}],30:[function(e,t){var n=e("once"),r=function(){},i=function(e){return e.setHeader&&"function"==typeof e.abort},o=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},s=function(e,t,a){if("function"==typeof t)return s(e,null,t);t||(t={}),a=n(a||r);var c=e._writableState,u=e._readableState,f=t.readable||t.readable!==!1&&e.readable,d=t.writable||t.writable!==!1&&e.writable,h=function(){e.writable||l()},l=function(){d=!1,f||a()},p=function(){f=!1,d||a()},m=function(e){a(e?new Error("exited with error code: "+e):null)},g=function(){return(!f||u&&u.ended)&&(!d||c&&c.ended)?void 0:a(new Error("premature close"))},_=function(){e.req.on("finish",l)};return i(e)?(e.on("complete",l),e.on("abort",g),e.req?_():e.on("request",_)):d&&!c&&(e.on("end",h),e.on("close",h)),o(e)&&e.on("exit",m),e.on("end",p),e.on("finish",l),t.error!==!1&&e.on("error",a),e.on("close",g),function(){e.removeListener("complete",l),e.removeListener("abort",g),e.removeListener("request",_),e.req&&e.req.removeListener("finish",l),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",l),e.removeListener("exit",m),e.removeListener("end",p),e.removeListener("error",a),e.removeListener("close",g)}};t.exports=s},{once:31}],31:[function(e,t){t.exports=e(21)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/once/once.js":21}],32:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],33:[function(e,t){t.exports=e(17)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/git-sha1/git-sha1.js":17,_process:110}],34:[function(e,t){var n=t.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),0>=e)return"0";for(var r=Math.log(Math.pow(2,e))/Math.log(t),i=2;1/0===r;i*=2)r=Math.log(Math.pow(2,e/i))/Math.log(t)*i;for(var o=r-Math.floor(r),s="",i=0;i<Math.floor(r);i++){var a=Math.floor(Math.random()*t).toString(t);s=a+s}if(o){var c=Math.pow(t,o),a=Math.floor(Math.random()*c).toString(t);s=a+s}var u=parseInt(s,t);return 1/0!==u&&u>=Math.pow(2,e)?n(e,t):s};n.rack=function(e,t,r){var i=function(i){var s=0;do{if(s++>10){if(!r)throw new Error("too many ID collisions, use more bits");e+=r}var a=n(e,t)}while(Object.hasOwnProperty.call(o,a));return o[a]=i,a},o=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=t||16,i}},{}],35:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],36:[function(e,t){(function(n){var r=e("magnet-uri"),i=e("parse-torrent-file");t.exports=function(e){if("string"==typeof e&&/magnet:/.test(e))return r(e);if("string"==typeof e&&(40===e.length||32===e.length)){var t=r("magnet:?xt=urn:btih:"+e);return t?{infoHash:t.infoHash}:null}if(n.isBuffer(e)&&20===e.length)return{infoHash:e.toString("hex")};if(!n.isBuffer(e))return e&&e.infoHash?e:null;try{return i(e)}catch(o){return null}},t.exports.toBuffer=i.toBuffer}).call(this,e("buffer").Buffer)},{buffer:103,"magnet-uri":37,"parse-torrent-file":40}],37:[function(e,t){(function(n){var r=e("thirty-two");t.exports=function(e){var t={},i=e.split("magnet:?")[1];if(!i||0===i.length)return t;var o=i.split("&");o.forEach(function(e){var n=e.split("=");if(2===n.length){var r=n[0],i=n[1];if("dn"===r&&(i=decodeURIComponent(i).replace(/\+/g," ")),"tr"===r&&(i=decodeURIComponent(i)),"kt"===r&&(i=decodeURIComponent(i).split("+")),t[r])if(Array.isArray(t[r]))t[r].push(i);else{var o=t[r];t[r]=[o,i]}else t[r]=i}});var s;if(t.xt&&(s=t.xt.match(/^urn:btih:(.{40})/)))t.infoHash=new n(s[1],"hex").toString("hex");else if(t.xt&&(s=t.xt.match(/^urn:btih:(.{32})/))){var a=r.decode(s[1]);t.infoHash=new n(a,"binary").toString("hex")}return t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),"string"==typeof t.tr?t.announce=[t.tr]:Array.isArray(t.tr)&&(t.announce=t.tr),t}}).call(this,e("buffer").Buffer)},{buffer:103,"thirty-two":38}],38:[function(e,t,n){var r=e("./thirty-two");n.encode=r.encode,n.decode=r.decode},{"./thirty-two":39}],39:[function(e,t,n){(function(e){function t(e){var t=Math.floor(e.length/5);return e.length%5==0?t:t+1}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",i=[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){var i=0,o=0,s=0,a=0,c=new e(8*t(n));for(e.isBuffer(n)||(n=new e(n));i<n.length;){var u=n[i];s>3?(a=u&255>>s,s=(s+5)%8,a=a<<s|(i+1<n.length?n[i+1]:0)>>8-s,i++):(a=u>>8-(s+5)&31,s=(s+5)%8,0==s&&i++),c[o]=r.charCodeAt(a),o++}for(i=o;i<c.length;i++)c[i]=61;return c},n.decode=function(t){var n,r=0,o=0,s=0;e.isBuffer(t)||(t=new e(t));for(var a=new e(Math.ceil(5*t.length/8)),c=0;c<t.length&&61!=t[c];c++){var u=t[c]-48;if(!(u<i.length))throw new Error("Invalid input - it is not base32 encoded string");o=i[u],3>=r?(r=(r+5)%8,0==r?(n|=o,a[s]=n,s++,n=0):n|=255&o<<8-r):(r=(r+5)%8,n|=255&o>>>r,a[s]=n,s++,n=255&o<<8-r)}return a.slice(0,s)}}).call(this,e("buffer").Buffer)},{buffer:103}],40:[function(e,t){(function(n){function r(e){n.isBuffer(e)&&(e=c.decode(e)),a(e.info,"info"),a(e.info.name,"info.name"),a(e.info["piece length"],"info['piece length']"),a(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(function(e){a("number"==typeof e.length,"info.files[0].length"),a(e.path,"info.files[0].path")}):a(e.info.length,"info.length");var t={};t.info=e.info,t.infoBuffer=c.encode(e.info),t.infoHash=f(t.infoBuffer),t.name=e.info.name.toString(),t.private=!!e.info.private,e["creation date"]&&(t.created=new Date(1e3*e["creation date"])),n.isBuffer(e.comment)&&(t.comment=e.comment.toString());var r=e["announce-list"];r||(r=e.announce?[[e.announce]]:[]),t.announceList=r.map(function(e){return e.map(function(e){return e.toString()})}),t.announce=[].concat.apply([],t.announceList),t.urlList=(e["url-list"]||[]).map(function(e){return e.toString()});var i=e.info.files||[e.info];t.files=i.map(function(e,n){var r=[].concat(e.name||t.name,e.path||[]).map(function(e){return e.toString()});return{path:u.join.apply(null,[u.sep].concat(r)).slice(1),name:r[r.length-1],length:e.length,offset:i.slice(0,n).reduce(o,0)}}),t.length=i.reduce(o,0);var d=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(d.offset+d.length)%t.pieceLength||t.pieceLength,t.pieces=s(e.info.pieces),t}function i(e){var t={info:e.info};return e.announce&&e.announce[0]&&(t.announce=e.announce[0]),e.announceList&&(t["announce-list"]=e.announceList.map(function(e){return e.map(function(e){return e=new n(e,"utf8"),t.announce||(t.announce=e),e})})),e.created&&(t["creation date"]=e.created.getTime()/1e3|0),c.encode(t)}function o(e,t){return e+t.length}function s(e){for(var t=[],n=0;n<e.length;n+=20)t.push(e.slice(n,n+20).toString("hex"));return t}function a(e,t){if(!e)throw new Error("Torrent is missing required field: "+t)}t.exports=r,t.exports.toBuffer=i;var c=e("bencode"),u=e("path"),f=e("git-sha1")}).call(this,e("buffer").Buffer)},{bencode:41,buffer:103,"git-sha1":44,path:109}],41:[function(e,t){t.exports=e(9)},{"./lib/decode":42,"./lib/encode":43,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/bencode.js":9}],42:[function(e,t){t.exports=e(10)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/decode.js":10,buffer:103}],43:[function(e,t){t.exports=e(11)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/encode.js":11,buffer:103}],44:[function(e,t){t.exports=e(17)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/git-sha1/git-sha1.js":17,_process:110}],45:[function(e,t){function n(e,t,n){Array.isArray(n)||(n=[n]),n.forEach(function(n){e.on(n,function(){var e=[].slice.call(arguments);e.unshift(n),t.emit.apply(t,e)})})}function r(e,t){var r=new i;return n(e,r,t),r}t.exports=n,t.exports.filter=r;var i=e("events").EventEmitter},{events:107}],46:[function(e,t){t.exports=e(24)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/run-parallel/index.js":24}],47:[function(e,t){var n=1,r=65535,i=4,o=function(){n=n+1&r},s=setInterval(o,1e3/i|0);s.unref&&s.unref(),t.exports=function(e){var t=i*(e||5),o=[0],s=1,a=n-1&r;return function(e){var c=n-a&r;for(c>t&&(c=t),a=n;c--;)s===t&&(s=0),o[s]=o[0===s?t-1:s-1],s++;e&&(o[s-1]+=e);var u=o[s-1],f=o.length<t?0:o[s===t?0:s];return o.length<i?u:(u-f)*i/o.length}}},{}],48:[function(e,t){(function(n){function r(e){var t=this;if(!(t instanceof r))return new r(e);if(s.call(t),e||(e={}),t._performedDHTLookup=!1,a(t,{announce:[],dht:"function"==typeof o,externalDHT:!1,tracker:!0,port:null},e),!t.peerId)throw new Error("peerId required");if(!t.port&&!n.browser)throw new Error("port required");t._createDHT(e.dhtPort)}t.exports=r;var i=e("debug")("torrent-discovery"),o=e("bittorrent-dht/client"),s=e("events").EventEmitter,a=e("extend.js"),c=e("inherits"),u=e("re-emitter"),f=e("bittorrent-tracker/client");c(r,s),r.prototype.setTorrent=function(e){var t=this;if(!t.torrent){if(e&&e.infoHash)t.torrent=e,t.infoHash=e.infoHash;else{if(t.infoHash)return;t.infoHash=e}i("setTorrent %s",e),t.tracker&&t.tracker!==!0?t.tracker.torrentLength=e.length:t._createTracker(),t.dht&&(t.dht.ready?t._dhtLookupAndAnnounce():t.dht.on("ready",t._dhtLookupAndAnnounce.bind(t)))}},r.prototype.stop=function(e){var t=this;t.tracker&&t.tracker.stop&&t.tracker.stop(),!t.externalDHT&&t.dht&&t.dht.destroy?t.dht.destroy(e):n.nextTick(function(){e(null)})},r.prototype._createDHT=function(e){var t=this;t.dht&&(t.dht?t.externalDHT=!0:t.dht=new o,u(t.dht,t,["peer","error","warning"]),t.externalDHT||t.dht.listen(e))},r.prototype._createTracker=function(){var e=this;if(e.tracker){var t=e.torrent||{infoHash:e.infoHash,announce:e.announce};e.tracker=n.browser?new f(e.peerId,t):new f(e.peerId,e.port,t),u(e.tracker,e,["peer","warning","error"]),e.tracker.start()}},r.prototype._dhtLookupAndAnnounce=function(){var e=this;e._performedDHTLookup||(e._performedDHTLookup=!0,i("lookup"),e.dht.lookup(e.infoHash,function(t){!t&&e.port&&(i("dhtAnnounce"),e.dht.announce(e.infoHash,e.port,function(){e.emit("dhtAnnounce")}))}))}}).call(this,e("_process"))},{_process:110,"bittorrent-dht/client":102,"bittorrent-tracker/client":55,debug:49,events:107,"extend.js":52,inherits:53,"re-emitter":54}],49:[function(e,t){t.exports=e(25)},{"./debug":50,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":25}],50:[function(e,t){t.exports=e(26)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":26,ms:51}],51:[function(e,t){t.exports=e(27)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":27}],52:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],53:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],54:[function(e,t){t.exports=e(45)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/re-emitter/index.js":45,events:107}],55:[function(e,t){(function(n){function r(e,t,o){var c=this;return c instanceof r?(a.call(c),c._opts=o||{},c._peerId=n.isBuffer(e)?e:new n(e,"utf8"),c._infoHash=n.isBuffer(t.infoHash)?t.infoHash:new n(t.infoHash,"hex"),c.torrentLength=t.length,c._numWant=c._opts.numWant||l,c._intervalMs=c._opts.interval||18e5,s("new client %s",c._infoHash.toString("hex")),"string"==typeof t.announce&&(t.announce=[t.announce]),void(c._trackers=(t.announce||[]).filter(function(e){return 0===e.indexOf("ws://")||0===e.indexOf("wss://")}).map(function(e){return new i(c,e,c._opts)}))):new r(e,t,o)}function i(e,t,n){var r=this;a.call(r),r._opts=n||{},r._announceUrl=t,r._peers={},s("new tracker %s",t),r.client=e,r.ready=!1,r._socket=null,r._intervalMs=r.client._intervalMs,r._interval=null}function o(e){return new n(e,"binary").toString("hex")}t.exports=r;var s=e("debug")("webtorrent-tracker"),a=e("events").EventEmitter,c=e("extend.js"),u=e("hat"),f=e("inherits"),d=e("simple-peer"),h=e("simple-websocket"),l=15;f(r,a);var p={};r.prototype.start=function(e){var t=this;t._trackers.forEach(function(t){t.start(e)})},r.prototype.stop=function(e){var t=this;t._trackers.forEach(function(t){t.stop(e)})},r.prototype.complete=function(e){var t=this;t._trackers.forEach(function(t){t.complete(e)})},r.prototype.update=function(e){var t=this;t._trackers.forEach(function(t){t.update(e)})},r.prototype.setInterval=function(e){var t=this;t._intervalMs=e,t._trackers.forEach(function(t){t.setInterval(e)})},f(i,a),i.prototype.start=function(e){var t=this;e=e||{},e.event="started",s("sent `start` %s %s",t._announceUrl,JSON.stringify(e)),t._announce(e),t.setInterval(t._intervalMs)},i.prototype.stop=function(e){var t=this;e=e||{},e.event="stopped",s("sent `stop` %s %s",t._announceUrl,JSON.stringify(e)),t._announce(e),t.setInterval(0)},i.prototype.complete=function(e){var t=this;e=e||{},e.event="completed",e.downloaded=e.downloaded||t.torrentLength||0,s("sent `complete` %s %s",t._announceUrl,JSON.stringify(e)),t._announce(e)},i.prototype.update=function(e){var t=this;e=e||{},s("sent `update` %s %s",t._announceUrl,JSON.stringify(e)),t._announce(e)},i.prototype._init=function(e){var t=this;e&&t.once("ready",e),t._socket||(p[t._announceUrl]?(t._socket=p[t._announceUrl],t._onSocketReady()):(t._socket=p[t._announceUrl]=new h(t._announceUrl),t._socket.on("ready",t._onSocketReady.bind(t))),t._socket.on("warning",t._onSocketWarning.bind(t)),t._socket.on("error",t._onSocketWarning.bind(t)),t._socket.on("message",t._onSocketMessage.bind(t)))},i.prototype._onSocketReady=function(){var e=this;e.ready=!0,e.emit("ready")},i.prototype._onSocketWarning=function(e){s("tracker warning %s",e.message)},i.prototype._onSocketMessage=function(e){var t=this;if("object"!=typeof e||null===e)return t.client.emit("warning",new Error("Invalid tracker response"));if(e.info_hash===t.client._infoHash.toString("binary")){s("received %s from %s",JSON.stringify(e),t._announceUrl);var n=e["failure reason"];if(n)return t.client.emit("warning",new Error(n));var r=e["warning message"];r&&t.client.emit("warning",new Error(r));var i=e.interval||e["min interval"];i&&!t._opts.interval&&0!==t._intervalMs&&t.setInterval(1e3*i);var a=e["tracker id"];a&&(t._trackerId=a),e.complete&&t.client.emit("update",{announce:t._announceUrl,complete:e.complete,incomplete:e.incomplete});var u;e.offer&&(u=new d({trickle:!1}),u.id=o(e.peer_id),u.once("signal",function(n){var r={info_hash:t.client._infoHash.toString("binary"),peer_id:t.client._peerId.toString("binary"),to_peer_id:e.peer_id};t._trackerId&&(r.trackerid=t._trackerId),t._send(c({answer:n,offer_id:e.offer_id},r))}),u.signal(e.offer),t.client.emit("peer",u)),e.answer&&(u=t._peers[e.offer_id],u&&(u.signal(e.answer),t.client.emit("peer",u)))}},i.prototype._announce=function(e){var t=this;return t.ready?void t._generateOffers(function(n){e=c({uploaded:0,downloaded:0,info_hash:t.client._infoHash.toString("binary"),peer_id:t.client._peerId.toString("binary"),offers:n},e),null!=t.client.torrentLength&&null==e.left&&(e.left=t.client.torrentLength-(e.downloaded||0)),t._trackerId&&(e.trackerid=t._trackerId),t._send(e)}):t._init(t._announce.bind(t,e))},i.prototype._send=function(e){var t=this;s("send %s",JSON.stringify(e)),t._socket.send(e)},i.prototype._generateOffers=function(e){function t(){var e=u(160),t=r._peers[e]=new d({initiator:!0,trickle:!1});t.once("signal",function(t){i.push({offer:t,offer_id:e}),n()})}function n(){console.log(i.length),i.length===r.client._numWant&&(s("generated %s offers",r.client._numWant),e(i))}var r=this,i=[];s("generating %s offers",r.client._numWant);for(var o=0;o<r.client._numWant;++o)t()},i.prototype.setInterval=function(e){var t=this;clearInterval(t._interval),t._intervalMs=e,e&&(t._interval=setInterval(t.update.bind(t),t._intervalMs))}}).call(this,e("buffer").Buffer)},{buffer:103,debug:56,events:107,"extend.js":59,hat:60,inherits:61,"simple-peer":62,"simple-websocket":72}],56:[function(e,t){t.exports=e(25)},{"./debug":57,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":25}],57:[function(e,t){t.exports=e(26)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":26,ms:58}],58:[function(e,t){t.exports=e(27)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":27}],59:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],60:[function(e,t){t.exports=e(34)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/hat/index.js":34}],61:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],62:[function(e,t){function n(e){return this instanceof n?(o.call(this),e=s({initiator:!1,stream:!1,config:n.config,constraints:n.constraints,channelName:e&&e.initiator?"simple-peer-"+a(160):null,trickle:!0},e),s(this,e),i("new peer initiator: %s channelName: %s",this.initiator,this.channelName),this.destroyed=!1,this.ready=!1,this._pcReady=!1,this._channelReady=!1,this._dataStreams=[],this._iceComplete=!1,this._pc=new l(this.config,this.constraints),this._pc.oniceconnectionstatechange=this._onIceConnectionStateChange.bind(this),this._pc.onsignalingstatechange=this._onSignalingStateChange.bind(this),this._pc.onicecandidate=this._onIceCandidate.bind(this),this._channel=null,this.stream&&this._setupVideo(this.stream),void(this.initiator?(this._setupData({channel:this._pc.createDataChannel(this.channelName)}),this._pc.onnegotiationneeded=f(function(){this._pc.createOffer(function(e){this._pc.setLocalDescription(e);var t=function(){this.emit("signal",this._pc.localDescription||e)}.bind(this);this.trickle||this._iceComplete?t():this.once("_iceComplete",t)}.bind(this),this._onError.bind(this))}.bind(this)),window.mozRTCPeerConnection&&setTimeout(this._pc.onnegotiationneeded.bind(this._pc),0)):this._pc.ondatachannel=this._setupData.bind(this))):new n(e)}function r(e){d.Duplex.call(this,e),this._peer=e._peer,i("new stream")}t.exports=n;var i=e("debug")("simple-peer"),o=e("events").EventEmitter,s=e("extend.js"),a=e("hat"),c=e("inherits"),u=e("is-typedarray"),f=e("once"),d=e("stream"),h=e("typedarray-to-buffer"),l="undefined"!=typeof window&&(window.mozRTCPeerConnection||window.RTCPeerConnection||window.webkitRTCPeerConnection),p="undefined"!=typeof window&&(window.mozRTCSessionDescription||window.RTCSessionDescription||window.webkitRTCSessionDescription),m="undefined"!=typeof window&&(window.mozRTCIceCandidate||window.RTCIceCandidate||window.webkitRTCIceCandidate);c(n,o),n.config={iceServers:[{url:"stun:23.21.150.121"}]},n.constraints={},n.prototype.send=function(e,t){return this._channelReady?(i("send %s",e),this._channel.send(u.strict(e)||e instanceof ArrayBuffer||e instanceof Blob||"string"==typeof e?e:JSON.stringify(e)),void(t&&t(null))):this.once("ready",this.send.bind(this,e,t))
+},n.prototype.signal=function(e){if(!this.destroyed){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}if(i("signal %s",JSON.stringify(e)),e.sdp&&this._pc.setRemoteDescription(new p(e),function(){var e="offer"===this._pc.remoteDescription.type;e&&this._pc.createAnswer(function(e){this._pc.setLocalDescription(e);var t=function(){this.emit("signal",this._pc.localDescription||e)}.bind(this);this.trickle||this._iceComplete?t():this.once("_iceComplete",t)}.bind(this),this._onError.bind(this))}.bind(this),this._onError.bind(this)),e.candidate)try{this._pc.addIceCandidate(new m(e.candidate))}catch(t){this.destroy(new Error("error adding candidate, "+t.message))}e.sdp||e.candidate||this.destroy(new Error("signal() called with invalid signal data"))}},n.prototype.destroy=function(e,t){if(!this.destroyed){if(i("destroy (error: %s)",e&&e.message),this.destroyed=!0,this.ready=!1,"function"==typeof e&&(t=e,e=null),t&&this.once("close",t),this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null}if(this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null}this._pc=null,this._channel=null,this._dataStreams.forEach(function(t){e&&t.emit("error",e),t._readableState.ended||t.push(null),t._writableState.finished||t.end()}),this._dataStreams=[],e&&this.emit("error",e),this.emit("close")}},n.prototype.getDataStream=function(e){if(this.destroyed)throw new Error("peer is destroyed");var t=new r(s({_peer:this},e));return this._dataStreams.push(t),t},n.prototype._setupData=function(e){this._channel=e.channel,this.channelName=this._channel.label,this._channel.binaryType="arraybuffer",this._channel.onmessage=this._onChannelMessage.bind(this),this._channel.onopen=this._onChannelOpen.bind(this),this._channel.onclose=this._onChannelClose.bind(this)},n.prototype._setupVideo=function(e){this._pc.addStream(e),this._pc.onaddstream=this._onAddStream.bind(this)},n.prototype._onIceConnectionStateChange=function(){var e=this._pc.iceGatheringState,t=this._pc.iceConnectionState;this.emit("iceConnectionStateChange",e,t),i("iceConnectionStateChange %s %s",e,t),("connected"===t||"completed"===t)&&(this._pcReady=!0,this._maybeReady()),("disconnected"===t||"closed"===t)&&this.destroy()},n.prototype._maybeReady=function(){i("maybeReady pc %s channel %s",this._pcReady,this._channelReady),!this.ready&&this._pcReady&&this._channelReady&&(i("ready"),this.ready=!0,this.emit("ready"))},n.prototype._onSignalingStateChange=function(){this.emit("signalingStateChange",this._pc.signalingState),i("signalingStateChange %s",this._pc.signalingState)},n.prototype._onIceCandidate=function(e){e.candidate&&this.trickle?this.emit("signal",{candidate:e.candidate}):e.candidate||(this._iceComplete=!0,this.emit("_iceComplete"))},n.prototype._onChannelMessage=function(e){if(!this.destroyed){var t=e.data;if(i("receive %s",t),t instanceof ArrayBuffer)t=h(new Uint8Array(t)),this.emit("message",t);else try{this.emit("message",JSON.parse(t))}catch(n){this.emit("message",t)}this._dataStreams.forEach(function(e){e.push(t)})}},n.prototype._onChannelOpen=function(){this._channelReady=!0,this._maybeReady()},n.prototype._onChannelClose=function(){this._channelReady=!1,this.destroy()},n.prototype._onAddStream=function(e){this.emit("stream",e.stream)},n.prototype._onError=function(e){i("error %s",e.message),this.destroy(e)},c(r,d.Duplex),r.prototype.destroy=function(){this._peer.destroy()},r.prototype._read=function(){},r.prototype._write=function(e,t,n){this._peer.send(e,n)}},{debug:63,events:107,"extend.js":66,hat:67,inherits:68,"is-typedarray":69,once:70,stream:123,"typedarray-to-buffer":71}],63:[function(e,t){t.exports=e(25)},{"./debug":64,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":25}],64:[function(e,t){t.exports=e(26)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":26,ms:65}],65:[function(e,t){t.exports=e(27)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":27}],66:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],67:[function(e,t){t.exports=e(34)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/hat/index.js":34}],68:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],69:[function(e,t){function n(e){return r(e)||i(e)}function r(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function i(e){return s[o.call(e)]}t.exports=n,n.strict=r,n.loose=i;var o=Object.prototype.toString,s={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},{}],70:[function(e,t){t.exports=e(21)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/once/once.js":21}],71:[function(e,t){t.exports=e(14)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/typedarray-to-buffer/index.js":14,buffer:103}],72:[function(e,t){function n(e,t){return this instanceof n?(r.call(this),t||(t={}),this._url=e,this._reconnect=void 0!==t.reconnect?t.reconnect:s,void this._init()):new n(e,t)}t.exports=n;var r=e("events").EventEmitter,i=e("inherits"),o=e("once"),s=5e3;i(n,r),n.prototype.send=function(e){this._ws&&this._ws.readyState===WebSocket.OPEN&&("object"==typeof e&&(e=JSON.stringify(e)),this._ws.send(e))},n.prototype.destroy=function(e){e&&this.once("close",e);try{this._ws.close()}catch(t){this._onclose()}},n.prototype._init=function(){this._errored=!1,this._ws=new WebSocket(this._url),this._ws.onopen=this._onopen.bind(this),this._ws.onmessage=this._onmessage.bind(this),this._ws.onclose=this._onclose.bind(this),this._ws.onerror=o(this._onerror.bind(this))},n.prototype._onopen=function(){this.emit("ready")},n.prototype._onerror=function(e){this._errored=!0,this.destroy(),this._reconnect?(this._timeout=setTimeout(this._init.bind(this),this._reconnect),this.emit("warning",e)):this.emit("error",e)},n.prototype._onmessage=function(e){var t=e.data;try{t=JSON.parse(e.data)}catch(n){}this.emit("message",t)},n.prototype._onclose=function(){clearTimeout(this._timeout),this._ws&&(this._ws.onopen=null,this._ws.onerror=null,this._ws.onmessage=null,this._ws.onclose=null),this._ws=null,this._errored||this.emit("close")}},{events:107,inherits:73,once:74}],73:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],74:[function(e,t){t.exports=e(21)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/once/once.js":21}],75:[function(e,t){(function(n){var r=e("bencode"),i=e("bitfield"),o=e("events").EventEmitter,s=e("inherits"),a=e("git-sha1"),c=1e7,u=1e3,f=16384;t.exports=function(e){function t(t){o.call(this),this._wire=t,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._fetching=!1,this._bitfield=new i(0,{grow:u}),n.isBuffer(e)&&this.setMetadata(e)}return s(t,o),t.prototype.name="ut_metadata",t.prototype.onHandshake=function(e){this._infoHash=e,this._infoHashHex=e.toString("hex")},t.prototype.onExtendedHandshake=function(e){return e.m&&e.m.ut_metadata?e.metadata_size?e.metadata_size>c?this.emit("warning",new Error("Peer gave maliciously large metadata size")):(this._metadataSize=e.metadata_size,this._numPieces=Math.ceil(this._metadataSize/f),this._remainingRejects=2*this._numPieces,void(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"))},t.prototype.onMessage=function(e){var t,n;try{var i=e.toString(),o=i.indexOf("ee")+2;t=r.decode(i.substring(0,o)),n=e.slice(o)}catch(s){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)}},t.prototype.fetch=function(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())},t.prototype.cancel=function(){this._fetching=!1},t.prototype.setMetadata=function(e){if(this._metadataComplete)return!0;try{var t=r.decode(e).info;t&&(e=r.encode(t))}catch(n){}return this._infoHashHex&&this._infoHashHex!==a(e)?!1:(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",r.encode({info:r.decode(this.metadata)})),!0)},t.prototype._send=function(e,t){var i=r.encode(e);n.isBuffer(t)&&(i=n.concat([i,t])),this._wire.extended("ut_metadata",i)},t.prototype._request=function(e){this._send({msg_type:0,piece:e})},t.prototype._data=function(e,t,n){var r={msg_type:1,piece:e};"number"==typeof n&&(r.total_size=n),this._send(r,t)},t.prototype._reject=function(e){this._send({msg_type:2,piece:e})},t.prototype._onRequest=function(e){if(!this._metadataComplete)return void this._reject(e);var t=e*f,n=t+f;n>this._metadataSize&&(n=this._metadataSize);var r=this.metadata.slice(t,n);this._data(e,r,this._metadataSize)},t.prototype._onData=function(e,t){t.length>f||(t.copy(this.metadata,e*f),this._bitfield.set(e),this._checkDone())},t.prototype._onReject=function(e){this._remainingRejects>0&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error('Peer sent "reject" too much'))},t.prototype._requestPieces=function(){this.metadata=new n(this._metadataSize);for(var e=0;e<this._numPieces;e++)this._request(e)},t.prototype._checkDone=function(){for(var e=!0,t=0;t<this._numPieces;t++)if(!this._bitfield.get(t)){e=!1;break}if(e){var n=this.setMetadata(this.metadata);n||this._failedMetadata()}},t.prototype._failedMetadata=function(){this._bitfield=new i(0,{grow:u}),this._remainingRejects-=this._numPieces,this._remainingRejects>0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))},t}}).call(this,e("buffer").Buffer)},{bencode:76,bitfield:79,buffer:103,events:107,"git-sha1":80,inherits:81}],76:[function(e,t){t.exports=e(9)},{"./lib/decode":77,"./lib/encode":78,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/bencode.js":9}],77:[function(e,t){t.exports=e(10)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/decode.js":10,buffer:103}],78:[function(e,t){t.exports=e(11)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/encode.js":11,buffer:103}],79:[function(e,t){t.exports=e(6)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/bitfield/index.js":6,buffer:103}],80:[function(e,t){t.exports=e(17)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/git-sha1/git-sha1.js":17,_process:110}],81:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],82:[function(e,t){(function(n){function r(e,t,n){this.swarm=e,this.stream=t,this.id=n;var r=this.wire=new f;this.timeout=null,this.handshaked=!1,this.paused=!0;var i=c(function(){this.handshaked&&this.swarm.wires.splice(this.swarm.wires.indexOf(this.wire),1),this.destroy(),this.swarm._drain(),this.swarm._peers[this.id]=null}.bind(this));t.once("end",i),t.once("error",i),t.once("close",i),t.once("finish",i),r.once("end",i),r.once("close",i),r.once("error",i),r.once("finish",i),r.on("handshake",this._onHandshake.bind(this)),t.pipe(r).pipe(t)}function i(e,t,r){return this instanceof i?(s.call(this),r||(r={}),this.infoHash="string"==typeof e?new n(e,"hex"):e,this.infoHashHex=this.infoHash.toString("hex"),this.peerId="string"==typeof t?new n(t,"utf8"):t,this.peerIdHex=this.peerId.toString("hex"),o("new swarm i %s p %s",this.infoHashHex,this.peerIdHex),this.handshake=r.handshake,this.maxPeers=r.maxPeers||d,this.downloaded=0,this.uploaded=0,this.downloadSpeed=u(),this.uploadSpeed=u(),this.wires=[],this._queue=[],this._peers={},this.paused=!1,void(this.destroyed=!1)):new i(e,t,r)}t.exports=i;var o=e("debug")("webtorrent-swarm"),s=e("events").EventEmitter,a=e("inherits"),c=e("once"),u=e("speedometer"),f=e("bittorrent-protocol"),d=30,h=25e3;r.prototype.destroy=function(){o("peer destroy"),this.stream&&this.stream.destroy(),this.wire&&this.wire.destroy(),this.timeout&&clearTimeout(this.timeout),this.stream=null,this.wire=null,this.timeout=null},r.prototype.handshake=function(){this.paused=!1,this.wire.handshake(this.swarm.infoHash,this.swarm.peerId,this.swarm.handshake),o("sent handshake i %s p %s",this.swarm.infoHashHex,this.swarm.peerIdHex),this.handshaked||(this.timeout=setTimeout(function(){this.destroy()}.bind(this),h))},r.prototype._onHandshake=function(e){var t=e.toString("hex");return o("got handshake %s",t),this.swarm.destroyed||t!==this.swarm.infoHashHex?this.destroy():(this.handshaked=!0,clearTimeout(this.timeout),this.wire.on("download",function(e){this.swarm.downloaded+=e,this.swarm.downloadSpeed(e),this.swarm.emit("download",e)}.bind(this)),this.wire.on("upload",function(e){this.swarm.uploaded+=e,this.swarm.uploadSpeed(e),this.swarm.emit("upload",e)}.bind(this)),this.swarm.wires.push(this.wire),void this.swarm.emit("wire",this.wire))},a(i,s),Object.defineProperty(i.prototype,"ratio",{get:function(){return 0===this.downloaded?0:this.uploaded/this.downloaded}}),Object.defineProperty(i.prototype,"numQueued",{get:function(){return this._queue.length}}),Object.defineProperty(i.prototype,"numPeers",{get:function(){return this.wires.length}}),i.prototype.addPeer=function(e){if(!this.destroyed&&!this._peers[e.id]){var t=new r(this,e.getDataStream(),e.id);this._peers[e.id]=t,this._queue.push(t),this._drain()}},i.prototype.pause=function(){o("pause"),this.paused=!0},i.prototype.resume=function(){o("resume"),this.paused=!1,this._drain()},i.prototype.removePeer=function(e){o("removePeer %s",e),this._removePeer(e),this._drain()},i.prototype._removePeer=function(e){o("_removePeer %s",e),e.destroy()},i.prototype.destroy=function(e){if(!this.destroyed){this.destroyed=!0,e&&this.once("close",e),o("destroy");for(var t in this._peers)this._removePeer(t);this.emit("close")}},i.prototype._drain=function(){if(!(this.paused||this.destroyed||this.numPeers>=this.maxPeers)){o("drain %s queued %s peers %s max",this.numQueued,this.numPeers,this.maxPeers);var e=this._queue.shift();e&&e.handshake()}}}).call(this,e("buffer").Buffer)},{"bittorrent-protocol":83,buffer:103,debug:94,events:107,inherits:97,once:98,speedometer:99}],83:[function(e,t){(function(n){function r(e,t,n,r){this.piece=e,this.offset=t,this.length=n,this.callback=r}function i(){return this instanceof i?(l.Duplex.call(this),u("new wire"),this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new a(0,{grow:p}),this.peerExtensions={},this.requests=[],this.peerRequests=[],this.extendedMapping={},this.peerExtendedMapping={},this.extendedHandshake={},this.peerExtendedHandshake={},this._ext={},this._nextExt=1,this.uploaded=0,this.downloaded=0,this.uploadSpeed=h(),this.downloadSpeed=h(),this._keepAlive=null,this._timeout=null,this._timeoutMs=0,this.destroyed=!1,this._finished=!1,this._buffer=[],this._bufferSize=0,this._parser=null,this._parserSize=0,this.on("finish",this._onfinish),void this._parseHandshake()):new i}function o(e,t,n,r){for(var i=0;i<e.length;i++){var o=e[i];if(o.piece===t&&o.offset===n&&o.length===r)return 0===i?e.shift():e.splice(i,1),o}return null}function s(e){try{return c.decode(e)}catch(t){console.warn(t)}}t.exports=i;var a=e("bitfield"),c=e("bencode"),u=e("debug")("bittorrent-protocol"),f=e("extend.js"),d=e("inherits"),h=e("speedometer"),l=e("stream"),p=4e5,m=new n("BitTorrent protocol"),g=new n([0,0,0,0]),_=new n([0,0,0,1,0]),b=new n([0,0,0,1,1]),v=new n([0,0,0,1,2]),y=new n([0,0,0,1,3]),w=[0,0,0,0,0,0,0,0],x=[0,0,0,3,9,0,0];d(i,l.Duplex),i.prototype.setKeepAlive=function(e){clearInterval(this._keepAlive),e!==!1&&(this._keepAlive=setInterval(this._push.bind(this,g),6e4))},i.prototype.setTimeout=function(e){this._clearTimeout(),this._timeoutMs=e,this._updateTimeout()},i.prototype.destroy=function(){this.destroyed=!0,this.end()},i.prototype.end=function(){this._onUninterested(),this._onChoke(),l.Duplex.prototype.end.apply(this,arguments)},i.prototype.use=function(e){function t(){}var n=e.name||e.prototype.name;if(!n)throw new Error("Extension API requires a named function, e.g. function name() {}");var r=this._nextExt,i=new e(this);"function"!=typeof i.onHandshake&&(i.onHandshake=t),"function"!=typeof i.onExtendedHandshake&&(i.onExtendedHandshake=t),"function"!=typeof i.onMessage&&(i.onMessage=t),this.extendedMapping[r]=n,this._ext[n]=i,this[n]=i,this._nextExt+=1},i.prototype.handshake=function(e,t,r){if("string"==typeof e&&(e=new n(e,"hex")),"string"==typeof t&&(t=new n(t,"hex")),20!==e.length||20!==t.length)throw new Error("infoHash and peerId MUST have length 20");var i=new n(w);i[5]|=16,r&&r.dht&&(i[7]|=1),this._push(n.concat([m,i,e,t]))},i.prototype.choke=function(){if(!this.amChoking){for(this.amChoking=!0;this.peerRequests.length;)this.peerRequests.pop();this._push(_)}},i.prototype.unchoke=function(){this.amChoking&&(this.amChoking=!1,this._push(b))},i.prototype.interested=function(){this.amInterested||(this.amInterested=!0,this._push(v))},i.prototype.uninterested=function(){this.amInterested&&(this.amInterested=!1,this._push(y))},i.prototype.have=function(e){this._message(4,[e],null)},i.prototype.bitfield=function(e){n.isBuffer(e)||(e=e.buffer),this._message(5,[],e)},i.prototype.request=function(e,t,n,i){return i||(i=function(){}),this._finished?i(new Error("wire is closed")):this.peerChoking?i(new Error("peer is choking")):(this.requests.push(new r(e,t,n,i)),this._updateTimeout(),void this._message(6,[e,t,n],null))},i.prototype.piece=function(e,t,n){this.uploaded+=n.length,this.uploadSpeed(n.length),this.emit("upload",n.length),this._message(7,[e,t],n)},i.prototype.cancel=function(e,t,n){this._callback(o(this.requests,e,t,n),new Error("request was cancelled"),null),this._message(8,[e,t,n],null)},i.prototype.port=function(e){var t=new n(x);t.writeUInt16BE(e,5),this._push(t)},i.prototype.extended=function(e,t){if("string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"==typeof e){var r=new n([e]),i=n.isBuffer(t)?t:c.encode(t);this._message(20,[],n.concat([r,i]))}else console.warn("Skipping extension",e)},i.prototype._onKeepAlive=function(){this.emit("keep-alive")},i.prototype._onHandshake=function(e,t,n){this.peerId=t,this.peerExtensions=n,this.emit("handshake",e,t,n);var r;for(r in this._ext)this._ext[r].onHandshake(e,t,n);if(n.extended){var i=f({},this.extendedHandshake);i.m={};for(var o in this.extendedMapping)r=this.extendedMapping[o],i.m[r]=Number(o);this.extended(0,c.encode(i))}},i.prototype._onChoke=function(){for(this.peerChoking=!0,this.emit("choke");this.requests.length;)this._callback(this.requests.shift(),new Error("peer is choking"),null)},i.prototype._onUnchoke=function(){this.peerChoking=!1,this.emit("unchoke")},i.prototype._onInterested=function(){this.peerInterested=!0,this.emit("interested")},i.prototype._onUninterested=function(){this.peerInterested=!1,this.emit("uninterested")},i.prototype._onHave=function(e){this.peerPieces.get(e)||(this.peerPieces.set(e,!0),this.emit("have",e))},i.prototype._onBitField=function(e){this.peerPieces=new a(e),this.emit("bitfield",this.peerPieces)},i.prototype._onRequest=function(e,t,n){if(!this.amChoking){var i=function(r,i){s===o(this.peerRequests,e,t,n)&&(r||this.piece(e,t,i))}.bind(this),s=new r(e,t,n,i);this.peerRequests.push(s),this.emit("request",e,t,n,i)}},i.prototype._onPiece=function(e,t,n){this._callback(o(this.requests,e,t,n.length),null,n),this.downloaded+=n.length,this.downloadSpeed(n.length),this.emit("download",n.length),this.emit("piece",e,t,n)},i.prototype._onCancel=function(e,t,n){o(this.peerRequests,e,t,n),this.emit("cancel",e,t,n)},i.prototype._onPort=function(e){this.emit("port",e)},i.prototype._onExtended=function(e,t){var n,r;if(0===e&&(n=s(t))){if(this.peerExtendedHandshake=n,"object"==typeof n.m)for(r in n.m)this.peerExtendedMapping[r]=Number(n.m[r].toString());for(r in this._ext)this.peerExtendedMapping[r]&&this._ext[r].onExtendedHandshake(this.peerExtendedHandshake);this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this.emit("extended",e,t)},i.prototype._onTimeout=function(){this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")},i.prototype._push=function(e){return this._finished?void 0:this.push(e)},i.prototype._write=function(e,t,r){for(this._bufferSize+=e.length,this._buffer.push(e);this._bufferSize>=this._parserSize;){var i=1===this._buffer.length?this._buffer[0]:n.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[i.slice(this._parserSize)]:[],this._parser(i.slice(0,this._parserSize))}r(null)},i.prototype._read=function(){},i.prototype._callback=function(e,t,n){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,n))},i.prototype._clearTimeout=function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)},i.prototype._updateTimeout=function(){this._timeoutMs&&this.requests.length&&!this._timeout&&(this._timeout=setTimeout(this._onTimeout.bind(this),this._timeoutMs))},i.prototype._parse=function(e,t){this._parserSize=e,this._parser=t},i.prototype._message=function(e,t,r){var i=r?r.length:0,o=new n(5+4*t.length);o.writeUInt32BE(o.length+i-4,0),o[4]=e;for(var s=0;s<t.length;s++)o.writeUInt32BE(t[s],5+4*s);this._push(o),r&&this._push(r)},i.prototype._onmessagelength=function(e){var t=e.readUInt32BE(0);t>0?this._parse(t,this._onmessage):(this._onKeepAlive(),this._parse(4,this._onmessagelength))},i.prototype._onmessage=function(e){switch(this._parse(4,this._onmessagelength),e[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.readUInt32BE(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 7:return this._onPiece(e.readUInt32BE(1),e.readUInt32BE(5),e.slice(9));case 8:return this._onCancel(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 9:return this._onPort(e.readUInt16BE(1));case 20:return this._onExtended(e.readUInt8(1),e.slice(2))}this.emit("unknownmessage",e)},i.prototype._parseHandshake=function(){this._parse(1,function(e){var t=e.readUInt8(0);this._parse(t+48,function(e){var n=e.slice(0,t);return"BitTorrent protocol"!==n.toString()?(u("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void this.end()):(e=e.slice(t),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),extended:!!(16&e[5])}),void this._parse(4,this._onmessagelength))}.bind(this))}.bind(this))},i.prototype._onfinish=function(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAlive),this._parse(Number.MAX_VALUE,function(){}),this.peerRequests=[];this.requests.length;)this._callback(this.requests.shift(),new Error("wire was closed"),null)}}).call(this,e("buffer").Buffer)},{bencode:84,bitfield:87,buffer:103,debug:88,"extend.js":91,inherits:92,speedometer:93,stream:123}],84:[function(e,t){t.exports=e(9)},{"./lib/decode":85,"./lib/encode":86,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/bencode.js":9}],85:[function(e,t){t.exports=e(10)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/decode.js":10,buffer:103}],86:[function(e,t){t.exports=e(11)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/bencode/lib/encode.js":11,buffer:103}],87:[function(e,t){t.exports=e(6)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/bitfield/index.js":6,buffer:103}],88:[function(e,t){t.exports=e(25)},{"./debug":89,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":25}],89:[function(e,t){t.exports=e(26)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":26,ms:90}],90:[function(e,t){t.exports=e(27)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":27}],91:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],92:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],93:[function(e,t){t.exports=e(47)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/speedometer/index.js":47}],94:[function(e,t){t.exports=e(25)},{"./debug":95,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":25}],95:[function(e,t){t.exports=e(26)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":26,ms:96}],96:[function(e,t){t.exports=e(27)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":27}],97:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],98:[function(e,t){t.exports=e(21)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/once/once.js":21}],99:[function(e,t){t.exports=e(47)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/speedometer/index.js":47}],100:[function(){},{}],101:[function(e,t){function n(e,t){return h.isUndefined(t)?""+t:!h.isNumber(t)||!isNaN(t)&&isFinite(t)?h.isFunction(t)||h.isRegExp(t)?t.toString():t:t.toString()}function r(e,t){return h.isString(e)?e.length<t?e:e.slice(0,t):e}function i(e){return r(JSON.stringify(e.actual,n),128)+" "+e.operator+" "+r(JSON.stringify(e.expected,n),128)}function o(e,t,n,r,i){throw new m.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:i})}function s(e,t){e||o(e,!0,t,"==",m.ok)}function a(e,t){if(e===t)return!0;if(h.isBuffer(e)&&h.isBuffer(t)){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return h.isDate(e)&&h.isDate(t)?e.getTime()===t.getTime():h.isRegExp(e)&&h.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:h.isObject(e)||h.isObject(t)?u(e,t):e==t}function c(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function u(e,t){if(h.isNullOrUndefined(e)||h.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(c(e))return c(t)?(e=l.call(e),t=l.call(t),a(e,t)):!1;try{var n,r,i=g(e),o=g(t)}catch(s){return!1}if(i.length!=o.length)return!1;for(i.sort(),o.sort(),r=i.length-1;r>=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(n=i[r],!a(e[n],t[n]))return!1;return!0}function f(e,t){return e&&t?"[object RegExp]"==Object.prototype.toString.call(t)?t.test(e):e instanceof t?!0:t.call({},e)===!0?!0:!1:!1}function d(e,t,n,r){var i;h.isString(n)&&(r=n,n=null);try{t()}catch(s){i=s}if(r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&o(i,n,"Missing expected exception"+r),!e&&f(i,n)&&o(i,n,"Got unwanted exception"+r),e&&i&&n&&!f(i,n)||!e&&i)throw i}var h=e("util/"),l=Array.prototype.slice,p=Object.prototype.hasOwnProperty,m=t.exports=s;m.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=i(this),this.generatedMessage=!0);var t=e.stackStartFunction||o;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,s=t.name,a=r.indexOf("\n"+s);if(a>=0){var c=r.indexOf("\n",a+1);r=r.substring(c+1)}this.stack=r}}},h.inherits(m.AssertionError,Error),m.fail=o,m.ok=s,m.equal=function(e,t,n){e!=t&&o(e,t,n,"==",m.equal)},m.notEqual=function(e,t,n){e==t&&o(e,t,n,"!=",m.notEqual)},m.deepEqual=function(e,t,n){a(e,t)||o(e,t,n,"deepEqual",m.deepEqual)},m.notDeepEqual=function(e,t,n){a(e,t)&&o(e,t,n,"notDeepEqual",m.notDeepEqual)},m.strictEqual=function(e,t,n){e!==t&&o(e,t,n,"===",m.strictEqual)},m.notStrictEqual=function(e,t,n){e===t&&o(e,t,n,"!==",m.notStrictEqual)},m.throws=function(){d.apply(this,[!0].concat(l.call(arguments)))},m.doesNotThrow=function(){d.apply(this,[!1].concat(l.call(arguments)))},m.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var n in e)p.call(e,n)&&t.push(n);return t}},{"util/":125}],102:[function(e,t){t.exports=e(100)},{"/Users/feross/code/webtorrent/node_modules/browserify/lib/_empty.js":100}],103:[function(e,t,n){function r(e,t,n){if(!(this instanceof r))return new r(e,t,n);var i,o=typeof e;if("number"===o)i=e>0?e>>>0:0;else if("string"===o)"base64"===t&&(e=k(e)),i=r.byteLength(e,t);else{if("object"!==o||null===e)throw new TypeError("must start with number, buffer, array or string");"Buffer"===e.type&&M(e.data)&&(e=e.data),i=+e.length>0?Math.floor(+e.length):0}if(this.length>C)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+C.toString(16)+" bytes");var s;r.TYPED_ARRAY_SUPPORT?s=r._augment(new Uint8Array(i)):(s=this,s.length=i,s._isBuffer=!0);var a;if(r.TYPED_ARRAY_SUPPORT&&"number"==typeof e.byteLength)s._set(e);else if(S(e))if(r.isBuffer(e))for(a=0;i>a;a++)s[a]=e.readUInt8(a);else for(a=0;i>a;a++)s[a]=(e[a]%256+256)%256;else if("string"===o)s.write(e,0,t);else if("number"===o&&!r.TYPED_ARRAY_SUPPORT&&!n)for(a=0;i>a;a++)s[a]=0;return s}function i(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new Error("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;r>s;s++){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))throw new Error("Invalid hex string");e[n+s]=a}return s}function o(e,t,n,r){var i=B(I(t),e,n,r);return i}function s(e,t,n,r){var i=B(L(t),e,n,r);return i}function a(e,t,n,r){return s(e,t,n,r)}function c(e,t,n,r){var i=B(A(t),e,n,r);return i}function u(e,t,n,r){var i=B(T(t),e,n,r);return i}function f(e,t,n){return R.fromByteArray(0===t&&n===e.length?e:e.slice(t,n))}function d(e,t,n){var r="",i="";n=Math.min(e.length,n);for(var o=t;n>o;o++)e[o]<=127?(r+=U(i)+String.fromCharCode(e[o]),i=""):i+="%"+e[o].toString(16);return r+U(i)}function h(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;n>i;i++)r+=String.fromCharCode(e[i]);return r}function l(e,t,n){return h(e,t,n)}function p(e,t,n){var r=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var i="",o=t;n>o;o++)i+=j(e[o]);return i}function m(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function g(e,t,n){if(e%1!==0||0>e)throw new RangeError("offset is not uint");
+if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function _(e,t,n,i,o,s){if(!r.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>o||s>t)throw new TypeError("value is out of bounds");if(n+i>e.length)throw new TypeError("index out of range")}function b(e,t,n,r){0>t&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);o>i;i++)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function v(e,t,n,r){0>t&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);o>i;i++)e[n+i]=t>>>8*(r?i:3-i)&255}function y(e,t,n,r,i,o){if(t>i||o>t)throw new TypeError("value is out of bounds");if(n+r>e.length)throw new TypeError("index out of range")}function w(e,t,n,r,i){return i||y(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),P.write(e,t,n,r,23,4),n+4}function x(e,t,n,r,i){return i||y(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),P.write(e,t,n,r,52,8),n+8}function k(e){for(e=E(e).replace(D,"");e.length%4!==0;)e+="=";return e}function E(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function S(e){return M(e)||r.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function j(e){return 16>e?"0"+e.toString(16):e.toString(16)}function I(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(127>=r)t.push(r);else{var i=n;r>=55296&&57343>=r&&n++;for(var o=encodeURIComponent(e.slice(i,n+1)).substr(1).split("%"),s=0;s<o.length;s++)t.push(parseInt(o[s],16))}}return t}function L(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}function T(e){for(var t,n,r,i=[],o=0;o<e.length;o++)t=e.charCodeAt(o),n=t>>8,r=t%256,i.push(r),i.push(n);return i}function A(e){return R.toByteArray(e)}function B(e,t,n,r){for(var i=0;r>i&&!(i+n>=t.length||i>=e.length);i++)t[i+n]=e[i];return i}function U(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}var R=e("base64-js"),P=e("ieee754"),M=e("is-array");n.Buffer=r,n.SlowBuffer=r,n.INSPECT_MAX_BYTES=50,r.poolSize=8192;var C=1073741823;r.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(n){return!1}}(),r.isBuffer=function(e){return!(null==e||!e._isBuffer)},r.compare=function(e,t){if(!r.isBuffer(e)||!r.isBuffer(t))throw new TypeError("Arguments must be Buffers");for(var n=e.length,i=t.length,o=0,s=Math.min(n,i);s>o&&e[o]===t[o];o++);return o!==s&&(n=e[o],i=t[o]),i>n?-1:n>i?1:0},r.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.concat=function(e,t){if(!M(e))throw new TypeError("Usage: Buffer.concat(list[, length])");if(0===e.length)return new r(0);if(1===e.length)return e[0];var n;if(void 0===t)for(t=0,n=0;n<e.length;n++)t+=e[n].length;var i=new r(t),o=0;for(n=0;n<e.length;n++){var s=e[n];s.copy(i,o),o+=s.length}return i},r.byteLength=function(e,t){var n;switch(e+="",t||"utf8"){case"ascii":case"binary":case"raw":n=e.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;case"hex":n=e.length>>>1;break;case"utf8":case"utf-8":n=I(e).length;break;case"base64":n=A(e).length;break;default:n=e.length}return n},r.prototype.length=void 0,r.prototype.parent=void 0,r.prototype.toString=function(e,t,n){var r=!1;if(t>>>=0,n=void 0===n||1/0===n?this.length:n>>>0,e||(e="utf8"),0>t&&(t=0),n>this.length&&(n=this.length),t>=n)return"";for(;;)switch(e){case"hex":return p(this,t,n);case"utf8":case"utf-8":return d(this,t,n);case"ascii":return h(this,t,n);case"binary":return l(this,t,n);case"base64":return f(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}},r.prototype.equals=function(e){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");return 0===r.compare(this,e)},r.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},r.prototype.compare=function(e){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");return r.compare(this,e)},r.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},r.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},r.prototype.write=function(e,t,n,r){if(isFinite(t))isFinite(n)||(r=n,n=void 0);else{var f=r;r=t,t=n,n=f}t=Number(t)||0;var d=this.length-t;n?(n=Number(n),n>d&&(n=d)):n=d,r=String(r||"utf8").toLowerCase();var h;switch(r){case"hex":h=i(this,e,t,n);break;case"utf8":case"utf-8":h=o(this,e,t,n);break;case"ascii":h=s(this,e,t,n);break;case"binary":h=a(this,e,t,n);break;case"base64":h=c(this,e,t,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":h=u(this,e,t,n);break;default:throw new TypeError("Unknown encoding: "+r)}return h},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},r.prototype.slice=function(e,t){var n=this.length;if(e=~~e,t=void 0===t?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),e>t&&(t=e),r.TYPED_ARRAY_SUPPORT)return r._augment(this.subarray(e,t));for(var i=t-e,o=new r(i,void 0,!0),s=0;i>s;s++)o[s]=this[s+e];return o},r.prototype.readUInt8=function(e,t){return t||g(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||g(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||g(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||g(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUInt32BE=function(e,t){return t||g(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readInt8=function(e,t){return t||g(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||g(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt16BE=function(e,t){t||g(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt32LE=function(e,t){return t||g(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return t||g(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readFloatLE=function(e,t){return t||g(e,4,this.length),P.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||g(e,4,this.length),P.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||g(e,8,this.length),P.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||g(e,8,this.length),P.read(this,e,!1,52,8)},r.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||_(this,e,t,1,255,0),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e,t+1},r.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||_(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8):b(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||_(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e):b(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||_(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e):v(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||_(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e):v(this,e,t,!1),t+4},r.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||_(this,e,t,1,127,-128),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=e,t+1},r.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||_(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8):b(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||_(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e):b(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||_(this,e,t,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):v(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||_(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e):v(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,n){return w(this,e,t,!0,n)},r.prototype.writeFloatBE=function(e,t,n){return w(this,e,t,!1,n)},r.prototype.writeDoubleLE=function(e,t,n){return x(this,e,t,!0,n)},r.prototype.writeDoubleBE=function(e,t,n){return x(this,e,t,!1,n)},r.prototype.copy=function(e,t,n,i){var o=this;if(n||(n=0),i||0===i||(i=this.length),t||(t=0),i!==n&&0!==e.length&&0!==o.length){if(n>i)throw new TypeError("sourceEnd < sourceStart");if(0>t||t>=e.length)throw new TypeError("targetStart out of bounds");if(0>n||n>=o.length)throw new TypeError("sourceStart out of bounds");if(0>i||i>o.length)throw new TypeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var s=i-n;if(100>s||!r.TYPED_ARRAY_SUPPORT)for(var a=0;s>a;a++)e[a+t]=this[a+n];else e._set(this.subarray(n,n+s),t)}},r.prototype.fill=function(e,t,n){if(e||(e=0),t||(t=0),n||(n=this.length),t>n)throw new TypeError("end < start");if(n!==t&&0!==this.length){if(0>t||t>=this.length)throw new TypeError("start out of bounds");if(0>n||n>this.length)throw new TypeError("end out of bounds");var r;if("number"==typeof e)for(r=t;n>r;r++)this[r]=e;else{var i=I(e.toString()),o=i.length;for(r=t;n>r;r++)this[r]=i[r%o]}return this}},r.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(r.TYPED_ARRAY_SUPPORT)return new r(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;n>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var O=r.prototype;r._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=O.get,e.set=O.set,e.write=O.write,e.toString=O.toString,e.toLocaleString=O.toString,e.toJSON=O.toJSON,e.equals=O.equals,e.compare=O.compare,e.copy=O.copy,e.slice=O.slice,e.readUInt8=O.readUInt8,e.readUInt16LE=O.readUInt16LE,e.readUInt16BE=O.readUInt16BE,e.readUInt32LE=O.readUInt32LE,e.readUInt32BE=O.readUInt32BE,e.readInt8=O.readInt8,e.readInt16LE=O.readInt16LE,e.readInt16BE=O.readInt16BE,e.readInt32LE=O.readInt32LE,e.readInt32BE=O.readInt32BE,e.readFloatLE=O.readFloatLE,e.readFloatBE=O.readFloatBE,e.readDoubleLE=O.readDoubleLE,e.readDoubleBE=O.readDoubleBE,e.writeUInt8=O.writeUInt8,e.writeUInt16LE=O.writeUInt16LE,e.writeUInt16BE=O.writeUInt16BE,e.writeUInt32LE=O.writeUInt32LE,e.writeUInt32BE=O.writeUInt32BE,e.writeInt8=O.writeInt8,e.writeInt16LE=O.writeInt16LE,e.writeInt16BE=O.writeInt16BE,e.writeInt32LE=O.writeInt32LE,e.writeInt32BE=O.writeInt32BE,e.writeFloatLE=O.writeFloatLE,e.writeFloatBE=O.writeFloatBE,e.writeDoubleLE=O.writeDoubleLE,e.writeDoubleBE=O.writeDoubleBE,e.fill=O.fill,e.inspect=O.inspect,e.toArrayBuffer=O.toArrayBuffer,e};var D=/[^+\/0-9A-z]/g},{"base64-js":104,ieee754:105,"is-array":106}],104:[function(e,t,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===s?62:t===a?63:c>t?-1:c+10>t?t-c+26+26:f+26>t?t-f:u+26>t?t-u+26:void 0}function n(e){function n(e){u[d++]=e}var r,i,s,a,c,u;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=e.length;c="="===e.charAt(f-2)?2:"="===e.charAt(f-1)?1:0,u=new o(3*e.length/4-c),s=c>0?e.length-4:e.length;var d=0;for(r=0,i=0;s>r;r+=4,i+=3)a=t(e.charAt(r))<<18|t(e.charAt(r+1))<<12|t(e.charAt(r+2))<<6|t(e.charAt(r+3)),n((16711680&a)>>16),n((65280&a)>>8),n(255&a);return 2===c?(a=t(e.charAt(r))<<2|t(e.charAt(r+1))>>4,n(255&a)):1===c&&(a=t(e.charAt(r))<<10|t(e.charAt(r+1))<<4|t(e.charAt(r+2))>>2,n(a>>8&255),n(255&a)),u}function i(e){function t(e){return r.charAt(e)}function n(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var i,o,s,a=e.length%3,c="";for(i=0,s=e.length-a;s>i;i+=3)o=(e[i]<<16)+(e[i+1]<<8)+e[i+2],c+=n(o);switch(a){case 1:o=e[e.length-1],c+=t(o>>2),c+=t(o<<4&63),c+="==";break;case 2:o=(e[e.length-2]<<8)+e[e.length-1],c+=t(o>>10),c+=t(o>>4&63),c+=t(o<<2&63),c+="="}return c}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),a="/".charCodeAt(0),c="0".charCodeAt(0),u="a".charCodeAt(0),f="A".charCodeAt(0);e.toByteArray=n,e.fromByteArray=i}("undefined"==typeof n?this.base64js={}:n)},{}],105:[function(e,t,n){n.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,f=-7,d=n?i-1:0,h=n?-1:1,l=e[t+d];for(d+=h,o=l&(1<<-f)-1,l>>=-f,f+=a;f>0;o=256*o+e[t+d],d+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=256*s+e[t+d],d+=h,f-=8);if(0===o)o=1-u;else{if(o===c)return s?0/0:1/0*(l?-1:1);s+=Math.pow(2,r),o-=u}return(l?-1:1)*s*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var s,a,c,u=8*o-i-1,f=(1<<u)-1,d=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=r?0:o-1,p=r?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),t+=s+d>=1?h/c:h*Math.pow(2,1-d),t*c>=2&&(s++,c/=2),s+d>=f?(a=0,s=f):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+l]=255&a,l+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+l]=255&s,l+=p,s/=256,u-=8);e[n+l-p]|=128*m}},{}],106:[function(e,t){var n=Array.isArray,r=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==r.call(e)}},{}],107:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,a,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],s(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,a=new Array(i-1),c=1;i>c;c++)a[c-1]=arguments[c];n.apply(this,a)}else if(o(n)){for(i=arguments.length,a=new Array(i-1),c=1;i>c;c++)a[c-1]=arguments[c];for(u=n.slice(),i=u.length,c=0;i>c;c++)u[c].apply(this,a)}return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned){var i;i=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(a=s;a-->0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(0>i)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?r(e._events[t])?1:e._events[t].length:0}},{}],108:[function(e,t){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],109:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(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}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(e){return i.exec(e).slice(1)};n.resolve=function(){for(var n="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(n=s+"/"+n,i="/"===s.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),o="/"===s(e,-1);return e=t(r(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(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;n>=0&&""===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 i=r(e.split("/")),o=r(t.split("/")),s=Math.min(i.length,o.length),a=s,c=0;s>c;c++)if(i[c]!==o[c]){a=c;break}for(var u=[],c=a;c<i.length;c++)u.push("..");return u=u.concat(o.slice(a)),u.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=o(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},n.basename=function(e,t){var n=o(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return o(e)[3]};var s="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return 0>t&&(t=e.length+t),e.substr(t,n)}}).call(this,e("_process"))},{_process:110}],110:[function(e,t){function n(){}var r=t.exports={};r.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],111:[function(e,t){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":112}],112:[function(e,t){(function(n){function r(e){return this instanceof r?(c.call(this,e),u.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(e)}function i(){this.allowHalfOpen||this._writableState.ended||n.nextTick(this.end.bind(this))}function o(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}t.exports=r;var s=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},a=e("core-util-is");a.inherits=e("inherits");var c=e("./_stream_readable"),u=e("./_stream_writable");a.inherits(r,c),o(s(u.prototype),function(e){r.prototype[e]||(r.prototype[e]=u.prototype[e])})}).call(this,e("_process"))},{"./_stream_readable":114,"./_stream_writable":116,_process:110,"core-util-is":117,inherits:130}],113:[function(e,t){function n(e){return this instanceof n?void r.call(this,e):new n(e)}t.exports=n;var r=e("./_stream_transform"),i=e("core-util-is");i.inherits=e("inherits"),i.inherits(n,r),n.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":115,"core-util-is":117,inherits:130}],114:[function(e,t){(function(n){function r(t){t=t||{};var n=t.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!t.objectMode,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(L||(L=e("string_decoder/").StringDecoder),this.decoder=new L(t.encoding),this.encoding=t.encoding)}function i(e){return this instanceof i?(this._readableState=new r(e,this),this.readable=!0,void j.call(this)):new i(e)}function o(e,t,n,r,i){var o=u(t,n);if(o)e.emit("error",o);else if(null===n||void 0===n)t.reading=!1,t.ended||f(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else!t.decoder||i||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&d(e),l(e,t);else i||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function a(e){if(e>=T)e=T;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function c(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function u(e,t){var n=null;return E.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function f(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?d(e):y(e)}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){h(e)}):h(e))}function h(e){e.emit("readable")}function l(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function m(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&g(e)}}function g(e){function t(e){var t=e.write(n);!1===t&&r.awaitDrain++}var n,r=e._readableState;for(r.awaitDrain=0;r.pipesCount&&null!==(n=e.read());)if(1===r.pipesCount?t(r.pipes,0,null):w(r.pipes,t),e.emit("data",n),r.awaitDrain>0)return;return 0===r.pipesCount?(r.flowing=!1,void(S.listenerCount(e,"data")>0&&b(e))):void(r.ranOut=!0)}function _(){this._readableState.ranOut&&(this._readableState.ranOut=!1,g(this))}function b(e,t){var r=e._readableState;if(r.flowing)throw new Error("Cannot switch to old mode now.");var i=t||!1,o=!1;e.readable=!0,e.pipe=j.prototype.pipe,e.on=e.addListener=j.prototype.on,e.on("readable",function(){o=!0;for(var t;!i&&null!==(t=e.read());)e.emit("data",t);null===t&&(o=!1,e._readableState.needReadable=!0)}),e.pause=function(){i=!0,this.emit("pause")},e.resume=function(){i=!1,o?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function v(e,t){var n,r=t.buffer,i=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(s)n=r.shift();else if(!e||e>=i)n=o?r.join(""):E.concat(r,i),r.length=0;else if(e<r[0].length){var a=r[0];n=a.slice(0,e),r[0]=a.slice(e)}else if(e===r[0].length)n=r.shift();else{n=o?"":new E(e);for(var c=0,u=0,f=r.length;f>u&&e>c;u++){var a=r[0],d=Math.min(e-c,a.length);o?n+=a.slice(0,d):a.copy(n,c,0,d),d<a.length?r[0]=a.slice(d):r.shift(),c+=d}}return n}function y(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}function x(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}t.exports=i;var k=e("isarray"),E=e("buffer").Buffer;i.ReadableState=r;var S=e("events").EventEmitter;S.listenerCount||(S.listenerCount=function(e,t){return e.listeners(t).length});var j=e("stream"),I=e("core-util-is");I.inherits=e("inherits");var L;I.inherits(i,j),i.prototype.push=function(e,t){var n=this._readableState;return"string"!=typeof e||n.objectMode||(t=t||n.defaultEncoding,t!==n.encoding&&(e=new E(e,t),t="")),o(this,n,e,t,!1)},i.prototype.unshift=function(e){var t=this._readableState;return o(this,t,e,"",!0)},i.prototype.setEncoding=function(t){L||(L=e("string_decoder/").StringDecoder),this._readableState.decoder=new L(t),this._readableState.encoding=t};var T=8388608;i.prototype.read=function(e){var t=this._readableState;t.calledRead=!0;var n,r=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d(this),null;if(e=c(e,t),0===e&&t.ended)return n=null,t.length>0&&t.decoder&&(n=v(e,t),t.length-=n.length),0===t.length&&y(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=c(r,t)),n=e>0?v(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&y(this),n},i.prototype._read=function(){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){e===f&&o()}function i(){e.end()}function o(){e.removeListener("close",a),e.removeListener("finish",c),e.removeListener("drain",p),e.removeListener("error",s),e.removeListener("unpipe",r),f.removeListener("end",i),f.removeListener("end",o),(!e._writableState||e._writableState.needDrain)&&p()}function s(t){u(),e.removeListener("error",s),0===S.listenerCount(e,"error")&&e.emit("error",t)}function a(){e.removeListener("finish",c),u()}function c(){e.removeListener("close",a),u()}function u(){f.unpipe(e)}var f=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1;var h=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,l=h?i:o;d.endEmitted?n.nextTick(l):f.once("end",l),e.on("unpipe",r);var p=m(f);return e.on("drain",p),e._events&&e._events.error?k(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",a),e.once("finish",c),e.emit("pipe",f),d.flowing||(this.on("readable",_),d.flowing=!0,n.nextTick(function(){g(f)})),e},i.prototype.unpipe=function(e){var t=this._readableState;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,this.removeListener("readable",_),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",_),t.flowing=!1;for(var i=0;r>i;i++)n[i].emit("unpipe",this);return this}var i=x(t.pipes,e);return-1===i?this:(t.pipes.splice(i,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},i.prototype.on=function(e,t){var n=j.prototype.on.call(this,e,t);if("data"!==e||this._readableState.flowing||b(this),"readable"===e&&this.readable){var r=this._readableState;r.readableListening||(r.readableListening=!0,r.emittedReadable=!1,r.needReadable=!0,r.reading?r.length&&d(this,r):this.read(0))}return n},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){b(this),this.read(0),this.emit("resume")},i.prototype.pause=function(){b(this,!0),this.emit("pause")},i.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;e.on("end",function(){if(t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(i){if(t.decoder&&(i=t.decoder.write(i)),(!t.objectMode||null!==i&&void 0!==i)&&(t.objectMode||i&&i.length)){var o=r.push(i);o||(n=!0,e.pause())}});for(var i in e)"function"==typeof e[i]&&"undefined"==typeof this[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));var o=["error","close","destroy","pause","resume"];return w(o,function(t){e.on(t,r.emit.bind(r,t))}),r._read=function(){n&&(n=!1,e.resume())},r},i._fromList=v}).call(this,e("_process"))},{_process:110,buffer:103,"core-util-is":117,events:107,inherits:130,isarray:108,stream:123,"string_decoder/":118}],115:[function(e,t){function n(e,t){this.afterTransform=function(e,n){return r(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function r(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!==n&&void 0!==n&&e.push(n),i&&i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}function i(e){if(!(this instanceof i))return new i(e);s.call(this,e);var t=(this._transformState=new n(e,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(e){o(t,e)}):o(t)})}function o(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=(e._readableState,e._transformState);if(n.length)throw new Error("calling transform done when ws.length != 0");if(r.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}t.exports=i;var s=e("./_stream_duplex"),a=e("core-util-is");a.inherits=e("inherits"),a.inherits(i,s),i.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},i.prototype._transform=function(){throw new Error("not implemented")},i.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},i.prototype._read=function(){var e=this._transformState;
+null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0}},{"./_stream_duplex":112,"core-util-is":117,inherits:130}],116:[function(e,t){(function(n){function r(e,t,n){this.chunk=e,this.encoding=t,this.callback=n}function i(e,t){e=e||{};var n=e.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var r=e.decodeStrings===!1;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){l(t,e)},this.writecb=null,this.writelen=0,this.buffer=[],this.errorEmitted=!1}function o(t){var n=e("./_stream_duplex");return this instanceof o||this instanceof n?(this._writableState=new i(t,this),this.writable=!0,void x.call(this)):new o(t)}function s(e,t,r){var i=new Error("write after end");e.emit("error",i),n.nextTick(function(){r(i)})}function a(e,t,r,i){var o=!0;if(!y.isBuffer(r)&&"string"!=typeof r&&null!==r&&void 0!==r&&!t.objectMode){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s),n.nextTick(function(){i(s)}),o=!1}return o}function c(e,t,n){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new y(t,n)),t}function u(e,t,n,i,o){n=c(t,n,i),y.isBuffer(n)&&(i="buffer");var s=t.objectMode?1:n.length;t.length+=s;var a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing?t.buffer.push(new r(n,i,o)):f(e,t,s,n,i,o),a}function f(e,t,n,r,i,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,e._write(r,i,t.onwrite),t.sync=!1}function d(e,t,r,i,o){r?n.nextTick(function(){o(i)}):o(i),e._writableState.errorEmitted=!0,e.emit("error",i)}function h(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function l(e,t){var r=e._writableState,i=r.sync,o=r.writecb;if(h(r),t)d(e,r,i,t,o);else{var s=_(e,r);s||r.bufferProcessing||!r.buffer.length||g(e,r),i?n.nextTick(function(){p(e,r,s,o)}):p(e,r,s,o)}}function p(e,t,n,r){n||m(e,t),r(),n&&b(e,t)}function m(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function g(e,t){t.bufferProcessing=!0;for(var n=0;n<t.buffer.length;n++){var r=t.buffer[n],i=r.chunk,o=r.encoding,s=r.callback,a=t.objectMode?1:i.length;if(f(e,t,a,i,o,s),t.writing){n++;break}}t.bufferProcessing=!1,n<t.buffer.length?t.buffer=t.buffer.slice(n):t.buffer.length=0}function _(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function b(e,t){var n=_(e,t);return n&&(t.finished=!0,e.emit("finish")),n}function v(e,t,r){t.ending=!0,b(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0}t.exports=o;var y=e("buffer").Buffer;o.WritableState=i;var w=e("core-util-is");w.inherits=e("inherits");var x=e("stream");w.inherits(o,x),o.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},o.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),y.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=function(){}),r.ended?s(this,r,n):a(this,r,e,n)&&(i=u(this,r,e,t,n)),i},o.prototype._write=function(e,t,n){n(new Error("not implemented"))},o.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),"undefined"!=typeof e&&null!==e&&this.write(e,t),r.ending||r.finished||v(this,r,n)}}).call(this,e("_process"))},{"./_stream_duplex":112,_process:110,buffer:103,"core-util-is":117,inherits:130,stream:123}],117:[function(e,t,n){(function(e){function t(e){return Array.isArray(e)}function r(e){return"boolean"==typeof e}function i(e){return null===e}function o(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function c(e){return"symbol"==typeof e}function u(e){return void 0===e}function f(e){return d(e)&&"[object RegExp]"===_(e)}function d(e){return"object"==typeof e&&null!==e}function h(e){return d(e)&&"[object Date]"===_(e)}function l(e){return d(e)&&("[object Error]"===_(e)||e instanceof Error)}function p(e){return"function"==typeof e}function m(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function g(t){return e.isBuffer(t)}function _(e){return Object.prototype.toString.call(e)}n.isArray=t,n.isBoolean=r,n.isNull=i,n.isNullOrUndefined=o,n.isNumber=s,n.isString=a,n.isSymbol=c,n.isUndefined=u,n.isRegExp=f,n.isObject=d,n.isDate=h,n.isError=l,n.isFunction=p,n.isPrimitive=m,n.isBuffer=g}).call(this,e("buffer").Buffer)},{buffer:103}],118:[function(e,t,n){function r(e){if(e&&!c(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function s(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var a=e("buffer").Buffer,c=a.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},u=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=s;break;default:return void(this.write=i)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};u.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";e=e.slice(n,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var r=t.charCodeAt(t.length-1);if(!(r>=55296&&56319>=r)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,r=t.charCodeAt(i);if(r>=55296&&56319>=r){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},u.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(2>=t&&n>>4==14){this.charLength=3;break}if(3>=t&&n>>3==30){this.charLength=4;break}}this.charReceived=t},u.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{buffer:103}],119:[function(e,t){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":113}],120:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),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")},{"./lib/_stream_duplex.js":112,"./lib/_stream_passthrough.js":113,"./lib/_stream_readable.js":114,"./lib/_stream_transform.js":115,"./lib/_stream_writable.js":116}],121:[function(e,t){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":115}],122:[function(e,t){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":116}],123:[function(e,t){function n(){r.call(this)}t.exports=n;var r=e("events").EventEmitter,i=e("inherits");i(n,r),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),n.Stream=n,n.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&u.pause&&u.pause()}function i(){u.readable&&u.resume&&u.resume()}function o(){f||(f=!0,e.end())}function s(){f||(f=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(c(),0===r.listenerCount(this,"error"))throw e}function c(){u.removeListener("data",n),e.removeListener("drain",i),u.removeListener("end",o),u.removeListener("close",s),u.removeListener("error",a),e.removeListener("error",a),u.removeListener("end",c),u.removeListener("close",c),e.removeListener("close",c)}var u=this;u.on("data",n),e.on("drain",i),e._isStdio||t&&t.end===!1||(u.on("end",o),u.on("close",s));var f=!1;return u.on("error",a),e.on("error",a),u.on("end",c),u.on("close",c),e.on("close",c),e.emit("pipe",u),e}},{events:107,inherits:130,"readable-stream/duplex.js":111,"readable-stream/passthrough.js":119,"readable-stream/readable.js":120,"readable-stream/transform.js":121,"readable-stream/writable.js":122}],124:[function(e,t){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],125:[function(e,t,n){(function(t,r){function i(e,t){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(t)?r.showHidden=t:t&&n._extend(r,t),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),c(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function s(e){return e}function a(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function c(e,t,r){if(e.customInspect&&t&&j(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return v(i)||(i=c(e,i,r)),i}var o=u(e,t);if(o)return o;var s=Object.keys(t),m=a(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),S(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(t);if(0===s.length){if(j(t)){var g=t.name?": "+t.name:"";return e.stylize("[Function"+g+"]","special")}if(x(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(E(t))return e.stylize(Date.prototype.toString.call(t),"date");if(S(t))return f(t)}var _="",b=!1,y=["{","}"];if(p(t)&&(b=!0,y=["[","]"]),j(t)){var w=t.name?": "+t.name:"";_=" [Function"+w+"]"}if(x(t)&&(_=" "+RegExp.prototype.toString.call(t)),E(t)&&(_=" "+Date.prototype.toUTCString.call(t)),S(t)&&(_=" "+f(t)),0===s.length&&(!b||0==t.length))return y[0]+_+y[1];if(0>r)return x(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var k;return k=b?d(e,t,r,m,s):s.map(function(n){return h(e,t,r,m,n,b)}),e.seen.pop(),l(k,_,y)}function u(e,t){if(w(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return b(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i){for(var o=[],s=0,a=t.length;a>s;++s)o.push(B(t,String(s))?h(e,t,n,r,String(s),!0):"");return i.forEach(function(i){i.match(/^\d+$/)||o.push(h(e,t,n,r,i,!0))}),o}function h(e,t,n,r,i,o){var s,a,u;if(u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},u.get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),B(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=g(n)?c(e,u.value,null):c(e,u.value,n-1),a.indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),w(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function l(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function g(e){return null===e}function _(e){return null==e}function b(e){return"number"==typeof e}function v(e){return"string"==typeof e}function y(e){return"symbol"==typeof e}function w(e){return void 0===e}function x(e){return k(e)&&"[object RegExp]"===L(e)}function k(e){return"object"==typeof e&&null!==e}function E(e){return k(e)&&"[object Date]"===L(e)}function S(e){return k(e)&&("[object Error]"===L(e)||e instanceof Error)}function j(e){return"function"==typeof e}function I(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function L(e){return Object.prototype.toString.call(e)}function T(e){return 10>e?"0"+e.toString(10):e.toString(10)}function A(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),M[e.getMonth()],t].join(" ")}function B(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var U=/%[sdj%]/g;n.format=function(e){if(!v(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(i(arguments[n]));return t.join(" ")}for(var n=1,r=arguments,o=r.length,s=String(e).replace(U,function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),a=r[n];o>n;a=r[++n])s+=g(a)||!k(a)?" "+a:" "+i(a);return s},n.deprecate=function(e,i){function o(){if(!s){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),s=!0}return e.apply(this,arguments)}if(w(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var s=!1;return o};var R,P={};n.debuglog=function(e){if(w(R)&&(R=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!P[e])if(new RegExp("\\b"+e+"\\b","i").test(R)){var r=t.pid;P[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else P[e]=function(){};return P[e]},n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=m,n.isNull=g,n.isNullOrUndefined=_,n.isNumber=b,n.isString=v,n.isSymbol=y,n.isUndefined=w,n.isRegExp=x,n.isObject=k,n.isDate=E,n.isError=S,n.isFunction=j,n.isPrimitive=I,n.isBuffer=e("./support/isBuffer");var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",A(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!k(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":124,_process:110,inherits:130}],126:[function(e,t){t.exports=e(25)},{"./debug":127,"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/browser.js":25}],127:[function(e,t){t.exports=e(26)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/debug.js":26,ms:128}],128:[function(e,t){t.exports=e(27)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/debug/node_modules/ms/index.js":27}],129:[function(e,t){t.exports=e(13)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/filestream/node_modules/extend.js/index.js":13}],130:[function(e,t){t.exports=e(18)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/inherits/inherits_browser.js":18}],131:[function(e,t){t.exports=e(24)},{"/Users/feross/code/webtorrent/node_modules/bittorrent-client/node_modules/create-torrent/node_modules/run-parallel/index.js":24}],132:[function(e,t){(function(n){function r(e){var t=this;e||(e={}),o("new webtorrent"),i.call(t,e),t.listening=!1,e.list||(e.port!==!1&&"function"==typeof f&&(t.server=new f(t,e.port),t.server.on("listening",function(){t.listening=!0,t.emit("listening")})),t.on("torrent",t._onTorrent.bind(t)))}t.exports=r;var i=e("bittorrent-client"),o=e("debug")("webtorrent"),s=e("extend.js"),a=e("./lib/fs-storage"),c=e("inherits"),u=e("run-parallel"),f=e("./lib/server");c(r,i),r.prototype.add=r.prototype.download=function(e,t,r){var c=this;o("add %s",e),"function"==typeof t&&(r=t,t={}),t=s({storage:"function"==typeof a&&a},t),c.index=t.index;var u=i.prototype.add.call(c,e,t,r);return n.nextTick(function(){c.emit("add",u)}),c},r.prototype.destroy=function(e){var t=this;o("destroy");var n=[i.prototype.destroy.bind(t)];return t.server&&n.push(function(e){try{t.server.close(e)}catch(n){e(null)}}),u(n,e),t},r.prototype._onTorrent=function(e){var t=this;if(o("on torrent"),"number"!=typeof e.index){var n=e.files.reduce(function(e,t){return e.length>t.length?e:t});e.index=e.files.indexOf(n)}e.files[e.index].select(),t.index=e.index,t.torrent=e}}).call(this,e("_process"))},{"./lib/fs-storage":102,"./lib/server":102,_process:110,"bittorrent-client":1,debug:126,"extend.js":129,inherits:130,"run-parallel":131}]},{},[132])(132)}); \ No newline at end of file