-
Notifications
You must be signed in to change notification settings - Fork 3
/
bundle.min.js
5 lines (5 loc) · 132 KB
/
bundle.min.js
1
2
3
4
5
(function(){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 h=n[s]={exports:{}};t[s][0].call(h.exports,function(e){var n=t[s][1][e];return i(n||e)},h,h.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}return e})()({1:[function(e,t,n){function r(e){var t=e.clientX-U.offsetLeft+U.scrollLeft,n=e.clientY-U.offsetTop+U.scrollTop;return[t,n]}function i(e){q.brush_down=!0,w(),E(),A("draw-start",q.id,[q.pre_pos.x,q.pre_pos.y]),[q.pre_pos.x,q.pre_pos.y]=r(e),u(e)}function o(e){q.brush_down=!0,w(),E(),[q.pre_pos.x,q.pre_pos.y]=r(e.touches),A("draw-start",q.id,[q.pre_pos.x,q.pre_pos.y])}function s(e){e.pre_pos.x=e.pos.x,e.pre_pos.y=e.pos.y}function a(e,t){e.stroke_array.push(t)}function c(){q.brush_down=!1,A("draw-stop",q.id,"")}function u(e){if(q.brush_down){var t=r(e);a(q,t),A("draw-pos",q.id,t),b(q)}}function h(e){j.style.cursor=e?"auto":"crosshair"}function l(e){modeIcons=['<i class="fa fa-bars"></i>','<i class="fa fa-pen"></i>','<i class="fa fa-eraser"></i>','<i class="fa fa-mouse-pointer"></i>'],modes=["view","pen","eraser","mouse"],e<4&&(q.mode=modes[e],document.getElementsByClassName("btn-main")[0].innerHTML=modeIcons[e]),"mouse"==modes[e]?h(!0):h(!1),A("ptr-mode",q.id,[q.mode,q.brush_color])}function f(){var e=document.getElementsByName("nick-name")[0].value;""!==e.trim()?(q.name=e,A("set-name",q.id,q.name)):q.name="Peer"}function d(e){q.brush_color=e,document.getElementById("dropdownMenuButton").style.background=e,l(1),A("ptr-mode",q.id,[q.mode,q.brush_color])}async function p(){const e={types:[{description:"Draw Board Files",accept:{"image/board":[".board"]}}]};if(D)m(D,j.toDataURL("image/png"));else{const t=await window.showSaveFilePicker(e);m(t,j.toDataURL("image/png"))}}function g(){var e=document.getElementById("btn-input-file");e.click(),e.addEventListener("change",y)}async function y(e){var t=e.target.files[0];if(t){var n=new FileReader;n.onload=function(e){var t=e.target.result;_(t)},n.readAsText(t)}}async function _(e){console.log(e);var t=q.ctx,n=new Image;n.onload=function(){t.drawImage(n,0,0)},n.src=e}async function m(e,t){D=e;const n=await e.createWritable();await n.write(t),await n.close()}function b(e){if(e.brush_down){if(e.ctx.beginPath(),e.ctx.lineCap="round",e.ctx.strokeStyle=e.brush_color,e.ctx.lineWidth=e.brush_size,"pen"==e.mode)for(e.ctx.globalCompositeOperation="source-over";e.stroke_array.length>0;)console.log(e.stroke_array),[e.pos.x,e.pos.y]=e.stroke_array.shift(),e.ctx.moveTo(e.pre_pos.x,e.pre_pos.y),s(e),e.ctx.lineTo(e.pos.x,e.pos.y),e.ctx.stroke();else if("eraser"==e.mode){for(e.ctx.globalCompositeOperation="destination-out";e.stroke_array.length>0;)e.ctx.strokeStyle=!1,e.ctx.lineWidth=20,[e.pos.x,e.pos.y]=e.stroke_array.shift(),e.ctx.moveTo(e.pre_pos.x,e.pre_pos.y),s(e);e.ctx.lineTo(e.pos.x,e.pos.y),e.ctx.stroke()}e.stroke_array=[]}}function w(){F.length>=5&&F.shift(),F.push(j.toDataURL())}function v(e){W.length>=5&&W.shift(),W.push(e)}function E(){W=[]}function C(e){var t=window.event?event:e;90==t.keyCode&&t.ctrlKey?(k(),console.log("Shortcut Undo")):89==t.keyCode&&t.ctrlKey&&(S(),console.log("Shortcut Undo"))}function k(){if(v(j.toDataURL()),!(F.length<=0)){var e=new Image;R(),e.src=F.pop(),e.onload=function(){q.ctx.drawImage(e,0,0)}}}function S(){if(w(j.toDataURL()),!(W.length<=0)){var e=new Image;R(),e.src=W.pop(),e.onload=function(){q.ctx.drawImage(e,0,0)}}}function R(){q.ctx.clearRect(0,0,j.width,j.height),A("draw-clear",q.id,"")}function T(e){var t=new Image;code=encodeURIComponent("https://elvistony.github.io/board-io/#"+e),t.src="https://api.qrserver.com/v1/create-qr-code/?size=120x120&data="+code,t.classList.add("img"),t.classList.add("m-3"),t.classList.add("rounded"),t.onload=function(){document.getElementById("qrcode").appendChild(t)},console.log("Joining Room:",e),N(e)}function A(e,t,n){console.log(e,n),Object.keys(z).forEach(t=>{P.send(z[t].peer,JSON.stringify({type:e,data:n}))})}function x(e,t){z[e].name=t,document.getElementById(e).innerText=t}function L(e){who=z[e],document.getElementById("peer-array").innerHTML+='<button class="set-name" id="'+e+'" style="background:'+who.profile_color+'">'+who.name+"</button>"}function O(e){delete z[e],document.getElementById(e).outerHTML=""}function I(){A("hi-there",q.id,[q.name,q.profile_color])}function N(e){let t=["wss://tracker.sloppyta.co:443/announce","wss://tracker.novage.com.ua:443/announce","wss://tracker.openwebtorrent.com","wss://tracker.webtorrent.io","wss://tracker.btorrent.xyz"];P=new B(t,"boardio"+e),M()}function M(){P.on("peerconnect",e=>{z[e.id]=Object.assign({},H),z[e.id].peer=e,console.log(z),document.getElementsByClassName("btn-main")[0].classList.add("btn-connected"),I(),document.getElementById("peers").innerHTML=Object.keys(z).length}),P.on("peerclose",e=>{console.log(e.id+" disconnected"),O(e.id),0==Object.keys(z).length&&document.getElementsByClassName("btn-main")[0].classList.remove("btn-connected")}),P.on("msg",(e,t)=>{t=JSON.parse(t),"ptr-mode"==t.type?(z[e.id].mode=t.data[0],z[e.id].brush_color=t.data[1]):"draw-start"==t.type?(z[e.id].brush_down=!0,z[e.id].pre_pos=t.data,console.log(e.id,"Started Drawing",z[e.id].brush_down)):"draw-stop"==t.type?(console.log(e.id,"Stopped Drawing"),console.log(z[e.id]),z[e.id].brush_down=!1):"draw-pos"==t.type?(z[e.id].stroke_array.push(t.data),console.log(z[e.id].stroke_array),b(z[e.id])):"draw-clear"==t.type?R():"set-name"==t.type?x(e.id,t.data):"hi-there"==t.type?(z[e.id].name=t.data[0],z[e.id].profile_color=t.data[1],L(e.id)):console.log(t)}),P.start()}const B=e("p2pt"),j=document.querySelector("#canvas"),U=document.getElementsByClassName("board-container")[0];document.getElementById("menu_pen").addEventListener("click",()=>{l(1)}),document.getElementById("menu_eraser").addEventListener("click",()=>{l(2)}),document.getElementById("menu_pointer").addEventListener("click",()=>{l(3)}),document.getElementById("menu_undo").addEventListener("click",()=>{k()}),document.getElementById("menu_redo").addEventListener("click",()=>{S()}),document.getElementById("btn-export").addEventListener("click",()=>{V()}),document.getElementById("btn-clear").addEventListener("click",()=>{R()}),document.getElementById("btn-set-name").addEventListener("click",()=>{f()}),document.getElementById("btn-open").addEventListener("click",()=>{g()}),document.getElementById("btn-download").addEventListener("click",()=>{p()}),colors.forEach(e=>{e.addEventListener("click",t=>{d(e.title)})}),document.getElementById("btn-join-room").addEventListener("click",()=>{room_code=document.getElementsByName("join-room-code")[0].value,document.getElementsByName("join-room-code")[1].value=room_code,document.getElementById("share-modal-back").style.display="none",document.getElementById("btn-join-room").style.display="none",document.getElementsByName("join-room-code")[0].setAttribute("readonly","true"),ShareModal(1),document.getElementById("btn-create-room").classList.add("disabled"),T(room_code)}),document.getElementById("btn-create-room").addEventListener("click",()=>{document.getElementsByName("join-room-code")[1].value=RandomCoder(),document.getElementById("share-modal-back").style.display="none",ShareModal(2),document.getElementById("btn-create-room").style.display="none",document.getElementById("btn-share-room").style.display="block",room_code=document.getElementsByName("join-room-code")[1].value,document.getElementsByName("join-room-code")[0].value=room_code,document.getElementById("btn-join-room").classList.add("disabled"),T(room_code)});var D=!1,P=!1,F=[],W=[],q={name:"One For All",id:"",pos:{x:0,y:0},brush_down:!1,mode:"pen",profile_color:"orangered",pre_pos:{x:0,y:0},brush_size:5,brush_color:"#1d809f",undo_array:[],redo_array:[],stroke_array:[],ctx:j.getContext("2d"),is_peer:!1,peer:!1};let H={name:"All For One",id:"",pos:{x:0,y:0},brush_down:!1,mode:"pen",profile_color:"pink",pre_pos:{x:0,y:0},brush_size:5,brush_color:"#1d809f",undo_array:[],redo_array:[],stroke_array:[],ctx:j.getContext("2d"),is_peer:!0,peer:!1};var z={};window.addEventListener("load",()=>{j.addEventListener("mousedown",i),j.addEventListener("mouseup",c),j.addEventListener("mousemove",u),j.addEventListener("touchstart",e=>{let t;if(1==e.touches.length){var n=!0;n?(o(e),clearTimeout(t)):t=setTimeout(()=>{n=!1},200)}}),j.addEventListener("touchend",o),j.addEventListener("touchmove",function(e){if(1==e.touches.length){var t=!0;if(t){var n=e.touches[0],r=new MouseEvent("mousemove",{clientX:n.clientX,clientY:n.clientY});u(r)}}},!1)}),q.profile_color=RandomColor();var V=function(){var e=document.createElement("a");e.download="drawboard.png",e.href=j.toDataURL(),e.click()};$(window).bind("keydown",function(e){if(e.ctrlKey||e.metaKey)switch(String.fromCharCode(e.which).toLowerCase()){case"s":e.preventDefault(),p()}}),document.onkeydown=C},{p2pt:16}],2:[function(e,t,n){"use strict";function r(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function i(e){var t=r(e),n=t[0],i=t[1];return 3*(n+i)/4-i}function o(e,t,n){return 3*(t+n)/4-n}function s(e){var t,n,i=r(e),s=i[0],a=i[1],c=new f(o(e,s,a)),u=0,h=a>0?s-4:s;for(n=0;n<h;n+=4)t=l[e.charCodeAt(n)]<<18|l[e.charCodeAt(n+1)]<<12|l[e.charCodeAt(n+2)]<<6|l[e.charCodeAt(n+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===a&&(t=l[e.charCodeAt(n)]<<2|l[e.charCodeAt(n+1)]>>4,c[u++]=255&t),1===a&&(t=l[e.charCodeAt(n)]<<10|l[e.charCodeAt(n+1)]<<4|l[e.charCodeAt(n+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c}function a(e){return h[e>>18&63]+h[e>>12&63]+h[e>>6&63]+h[63&e]}function c(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(a(r));return i.join("")}function u(e){for(var t,n=e.length,r=n%3,i=[],o=16383,s=0,a=n-r;s<a;s+=o)i.push(c(e,s,s+o>a?a:s+o));return 1===r?(t=e[n-1],i.push(h[t>>2]+h[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(h[t>>10]+h[t>>4&63]+h[t<<2&63]+"=")),i.join("")}n.byteLength=i,n.toByteArray=s,n.fromByteArray=u;for(var h=[],l=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=d.length;p<g;++p)h[p]=d[p],l[d.charCodeAt(p)]=p;l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63},{}],3:[function(e,t,n){const r=e("events");class i extends r{constructor(e,t){super(),this.client=e,this.announceUrl=t,this.interval=null,this.destroyed=!1}setInterval(e){null==e&&(e=this.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(this.interval),e&&(this.interval=setInterval(()=>{this.announce(this.client._defaultAnnounceOpts())},e),this.interval.unref&&this.interval.unref())}}t.exports=i},{events:8}],4:[function(e,t,n){function r(){}const i=e("debug")("bittorrent-tracker:websocket-tracker"),o=e("simple-peer"),s=e("randombytes"),a=e("simple-websocket"),c=e("../common"),u=e("./tracker"),h={},l=1e4,f=36e5,d=3e5,p=5e4;class g extends u{constructor(e,t,n){super(e,t),i("new websocket tracker %s",t),this.peers={},this.socket=null,this.reconnecting=!1,this.retries=0,this.reconnectTimer=null,this.expectingResponse=!1,this._openSocket()}announce(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",()=>{this.announce(e)});const t=Object.assign({},e,{action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(t.trackerid=this._trackerId),"stopped"===e.event||"completed"===e.event)this._send(t);else{const n=Math.min(e.numwant,10);this._generateOffers(n,e=>{t.numwant=n,t.offers=e,this._send(t)})}}scrape(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",()=>{this.scrape(e)});const t=Array.isArray(e.infoHash)&&e.infoHash.length>0?e.infoHash.map(e=>e.toString("binary")):e.infoHash&&e.infoHash.toString("binary")||this.client._infoHashBinary,n={action:"scrape",info_hash:t};this._send(n)}destroy(e=r){function t(){i&&(clearTimeout(i),i=null),n.removeListener("data",t),n.destroy(),n=null}if(this.destroyed)return e(null);this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer);for(const e in this.peers){const t=this.peers[e];clearTimeout(t.trackerTimeout),t.destroy()}if(this.peers=null,this.socket&&(this.socket.removeListener("connect",this._onSocketConnectBound),this.socket.removeListener("data",this._onSocketDataBound),this.socket.removeListener("close",this._onSocketCloseBound),this.socket.removeListener("error",this._onSocketErrorBound),this.socket=null),this._onSocketConnectBound=null,this._onSocketErrorBound=null,this._onSocketDataBound=null,this._onSocketCloseBound=null,h[this.announceUrl]&&(h[this.announceUrl].consumers-=1),h[this.announceUrl].consumers>0)return e();let n=h[this.announceUrl];if(delete h[this.announceUrl],n.on("error",r),n.once("close",e),!this.expectingResponse)return t();var i=setTimeout(t,c.DESTROY_TIMEOUT);n.once("data",t)}_openSocket(){this.destroyed=!1,this.peers||(this.peers={}),this._onSocketConnectBound=(()=>{this._onSocketConnect()}),this._onSocketErrorBound=(e=>{this._onSocketError(e)}),this._onSocketDataBound=(e=>{this._onSocketData(e)}),this._onSocketCloseBound=(()=>{this._onSocketClose()}),this.socket=h[this.announceUrl],this.socket?(h[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound()):(this.socket=h[this.announceUrl]=new a(this.announceUrl),this.socket.consumers=1,this.socket.once("connect",this._onSocketConnectBound)),this.socket.on("data",this._onSocketDataBound),this.socket.once("close",this._onSocketCloseBound),this.socket.once("error",this._onSocketErrorBound)}_onSocketConnect(){this.destroyed||this.reconnecting&&(this.reconnecting=!1,this.retries=0,this.announce(this.client._defaultAnnounceOpts()))}_onSocketData(e){if(!this.destroyed){this.expectingResponse=!1;try{e=JSON.parse(e)}catch(e){return void this.client.emit("warning",new Error("Invalid tracker response"))}"announce"===e.action?this._onAnnounceResponse(e):"scrape"===e.action?this._onScrapeResponse(e):this._onSocketError(new Error(`invalid action in WS response: ${e.action}`))}}_onAnnounceResponse(e){if(e.info_hash!==this.client._infoHashBinary)return void i("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,c.binaryToHex(e.info_hash),this.client.infoHash);if(e.peer_id&&e.peer_id===this.client._peerIdBinary)return;i("received %s from %s for %s",JSON.stringify(e),this.announceUrl,this.client.infoHash);const t=e["failure reason"];if(t)return this.client.emit("warning",new Error(t));const n=e["warning message"];n&&this.client.emit("warning",new Error(n));const r=e.interval||e["min interval"];r&&this.setInterval(1e3*r);const o=e["tracker id"];if(o&&(this._trackerId=o),null!=e.complete){const t=Object.assign({},e,{announce:this.announceUrl,infoHash:c.binaryToHex(e.info_hash)});this.client.emit("update",t)}let s;if(e.offer&&e.peer_id&&(i("creating peer (from remote offer)"),s=this._createPeer(),s.id=c.binaryToHex(e.peer_id),s.once("signal",t=>{const n={action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,to_peer_id:e.peer_id,answer:t,offer_id:e.offer_id};this._trackerId&&(n.trackerid=this._trackerId),this._send(n)}),s.signal(e.offer),this.client.emit("peer",s)),e.answer&&e.peer_id){const t=c.binaryToHex(e.offer_id);s=this.peers[t],s?(s.id=c.binaryToHex(e.peer_id),s.signal(e.answer),this.client.emit("peer",s),clearTimeout(s.trackerTimeout),s.trackerTimeout=null,delete this.peers[t]):i(`got unexpected answer: ${JSON.stringify(e.answer)}`)}}_onScrapeResponse(e){e=e.files||{};const t=Object.keys(e);0!==t.length?t.forEach(t=>{const n=Object.assign(e[t],{announce:this.announceUrl,infoHash:c.binaryToHex(t)});this.client.emit("scrape",n)}):this.client.emit("warning",new Error("invalid scrape response"))}_onSocketClose(){this.destroyed||(this.destroy(),this._startReconnectTimer())}_onSocketError(e){this.destroyed||(this.destroy(),this.client.emit("warning",e),this._startReconnectTimer())}_startReconnectTimer(){const e=Math.floor(Math.random()*d)+Math.min(Math.pow(2,this.retries)*l,f);this.reconnecting=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{this.retries++,this._openSocket()},e),this.reconnectTimer.unref&&this.reconnectTimer.unref(),i("reconnecting socket in %s ms",e)}_send(e){if(this.destroyed)return;this.expectingResponse=!0;const t=JSON.stringify(e);i("send %s",t),this.socket.send(t)}_generateOffers(e,t){function n(){const e=s(20).toString("hex");i("creating peer (from _generateOffers)");const t=o.peers[e]=o._createPeer({initiator:!0});t.once("signal",t=>{a.push({offer:t,offer_id:c.hexToBinary(e)}),r()}),t.trackerTimeout=setTimeout(()=>{i("tracker timeout: destroying peer"),t.trackerTimeout=null,delete o.peers[e],t.destroy()},p),t.trackerTimeout.unref&&t.trackerTimeout.unref()}function r(){a.length===e&&(i("generated %s offers",e),t(a))}const o=this,a=[];i("generating %s offers",e);for(let t=0;t<e;++t)n();r()}_createPeer(e){function t(e){r.client.emit("warning",new Error(`Connection error: ${e.message}`)),i.destroy()}function n(){i.removeListener("error",t),i.removeListener("connect",n)}const r=this;e=Object.assign({trickle:!1,config:r.client._rtcConfig,wrtc:r.client._wrtc},e);const i=new o(e);return i.once("error",t),i.once("connect",n),i}}g.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,g._socketPool=h,t.exports=g},{"../common":5,"./tracker":3,debug:9,randombytes:19,"simple-peer":37,"simple-websocket":40}],5:[function(e,t,n){(function(t){(function(){n.DEFAULT_ANNOUNCE_PEERS=50,n.MAX_ANNOUNCE_PEERS=82,n.binaryToHex=function(e){return"string"!=typeof e&&(e=String(e)),t.from(e,"binary").toString("hex")},n.hexToBinary=function(e){return"string"!=typeof e&&(e=String(e)),t.from(e,"hex").toString("binary")};var r=e("./common-node");Object.assign(n,r)}).call(this)}).call(this,e("buffer").Buffer)},{"./common-node":6,buffer:7}],6:[function(e,t,n){},{}],7:[function(e,t,n){(function(t){(function(){"use strict";function t(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}function r(e){if(e>K)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return o(e,t,n)}function o(e,t,n){if("string"==typeof e)return u(e,t);if(ArrayBuffer.isView(e))return h(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return l(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return i.from(r,t,n);var o=f(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return i.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function a(e,t,n){return s(e),e<=0?r(e):void 0!==t?"string"==typeof n?r(e).fill(t,n):r(e).fill(t):r(e)}function c(e){return s(e),r(e<0?0:0|d(e))}function u(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!i.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|g(e,t),o=r(n),s=o.write(e,t);return s!==n&&(o=o.slice(0,s)),o}function h(e){for(var t=e.length<0?0:0|d(e.length),n=r(t),i=0;i<t;i+=1)n[i]=255&e[i];return n}function l(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),r.__proto__=i.prototype,r}function f(e){if(i.isBuffer(e)){var t=0|d(e.length),n=r(t);return 0===n.length?n:(e.copy(n,0,0,t),n)}return void 0!==e.length?"number"!=typeof e.length||Y(e.length)?r(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}function d(e){if(e>=K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");return 0|e}function p(e){return+e!=e&&(e=0),i.alloc(+e)}function g(e,t){if(i.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(o)return r?-1:F(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return x(this,t,n);case"latin1":case"binary":return L(this,t,n);case"base64":return R(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function _(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Y(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=i.from(t,r)),i.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var s,a=1,c=e.length,u=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,c/=2,u/=2,n/=2}if(i){var h=-1;for(s=n;s<c;s++)if(o(e,s)===o(t,-1===h?0:s-h)){if(-1===h&&(h=s),s-h+1===u)return h*a}else-1!==h&&(s-=s-h),h=-1}else for(n+u>c&&(n=c-u),s=n;s>=0;s--){for(var l=!0,f=0;f<u;f++)if(o(e,s+f)!==o(t,f)){l=!1;break}if(l)return s}return-1}function w(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;r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(Y(a))return s;e[n+s]=a}return s}function v(e,t,n,r){return z(F(t,e.length-n),e,n,r)}function E(e,t,n,r){return z(W(t),e,n,r)}function C(e,t,n,r){return E(e,t,n,r)}function k(e,t,n,r){return z(H(t),e,n,r)}function S(e,t,n,r){return z(q(t,e.length-n),e,n,r)}function R(e,t,n){return 0===t&&n===e.length?G.fromByteArray(e):G.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,c,u=e[i],h=null,l=u>239?4:u>223?3:u>191?2:1;if(i+l<=n)switch(l){case 1:u<128&&(h=u);break;case 2:o=e[i+1],128==(192&o)&&(c=(31&u)<<6|63&o,c>127&&(h=c));break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s,c>2047&&(c<55296||c>57343)&&(h=c));break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a,c>65535&&c<1114112&&(h=c))}null===h?(h=65533,l=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),i+=l}return A(r)}function A(e){var t=e.length;if(t<=$)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=$));return n}function x(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function L(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function O(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=P(e[o]);return i}function I(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 N(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,n,r,o,s){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<s)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function B(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(e,t,n,r,i){return t=+t,n>>>=0,i||B(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,i){return t=+t,n>>>=0,i||B(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,n,r,52,8),n+8}function D(e){if(e=e.split("=")[0],e=e.trim().replace(X,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function P(e){return e<16?"0"+e.toString(16):e.toString(16)}function F(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function W(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function q(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}function H(e){return G.toByteArray(D(e))}function z(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}var G=e("base64-js"),J=e("ieee754");n.Buffer=i,n.SlowBuffer=p,n.INSPECT_MAX_BYTES=50;var K=2147483647;n.kMaxLength=K,i.TYPED_ARRAY_SUPPORT=t(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,n){return o(e,t,n)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,n){return a(e,t,n)},i.allocUnsafe=function(e){return c(e)},i.allocUnsafeSlow=function(e){return c(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==i.prototype},i.compare=function(e,t){if(V(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),V(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,o=0,s=Math.min(n,r);o<s;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},i.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return i.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=i.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var s=e[n];if(V(s,Uint8Array)&&(s=i.from(s)),!i.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,o),o+=s.length}return r},i.byteLength=g,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)_(this,t,t+1);return this},i.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)_(this,t,t+3),_(this,t+1,t+2);return this},i.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)_(this,t,t+7),_(this,t+1,t+6),_(this,t+2,t+5),_(this,t+3,t+4);return this},i.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):y.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(e){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===i.compare(this,e)},i.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},i.prototype.compare=function(e,t,n,r,o){if(V(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;for(var s=o-r,a=n-t,c=Math.min(s,a),u=this.slice(r,o),h=e.slice(t,n),l=0;l<c;++l)if(u[l]!==h[l]){s=u[l],a=h[l];break}return s<a?-1:a<s?1:0},i.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},i.prototype.indexOf=function(e,t,n){return m(this,e,t,n,!0)},i.prototype.lastIndexOf=function(e,t,n){return m(this,e,t,n,!1)},i.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return C(this,e,t,n);case"base64":return k(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},i.prototype.toJSON=function(){
return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;i.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return r.__proto__=i.prototype,r},i.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},i.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},i.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},i.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},i.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),J.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),J.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),J.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),J.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;M(this,e,t,n,i,0)}var o=1,s=0;for(this[t]=255&e;++s<n&&(o*=256);)this[t+s]=e/o&255;return t+n},i.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;M(this,e,t,n,i,0)}var o=n-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+n},i.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);M(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},i.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);M(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},i.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,n){return j(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return j(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},i.prototype.copy=function(e,t,n,r){if(!i.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var o=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,r);else if(this===e&&n<t&&t<r)for(var s=o-1;s>=0;--s)e[s+t]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),t);return o},i.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!i.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){var o=e.charCodeAt(0);("utf8"===r&&o<128||"latin1"===r)&&(e=o)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{var a=i.isBuffer(e)?e:i.from(e,r),c=a.length;if(0===c)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-t;++s)this[s+t]=a[s%c]}return this};var X=/[^+/0-9A-Za-z-_]/g}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":2,buffer:7,ieee754:13}],8:[function(e,t,n){function r(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=v(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}function i(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function o(e,t,n){if(t)e.call(n);else for(var r=e.length,i=y(e,r),o=0;o<r;++o)i[o].call(n)}function s(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=y(e,i),s=0;s<i;++s)o[s].call(n,r)}function a(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,s=y(e,o),a=0;a<o;++a)s[a].call(n,r,i)}function c(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var s=e.length,a=y(e,s),c=0;c<s;++c)a[c].call(n,r,i,o)}function u(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=y(e,i),s=0;s<i;++s)o[s].apply(n,r)}function h(e,t,n,r){var o,s,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if(s=e._events,s?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),a=s[t]):(s=e._events=v(null),e._eventsCount=0),a){if("function"==typeof a?a=s[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(o=i(e),o&&o>0&&a.length>o)){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",c.name,c.message)}}else a=s[t]=n,++e._eventsCount;return e}function l(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=C.call(l,r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(!r)return[];var i=r[t];return i?"function"==typeof i?n?[i.listener||i]:[i]:n?_(i):y(i,i.length):[]}function p(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function g(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}function y(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function m(e){var t=function(){};return t.prototype=e,new t}function b(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n}function w(e){var t=this;return function(){return t.apply(e,arguments)}}var v=Object.create||m,E=Object.keys||b,C=Function.prototype.bind||w;t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0;var k,S=10;try{var R={};Object.defineProperty&&Object.defineProperty(R,"x",{value:0}),k=0===R.x}catch(e){k=!1}k?Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return S},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');S=e}}):r.defaultMaxListeners=S,r.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},r.prototype.getMaxListeners=function(){return i(this)},r.prototype.emit=function(e){var t,n,r,i,h,l,f="error"===e;if(l=this._events,l)f=f&&null==l.error;else if(!f)return!1;if(f){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var d=new Error('Unhandled "error" event. ('+t+")");throw d.context=t,d}if(n=l[e],!n)return!1;var p="function"==typeof n;switch(r=arguments.length,r){case 1:o(n,p,this);break;case 2:s(n,p,this,arguments[1]);break;case 3:a(n,p,this,arguments[1],arguments[2]);break;case 4:c(n,p,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),h=1;h<r;h++)i[h-1]=arguments[h];u(n,p,this,i)}return!0},r.prototype.addListener=function(e,t){return h(this,e,t,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(e,t){return h(this,e,t,!0)},r.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,f(this,e,t)),this},r.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,f(this,e,t)),this},r.prototype.removeListener=function(e,t){var n,r,i,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(r=this._events,!r)return this;if(n=r[e],!n)return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=v(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():g(n,i),1===n.length&&(r[e]=n[0]),r.removeListener&&this.emit("removeListener",e,s||t)}return this},r.prototype.removeAllListeners=function(e){var t,n,r;if(n=this._events,!n)return this;if(!n.removeListener)return 0===arguments.length?(this._events=v(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=v(null):delete n[e]),this;if(0===arguments.length){var i,o=E(n);for(r=0;r<o.length;++r)i=o[r],"removeListener"!==i&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=v(null),this._eventsCount=0,this}if(t=n[e],"function"==typeof t)this.removeListener(e,t);else if(t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},r.prototype.listeners=function(e){return d(this,e,!0)},r.prototype.rawListeners=function(e){return d(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},r.prototype.listenerCount=p,r.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],9:[function(e,t,n){(function(r){(function(){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),e.splice(i,0,n)}function s(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}}function a(){let e;try{e=n.storage.getItem("debug")}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function c(){try{return localStorage}catch(e){}}n.formatArgs=o,n.save=s,n.load=a,n.useColors=i,n.storage=c(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(n);const{formatters:u}=t.exports;u.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":10,_process:17}],10:[function(e,t,n){function r(t){function n(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return r.colors[Math.abs(t)%r.colors.length]}function r(e){function t(...e){if(!t.enabled)return;const i=t,o=Number(new Date),s=o-(n||o);i.diff=s,i.prev=n,i.curr=o,n=o,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,n)=>{if("%%"===t)return"%";a++;const o=r.formatters[n];if("function"==typeof o){const n=e[a];t=o.call(i,n),e.splice(a,1),a--}return t}),r.formatArgs.call(i,e);const c=i.log||r.log;c.apply(i,e)}let n,o=null;return t.namespace=e,t.useColors=r.useColors(),t.color=r.selectColor(e),t.extend=i,t.destroy=r.destroy,Object.defineProperty(t,"enabled",{enumerable:!0,configurable:!1,get:()=>null===o?r.enabled(e):o,set:e=>{o=e}}),"function"==typeof r.init&&r.init(t),t}function i(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function o(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t<i;t++)n[t]&&(e=n[t].replace(/\*/g,".*?"),"-"===e[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))}function s(){const e=[...r.names.map(c),...r.skips.map(c).map(e=>"-"+e)].join(",");return r.enable(""),e}function a(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1}function c(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}function u(e){return e instanceof Error?e.stack||e.message:e}function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.debug=r,r.default=r,r.coerce=u,r.disable=s,r.enable=o,r.enabled=a,r.humanize=e("ms"),r.destroy=h,Object.keys(t).forEach(e=>{r[e]=t[e]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=n,r.enable(r.load()),r}t.exports=r},{ms:15}],11:[function(e,t,n){"use strict";function r(e,t){for(const n in t)Object.defineProperty(e,n,{value:t[n],enumerable:!0,configurable:!0});return e}function i(e,t,n){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof t&&(n=t,t=void 0),null!=t&&(n.code=t);try{return r(e,n)}catch(t){n.message=e.message,n.stack=e.stack;const i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(e)),r(new i,n)}}t.exports=i},{}],12:[function(e,t,n){t.exports=function(){if("undefined"==typeof globalThis)return null;var e={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}},{}],13:[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,h=-7,l=n?i-1:0,f=n?-1:1,d=e[t+l];for(l+=f,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+e[t+l],l+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+e[t+l],l+=f,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=u}return(d?-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,h=(1<<u)-1,l=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),t+=s+l>=1?f/c:f*Math.pow(2,1-l),t*c>=2&&(s++,c/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(t*c-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+d]=255&s,d+=p,s/=256,u-=8);e[n+d-p]|=128*g}},{}],14:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},{}],15:[function(e,t,n){function r(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*f;case"weeks":case"week":case"w":return n*l;case"days":case"day":case"d":return n*h;case"hours":case"hour":case"hrs":case"hr":case"h":return n*u;case"minutes":case"minute":case"mins":case"min":case"m":return n*c;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function i(e){var t=Math.abs(e);return t>=h?Math.round(e/h)+"d":t>=u?Math.round(e/u)+"h":t>=c?Math.round(e/c)+"m":t>=a?Math.round(e/a)+"s":e+"ms"}function o(e){var t=Math.abs(e);return t>=h?s(e,t,h,"day"):t>=u?s(e,t,u,"hour"):t>=c?s(e,t,c,"minute"):t>=a?s(e,t,a,"second"):e+" ms"}function s(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}var a=1e3,c=60*a,u=60*c,h=24*u,l=7*h,f=365.25*h;t.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return r(e);if("number"===n&&isFinite(e))return t.long?o(e):i(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],16:[function(e,t,n){(function(n){(function(){const r=e("bittorrent-tracker/lib/client/websocket-tracker"),i=e("randombytes"),o=e("events"),s=e("simple-sha1"),a=e("debug")("p2pt"),c="^",u=16e3;class h extends o{constructor(e=[],t=""){super(),this.announceURLs=e,this.trackers={},this.peers={},this.msgChunks={},this.responseWaiting={},t&&this.setIdentifier(t),this._peerIdBuffer=i(20),this._peerId=this._peerIdBuffer.toString("hex"),this._peerIdBinary=this._peerIdBuffer.toString("binary"),a("my peer id: "+this._peerId)}setIdentifier(e){this.identifierString=e,this.infoHash=s.sync(e).toLowerCase(),this._infoHashBuffer=n.from(this.infoHash,"hex"),this._infoHashBinary=this._infoHashBuffer.toString("binary")}start(){this.on("peer",e=>{let t=!1;this.peers[e.id]||(t=!0,this.peers[e.id]={},this.responseWaiting[e.id]={}),e.on("connect",()=>{this.peers[e.id][e.channelName]=e,t&&this.emit("peerconnect",e)}),e.on("data",t=>{if(this.emit("data",e,t),t=t.toString(),a("got a message from "+e.id),t[0]===c)try{t=JSON.parse(t.slice(1)),e.respond=this._peerRespond(e,t.id);let n=this._chunkHandler(t);!1!==n&&(t.o&&(n=JSON.parse(n)),this.responseWaiting[e.id][t.id]?(this.responseWaiting[e.id][t.id]([e,n]),delete this.responseWaiting[e.id][t.id]):this.emit("msg",e,n),this._destroyChunks(t.id))}catch(e){console.log(e)}}),e.on("error",t=>{this._removePeer(e),a("Error in connection : "+t)}),e.on("close",()=>{this._removePeer(e),a("Connection closed with "+e.id)})}),this.on("update",e=>{const t=this.trackers[this.announceURLs.indexOf(e.announce)];this.emit("trackerconnect",t,this.getTrackerStats())}),this.on("warning",e=>{this.emit("trackerwarning",e,this.getTrackerStats())}),this._fetchPeers()}addTracker(e){if(-1!==this.announceURLs.indexOf(e))throw new Error("Tracker already added");const t=this.announceURLs.push(e);this.trackers[t]=new r(this,e),this.trackers[t].announce(this._defaultAnnounceOpts())}removeTracker(e){const t=this.announceURLs.indexOf(e);if(-1===t)throw new Error("Tracker does not exist");this.trackers[t].peers=[],this.trackers[t].destroy(),delete this.trackers[t],delete this.announceURLs[t]}_removePeer(e){if(!this.peers[e.id])return!1;delete this.peers[e.id][e.channelName],0===Object.keys(this.peers[e.id]).length&&(this.emit("peerclose",e),delete this.responseWaiting[e.id],delete this.peers[e.id])}send(e,t,n=""){return new Promise((r,i)=>{const o={id:""!==n?n:Math.floor(1e5*Math.random()+1e5),msg:t};"object"==typeof t&&(o.msg=JSON.stringify(t),o.o=1);try{if(!e.connected)for(const t in this.peers[e.id])if(e=this.peers[e.id][t],e.connected)break;this.responseWaiting[e.id]||(this.responseWaiting[e.id]={}),this.responseWaiting[e.id][o.id]=r}catch(e){return i(Error("Connection to peer closed"+e))}let s=0,h="";for(;o.msg.length>0;)o.c=s,h=o.msg.slice(u),o.msg=o.msg.slice(0,u),h||(o.last=!0),e.send(c+JSON.stringify(o)),o.msg=h,s++;a("sent a message to "+e.id)})}requestMorePeers(){return new Promise(e=>{for(const e in this.trackers)this.trackers[e].announce(this._defaultAnnounceOpts());e(this.peers)})}getTrackerStats(){let e=0;for(const t in this.trackers)this.trackers[t].socket&&this.trackers[t].socket.connected&&e++;return{connected:e,total:this.announceURLs.length}}destroy(){let e;for(e in this.peers)for(const t in this.peers[e])this.peers[e][t].destroy();for(e in this.trackers)this.trackers[e].destroy()}_peerRespond(e,t){return n=>this.send(e,n,t)}_chunkHandler(e){if(this.msgChunks[e.id]||(this.msgChunks[e.id]=[]),this.msgChunks[e.id][e.c]=e.msg,e.last){const t=this.msgChunks[e.id].join("");return t}return!1}_destroyChunks(e){delete this.msgChunks[e]}_defaultAnnounceOpts(e={}){return null==e.numwant&&(e.numwant=50),null==e.uploaded&&(e.uploaded=0),null==e.downloaded&&(e.downloaded=0),e}_fetchPeers(){for(const e in this.announceURLs)this.trackers[e]=new r(this,this.announceURLs[e]),this.trackers[e].announce(this._defaultAnnounceOpts())}}t.exports=h}).call(this)}).call(this,e("buffer").Buffer)},{"bittorrent-tracker/lib/client/websocket-tracker":4,buffer:7,debug:9,events:8,randombytes:19,"simple-sha1":38}],17:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function s(e){if(f===clearTimeout)return clearTimeout(e);if((f===i||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){y&&p&&(y=!1,p.length?g=p.concat(g):_=-1,g.length&&c())}function c(){if(!y){var e=o(a);y=!0;for(var t=g.length;t;){for(p=g,g=[];++_<t;)p&&p[_].run();_=-1,t=g.length}p=null,y=!1,s(e)}}function u(e,t){this.fun=e,this.array=t}function h(){}var l,f,d=t.exports={};(function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(e){l=r}try{f="function"==typeof clearTimeout?clearTimeout:i}catch(e){f=i}})();var p,g=[],y=!1,_=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];g.push(new u(e,t)),1!==g.length||y||o(c)},u.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=h,d.addListener=h,d.once=h,d.off=h,d.removeListener=h,d.removeAllListeners=h,d.emit=h,d.prependListener=h,d.prependOnceListener=h,d.listeners=function(e){return[]},d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},{}],18:[function(e,t,n){let r;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind(globalThis):e=>(r||(r=Promise.resolve())).then(e).catch(e=>setTimeout(()=>{throw e},0))},{}],19:[function(e,t,n){(function(n,r){(function(){"use strict";function i(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}function o(e,t){if(e>a)throw new RangeError("requested too many random bytes");var r=c.allocUnsafe(e);if(e>0)if(e>s)for(var i=0;i<e;i+=s)u.getRandomValues(r.slice(i,i+s));else u.getRandomValues(r);return"function"==typeof t?n.nextTick(function(){t(null,r)}):r}var s=65536,a=4294967295,c=e("safe-buffer").Buffer,u=r.crypto||r.msCrypto;u&&u.getRandomValues?t.exports=o:t.exports=i}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:17,"safe-buffer":36}],20:[function(e,t,n){"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(e,t,n){function i(e,n,r){return"string"==typeof t?t:t(e,n,r)}n||(n=Error);var o=function(e){function t(t,n,r){return e.call(this,i(t,n,r))||this}return r(t,e),t}(n);o.prototype.name=n.name,o.prototype.code=e,u[e]=o}function o(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function s(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function a(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function c(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}var u={};i("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,n){var r,i;if("string"==typeof t&&s(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be",a(e," argument"))i="The ".concat(e," ").concat(r," ").concat(o(t,"type"));else{var u=c(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(u," ").concat(r," ").concat(o(t,"type"))}return i+=". Received type ".concat(typeof n),i},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=u},{}],21:[function(e,t,n){(function(n){(function(){"use strict";function r(e){if(!(this instanceof r))return new r(e);a.call(this,e),c.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",i)))}function i(){this._writableState.ended||n.nextTick(o,this)}function o(e){e.end()}var s=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var a=e("./_stream_readable"),c=e("./_stream_writable");e("inherits")(r,a);for(var u=s(c.prototype),h=0;h<u.length;h++){var l=u[h];r.prototype[l]||(r.prototype[l]=c.prototype[l])}Object.defineProperty(r.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(r.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(r.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(r.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this)}).call(this,e("_process"))},{"./_stream_readable":23,"./_stream_writable":25,_process:17,inherits:14}],22:[function(e,t,n){"use strict";function r(e){if(!(this instanceof r))return new r(e);i.call(this,e)}t.exports=r;var i=e("./_stream_transform");e("inherits")(r,i),r.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":24,inherits:14}],23:[function(e,t,n){(function(n,r){(function(){"use strict";function i(e){return N.from(e)}function o(e){return N.isBuffer(e)||e instanceof M}function s(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n)
;e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function a(t,n,r){x=x||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof x),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=q(this,t,"readableHighWaterMark",r),this.buffer=new P,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(j||(j=e("string_decoder/").StringDecoder),this.decoder=new j(t.encoding),this.encoding=t.encoding)}function c(t){if(x=x||e("./_stream_duplex"),!(this instanceof c))return new c(t);var n=this instanceof x;this._readableState=new a(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),I.call(this)}function u(e,t,n,r,o){L("readableAddChunk",t);var s,a=e._readableState;if(null===t)a.reading=!1,p(e,a);else if(o||(s=l(a,t)),s)J(e,s);else if(a.objectMode||t&&t.length>0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===N.prototype||(t=i(t)),r)a.endEmitted?J(e,new G):h(e,a,t,!0);else if(a.ended)J(e,new V);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?h(e,a,t,!1):_(e,a)):h(e,a,t,!1)}else r||(a.reading=!1,_(e,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function h(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&g(e)),_(e,t)}function l(e,t){var n;return o(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new z("chunk",["string","Buffer","Uint8Array"],t)),n}function f(e){return e>=$?e=$:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function d(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=f(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function p(e,t){if(L("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?g(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,y(e)))}}function g(e){var t=e._readableState;L("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(L("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(y,e))}function y(e){var t=e._readableState;L("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,k(e)}function _(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(m,e,t))}function m(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(L("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function b(e){return function(){var t=e._readableState;L("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&O(e,"data")&&(t.flowing=!0,k(e))}}function w(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function v(e){L("readable nexttick read 0"),e.read(0)}function E(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(C,e,t))}function C(e,t){L("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),k(e),t.flowing&&!t.reading&&e.read(0)}function k(e){var t=e._readableState;for(L("flow",t.flowing);t.flowing&&null!==e.read(););}function S(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function R(e){var t=e._readableState;L("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(T,t,e))}function T(e,t){if(L("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function A(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}var x;t.exports=c,c.ReadableState=a;e("events").EventEmitter;var L,O=function(e,t){return e.listeners(t).length},I=e("./internal/streams/stream"),N=e("buffer").Buffer,M=r.Uint8Array||function(){},B=e("util");L=B&&B.debuglog?B.debuglog("stream"):function(){};var j,U,D,P=e("./internal/streams/buffer_list"),F=e("./internal/streams/destroy"),W=e("./internal/streams/state"),q=W.getHighWaterMark,H=e("../errors").codes,z=H.ERR_INVALID_ARG_TYPE,V=H.ERR_STREAM_PUSH_AFTER_EOF,Y=H.ERR_METHOD_NOT_IMPLEMENTED,G=H.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(c,I);var J=F.errorOrDestroy,K=["error","close","destroy","pause","resume"];Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),c.prototype.destroy=F.destroy,c.prototype._undestroy=F.undestroy,c.prototype._destroy=function(e,t){t(e)},c.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=N.from(e,t),t=""),n=!0),u(this,e,t,!1,n)},c.prototype.unshift=function(e){return u(this,e,null,!0,!1)},c.prototype.isPaused=function(){return!1===this._readableState.flowing},c.prototype.setEncoding=function(t){j||(j=e("string_decoder/").StringDecoder);var n=new j(t);this._readableState.decoder=n,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=n.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var $=1073741824;c.prototype.read=function(e){L("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return L("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?R(this):g(this),null;if(e=d(e,t),0===e&&t.ended)return 0===t.length&&R(this),null;var r,i=t.needReadable;return L("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&(i=!0,L("length less than watermark",i)),t.ended||t.reading?(i=!1,L("reading or ended",i)):i&&(L("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=d(n,t))),r=e>0?S(e,t):null,null===r?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&R(this)),null!==r&&this.emit("data",r),r},c.prototype._read=function(e){J(this,new Y("_read()"))},c.prototype.pipe=function(e,t){function r(e,t){L("onunpipe"),e===f&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,o())}function i(){L("onend"),e.end()}function o(){L("cleanup"),e.removeListener("close",u),e.removeListener("finish",h),e.removeListener("drain",y),e.removeListener("error",c),e.removeListener("unpipe",r),f.removeListener("end",i),f.removeListener("end",l),f.removeListener("data",a),_=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}function a(t){L("ondata");var n=e.write(t);L("dest.write",n),!1===n&&((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&-1!==A(d.pipes,e))&&!_&&(L("false write response, pause",d.awaitDrain),d.awaitDrain++),f.pause())}function c(t){L("onerror",t),l(),e.removeListener("error",c),0===O(e,"error")&&J(e,t)}function u(){e.removeListener("finish",h),l()}function h(){L("onfinish"),e.removeListener("close",u),l()}function l(){L("unpipe"),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,L("pipe count=%d opts=%j",d.pipesCount,t);var p=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,g=p?i:l;d.endEmitted?n.nextTick(g):f.once("end",g),e.on("unpipe",r);var y=b(f);e.on("drain",y);var _=!1;return f.on("data",a),s(e,"error",c),e.once("close",u),e.once("finish",h),e.emit("pipe",f),d.flowing||(L("pipe resume"),f.resume()),e},c.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=A(t.pipes,e);return-1===s?this:(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)},c.prototype.on=function(e,t){var r=I.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,L("on readable",i.length,i.reading),i.length?g(this):i.reading||n.nextTick(v,this))),r},c.prototype.addListener=c.prototype.on,c.prototype.removeListener=function(e,t){var r=I.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(w,this),r},c.prototype.removeAllListeners=function(e){var t=I.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(w,this),t},c.prototype.resume=function(){var e=this._readableState;return e.flowing||(L("resume"),e.flowing=!e.readableListening,E(this,e)),e.paused=!1,this},c.prototype.pause=function(){return L("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(L("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},c.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(L("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){if(L("wrapped data"),n.decoder&&(i=n.decoder.write(i)),(!n.objectMode||null!=i)&&(n.objectMode||i&&i.length)){var o=t.push(i);o||(r=!0,e.pause())}}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<K.length;o++)e.on(K[o],this.emit.bind(this,K[o]));return this._read=function(t){L("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(c.prototype[Symbol.asyncIterator]=function(){return void 0===U&&(U=e("./internal/streams/async_iterator")),U(this)}),Object.defineProperty(c.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(c.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(c.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),c._fromList=S,Object.defineProperty(c.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(c.from=function(t,n){return void 0===D&&(D=e("./internal/streams/from")),D(c,t,n)})}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":20,"./_stream_duplex":21,"./internal/streams/async_iterator":26,"./internal/streams/buffer_list":27,"./internal/streams/destroy":28,"./internal/streams/from":30,"./internal/streams/state":32,"./internal/streams/stream":33,_process:17,buffer:7,events:8,inherits:14,"string_decoder/":41,util:6}],24:[function(e,t,n){"use strict";function r(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new u);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function i(e){if(!(this instanceof i))return new i(e);f.call(this,e),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",o)}function o(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?s(this,null,null):this._flush(function(t,n){s(e,t,n)})}function s(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new l;if(e._transformState.transforming)throw new h;return e.push(null)}t.exports=i;var a=e("../errors").codes,c=a.ERR_METHOD_NOT_IMPLEMENTED,u=a.ERR_MULTIPLE_CALLBACK,h=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,l=a.ERR_TRANSFORM_WITH_LENGTH_0,f=e("./_stream_duplex");e("inherits")(i,f),i.prototype.push=function(e,t){return this._transformState.needTransform=!1,f.prototype.push.call(this,e,t)},i.prototype._transform=function(e,t,n){n(new c("_transform()"))},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(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},i.prototype._destroy=function(e,t){f.prototype._destroy.call(this,e,function(e){t(e)})}},{"../errors":20,"./_stream_duplex":21,inherits:14}],25:[function(e,t,n){(function(n,r){(function(){"use strict";function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){R(t,e)}}function o(e){return O.from(e)}function s(e){return O.isBuffer(e)||e instanceof I}function a(){}function c(t,n,r){T=T||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof T),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=B(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===t.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){_(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function u(t){T=T||e("./_stream_duplex");var n=this instanceof T;if(!n&&!A.call(u,this))return new u(t);this._writableState=new c(t,this,n),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),L.call(this)}function h(e,t){var r=new H;V(e,r),n.nextTick(t,r)}function l(e,t,r,i){var o;return null===r?o=new q:"string"==typeof r||t.objectMode||(o=new U("chunk",["string","Buffer"],r)),!o||(V(e,o),n.nextTick(i,o),!1)}function f(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=O.from(t,n)),t}function d(e,t,n,r,i,o){if(!n){var s=f(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else p(e,t,!1,a,r,i,o);return c}function p(e,t,n,r,i,o,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new W("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function g(e,t,r,i,o){--t.pendingcb,r?(n.nextTick(o,i),n.nextTick(k,e,t),e._writableState.errorEmitted=!0,V(e,i)):(o(i),e._writableState.errorEmitted=!0,V(e,i),k(e,t))}function y(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function _(e,t){var r=e._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new P;if(y(r),t)g(e,r,i,t,o);else{var s=v(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),i?n.nextTick(m,e,r,s,o):m(e,r,s,o)}}function m(e,t,n,r){n||b(e,t),t.pendingcb--,r(),k(e,t)}function b(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function w(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),s=t.corkedRequestsFree;s.entry=n;for(var a=0,c=!0;n;)o[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;o.allBuffers=c,p(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,h=n.encoding,l=n.callback,f=t.objectMode?1:u.length;if(p(e,t,!1,f,u,h,l),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function v(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function E(e,t){e._final(function(n){t.pendingcb--,n&&V(e,n),t.prefinished=!0,e.emit("prefinish"),k(e,t)})}function C(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(E,e,t)))}function k(e,t){var n=v(t);if(n&&(C(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}function S(e,t,r){t.ending=!0,k(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function R(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}var T;t.exports=u,u.WritableState=c;var A,x={deprecate:e("util-deprecate")},L=e("./internal/streams/stream"),O=e("buffer").Buffer,I=r.Uint8Array||function(){},N=e("./internal/streams/destroy"),M=e("./internal/streams/state"),B=M.getHighWaterMark,j=e("../errors").codes,U=j.ERR_INVALID_ARG_TYPE,D=j.ERR_METHOD_NOT_IMPLEMENTED,P=j.ERR_MULTIPLE_CALLBACK,F=j.ERR_STREAM_CANNOT_PIPE,W=j.ERR_STREAM_DESTROYED,q=j.ERR_STREAM_NULL_VALUES,H=j.ERR_STREAM_WRITE_AFTER_END,z=j.ERR_UNKNOWN_ENCODING,V=N.errorOrDestroy;e("inherits")(u,L),c.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(c.prototype,"buffer",{get:x.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(A=Function.prototype[Symbol.hasInstance],Object.defineProperty(u,Symbol.hasInstance,{value:function(e){return!!A.call(this,e)||this===u&&(e&&e._writableState instanceof c)}})):A=function(e){return e instanceof this},u.prototype.pipe=function(){V(this,new F)},u.prototype.write=function(e,t,n){var r=this._writableState,i=!1,c=!r.objectMode&&s(e);return c&&!O.isBuffer(e)&&(e=o(e)),"function"==typeof t&&(n=t,t=null),c?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=a),r.ending?h(this,n):(c||l(this,r,e,n))&&(r.pendingcb++,i=d(this,r,c,e,t,n)),i},u.prototype.cork=function(){this._writableState.corked++},u.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||w(this,e))},u.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new z(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),u.prototype._write=function(e,t,n){n(new D("_write()"))},u.prototype._writev=null,u.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||S(this,r,n),this},Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),u.prototype.destroy=N.destroy,u.prototype._undestroy=N.undestroy,u.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":20,"./_stream_duplex":21,"./internal/streams/destroy":28,"./internal/streams/state":32,"./internal/streams/stream":33,_process:17,buffer:7,inherits:14,"util-deprecate":42}],26:[function(e,t,n){(function(n){(function(){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){return{value:e,done:t}}function o(e){var t=e[h];if(null!==t){var n=e[y].read();null!==n&&(e[p]=null,e[h]=null,e[l]=null,t(i(n,!1)))}}function s(e){n.nextTick(o,e)}function a(e,t){return function(n,r){e.then(function(){t[d]?n(i(void 0,!0)):t[g](n,r)},r)}}var c,u=e("./end-of-stream"),h=Symbol("lastResolve"),l=Symbol("lastReject"),f=Symbol("error"),d=Symbol("ended"),p=Symbol("lastPromise"),g=Symbol("handlePromise"),y=Symbol("stream"),_=Object.getPrototypeOf(function(){}),m=Object.setPrototypeOf((c={get stream(){return this[y]},next:function(){var e=this,t=this[f];if(null!==t)return Promise.reject(t);if(this[d])return Promise.resolve(i(void 0,!0));if(this[y].destroyed)return new Promise(function(t,r){n.nextTick(function(){e[f]?r(e[f]):t(i(void 0,!0))})});var r,o=this[p];if(o)r=new Promise(a(o,this));else{var s=this[y].read();if(null!==s)return Promise.resolve(i(s,!1));r=new Promise(this[g])}return this[p]=r,r}},r(c,Symbol.asyncIterator,function(){return this}),r(c,"return",function(){var e=this;return new Promise(function(t,n){e[y].destroy(null,function(e){e?n(e):t(i(void 0,!0))})})}),c),_),b=function(e){var t,n=Object.create(m,(t={},r(t,y,{value:e,writable:!0}),r(t,h,{value:null,writable:!0}),r(t,l,{value:null,writable:!0}),r(t,f,{value:null,writable:!0}),r(t,d,{value:e._readableState.endEmitted,writable:!0}),r(t,g,{value:function(e,t){var r=n[y].read();r?(n[p]=null,n[h]=null,n[l]=null,e(i(r,!1))):(n[h]=e,n[l]=t)},writable:!0}),t));return n[p]=null,u(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[l];return null!==t&&(n[p]=null,n[h]=null,n[l]=null,t(e)),void(n[f]=e)}var r=n[h];null!==r&&(n[p]=null,n[h]=null,n[l]=null,r(i(void 0,!0))),n[d]=!0}),e.on("readable",s.bind(null,n)),n};t.exports=b}).call(this)}).call(this,e("_process"))},{"./end-of-stream":29,_process:17}],27:[function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}function u(e,t,n){l.prototype.copy.call(e,t,n)}var h=e("buffer"),l=h.Buffer,f=e("util"),d=f.inspect,p=d&&d.custom||"inspect";t.exports=function(){function e(){s(this,e),this.head=null,this.tail=null,this.length=0}return c(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return l.alloc(0);for(var t=l.allocUnsafe(e>>>0),n=this.head,r=0;n;)u(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),e-=o,0===e){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),e-=o,0===e){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,t}},{key:p,value:function(e,t){return d(this,i({},t,{depth:0,customInspect:!1}))}}]),e}()},{buffer:7,util:6}],28:[function(e,t,n){(function(e){(function(){"use strict";function n(t,n){var o=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(n?n(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(s,this,t)):e.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!n&&t?o._writableState?o._writableState.errorEmitted?e.nextTick(i,o):(o._writableState.errorEmitted=!0,e.nextTick(r,o,t)):e.nextTick(r,o,t):n?(e.nextTick(i,o),n(t)):e.nextTick(i,o)}),this)}function r(e,t){s(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(e,t){e.emit("error",t)}function a(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}t.exports={destroy:n,undestroy:o,errorOrDestroy:a}}).call(this)}).call(this,e("_process"))},{_process:17}],29:[function(e,t,n){"use strict";function r(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}function i(){}function o(e){return e.setHeader&&"function"==typeof e.abort}function s(e,t,n){if("function"==typeof t)return s(e,null,t);t||(t={}),n=r(n||i);var c=t.readable||!1!==t.readable&&e.readable,u=t.writable||!1!==t.writable&&e.writable,h=function(){e.writable||f()},l=e._writableState&&e._writableState.finished,f=function(){u=!1,l=!0,c||n.call(e)},d=e._readableState&&e._readableState.endEmitted,p=function(){c=!1,d=!0,u||n.call(e)},g=function(t){n.call(e,t)},y=function(){var t;return c&&!d?(e._readableState&&e._readableState.ended||(t=new a),n.call(e,t)):u&&!l?(e._writableState&&e._writableState.ended||(t=new a),n.call(e,t)):void 0},_=function(){e.req.on("finish",f)};return o(e)?(e.on("complete",f),e.on("abort",y),e.req?_():e.on("request",_)):u&&!e._writableState&&(e.on("end",h),e.on("close",h)),e.on("end",p),e.on("finish",f),!1!==t.error&&e.on("error",g),e.on("close",y),function(){e.removeListener("complete",f),e.removeListener("abort",y),e.removeListener("request",_),e.req&&e.req.removeListener("finish",f),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",f),e.removeListener("end",p),e.removeListener("error",g),e.removeListener("close",y)}}var a=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;t.exports=s},{"../../../errors":20}],30:[function(e,t,n){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],31:[function(e,t,n){"use strict";function r(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}function i(e){if(e)throw e}function o(e){return e.setHeader&&"function"==typeof e.abort}function s(t,n,i,s){s=r(s);var a=!1;t.on("close",function(){a=!0}),void 0===l&&(l=e("./end-of-stream")),l(t,{readable:n,writable:i},function(e){if(e)return s(e);a=!0,s()});var c=!1;return function(e){if(!a&&!c)return c=!0,o(t)?t.abort():"function"==typeof t.destroy?t.destroy():void s(e||new p("pipe"))}}function a(e){e()}function c(e,t){return e.pipe(t)}function u(e){return e.length?"function"!=typeof e[e.length-1]?i:e.pop():i}function h(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=u(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new d("streams");var o=t.map(function(e,n){var c=n<t.length-1,u=n>0;return s(e,c,u,function(e){r||(r=e),e&&o.forEach(a),c||(o.forEach(a),i(r))})});return t.reduce(c)}var l,f=e("../../../errors").codes,d=f.ERR_MISSING_ARGS,p=f.ERR_STREAM_DESTROYED;t.exports=h},{"../../../errors":20,"./end-of-stream":29}],32:[function(e,t,n){"use strict";function r(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}function i(e,t,n,i){var s=r(t,i,n);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0){var a=i?n:"highWaterMark";throw new o(a,s)}return Math.floor(s)}return e.objectMode?16:16384}var o=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:i}},{"../../../errors":20}],33:[function(e,t,n){t.exports=e("events").EventEmitter},{events:8}],34:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),n.Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),
n.PassThrough=e("./lib/_stream_passthrough.js"),n.finished=e("./lib/internal/streams/end-of-stream.js"),n.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":21,"./lib/_stream_passthrough.js":22,"./lib/_stream_readable.js":23,"./lib/_stream_transform.js":24,"./lib/_stream_writable.js":25,"./lib/internal/streams/end-of-stream.js":29,"./lib/internal/streams/pipeline.js":31}],35:[function(e,t,n){var r,i;r="undefined"!=typeof self?self:this,i=function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(5),o=n(1),s=o.toHex,a=o.ceilHeapSize,c=n(6),u=function(e){for(e+=9;e%64>0;e+=1);return e},h=function(e,t){var n=new Uint8Array(e.buffer),r=t%4,i=t-r;switch(r){case 0:n[i+3]=0;case 1:n[i+2]=0;case 2:n[i+1]=0;case 3:n[i+0]=0}for(var o=1+(t>>2);o<e.length;o++)e[o]=0},l=function(e,t,n){e[t>>2]|=128<<24-(t%4<<3),e[14+(2+(t>>2)&-16)]=n/(1<<29)|0,e[15+(2+(t>>2)&-16)]=n<<3},f=function(e,t){var n=new Int32Array(e,t+320,5),r=new Int32Array(5),i=new DataView(r.buffer);return i.setInt32(0,n[0],!1),i.setInt32(4,n[1],!1),i.setInt32(8,n[2],!1),i.setInt32(12,n[3],!1),i.setInt32(16,n[4],!1),r},d=function(){function e(t){if(r(this,e),t=t||65536,t%64>0)throw new Error("Chunk size must be a multiple of 128 bit");this._offset=0,this._maxChunkLen=t,this._padMaxChunkLen=u(t),this._heap=new ArrayBuffer(a(this._padMaxChunkLen+320+20)),this._h32=new Int32Array(this._heap),this._h8=new Int8Array(this._heap),this._core=new i({Int32Array:Int32Array},{},this._heap)}return e.prototype._initState=function(e,t){this._offset=0;var n=new Int32Array(e,t+320,5);n[0]=1732584193,n[1]=-271733879,n[2]=-1732584194,n[3]=271733878,n[4]=-1009589776},e.prototype._padChunk=function(e,t){var n=u(e),r=new Int32Array(this._heap,0,n>>2);return h(r,e),l(r,e,t),n},e.prototype._write=function(e,t,n,r){c(e,this._h8,this._h32,t,n,r||0)},e.prototype._coreCall=function(e,t,n,r,i){var o=n;this._write(e,t,n),i&&(o=this._padChunk(n,r)),this._core.hash(o,this._padMaxChunkLen)},e.prototype.rawDigest=function(e){var t=e.byteLength||e.length||e.size||0;this._initState(this._heap,this._padMaxChunkLen);var n=0,r=this._maxChunkLen;for(n=0;t>n+r;n+=r)this._coreCall(e,n,r,t,!1);return this._coreCall(e,n,t-n,t,!0),f(this._heap,this._padMaxChunkLen)},e.prototype.digest=function(e){return s(this.rawDigest(e).buffer)},e.prototype.digestFromString=function(e){return this.digest(e)},e.prototype.digestFromBuffer=function(e){return this.digest(e)},e.prototype.digestFromArrayBuffer=function(e){return this.digest(e)},e.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},e.prototype.append=function(e){var t=0,n=e.byteLength||e.length||e.size||0,r=this._offset%this._maxChunkLen,i=void 0;for(this._offset+=n;t<n;)i=Math.min(n-t,this._maxChunkLen-r),this._write(e,t,i,r),r+=i,t+=i,r===this._maxChunkLen&&(this._core.hash(this._maxChunkLen,this._padMaxChunkLen),r=0);return this},e.prototype.getState=function(){var e=this._offset%this._maxChunkLen,t=void 0;if(e)t=this._heap.slice(0);else{var n=new Int32Array(this._heap,this._padMaxChunkLen+320,5);t=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}return{offset:this._offset,heap:t}},e.prototype.setState=function(e){if(this._offset=e.offset,20===e.heap.byteLength){var t=new Int32Array(this._heap,this._padMaxChunkLen+320,5);t.set(new Int32Array(e.heap))}else this._h32.set(new Int32Array(e.heap));return this},e.prototype.rawEnd=function(){var e=this._offset,t=e%this._maxChunkLen,n=this._padChunk(t,e);this._core.hash(n,this._padMaxChunkLen);var r=f(this._heap,this._padMaxChunkLen);return this._initState(this._heap,this._padMaxChunkLen),r},e.prototype.end=function(){return s(this.rawEnd().buffer)},e}();e.exports=d,e.exports._core=i},function(e,t){for(var n=new Array(256),r=0;r<256;r++)n[r]=(r<16?"0":"")+r.toString(16);e.exports.toHex=function(e){for(var t=new Uint8Array(e),r=new Array(e.byteLength),i=0;i<r.length;i++)r[i]=n[t[i]];return r.join("")},e.exports.ceilHeapSize=function(e){var t=0;if(e<=65536)return 65536;if(e<16777216)for(t=1;t<e;t<<=1);else for(t=16777216;t<e;t+=16777216);return t},e.exports.isDedicatedWorkerScope=function(e){var t="WorkerGlobalScope"in e&&e instanceof e.WorkerGlobalScope,n="SharedWorkerGlobalScope"in e&&e instanceof e.SharedWorkerGlobalScope,r="ServiceWorkerGlobalScope"in e&&e instanceof e.ServiceWorkerGlobalScope;return t&&!n&&!r}},function(e,t,n){e.exports=function(){var e=n(0),t=function(e,t,n){try{return n(null,e.digest(t))}catch(e){return n(e)}},r=function(e,t,n,i,o){var s=new self.FileReader;s.onloadend=function(){if(s.error)return o(s.error);var a=s.result;t+=s.result.byteLength;try{e.append(a)}catch(e){return void o(e)}t<i.size?r(e,t,n,i,o):o(null,e.end())},s.readAsArrayBuffer(i.slice(t,t+n))},i=!0;return self.onmessage=function(n){if(i){var o=n.data.data,s=n.data.file,a=n.data.id;if(void 0!==a&&(s||o)){var c=n.data.blockSize||4194304,u=new e(c);u.resetState();var h=function(e,t){e?self.postMessage({id:a,error:e.name}):self.postMessage({id:a,hash:t})};o&&t(u,o,h),s&&r(u,0,c,s,h)}}},function(){i=!1}}},function(e,t,n){var r=n(4),i=n(0),o=n(7),s=n(2),a=n(1),c=a.isDedicatedWorkerScope,u="undefined"!=typeof self&&c(self);i.disableWorkerBehaviour=u?s():function(){},i.createWorker=function(){var e=r(2),t=e.terminate;return e.terminate=function(){URL.revokeObjectURL(e.objectURL),t.call(e)},e},i.createHash=o,e.exports=i},function(e,t,n){function r(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t.oe=function(e){throw console.error(e),e};var r=t(t.s=ENTRY_MODULE);return r.default||r}function i(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function o(e,t,r){var o={};o[r]=[];var s=t.toString(),a=s.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return o;for(var h,l=a[1],f=new RegExp("(\\\\n|\\W)"+i(l)+u,"g");h=f.exec(s);)"dll-reference"!==h[3]&&o[r].push(h[3]);for(f=new RegExp("\\("+i(l)+'\\("(dll-reference\\s('+c+'))"\\)\\)'+u,"g");h=f.exec(s);)e[h[2]]||(o[r].push(h[1]),e[h[2]]=n(h[1]).m),o[h[2]]=o[h[2]]||[],o[h[2]].push(h[4]);return o}function s(e){var t=Object.keys(e);return t.reduce(function(t,n){return t||e[n].length>0},!1)}function a(e,t){for(var n={main:[t]},r={main:[]},i={main:{}};s(n);)for(var a=Object.keys(n),c=0;c<a.length;c++){var u=a[c],h=n[u],l=h.pop();if(i[u]=i[u]||{},!i[u][l]&&e[u][l]){i[u][l]=!0,r[u]=r[u]||[],r[u].push(l);for(var f=o(e,e[u][l],u),d=Object.keys(f),p=0;p<d.length;p++)n[d[p]]=n[d[p]]||[],n[d[p]]=n[d[p]].concat(f[d[p]])}}return r}var c="[\\.|\\-|\\+|\\w|/|@]+",u="\\((/\\*.*?\\*/)?s?.*?("+c+").*?\\)";e.exports=function(e,t){t=t||{};var i={main:n.m},o=t.all?{main:Object.keys(i)}:a(i,e),s="";Object.keys(o).filter(function(e){return"main"!==e}).forEach(function(e){for(var t=0;o[e][t];)t++;o[e].push(t),i[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",s=s+"var "+e+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+o[e].map(function(t){return JSON.stringify(t)+": "+i[e][t].toString()}).join(",")+"});\n"}),s=s+"("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+o.main.map(function(e){return JSON.stringify(e)+": "+i.main[e].toString()}).join(",")+"})(self);";var c=new window.Blob([s],{type:"text/javascript"});if(t.bare)return c;var u=window.URL||window.webkitURL||window.mozURL||window.msURL,h=u.createObjectURL(c),l=new window.Worker(h);return l.objectURL=h,l}},function(e,t){e.exports=function(e,t,n){"use asm";var r=new e.Int32Array(n);function i(e,t){e=e|0;t=t|0;var n=0,i=0,o=0,s=0,a=0,c=0,u=0,h=0,l=0,f=0,d=0,p=0,g=0,y=0;o=r[t+320>>2]|0;a=r[t+324>>2]|0;u=r[t+328>>2]|0;l=r[t+332>>2]|0;d=r[t+336>>2]|0;for(n=0;(n|0)<(e|0);n=n+64|0){s=o;c=a;h=u;f=l;p=d;for(i=0;(i|0)<64;i=i+4|0){y=r[n+i>>2]|0;g=((o<<5|o>>>27)+(a&u|~a&l)|0)+((y+d|0)+1518500249|0)|0;d=l;l=u;u=a<<30|a>>>2;a=o;o=g;r[e+i>>2]=y}for(i=e+64|0;(i|0)<(e+80|0);i=i+4|0){y=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;g=((o<<5|o>>>27)+(a&u|~a&l)|0)+((y+d|0)+1518500249|0)|0;d=l;l=u;u=a<<30|a>>>2;a=o;o=g;r[i>>2]=y}for(i=e+80|0;(i|0)<(e+160|0);i=i+4|0){y=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;g=((o<<5|o>>>27)+(a^u^l)|0)+((y+d|0)+1859775393|0)|0;d=l;l=u;u=a<<30|a>>>2;a=o;o=g;r[i>>2]=y}for(i=e+160|0;(i|0)<(e+240|0);i=i+4|0){y=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;g=((o<<5|o>>>27)+(a&u|a&l|u&l)|0)+((y+d|0)-1894007588|0)|0;d=l;l=u;u=a<<30|a>>>2;a=o;o=g;r[i>>2]=y}for(i=e+240|0;(i|0)<(e+320|0);i=i+4|0){y=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;g=((o<<5|o>>>27)+(a^u^l)|0)+((y+d|0)-899497514|0)|0;d=l;l=u;u=a<<30|a>>>2;a=o;o=g;r[i>>2]=y}o=o+s|0;a=a+c|0;u=u+h|0;l=l+f|0;d=d+p|0}r[t+320>>2]=o;r[t+324>>2]=a;r[t+328>>2]=u;r[t+332>>2]=l;r[t+336>>2]=d}return{hash:i}}},function(e,t){var n=this,r=void 0;"undefined"!=typeof self&&void 0!==self.FileReaderSync&&(r=new self.FileReaderSync);var i=function(e,t,n,r,i,o){var s=void 0,a=o%4,c=(i+a)%4,u=i-c;switch(a){case 0:t[o]=e.charCodeAt(r+3);case 1:t[o+1-(a<<1)|0]=e.charCodeAt(r+2);case 2:t[o+2-(a<<1)|0]=e.charCodeAt(r+1);case 3:t[o+3-(a<<1)|0]=e.charCodeAt(r)}if(!(i<c+(4-a))){for(s=4-a;s<u;s=s+4|0)n[o+s>>2]=e.charCodeAt(r+s)<<24|e.charCodeAt(r+s+1)<<16|e.charCodeAt(r+s+2)<<8|e.charCodeAt(r+s+3);switch(c){case 3:t[o+u+1|0]=e.charCodeAt(r+u+2);case 2:t[o+u+2|0]=e.charCodeAt(r+u+1);case 1:t[o+u+3|0]=e.charCodeAt(r+u)}}},o=function(e,t,n,r,i,o){var s=void 0,a=o%4,c=(i+a)%4,u=i-c;switch(a){case 0:t[o]=e[r+3];case 1:t[o+1-(a<<1)|0]=e[r+2];case 2:t[o+2-(a<<1)|0]=e[r+1];case 3:t[o+3-(a<<1)|0]=e[r]}if(!(i<c+(4-a))){for(s=4-a;s<u;s=s+4|0)n[o+s>>2|0]=e[r+s]<<24|e[r+s+1]<<16|e[r+s+2]<<8|e[r+s+3];switch(c){case 3:t[o+u+1|0]=e[r+u+2];case 2:t[o+u+2|0]=e[r+u+1];case 1:t[o+u+3|0]=e[r+u]}}},s=function(e,t,n,i,o,s){var a=void 0,c=s%4,u=(o+c)%4,h=o-u,l=new Uint8Array(r.readAsArrayBuffer(e.slice(i,i+o)));switch(c){case 0:t[s]=l[3];case 1:t[s+1-(c<<1)|0]=l[2];case 2:t[s+2-(c<<1)|0]=l[1];case 3:t[s+3-(c<<1)|0]=l[0]}if(!(o<u+(4-c))){for(a=4-c;a<h;a=a+4|0)n[s+a>>2|0]=l[a]<<24|l[a+1]<<16|l[a+2]<<8|l[a+3];switch(u){case 3:t[s+h+1|0]=l[h+2];case 2:t[s+h+2|0]=l[h+1];case 1:t[s+h+3|0]=l[h]}}};e.exports=function(e,t,r,a,c,u){if("string"==typeof e)return i(e,t,r,a,c,u);if(e instanceof Array)return o(e,t,r,a,c,u);if(n&&n.Buffer&&n.Buffer.isBuffer(e))return o(e,t,r,a,c,u);if(e instanceof ArrayBuffer)return o(new Uint8Array(e),t,r,a,c,u);if(e.buffer instanceof ArrayBuffer)return o(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t,r,a,c,u);if(e instanceof Blob)return s(e,t,r,a,c,u);throw new Error("Unsupported data type.")}},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(0),o=n(1),s=o.toHex,a=function(){function e(){r(this,e),this._rusha=new i,this._rusha.resetState()}return e.prototype.update=function(e){return this._rusha.append(e),this},e.prototype.digest=function(e){var t=this._rusha.rawEnd().buffer;if(!e)return t;if("hex"===e)return s(t);throw new Error("unsupported digest encoding")},e}();e.exports=function(){return new a}}])},"object"==typeof n&&"object"==typeof t?t.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof n?n.Rusha=i():r.Rusha=i()},{}],36:[function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return s(e,t,n)}var o=e("buffer"),s=o.Buffer;s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?t.exports=o:(r(o,n),n.Buffer=i),i.prototype=Object.create(s.prototype),r(s,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return s(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=s(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return s(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o.SlowBuffer(e)}},{buffer:7}],37:[function(e,t,n){function r(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function i(e){console.warn(e)}const o=e("debug")("simple-peer"),s=e("get-browser-rtc"),a=e("randombytes"),c=e("readable-stream"),u=e("queue-microtask"),h=e("err-code"),{Buffer:l}=e("buffer"),f=65536,d=5e3,p=5e3;class g extends c.Duplex{constructor(e){if(e=Object.assign({allowHalfOpen:!1},e),super(e),this._id=a(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||a(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||g.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},g.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.iceCompleteTimeout||d,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:s(),!this._wrtc)throw"undefined"==typeof window?h(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):h(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(e){return void u(()=>this.destroy(h(e,"ERR_PC_CONSTRUCTOR")))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=(()=>{this._onIceStateChange()}),this._pc.onicegatheringstatechange=(()=>{this._onIceStateChange()}),this._pc.onconnectionstatechange=(()=>{this._onConnectionStateChange()}),this._pc.onsignalingstatechange=(()=>{this._onSignalingStateChange()}),this._pc.onicecandidate=(e=>{this._onIceCandidate(e)}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=(e=>{this._setupData(e)}),this.streams&&this.streams.forEach(e=>{this.addStream(e)}),this._pc.ontrack=(e=>{this._onTrack(e)}),this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=(()=>{this._onFinish()}),this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(this.destroyed)throw h(new Error("cannot signal after peer is destroyed"),"ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(e=>{this._addIceCandidate(e)}),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())}).catch(e=>{this.destroy(h(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(h(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}_addIceCandidate(e){const t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch(e=>{!t.address||t.address.endsWith(".local")?i("Ignoring unsupported ICE candidate."):this.destroy(h(e,"ERR_ADD_ICE_CANDIDATE"))})}send(e){this._channel.send(e)}addTransceiver(e,t){if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(h(e,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:e,init:t}})}addStream(e){this._debug("addStream()"),e.getTracks().forEach(t=>{this.addTrack(t,e)})}addTrack(e,t){this._debug("addTrack()");const n=this._senderMap.get(e)||new Map;let r=n.get(t);if(r)throw r.removed?h(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):h(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");r=this._pc.addTrack(e,t),n.set(t,r),this._senderMap.set(e,n),this._needsNegotiation()}replaceTrack(e,t,n){this._debug("replaceTrack()");const r=this._senderMap.get(e),i=r?r.get(n):null;if(!i)throw h(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,r),null!=i.replaceTrack?i.replaceTrack(t):this.destroy(h(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(e,t){this._debug("removeSender()");const n=this._senderMap.get(e),r=n?n.get(t):null;if(!r)throw h(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{r.removed=!0,this._pc.removeTrack(r)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(r):this.destroy(h(e,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(e){this._debug("removeSenders()"),e.getTracks().forEach(t=>{this.removeTrack(t,e)})}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,u(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}destroy(e){this._destroy(e,()=>{})}_destroy(e,t){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",e&&(e.message||e)),u(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()}))}_setupData(e){if(!e.channel)return this.destroy(h(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=f),this.channelName=this._channel.label,this._channel.onmessage=(e=>{this._onChannelMessage(e)}),this._channel.onbufferedamountlow=(()=>{this._onChannelBufferedAmountLow()}),this._channel.onopen=(()=>{this._onChannelOpen()}),this._channel.onclose=(()=>{this._onChannelClose()}),this._channel.onerror=(e=>{this.destroy(h(e,"ERR_DATA_CHANNEL"))});let t=!1;this._closingInterval=setInterval(()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1},p)}_read(){}_write(e,t,n){if(this.destroyed)return n(h(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(e){return this.destroy(h(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>f?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n}_onFinish(){if(this.destroyed)return;const e=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?e():this.once("connect",e)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=r(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(this.destroyed)return;const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})},n=()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))},i=e=>{this.destroy(h(e,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(e).then(n).catch(i)}).catch(e=>{this.destroy(h(e,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(e=>{e.mid||!e.sender.track||e.requested||(e.requested=!0,this.addTransceiver(e.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=r(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(this.destroyed)return;const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers()},n=()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))},i=e=>{this.destroy(h(e,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(e).then(n).catch(i)}).catch(e=>{this.destroy(h(e,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(h(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(h(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(h(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(e){const t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(t=>{Object.assign(e,t)}),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then(n=>{const r=[];n.forEach(e=>{r.push(t(e))}),e(null,r)},t=>e(t)):this._pc.getStats.length>0?this._pc.getStats(n=>{if(this.destroyed)return;const r=[];n.result().forEach(e=>{const n={};e.names().forEach(t=>{n[t]=e.stat(t)}),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,r.push(t(n))}),e(null,r)},t=>e(t)):e(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const e=()=>{this.destroyed||this.getStats((t,n)=>{if(this.destroyed)return;t&&(n=[]);const r={},i={},o={};let s=!1;n.forEach(e=>{"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(r[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(i[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(o[e.id]=e)});const a=e=>{s=!0;let t=i[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):"string"==typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let n=r[e.remoteCandidateId];n&&(n.ip||n.address)?(this.remoteAddress=n.ip||n.address,this.remotePort=Number(n.port)):n&&n.ipAddress?(this.remoteAddress=n.ipAddress,this.remotePort=Number(n.portNumber)):"string"==typeof e.googRemoteAddress&&(n=e.googRemoteAddress.split(":"),this.remoteAddress=n[0],this.remotePort=Number(n[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(n.forEach(e=>{"transport"===e.type&&e.selectedCandidatePairId&&a(o[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&a(e)}),s||Object.keys(o).length&&!Object.keys(i).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.destroy(h(t,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(e,100)})};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>f||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(e=>{this._pc.removeTrack(e),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=l.from(t)),this.push(t)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const e=this._cb;this._cb=null,e(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(e){this.destroyed||e.streams.forEach(t=>{this._debug("on track"),this.emit("track",e.track,t),this._remoteTracks.push({track:e.track,stream:t}),this._remoteStreams.some(e=>e.id===t.id)||(this._remoteStreams.push(t),u(()=>{this._debug("on stream"),this.emit("stream",t)}))})}_debug(){const e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],o.apply(null,e)}}g.WEBRTC_SUPPORT=!!s(),g.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},g.channelConfig={},t.exports=g},{buffer:7,debug:9,"err-code":11,"get-browser-rtc":12,"queue-microtask":18,randombytes:19,"readable-stream":34}],38:[function(e,t,n){function r(e){return u.digest(e)}function i(e,t){f?("string"==typeof e&&(e=o(e)),f.digest({name:"sha-1"},e).then(function(e){t(s(new Uint8Array(e)))},function(){t(r(e))})):"undefined"!=typeof window?c(e,function(n,i){t(n?r(e):i)}):queueMicrotask(()=>t(r(e)))}function o(e){for(var t=e.length,n=new Uint8Array(t),r=0;r<t;r++)n[r]=e.charCodeAt(r);return n}function s(e){for(var t=e.length,n=[],r=0;r<t;r++){var i=e[r];n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")}var a=e("rusha"),c=e("./rusha-worker-sha1"),u=new a,h="undefined"!=typeof window?window:self,l=h.crypto||h.msCrypto||{},f=l.subtle||l.webkitSubtle;try{f.digest({name:"sha-1"},new Uint8Array).catch(function(){f=!1})}catch(e){f=!1}t.exports=i,t.exports.sync=r},{"./rusha-worker-sha1":39,rusha:35}],39:[function(e,t,n){function r(){o=c.createWorker(),s=1,a={},o.onmessage=function(e){var t=e.data.id,n=a[t];delete a[t],null!=e.data.error?n(new Error("Rusha worker error: "+e.data.error)):n(null,e.data.hash)}}function i(e,t){o||r(),a[s]=t,o.postMessage({id:s,data:e}),s+=1}var o,s,a,c=e("rusha");t.exports=i},{rusha:35}],40:[function(e,t,n){(function(n){(function(){const r=e("debug")("simple-websocket"),i=e("randombytes"),o=e("readable-stream"),s=e("queue-microtask"),a=e("ws"),c="function"!=typeof a?WebSocket:a,u=65536;class h extends o.Duplex{constructor(e={}){if("string"==typeof e&&(e={url:e}),e=Object.assign({allowHalfOpen:!1},e),super(e),null==e.url&&null==e.socket)throw new Error("Missing required `url` or `socket` option");if(null!=e.url&&null!=e.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(this._id=i(4).toString("hex").slice(0,7),this._debug("new websocket: %o",e),this.connected=!1,this.destroyed=!1,this._chunk=null,this._cb=null,this._interval=null,e.socket)this.url=e.socket.url,this._ws=e.socket,this.connected=e.socket.readyState===c.OPEN;else{this.url=e.url;try{this._ws="function"==typeof a?new c(e.url,e):new c(e.url)}catch(e){return void s(()=>this.destroy(e))}}this._ws.binaryType="arraybuffer",this._ws.onopen=(()=>{this._onOpen()}),this._ws.onmessage=(e=>{this._onMessage(e)}),
this._ws.onclose=(()=>{this._onClose()}),this._ws.onerror=(()=>{this.destroy(new Error("connection error to "+this.url))}),this._onFinishBound=(()=>{this._onFinish()}),this.once("finish",this._onFinishBound)}send(e){this._ws.send(e)}destroy(e){this._destroy(e,()=>{})}_destroy(e,t){if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.connected=!1,this.destroyed=!0,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._ws){const t=this._ws,n=()=>{t.onclose=null};if(t.readyState===c.CLOSED)n();else try{t.onclose=n,t.close()}catch(e){n()}t.onopen=null,t.onmessage=null,t.onerror=(()=>{})}if(this._ws=null,e){if("undefined"!=typeof DOMException&&e instanceof DOMException){const t=e.code;e=new Error(e.message),e.code=t}this.emit("error",e)}this.emit("close"),t()}}_read(){}_write(e,t,n){if(this.destroyed)return n(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof a&&this._ws.bufferedAmount>u?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n}_onFinish(){if(this.destroyed)return;const e=()=>{setTimeout(()=>this.destroy(),1e3)};this.connected?e():this.once("connect",e)}_onMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=n.from(t)),this.push(t)}_onOpen(){if(!this.connected&&!this.destroyed){if(this.connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(e)}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(null)}"function"!=typeof a&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}}_onInterval(){if(!this._cb||!this._ws||this._ws.bufferedAmount>u)return;this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);const e=this._cb;this._cb=null,e(null)}_onClose(){this.destroyed||(this._debug("on close"),this.destroy())}_debug(){const e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],r.apply(null,e)}}h.WEBSOCKET_SUPPORT=!!c,t.exports=h}).call(this)}).call(this,e("buffer").Buffer)},{buffer:7,debug:9,"queue-microtask":18,randombytes:19,"readable-stream":34,ws:6}],41:[function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function i(e){var t=r(e);if("string"!=typeof t&&(m.isEncoding===b||!b(e)))throw new Error("Unknown encoding: "+e);return t||e}function o(e){var t;switch(this.encoding=i(e),this.encoding){case"utf16le":this.text=f,this.end=d,t=4;break;case"utf8":this.fillLast=u,t=4;break;case"base64":this.text=p,this.end=g,t=3;break;default:return this.write=y,void(this.end=_)}this.lastNeed=0,this.lastTotal=0,this.lastChar=m.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e,t,n){var r=t.length-1;if(r<n)return 0;var i=s(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||-2===i?0:(i=s(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||-2===i?0:(i=s(t[r]),i>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}function u(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function h(e,t){var n=a(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function f(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function d(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function p(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function g(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function y(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):""}var m=e("safe-buffer").Buffer,b=m.isEncoding||function(e){switch(e=""+e,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}};n.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},o.prototype.end=l,o.prototype.text=h,o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":36}],42:[function(e,t,n){(function(e){(function(){function n(e,t){function n(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(r("noDeprecation"))return e;var i=!1;return n}function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=n}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);