(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.P2P=e()}})(function(){var e,t,r;return function n(e,t,r){function i(a,s){if(!t[a]){if(!e[a]){var f=typeof require=="function"&&require;if(!s&&f)return f(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=t[a]={exports:{}};e[a][0].call(u.exports,function(t){var r=e[a][1][t];return i(r?r:t)},u,u.exports,n,e,t,r)}return t[a].exports}var o=typeof require=="function"&&require;for(var a=0;aa)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+a.toString(16)+" bytes");if(i<0)i=0;else i>>>=0;var c=this;if(f.TYPED_ARRAY_SUPPORT){c=f._augment(new Uint8Array(i))}else{c.length=i;c._isBuffer=true}var u;if(f.TYPED_ARRAY_SUPPORT&&typeof e.byteLength==="number"){c._set(e)}else if(P(e)){if(f.isBuffer(e)){for(u=0;u0&&i<=f.poolSize)c.parent=s;return c}function c(e,t,r){if(!(this instanceof c))return new c(e,t,r);var n=new f(e,t,r);delete n.parent;return n}f.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};f.compare=function(e,t){if(!f.isBuffer(e)||!f.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;var r=e.length;var n=t.length;for(var i=0,o=Math.min(r,n);i>>1;break;case"utf8":case"utf-8":r=j(e).length;break;case"base64":r=O(e).length;break;default:r=e.length}return r};f.prototype.length=undefined;f.prototype.parent=undefined;f.prototype.toString=function(e,t,r){var n=false;t=t>>>0;r=r===undefined||r===Infinity?this.length:r>>>0;if(!e)e="utf8";if(t<0)t=0;if(r>this.length)r=this.length;if(r<=t)return"";while(true){switch(e){case"hex":return w(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return y(this,t,r);case"binary":return m(this,t,r);case"base64":return v(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();n=true}}};f.prototype.equals=function(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return true;return f.compare(this,e)===0};f.prototype.inspect=function(){var e="";var t=r.INSPECT_MAX_BYTES;if(this.length>0){e=this.toString("hex",0,t).match(/.{2}/g).join(" ");if(this.length>t)e+=" ... "}return""};f.prototype.compare=function(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return 0;return f.compare(this,e)};f.prototype.get=function(e){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(e)};f.prototype.set=function(e,t){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(e,t)};function u(e,t,r,n){r=Number(r)||0;var i=e.length-r;if(!n){n=i}else{n=Number(n);if(n>i){n=i}}var o=t.length;if(o%2!==0)throw new Error("Invalid hex string");if(n>o/2){n=o/2}for(var a=0;athis.length)throw new RangeError("attempt to write outside buffer bounds");var o=this.length-t;if(!r){r=o}else{r=Number(r);if(r>o){r=o}}n=String(n||"utf8").toLowerCase();var a;switch(n){case"hex":a=u(this,e,t,r);break;case"utf8":case"utf-8":a=l(this,e,t,r);break;case"ascii":a=h(this,e,t,r);break;case"binary":a=d(this,e,t,r);break;case"base64":a=p(this,e,t,r);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":a=g(this,e,t,r);break;default:throw new TypeError("Unknown encoding: "+n)}return a};f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function v(e,t,r){if(t===0&&r===e.length){return n.fromByteArray(e)}else{return n.fromByteArray(e.slice(t,r))}}function b(e,t,r){var n="";var i="";r=Math.min(e.length,r);for(var o=t;on)r=n;var i="";for(var o=t;or){e=r}if(t<0){t+=r;if(t<0)t=0}else if(t>r){t=r}if(tr)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUIntLE=function(e,t,r){e=e>>>0;t=t>>>0;if(!r)E(e,t,this.length);var n=this[e];var i=1;var o=0;while(++o>>0;t=t>>>0;if(!r)E(e,t,this.length);var n=this[e+--t];var i=1;while(t>0&&(i*=256))n+=this[e+--t]*i;return n};f.prototype.readUInt8=function(e,t){if(!t)E(e,1,this.length);return this[e]};f.prototype.readUInt16LE=function(e,t){if(!t)E(e,2,this.length);return this[e]|this[e+1]<<8};f.prototype.readUInt16BE=function(e,t){if(!t)E(e,2,this.length);return this[e]<<8|this[e+1]};f.prototype.readUInt32LE=function(e,t){if(!t)E(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};f.prototype.readUInt32BE=function(e,t){if(!t)E(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};f.prototype.readIntLE=function(e,t,r){e=e>>>0;t=t>>>0;if(!r)E(e,t,this.length);var n=this[e];var i=1;var o=0;while(++o=i)n-=Math.pow(2,8*t);return n};f.prototype.readIntBE=function(e,t,r){e=e>>>0;t=t>>>0;if(!r)E(e,t,this.length);var n=t;var i=1;var o=this[e+--n];while(n>0&&(i*=256))o+=this[e+--n]*i;i*=128;if(o>=i)o-=Math.pow(2,8*t);return o};f.prototype.readInt8=function(e,t){if(!t)E(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};f.prototype.readInt16LE=function(e,t){if(!t)E(e,2,this.length);var r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};f.prototype.readInt16BE=function(e,t){if(!t)E(e,2,this.length);var r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};f.prototype.readInt32LE=function(e,t){if(!t)E(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};f.prototype.readInt32BE=function(e,t){if(!t)E(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};f.prototype.readFloatLE=function(e,t){if(!t)E(e,4,this.length);return i.read(this,e,true,23,4)};f.prototype.readFloatBE=function(e,t){if(!t)E(e,4,this.length);return i.read(this,e,false,23,4)};f.prototype.readDoubleLE=function(e,t){if(!t)E(e,8,this.length);return i.read(this,e,true,52,8)};f.prototype.readDoubleBE=function(e,t){if(!t)E(e,8,this.length);return i.read(this,e,false,52,8)};function A(e,t,r,n,i,o){if(!f.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||te.length)throw new RangeError("index out of range")}f.prototype.writeUIntLE=function(e,t,r,n){e=+e;t=t>>>0;r=r>>>0;if(!n)A(this,e,t,r,Math.pow(2,8*r),0);var i=1;var o=0;this[t]=e&255;while(++o>>0&255;return t+r};f.prototype.writeUIntBE=function(e,t,r,n){e=+e;t=t>>>0;r=r>>>0;if(!n)A(this,e,t,r,Math.pow(2,8*r),0);var i=r-1;var o=1;this[t+i]=e&255;while(--i>=0&&(o*=256))this[t+i]=e/o>>>0&255;return t+r};f.prototype.writeUInt8=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,1,255,0);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);this[t]=e;return t+1};function C(e,t,r,n){if(t<0)t=65535+t+1;for(var i=0,o=Math.min(e.length-r,2);i>>(n?i:1-i)*8}}f.prototype.writeUInt16LE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else C(this,e,t,true);return t+2};f.prototype.writeUInt16BE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else C(this,e,t,false);return t+2};function k(e,t,r,n){if(t<0)t=4294967295+t+1;for(var i=0,o=Math.min(e.length-r,4);i>>(n?i:3-i)*8&255}}f.prototype.writeUInt32LE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,4,4294967295,0);if(f.TYPED_ARRAY_SUPPORT){this[t+3]=e>>>24;this[t+2]=e>>>16;this[t+1]=e>>>8;this[t]=e}else k(this,e,t,true);return t+4};f.prototype.writeUInt32BE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,4,4294967295,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>24;this[t+1]=e>>>16;this[t+2]=e>>>8;this[t+3]=e}else k(this,e,t,false);return t+4};f.prototype.writeIntLE=function(e,t,r,n){e=+e;t=t>>>0;if(!n){A(this,e,t,r,Math.pow(2,8*r-1)-1,-Math.pow(2,8*r-1))}var i=0;var o=1;var a=e<0?1:0;this[t]=e&255;while(++i>0)-a&255;return t+r};f.prototype.writeIntBE=function(e,t,r,n){e=+e;t=t>>>0;if(!n){A(this,e,t,r,Math.pow(2,8*r-1)-1,-Math.pow(2,8*r-1))}var i=r-1;var o=1;var a=e<0?1:0;this[t+i]=e&255;while(--i>=0&&(o*=256))this[t+i]=(e/o>>0)-a&255;return t+r};f.prototype.writeInt8=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,1,127,-128);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);if(e<0)e=255+e+1;this[t]=e;return t+1};f.prototype.writeInt16LE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else C(this,e,t,true);return t+2};f.prototype.writeInt16BE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else C(this,e,t,false);return t+2};f.prototype.writeInt32LE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,4,2147483647,-2147483648);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8;this[t+2]=e>>>16;this[t+3]=e>>>24}else k(this,e,t,true);return t+4};f.prototype.writeInt32BE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,4,2147483647,-2147483648);if(e<0)e=4294967295+e+1;if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>24;this[t+1]=e>>>16;this[t+2]=e>>>8;this[t+3]=e}else k(this,e,t,false);return t+4};function S(e,t,r,n,i,o){if(t>i||te.length)throw new RangeError("index out of range");if(r<0)throw new RangeError("index out of range")}function R(e,t,r,n,o){if(!o)S(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38);i.write(e,t,r,n,23,4);return r+4}f.prototype.writeFloatLE=function(e,t,r){return R(this,e,t,true,r)};f.prototype.writeFloatBE=function(e,t,r){return R(this,e,t,false,r)};function T(e,t,r,n,o){if(!o)S(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308);i.write(e,t,r,n,52,8);return r+8}f.prototype.writeDoubleLE=function(e,t,r){return T(this,e,t,true,r)};f.prototype.writeDoubleBE=function(e,t,r){return T(this,e,t,false,r)};f.prototype.copy=function(e,t,r,n){var i=this;if(!r)r=0;if(!n&&n!==0)n=this.length;if(t>=e.length)t=e.length;if(!t)t=0;if(n>0&&n=i.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");if(n>this.length)n=this.length;if(e.length-t=this.length)throw new RangeError("start out of bounds");if(r<0||r>this.length)throw new RangeError("end out of bounds");var n;if(typeof e==="number"){for(n=t;n55295&&r<57344){if(i){if(r<56320){if((t-=3)>-1)o.push(239,191,189);i=r;continue}else{r=i-55296<<10|r-56320|65536;i=null}}else{if(r>56319){if((t-=3)>-1)o.push(239,191,189);continue}else if(a+1===n){if((t-=3)>-1)o.push(239,191,189);continue}else{i=r;continue}}}else if(i){if((t-=3)>-1)o.push(239,191,189);i=null}if(r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<2097152){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else{throw new Error("Invalid code point")}}return o}function U(e){var t=[];for(var r=0;r>8;i=r%256;o.push(i);o.push(n)}return o}function O(e){return n.toByteArray(B(e))}function D(e,t,r,n){for(var i=0;i=t.length||i>=e.length)break;t[i+r]=e[i]}return i}function Y(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}},{"base64-js":3,ieee754:4,"is-array":5}],3:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(e){"use strict";var t=typeof Uint8Array!=="undefined"?Uint8Array:Array;var r="+".charCodeAt(0);var i="/".charCodeAt(0);var o="0".charCodeAt(0);var a="a".charCodeAt(0);var s="A".charCodeAt(0);var f="-".charCodeAt(0);var c="_".charCodeAt(0);function u(e){var t=e.charCodeAt(0);if(t===r||t===f)return 62;if(t===i||t===c)return 63;if(t0){throw new Error("Invalid string. Length must be a multiple of 4")}var f=e.length;a="="===e.charAt(f-2)?2:"="===e.charAt(f-1)?1:0;s=new t(e.length*3/4-a);i=a>0?e.length-4:e.length;var c=0;function l(e){s[c++]=e}for(r=0,n=0;r>16);l((o&65280)>>8);l(o&255)}if(a===2){o=u(e.charAt(r))<<2|u(e.charAt(r+1))>>4;l(o&255)}else if(a===1){o=u(e.charAt(r))<<10|u(e.charAt(r+1))<<4|u(e.charAt(r+2))>>2;l(o>>8&255);l(o&255)}return s}function h(e){var t,r=e.length%3,i="",o,a;function s(e){return n.charAt(e)}function f(e){return s(e>>18&63)+s(e>>12&63)+s(e>>6&63)+s(e&63)}for(t=0,a=e.length-r;t>2);i+=s(o<<4&63);i+="==";break;case 2:o=(e[e.length-2]<<8)+e[e.length-1];i+=s(o>>10);i+=s(o>>4&63);i+=s(o<<2&63);i+="=";break}return i}e.toByteArray=l;e.fromByteArray=h})(typeof r==="undefined"?this.base64js={}:r)},{}],4:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a,s=i*8-n-1,f=(1<>1,u=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];l+=h;o=d&(1<<-u)-1;d>>=-u;u+=s;for(;u>0;o=o*256+e[t+l],l+=h,u-=8);a=o&(1<<-u)-1;o>>=-u;u+=n;for(;u>0;a=a*256+e[t+l],l+=h,u-=8);if(o===0){o=1-c}else if(o===f){return a?NaN:(d?-1:1)*Infinity}else{a=a+Math.pow(2,n);o=o-c}return(d?-1:1)*a*Math.pow(2,o-n)};r.write=function(e,t,r,n,i,o){var a,s,f,c=o*8-i-1,u=(1<>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){s=isNaN(t)?1:0;a=u}else{a=Math.floor(Math.log(t)/Math.LN2);if(t*(f=Math.pow(2,-a))<1){a--;f*=2}if(a+l>=1){t+=h/f}else{t+=h*Math.pow(2,1-l)}if(t*f>=2){a++;f/=2}if(a+l>=u){s=0;a=u}else if(a+l>=1){s=(t*f-1)*Math.pow(2,i);a=a+l}else{s=t*Math.pow(2,l-1)*Math.pow(2,i);a=0}}for(;i>=8;e[r+d]=s&255,d+=p,s/=256,i-=8);a=a<0;e[r+d]=a&255,d+=p,a/=256,c-=8);e[r+d-p]|=g*128}},{}],5:[function(e,t,r){var n=Array.isArray;var i=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],6:[function(e,t,r){function n(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}t.exports=n;n.EventEmitter=n;n.prototype._events=undefined;n.prototype._maxListeners=undefined;n.defaultMaxListeners=10;n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");this._maxListeners=e;return this};n.prototype.emit=function(e){var t,r,n,o,f,c;if(!this._events)this._events={};if(e==="error"){if(!this._events.error||a(this._events.error)&&!this._events.error.length){t=arguments[1];if(t instanceof Error){throw t}throw TypeError('Uncaught, unspecified "error" event.')}}r=this._events[e];if(s(r))return false;if(i(r)){switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:n=arguments.length;o=new Array(n-1);for(f=1;f0&&this._events[e].length>r){this._events[e].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[e].length);if(typeof console.trace==="function"){console.trace()}}}return this};n.prototype.on=n.prototype.addListener;n.prototype.once=function(e,t){if(!i(t))throw TypeError("listener must be a function");var r=false;function n(){this.removeListener(e,n);if(!r){r=true;t.apply(this,arguments)}}n.listener=t;this.on(e,n);return this};n.prototype.removeListener=function(e,t){var r,n,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;r=this._events[e];o=r.length;n=-1;if(r===t||i(r.listener)&&r.listener===t){delete this._events[e];if(this._events.removeListener)this.emit("removeListener",e,t)}else if(a(r)){for(s=o;s-->0;){if(r[s]===t||r[s].listener&&r[s].listener===t){n=s;break}}if(n<0)return this;if(r.length===1){r.length=0;delete this._events[e]}else{r.splice(n,1)}if(this._events.removeListener)this.emit("removeListener",e,t)}return this};n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[e])delete this._events[e];return this}if(arguments.length===0){for(t in this._events){if(t==="removeListener")continue;this.removeAllListeners(t)}this.removeAllListeners("removeListener");this._events={};return this}r=this._events[e];if(i(r)){this.removeListener(e,r)}else{while(r.length)this.removeListener(e,r[r.length-1])}delete this._events[e];return this};n.prototype.listeners=function(e){var t;if(!this._events||!this._events[e])t=[];else if(i(this._events[e]))t=[this._events[e]];else t=this._events[e].slice();return t};n.listenerCount=function(e,t){var r;if(!e._events||!e._events[t])r=0;else if(i(e._events[t]))r=1;else r=e._events[t].length;return r};function i(e){return typeof e==="function"}function o(e){return typeof e==="number"}function a(e){return typeof e==="object"&&e!==null}function s(e){return e===void 0}},{}],7:[function(e,t,r){if(typeof Object.create==="function"){t.exports=function n(e,t){e.super_=t;e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}else{t.exports=function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype;e.prototype=new r;e.prototype.constructor=e}}},{}],8:[function(e,t,r){t.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}},{}],9:[function(e,t,r){var n=t.exports={};var i=[];var o=false;function a(){if(o){return}o=true;var e;var t=i.length;while(t){e=i;i=[];var r=-1;while(++r0){if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else{if(t.decoder&&!i&&!n)r=t.decoder.write(r);if(!i)t.reading=false;if(t.flowing&&t.length===0&&!t.sync){e.emit("data",r);e.read(0)}else{t.length+=t.objectMode?1:r.length;if(i)t.buffer.unshift(r);else t.buffer.push(r);if(t.needReadable)m(e)}_(e,t)}}else if(!i){t.reading=false}return d(t)}function d(e){return!e.ended&&(e.needReadable||e.length=p){e=p}else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function v(e,t){if(t.length===0&&t.ended)return 0;if(t.objectMode)return e===0?0:1;if(isNaN(e)||s.isNull(e)){if(t.flowing&&t.buffer.length)return t.buffer[0].length;else return t.length}if(e<=0)return 0;if(e>t.highWaterMark)t.highWaterMark=g(e);if(e>t.length){if(!t.ended){t.needReadable=true;return 0}else return t.length}return e}l.prototype.read=function(e){c("read",e);var t=this._readableState;var r=e;if(!s.isNumber(e)||e>0)t.emittedReadable=false;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){c("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)T(this);else m(this);return null}e=v(e,t);if(e===0&&t.ended){if(t.length===0)T(this);return null}var n=t.needReadable;c("need readable",n);if(t.length===0||t.length-e0)i=R(e,t);else i=null;if(s.isNull(i)){t.needReadable=true;e=0}t.length-=e;if(t.length===0&&!t.ended)t.needReadable=true;if(r!==e&&t.ended&&t.length===0)T(this);if(!s.isNull(i))this.emit("data",i);return i};function b(e,t){var r=null;if(!s.isBuffer(t)&&!s.isString(t)&&!s.isNullOrUndefined(t)&&!e.objectMode){r=new TypeError("Invalid non-string/buffer chunk")}return r}function y(e,t){if(t.decoder&&!t.ended){var r=t.decoder.end();if(r&&r.length){t.buffer.push(r);t.length+=t.objectMode?1:r.length}}t.ended=true;m(e)}function m(e){var t=e._readableState;t.needReadable=false;if(!t.emittedReadable){c("emitReadable",t.flowing);t.emittedReadable=true;if(t.sync)r.nextTick(function(){w(e)});else w(e)}}function w(e){c("emit readable");e.emit("readable");S(e)}function _(e,t){if(!t.readingMore){t.readingMore=true;r.nextTick(function(){E(e,t)})}}function E(e,t){var r=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length=n){if(o)s=r.join("");else s=i.concat(r,n);r.length=0}else{if(e0)throw new Error("endReadable called on non-empty stream");if(!t.endEmitted){t.ended=true;r.nextTick(function(){if(!t.endEmitted&&t.length===0){t.endEmitted=true;e.readable=false;e.emit("end")}})}}function I(e,t){for(var r=0,n=e.length;r1){var r=[];for(var n=0;n=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;e.copy(this.charBuffer,this.charReceived,0,r);this.charReceived+=r;if(this.charReceived=55296&&n<=56319){this.charLength+=this.surrogateSize;t="";continue}this.charReceived=this.charLength=0;if(e.length===0){return t}break}this.detectIncompleteChar(e);var i=e.length;if(this.charLength){e.copy(this.charBuffer,0,e.length-this.charReceived,i);i-=this.charReceived}t+=e.toString(this.encoding,0,i);var i=t.length-1;var n=t.charCodeAt(i);if(n>=55296&&n<=56319){var o=this.surrogateSize;this.charLength+=o;this.charReceived+=o;this.charBuffer.copy(this.charBuffer,o,0,o);e.copy(this.charBuffer,0,0,o);return t.substring(0,i)}return t};a.prototype.detectIncompleteChar=function(e){var t=e.length>=3?3:e.length;for(;t>0;t--){var r=e[e.length-t];if(t==1&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t};a.prototype.end=function(e){var t="";if(e&&e.length)t=this.write(e);if(this.charReceived){var r=this.charReceived;var n=this.charBuffer;var i=this.encoding;t+=n.slice(0,r).toString(i)}return t};function s(e){return e.toString(this.encoding)}function f(e){this.charReceived=e.length%2;this.charLength=this.charReceived?2:0}function c(e){this.charReceived=e.length%3;this.charLength=this.charReceived?3:0}},{buffer:2}],23:[function(e,t,r){var n=[].slice;t.exports=function(e,t){if("string"==typeof t)t=e[t];if("function"!=typeof t)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return t.apply(e,r.concat(n.call(arguments)))}}},{}],24:[function(e,t,r){t.exports=n;function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype){e[t]=n.prototype[t]}return e}n.prototype.on=n.prototype.addEventListener=function(e,t){this._callbacks=this._callbacks||{};(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t);return this};n.prototype.once=function(e,t){function r(){this.off(e,r);t.apply(this,arguments)}r.fn=t;this.on(e,r);return this};n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length){delete this._callbacks["$"+e];return this}var n;for(var i=0;i=31}r.formatters.j=function(e){return JSON.stringify(e)};function i(){var e=arguments;var t=this.useColors;e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff);if(!t)return e;var n="color: "+this.color;e=[e[0],n,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0;var o=0;e[0].replace(/%[a-z%]/g,function(e){if("%%"===e)return;i++;if("%c"===e){o=i}});e.splice(o,0,n);return e}function o(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{if(null==e){r.storage.removeItem("debug")}else{r.storage.debug=e}}catch(t){}}function s(){var e;try{e=r.storage.debug}catch(t){}return e}r.enable(s());function f(){try{return window.localStorage}catch(e){}}},{"./debug":26}],26:[function(e,t,r){r=t.exports=a;r.coerce=u;r.disable=f;r.enable=s;r.enabled=c;r.humanize=e("ms");r.names=[];r.skips=[];r.formatters={};var n=0;var i;function o(){return r.colors[n++%r.colors.length]}function a(e){function t(){}t.enabled=false;function n(){var e=n;var t=+new Date;var a=t-(i||t);e.diff=a;e.prev=i;e.curr=t;i=t;if(null==e.useColors)e.useColors=r.useColors();if(null==e.color&&e.useColors)e.color=o();var s=Array.prototype.slice.call(arguments);s[0]=r.coerce(s[0]);if("string"!==typeof s[0]){s=["%o"].concat(s)}var f=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,n){if(t==="%%")return t;f++;var i=r.formatters[n];if("function"===typeof i){var o=s[f];t=i.call(e,o);s.splice(f,1);f--}return t});if("function"===typeof r.formatArgs){s=r.formatArgs.apply(e,s)}var c=n.log||r.log||console.log.bind(console);c.apply(e,s)}n.enabled=true;var a=r.enabled(e)?n:t;a.namespace=e;return a}function s(e){r.save(e);var t=(e||"").split(/[\s,]+/);var n=t.length;for(var i=0;i1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);var f=(t[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return r*s;case"days":case"day":case"d":return r*a;case"hours":case"hour":case"hrs":case"hr":case"h":return r*o;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}function c(e){if(e>=a)return Math.round(e/a)+"d";if(e>=o)return Math.round(e/o)+"h";if(e>=i)return Math.round(e/i)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}function u(e){return l(e,a,"day")||l(e,o,"hour")||l(e,i,"minute")||l(e,n,"second")||e+" ms"}function l(e,t,r){if(e=Math.pow(2,e)){return n(e,t)}else return a};n.rack=function(e,t,r){var i=function(i){var a=0;do{if(a++>10){if(r)e+=r;else throw new Error("too many ID collisions, use more bits")}var s=n(e,t)}while(Object.hasOwnProperty.call(o,s));o[s]=i;return s};var o=i.hats={};i.get=function(e){return i.hats[e]};i.set=function(e,t){i.hats[e]=t;return i};i.bits=e||128;i.base=t||16;return i}},{}],32:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],33:[function(e,t,r){(function(r){t.exports=l;var n=e("debug")("simple-peer");var i=e("get-browser-rtc");var o=e("hat");var a=e("inherits");var s=e("is-typedarray");var f=e("once");var c=e("stream");var u=e("typedarray-to-buffer");a(l,c.Duplex);function l(e){var t=this;if(!(t instanceof l))return new l(e);t._debug("new peer %o",e);if(!e)e={};e.allowHalfOpen=false;if(e.highWaterMark==null)e.highWaterMark=1024*1024;c.Duplex.call(t,e);t.initiator=e.initiator||false;t.channelConfig=e.channelConfig||l.channelConfig;t.channelName=e.channelName||o(160);if(!e.initiator)t.channelName=null;t.config=e.config||l.config;t.constraints=e.constraints||l.constraints;t.reconnectTimer=e.reconnectTimer||0;t.sdpTransform=e.sdpTransform||function(e){return e};t.stream=e.stream||false;t.trickle=e.trickle!==undefined?e.trickle:true;t.destroyed=false;t.connected=false;t.remoteAddress=undefined;t.remoteFamily=undefined;t.remotePort=undefined;t.localAddress=undefined;t.localPort=undefined;t._wrtc=e.wrtc||i();if(!t._wrtc){if(typeof window==="undefined"){throw new Error("No WebRTC support: Specify `opts.wrtc` option in this environment")}else{throw new Error("No WebRTC support: Not a supported browser")}}t._maxBufferedAmount=e.highWaterMark;t._pcReady=false;t._channelReady=false;t._iceComplete=false;t._channel=null;t._pendingCandidates=[];t._chunk=null;t._cb=null;t._interval=null;t._reconnectTimeout=null;t._pc=new t._wrtc.RTCPeerConnection(t.config,t.constraints);t._pc.oniceconnectionstatechange=t._onIceConnectionStateChange.bind(t);t._pc.onsignalingstatechange=t._onSignalingStateChange.bind(t);t._pc.onicecandidate=t._onIceCandidate.bind(t);if(t.stream)t._pc.addStream(t.stream);t._pc.onaddstream=t._onAddStream.bind(t);if(t.initiator){t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)});t._pc.onnegotiationneeded=f(t._createOffer.bind(t));if(typeof window==="undefined"||!window.webkitRTCPeerConnection){t._pc.onnegotiationneeded()}}else{t._pc.ondatachannel=t._setupData.bind(t)}t.on("finish",function(){if(t.connected){setTimeout(function(){t._destroy()},100)}else{t.once("connect",function(){setTimeout(function(){t._destroy()},100)})}})}l.WEBRTC_SUPPORT=!!i();l.config={iceServers:[{url:"stun:23.21.150.121",urls:"stun:23.21.150.121"}]};l.constraints={};l.channelConfig={};Object.defineProperty(l.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}});l.prototype.address=function(){var e=this;return{port:e.localPort,family:"IPv4",address:e.localAddress}};l.prototype.signal=function(e){var t=this;if(t.destroyed)throw new Error("cannot signal after peer is destroyed");if(typeof e==="string"){try{e=JSON.parse(e)}catch(r){e={}}}t._debug("signal()");function n(e){try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),h,t._onError.bind(t))}catch(r){t._destroy(new Error("error adding candidate: "+r.message))}}if(e.sdp){t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e),function(){if(t.destroyed)return;if(t._pc.remoteDescription.type==="offer")t._createAnswer();t._pendingCandidates.forEach(n);t._pendingCandidates=[]},t._onError.bind(t))}if(e.candidate){if(t._pc.remoteDescription)n(e.candidate);else t._pendingCandidates.push(e.candidate)}if(!e.sdp&&!e.candidate){t._destroy(new Error("signal() called with invalid signal data"))}};l.prototype.send=function(e){var t=this;if(!s.strict(e)&&!(e instanceof ArrayBuffer)&&!r.isBuffer(e)&&typeof e!=="string"&&(typeof Blob==="undefined"||!(e instanceof Blob))){e=JSON.stringify(e)}if(r.isBuffer(e)&&!s.strict(e)){e=new Uint8Array(e)}var n=e.length||e.byteLength||e.size;t._channel.send(e);t._debug("write: %d bytes",n)};l.prototype.destroy=function(e){var t=this;t._destroy(null,e)};l.prototype._destroy=function(e,t){var r=this;if(r.destroyed)return;if(t)r.once("close",t);r._debug("destroy (error: %s)",e&&e.message);r.readable=r.writable=false;if(!r._readableState.ended)r.push(null);if(!r._writableState.finished)r.end();r.destroyed=true;r.connected=false;r._pcReady=false;r._channelReady=false;r._chunk=null;r._cb=null;clearInterval(r._interval);clearTimeout(r._reconnectTimeout);if(r._pc){try{r._pc.close()}catch(e){}r._pc.oniceconnectionstatechange=null;r._pc.onsignalingstatechange=null;r._pc.onicecandidate=null}if(r._channel){try{r._channel.close()}catch(e){}r._channel.onmessage=null;r._channel.onopen=null;r._channel.onclose=null}r._pc=null;r._channel=null;if(e)r.emit("error",e);r.emit("close")};l.prototype._setupData=function(e){var t=this;t._channel=e.channel;t.channelName=t._channel.label;t._channel.binaryType="arraybuffer";t._channel.onmessage=t._onChannelMessage.bind(t);t._channel.onopen=t._onChannelOpen.bind(t);t._channel.onclose=t._onChannelClose.bind(t)};l.prototype._read=function(){};l.prototype._write=function(e,t,r){var n=this;if(n.destroyed)return r(new Error("cannot write after peer is destroyed"));if(n.connected){try{n.send(e)}catch(i){return n._onError(i)}if(n._channel.bufferedAmount>n._maxBufferedAmount){n._debug("start backpressure: bufferedAmount %d",n._channel.bufferedAmount);n._cb=r}else{r(null)}}else{n._debug("write before connect");n._chunk=e;n._cb=r}};l.prototype._createOffer=function(){var e=this;if(e.destroyed)return;e._pc.createOffer(function(t){if(e.destroyed)return;t.sdp=e.sdpTransform(t.sdp);e._pc.setLocalDescription(t,h,e._onError.bind(e));var r=function(){var r=e._pc.localDescription||t;e._debug("signal");e.emit("signal",{type:r.type,sdp:r.sdp})};if(e.trickle||e._iceComplete)r();else e.once("_iceComplete",r)},e._onError.bind(e),e.offerConstraints)};l.prototype._createAnswer=function(){var e=this;if(e.destroyed)return;e._pc.createAnswer(function(t){if(e.destroyed)return;t.sdp=e.sdpTransform(t.sdp);e._pc.setLocalDescription(t,h,e._onError.bind(e));var r=function(){var r=e._pc.localDescription||t;e._debug("signal");e.emit("signal",{type:r.type,sdp:r.sdp})};if(e.trickle||e._iceComplete)r();else e.once("_iceComplete",r)},e._onError.bind(e),e.answerConstraints)};l.prototype._onIceConnectionStateChange=function(){var e=this;if(e.destroyed)return;var t=e._pc.iceGatheringState;var r=e._pc.iceConnectionState;e._debug("iceConnectionStateChange %s %s",t,r);e.emit("iceConnectionStateChange",t,r);if(r==="connected"||r==="completed"){clearTimeout(e._reconnectTimeout);e._pcReady=true;e._maybeReady()}if(r==="disconnected"){if(e.reconnectTimer){clearTimeout(e._reconnectTimeout);e._reconnectTimeout=setTimeout(function(){e._destroy()},e.reconnectTimer)}else{e._destroy()}}if(r==="closed"){e._destroy()}};l.prototype._maybeReady=function(){var e=this;e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady);if(e.connected||e._connecting||!e._pcReady||!e._channelReady)return;e._connecting=true;if(typeof window!=="undefined"&&!!window.mozRTCPeerConnection){e._pc.getStats(null,function(e){var r=[];e.forEach(function(e){r.push(e)});t(r)},e._onError.bind(e))}else{e._pc.getStats(function(e){var r=[];e.result().forEach(function(e){var t={};e.names().forEach(function(r){t[r]=e.stat(r)});t.id=e.id;t.type=e.type;t.timestamp=e.timestamp;r.push(t)});t(r)})}function t(t){t.forEach(function(t){if(t.type==="remotecandidate"){e.remoteAddress=t.ipAddress;e.remoteFamily="IPv4";e.remotePort=Number(t.portNumber);e._debug("connect remote: %s:%s (%s)",e.remoteAddress,e.remotePort,e.remoteFamily)}else if(t.type==="localcandidate"&&t.candidateType==="host"){e.localAddress=t.ipAddress;e.localPort=Number(t.portNumber);e._debug("connect local: %s:%s",e.localAddress,e.localPort)}});e._connecting=false;e.connected=true;if(e._chunk){try{e.send(e._chunk)}catch(r){return e._onError(r)}e._chunk=null;e._debug('sent chunk from "write before connect"');var n=e._cb;e._cb=null;n(null)}e._interval=setInterval(function(){if(!e._cb||!e._channel||e._channel.bufferedAmount>e._maxBufferedAmount)return;e._debug("ending backpressure: bufferedAmount %d",e._channel.bufferedAmount);var t=e._cb;e._cb=null;t(null)},150);if(e._interval.unref)e._interval.unref();e._debug("connect");e.emit("connect")}};l.prototype._onSignalingStateChange=function(){var e=this;if(e.destroyed)return;e._debug("signalingStateChange %s",e._pc.signalingState);e.emit("signalingStateChange",e._pc.signalingState)};l.prototype._onIceCandidate=function(e){var t=this;if(t.destroyed)return;if(e.candidate&&t.trickle){t.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}})}else if(!e.candidate){t._iceComplete=true;t.emit("_iceComplete")}};l.prototype._onChannelMessage=function(e){var t=this;if(t.destroyed)return;var r=e.data;t._debug("read: %d bytes",r.byteLength||r.length);if(r instanceof ArrayBuffer){r=u(new Uint8Array(r));t.push(r)}else{try{r=JSON.parse(r)}catch(n){}t.emit("data",r)}};l.prototype._onChannelOpen=function(){var e=this;if(e.connected||e.destroyed)return;e._debug("on channel open");e._channelReady=true;e._maybeReady(); };l.prototype._onChannelClose=function(){var e=this;if(e.destroyed)return;e._debug("on channel close");e._destroy()};l.prototype._onAddStream=function(e){var t=this;if(t.destroyed)return;t._debug("on add stream");t.emit("stream",e.stream)};l.prototype._onError=function(e){var t=this;if(t.destroyed)return;t._debug("error %s",e.message||e);t._destroy(e)};l.prototype._debug=function(){var e=this;var t=[].slice.call(arguments);var r=e.channelName&&e.channelName.substring(0,7);t[0]="["+r+"] "+t[0];n.apply(null,t)};function h(){}}).call(this,e("buffer").Buffer)},{buffer:2,debug:25,"get-browser-rtc":34,hat:31,inherits:32,"is-typedarray":35,once:37,stream:21,"typedarray-to-buffer":38}],34:[function(e,t,r){t.exports=function n(){if(typeof window==="undefined")return null;var e={RTCPeerConnection:window.mozRTCPeerConnection||window.RTCPeerConnection||window.webkitRTCPeerConnection,RTCSessionDescription:window.mozRTCSessionDescription||window.RTCSessionDescription||window.webkitRTCSessionDescription,RTCIceCandidate:window.mozRTCIceCandidate||window.RTCIceCandidate||window.webkitRTCIceCandidate};if(!e.RTCPeerConnection)return null;return e}},{}],35:[function(e,t,r){t.exports=o;o.strict=a;o.loose=s;var n=Object.prototype.toString;var i={"[object Int8Array]":true,"[object Int16Array]":true,"[object Int32Array]":true,"[object Uint8Array]":true,"[object Uint8ClampedArray]":true,"[object Uint16Array]":true,"[object Uint32Array]":true,"[object Float32Array]":true,"[object Float64Array]":true};function o(e){return a(e)||s(e)}function a(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function s(e){return i[n.call(e)]}},{}],36:[function(e,t,r){t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=="function")throw new TypeError("need wrapper function");Object.keys(e).forEach(function(t){r[t]=e[t]});return r;function r(){var t=new Array(arguments.length);for(var r=0;r=n)return(e/n).toFixed(1)+"h";if(e>=r)return(e/r).toFixed(1)+"m";if(e>=t)return(e/t|0)+"s";return e+"ms"};n.enabled=function(e){for(var t=0,r=n.skips.length;t1)))/4)-w((e-1901+t)/100)+w((e-1601+t)/400)}}if(!(i={}.hasOwnProperty)){i=function(e){var t={},n;if((t.__proto__=null,t.__proto__={toString:1},t).toString!=r){i=function(e){var t=this.__proto__,r=e in(this.__proto__=null,this);this.__proto__=t;return r}}else{n=t.constructor;i=function(e){var t=(this.constructor||n).prototype;return e in this&&!(e in t&&this[e]===t[e])}}t=null;return i.call(this,e)}}var A={"boolean":1,number:1,string:1,undefined:1};var C=function(e,t){var r=typeof e[t];return r=="object"?!!e[t]:!A[r]};o=function(e,t){var n=0,a,s,f;(a=function(){this.valueOf=0}).prototype.valueOf=0;s=new a;for(f in s){if(i.call(s,f)){n++}}a=s=null;if(!n){s=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];o=function(e,t){var n=r.call(e)==d,o,a;var f=!n&&typeof e.constructor!="function"&&C(e,"hasOwnProperty")?e.hasOwnProperty:i;for(o in e){if(!(n&&o=="prototype")&&f.call(e,o)){t(o)}}for(a=s.length;o=s[--a];f.call(e,o)&&t(o));}}else if(n==2){o=function(e,t){var n={},o=r.call(e)==d,a;for(a in e){if(!(o&&a=="prototype")&&!i.call(n,a)&&(n[a]=1)&&i.call(e,a)){t(a)}}}}else{o=function(e,t){var n=r.call(e)==d,o,a;for(o in e){if(!(n&&o=="prototype")&&i.call(e,o)&&!(a=o==="constructor")){t(o)}}if(a||i.call(e,o="constructor")){t(o)}}}return o(e,t)};if(!h("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var S="000000";var R=function(e,t){return(S+(t||0)).slice(-e)};var T="\\u00";var I=function(e){var t='"',r=0,n=e.length,i=n>10&&m,o;if(i){o=e.split("")}for(;r-1/0&&l<1/0){if(E){_=w(l/864e5);for(d=w(_/365.2425)+1970-1;E(d+1,0)<=_;d++);for(m=w((_-E(d,0))/30.42);E(d,m+1)<=_;m++);_=1+_-E(d,m);A=(l%864e5+864e5)%864e5;C=w(A/36e5)%24;k=w(A/6e4)%60;S=w(A/1e3)%60;T=A%1e3}else{d=l.getUTCFullYear();m=l.getUTCMonth();_=l.getUTCDate();C=l.getUTCHours();k=l.getUTCMinutes();S=l.getUTCSeconds();T=l.getUTCMilliseconds()}l=(d<=0||d>=1e4?(d<0?"-":"+")+R(6,d<0?-d:d):R(4,d))+"-"+R(2,m+1)+"-"+R(2,_)+"T"+R(2,C)+":"+R(2,k)+":"+R(2,S)+"."+R(3,T)+"Z"}else{l=null}}else if(typeof l.toJSON=="function"&&(h!=g&&h!=v&&h!=b||i.call(l,"toJSON"))){l=l.toJSON(e)}}if(n){l=n.call(t,e,l)}if(l===null){return"null"}h=r.call(l);if(h==y){return""+l}else if(h==g){return l>-1/0&&l<1/0?""+l:"null"}else if(h==v){return I(""+l)}if(typeof l=="object"){for(x=u.length;x--;){if(u[x]===l){throw TypeError()}}u.push(l);B=[];j=c;c+=f;if(h==b){for(P=0,x=l.length;P0){for(i="",n>10&&(n=10);i.length=48&&a<=57||a>=97&&a<=102||a>=65&&a<=70)){j()}}r+=B("0x"+e.slice(n,P));break;default:j()}}else{if(a==34){break}a=e.charCodeAt(P);n=P;while(a>=32&&a!=92&&a!=34){a=e.charCodeAt(++P)}r+=e.slice(n,P)}}if(e.charCodeAt(P)==34){P++;return r}j();default:n=P;if(a==45){o=true;a=e.charCodeAt(++P)}if(a>=48&&a<=57){if(a==48&&(a=e.charCodeAt(P+1),a>=48&&a<=57)){j()}o=false;for(;P=48&&a<=57);P++);if(e.charCodeAt(P)==46){i=++P;for(;i=48&&a<=57);i++);if(i==P){j()}P=i}a=e.charCodeAt(P);if(a==101||a==69){a=e.charCodeAt(++P);if(a==43||a==45){P++}for(i=P;i=48&&a<=57);i++);if(i==P){j()}P=i}return+e.slice(n,P)}if(o){j()}if(e.slice(P,P+4)=="true"){P+=4;return true}else if(e.slice(P,P+5)=="false"){P+=5;return false}else if(e.slice(P,P+4)=="null"){P+=4;return null}j()}}return"$"};var N=function(e){var t,r;if(e=="$"){j()}if(typeof e=="string"){if((m?e.charAt(0):e[0])=="@"){return e.slice(1)}if(e=="["){t=[];for(;;r||(r=true)){e=U();if(e=="]"){break}if(r){if(e==","){e=U();if(e=="]"){j()}}else{j()}}if(e==","){j()}t.push(N(e))}return t}else if(e=="{"){t={};for(;;r||(r=true)){e=U();if(e=="}"){break}if(r){if(e==","){e=U();if(e=="}"){j()}}else{j()}}if(e==","||typeof e!="string"||(m?e.charAt(0):e[0])!="@"||U()!=":"){j()}t[e.slice(1)]=N(U())}return t}j()}return e};var O=function(e,t,r){var n=D(e,t,r);if(n===a){delete e[t]}else{e[t]=n}};var D=function(e,t,n){var i=e[t],a;if(typeof i=="object"&&i){if(r.call(i)==b){for(a=i.length;a--;){O(i,a,n)}}else{o(i,function(e){O(i,e,n)})}}return n.call(e,t,i)};c.parse=function(e,t){var n,i;P=0;x=""+e;n=N(U());if(U()!="$"){j()}P=x=null;return t&&r.call(t)==d?D((i={},i[""]=n,i),"",t):n}}}if(s){e(function(){return c})}})(this)},{}],46:[function(e,t,r){t.exports=n;function n(e,t){var r=[];t=t||0;for(var n=t||0;n=26||n==="moz"&&i>=33);var u=window.AudioContext||window.webkitAudioContext;var l=document.createElement("video");var h=l&&l.canPlayType&&l.canPlayType('video/webm; codecs="vp8", vorbis')==="probably";var d=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.msGetUserMedia||navigator.mozGetUserMedia;t.exports={prefix:n,browserVersion:i,support:!!o&&h&&!!d,supportRTCPeerConnection:!!o,supportVp8:h,supportGetUserMedia:!!d,supportDataChannel:!!(o&&o.prototype&&o.prototype.createDataChannel),supportWebAudio:!!(u&&u.prototype.createMediaStreamSource),supportMediaStream:!!(f&&f.prototype.removeTrack),supportScreenSharing:!!c,AudioContext:u,PeerConnection:o,SessionDescription:s,IceCandidate:a,MediaStream:f,getUserMedia:d}},{}],"/":[function(e,t,r){window.myDebug=e("debug");var n=e("simple-peer");var i=e("component-emitter");var o=e("socket.io-parser");var a=e("to-array");var s=e("has-binary");var f=e("component-bind");var c=e("debug")("socket");var u=e("hat");var l=e("extend.js");var h=e("webrtcsupport");var d=i.prototype.emit;function p(e,t,r){var i=this;i.useSockets=true;i.usePeerConnection=false;i.decoder=new o.Decoder(this);i.decoder.on("decoded",f(this,this.ondecoded));i.socket=e;i.cb=r;i._peers={};i.readyPeers=0;i.ready=false;i._peerEvents={upgrade:1,error:1,peer_signal:1,peer_ready:1,stream:1};var a={autoUpgrade:true,numClients:5};i.opts=l(a,t||{});i.peerOpts=i.opts.peerOpts||{};i.numConnectedClients;e.on("numClients",function(t){i.peerId=e.io.engine.id;i.numConnectedClients=t;if(h.supportDataChannel){r(function(t){var r={offers:t,fromPeerId:i.peerId};e.emit("offers",r)})}function r(e){var t=[];for(var r=0;r=i.numConnectedClients&&!i.ready){i.ready=true;if(i.opts.autoUpgrade)i.usePeerConnection=true;if(typeof i.cb==="function")i.cb();i.emit("upgrade")}})}i(p.prototype);p.prototype.setupPeerEvents=function(e){var t=this;e.on("connect",function(e){t.emit("peer_ready",e)});e.on("data",function(e){if(this.destroyed)return;t.decoder.add(e)});e.on("stream",function(e){t.emit("stream",e)})};p.prototype.on=function(e,t){var r=this;this.socket.addEventListener(e,function(t){d.call(r,e,t)});this.addEventListener(e,t)};p.prototype.emit=function(e,t){var r=this;var n=t||{};var i=new o.Encoder;if(this._peerEvents.hasOwnProperty(e)||n.fromSocket){d.apply(this,arguments)}else if(this.usePeerConnection||!this.useSockets){var f=a(arguments);var c=o.EVENT;if(s(f)){c=o.BINARY_EVENT}var u={type:c,data:f};i.encode(u,function(e){if(e[1]instanceof ArrayBuffer){r._sendArray(e)}else if(e){for(var t=0;t