From 5ac5de5595fd9fea95026298620b88fde7d55af9 Mon Sep 17 00:00:00 2001 From: csturiale Date: Mon, 7 Mar 2016 09:44:01 +0100 Subject: [PATCH 01/16] added roomName in createdPeer event (+1 squashed commit) Squashed commits: [7ab0253] revert to package.json and bundle (+3 squashed commits) Squashed commits: [9532b6f] 2.1.2 [cb97b07] make latest-v2 and bundle [ceed4e6] 2.1.1 --- latest-v2.js | 13 +- simplewebrtc.bundle.js | 322 ++++++++++++++++++++--------------------- simplewebrtc.js | 2 +- 3 files changed, 169 insertions(+), 168 deletions(-) diff --git a/latest-v2.js b/latest-v2.js index f1f8ff47..56c408be 100644 --- a/latest-v2.js +++ b/latest-v2.js @@ -1,6 +1,7 @@ -!function(e){if("function"==typeof bootstrap)bootstrap("simplewebrtc",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeSimpleWebRTC=e}else"undefined"!=typeof window?window.SimpleWebRTC=e():global.SimpleWebRTC=e()}(function(){var e;return function(e,t,n){function r(n,i){if(!t[n]){if(!e[n]){var a="function"==typeof require&&require;if(!i&&a)return a(n,!0);if(o)return o(n,!0);throw new Error("Cannot find module '"+n+"'")}var s=t[n]={exports:{}};e[n][0].call(s.exports,function(t){var o=e[n][1][t];return r(o?o:t)},s,s.exports)}return t[n].exports}for(var o="function"==typeof require&&require,i=0;i0&&e.emit("readyToCall",e.connection.getSessionid()):e.emit("readyToCall",e.connection.getSessionid()))},n.prototype.createRoom=function(e,t){this.roomName=e,2===arguments.length?this.connection.emit("create",e,t):this.connection.emit("create",e)},n.prototype.sendFile=function(){return i.dataChannel?void 0:this.emit("error",new Error("DataChannelNotSupported"))},t.exports=n},{"./socketioconnection":3,"./webrtc":2,attachmediastream:6,mockconsole:7,webrtcsupport:4,wildemitter:5}],4:[function(e,t){var n,r;window.mozRTCPeerConnection||navigator.mozGetUserMedia?(n="moz",r=parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1],10)):(window.webkitRTCPeerConnection||navigator.webkitGetUserMedia)&&(n="webkit",r=navigator.userAgent.match(/Chrom(e|ium)/)&&parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2],10));var o=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,i=window.mozRTCIceCandidate||window.RTCIceCandidate,a=window.mozRTCSessionDescription||window.RTCSessionDescription,s=window.webkitMediaStream||window.MediaStream,c="https:"===window.location.protocol&&("webkit"===n&&r>=26||"moz"===n&&r>=33),u=window.AudioContext||window.webkitAudioContext,p=document.createElement("video"),d=p&&p.canPlayType&&"probably"===p.canPlayType('video/webm; codecs="vp8", vorbis'),f=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.msGetUserMedia||navigator.mozGetUserMedia;t.exports={prefix:n,browserVersion:r,support:!!o&&!!f,supportRTCPeerConnection:!!o,supportVp8:d,supportGetUserMedia:!!f,supportDataChannel:!!(o&&o.prototype&&o.prototype.createDataChannel),supportWebAudio:!(!u||!u.prototype.createMediaStreamSource),supportMediaStream:!(!s||!s.prototype.removeTrack),supportScreenSharing:!!c,AudioContext:u,PeerConnection:o,SessionDescription:a,IceCandidate:i,MediaStream:s,getUserMedia:f}},{}],5:[function(e,t){function n(){this.isWildEmitter=!0,this.callbacks={}}t.exports=n,n.prototype.on=function(e){var t=3===arguments.length,n=t?arguments[1]:void 0,r=t?arguments[2]:arguments[1];return r._groupName=n,(this.callbacks[e]=this.callbacks[e]||[]).push(r),this},n.prototype.once=function(e){function t(){n.off(e,t),i.apply(this,arguments)}var n=this,r=3===arguments.length,o=r?arguments[1]:void 0,i=r?arguments[2]:arguments[1];return this.on(e,o,t),this},n.prototype.releaseGroup=function(e){var t,n,r,o;for(t in this.callbacks)for(o=this.callbacks[t],n=0,r=o.length;r>n;n++)o[n]._groupName===e&&(o.splice(n,1),n--,r--);return this},n.prototype.off=function(e,t){var n,r=this.callbacks[e];return r?1===arguments.length?(delete this.callbacks[e],this):(n=r.indexOf(t),r.splice(n,1),0===r.length&&delete this.callbacks[e],this):this},n.prototype.emit=function(e){var t,n,r,o=[].slice.call(arguments,1),i=this.callbacks[e],a=this.getWildcardCallbacks(e);if(i)for(r=i.slice(),t=0,n=r.length;n>t&&r[t];++t)r[t].apply(this,o);if(a)for(n=a.length,r=a.slice(),t=0,n=r.length;n>t&&r[t];++t)r[t].apply(this,[e].concat(o));return this},n.prototype.getWildcardCallbacks=function(e){var t,n,r=[];for(t in this.callbacks)n=t.split("*"),("*"===t||2===n.length&&e.slice(0,n[0].length)===n[0])&&(r=r.concat(this.callbacks[t]));return r}},{}],7:[function(e,t){for(var n="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),r=n.length,o=function(){},i={};r--;)i[n[r]]=o;t.exports=i},{}],2:[function(e,t){function n(e){var t=this,n=e||{};this.config={debug:!1,peerConnectionConfig:{iceServers:[{urls:"stun:stun.l.google.com:19302"}]},peerConnectionConstraints:{optional:[]},receiveMedia:{offerToReceiveAudio:1,offerToReceiveVideo:1},enableDataChannels:!0};var r;this.screenSharingSupport=o.screenSharing,this.logger=function(){return e.debug?e.logger||console:e.logger||i}();for(r in n)this.config[r]=n[r];o.support||this.logger.error("Your browser doesn't seem to support WebRTC"),this.peers=[],a.call(this,this.config),this.on("speaking",function(){t.hardMuted||t.peers.forEach(function(e){if(e.enableDataChannels){var t=e.getDataChannel("hark");if("open"!=t.readyState)return;t.send(JSON.stringify({type:"speaking"}))}})}),this.on("stoppedSpeaking",function(){t.hardMuted||t.peers.forEach(function(e){if(e.enableDataChannels){var t=e.getDataChannel("hark");if("open"!=t.readyState)return;t.send(JSON.stringify({type:"stoppedSpeaking"}))}})}),this.on("volumeChange",function(e){t.hardMuted||t.peers.forEach(function(t){if(t.enableDataChannels){var n=t.getDataChannel("hark");if("open"!=n.readyState)return;n.send(JSON.stringify({type:"volume",volume:e}))}})}),this.config.debug&&this.on("*",function(e,n,r){var o;o=t.config.logger===i?console:t.logger,o.log("event:",e,n,r)})}var r=e("util"),o=e("webrtcsupport");e("wildemitter");var i=e("mockconsole"),a=e("localmedia"),s=e("./peer");r.inherits(n,a),n.prototype.createPeer=function(e){var t;return e.parent=this,t=new s(e),this.peers.push(t),t},n.prototype.removePeers=function(e,t){this.getPeers(e,t).forEach(function(e){e.end()})},n.prototype.getPeers=function(e,t){return this.peers.filter(function(n){return!(e&&n.id!==e||t&&n.type!==t)})},n.prototype.sendToAll=function(e,t){this.peers.forEach(function(n){n.send(e,t)})},n.prototype.sendDirectlyToAll=function(e,t,n){this.peers.forEach(function(r){r.enableDataChannels&&r.sendDirectly(e,t,n)})},t.exports=n},{"./peer":9,localmedia:10,mockconsole:7,util:8,webrtcsupport:4,wildemitter:5}],3:[function(e,t){function n(e){this.connection=r.connect(e.url,e.socketio)}var r=e("socket.io-client");n.prototype.on=function(e,t){this.connection.on(e,t)},n.prototype.emit=function(){this.connection.emit.apply(this.connection,arguments)},n.prototype.getSessionid=function(){return this.connection.id},n.prototype.disconnect=function(){return this.connection.disconnect()},t.exports=n},{"socket.io-client":11}],8:[function(e,t,n){function r(e){return Array.isArray(e)||"object"==typeof e&&"[object Array]"===Object.prototype.toString.call(e)}function o(e){"object"==typeof e&&"[object RegExp]"===Object.prototype.toString.call(e)}function i(e){return"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}e("events"),n.isArray=r,n.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},n.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},n.print=function(){},n.puts=function(){},n.debug=function(){},n.inspect=function(e,t,c,u){function p(e,c){if(e&&"function"==typeof e.inspect&&e!==n&&(!e.constructor||e.constructor.prototype!==e))return e.inspect(c);switch(typeof e){case"undefined":return f("undefined","undefined");case"string":var u="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return f(u,"string");case"number":return f(""+e,"number");case"boolean":return f(""+e,"boolean")}if(null===e)return f("null","null");var l=a(e),h=t?s(e):l;if("function"==typeof e&&0===h.length){if(o(e))return f(""+e,"regexp");var g=e.name?": "+e.name:"";return f("[Function"+g+"]","special")}if(i(e)&&0===h.length)return f(e.toUTCString(),"date");var m,v,y;if(r(e)?(v="Array",y=["[","]"]):(v="Object",y=["{","}"]),"function"==typeof e){var b=e.name?": "+e.name:"";m=o(e)?" "+e:" [Function"+b+"]"}else m="";if(i(e)&&(m=" "+e.toUTCString()),0===h.length)return y[0]+m+y[1];if(0>c)return o(e)?f(""+e,"regexp"):f("[Object]","special");d.push(e);var w=h.map(function(t){var n,o;if(e.__lookupGetter__&&(e.__lookupGetter__(t)?o=e.__lookupSetter__(t)?f("[Getter/Setter]","special"):f("[Getter]","special"):e.__lookupSetter__(t)&&(o=f("[Setter]","special"))),l.indexOf(t)<0&&(n="["+t+"]"),o||(d.indexOf(e[t])<0?(o=null===c?p(e[t]):p(e[t],c-1),o.indexOf("\n")>-1&&(o=r(e)?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=f("[Circular]","special")),"undefined"==typeof n){if("Array"===v&&t.match(/^\d+$/))return o;n=JSON.stringify(""+t),n.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(n=n.substr(1,n.length-2),n=f(n,"name")):(n=n.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),n=f(n,"string"))}return n+": "+o});d.pop();var S=0,k=w.reduce(function(e,t){return S++,t.indexOf("\n")>=0&&S++,e+t.length+1},0);return w=k>50?y[0]+(""===m?"":m+"\n ")+" "+w.join(",\n ")+" "+y[1]:y[0]+m+" "+w.join(", ")+" "+y[1]}var d=[],f=function(e,t){var n={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},r={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[t];return r?"["+n[r][0]+"m"+e+"["+n[r][1]+"m":e};return u||(f=function(e){return e}),p(e,"undefined"==typeof c?2:c)},n.log=function(){},n.pump=null;var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},s=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.hasOwnProperty.call(e,n)&&t.push(n);return t},c=Object.create||function(e,t){var n;if(null===e)n={__proto__:null};else{if("object"!=typeof e)throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return"undefined"!=typeof t&&Object.defineProperties&&Object.defineProperties(n,t),n};n.inherits=function(e,t){e.super_=t,e.prototype=c(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})};var u=/%[sdj%]/g;n.format=function(e){if("string"!=typeof e){for(var t=[],r=0;r=i)return e;switch(e){case"%s":return String(o[r++]);case"%d":return Number(o[r++]);case"%j":return JSON.stringify(o[r++]);default:return e}}),s=o[r];i>r;s=o[++r])a+=null===s||"object"!=typeof s?" "+s:" "+n.inspect(s);return a}},{events:12}],6:[function(e,t){var n=e("webrtc-adapter-test");t.exports=function(e,t,r){var o;window.URL;var i=t,a={autoplay:!0,mirror:!1,muted:!1,audio:!1,disableContextMenu:!1};if(r)for(o in r)a[o]=r[o];return i?"audio"===i.tagName.toLowerCase()&&(a.audio=!0):i=document.createElement(a.audio?"audio":"video"),a.disableContextMenu&&(i.oncontextmenu=function(e){e.preventDefault()}),a.autoplay&&(i.autoplay="autoplay"),a.muted&&(i.muted=!0),!a.audio&&a.mirror&&["","moz","webkit","o","ms"].forEach(function(e){var t=e?e+"Transform":"transform";i.style[t]="scaleX(-1)"}),n.attachMediaStream(i,e),i}},{"webrtc-adapter-test":13}],13:[function(t,n){"use strict";function r(e){return new Promise(function(t,n){o(e,t,n)})}var o=null,i=null,a=null,s=null,c=null,u=null,p={log:function(){"undefined"!=typeof n||"function"==typeof t&&"function"==typeof e||console.log.apply(console,arguments)},extractVersion:function(e,t,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n])}};if("object"==typeof window&&(!window.HTMLMediaElement||"srcObject"in window.HTMLMediaElement.prototype||Object.defineProperty(window.HTMLMediaElement.prototype,"srcObject",{get:function(){return"mozSrcObject"in this?this.mozSrcObject:this._srcObject},set:function(e){"mozSrcObject"in this?this.mozSrcObject=e:(this._srcObject=e,this.src=URL.createObjectURL(e))}}),o=window.navigator&&window.navigator.getUserMedia),i=function(e,t){e.srcObject=t},a=function(e,t){e.srcObject=t.srcObject},"undefined"!=typeof window&&window.navigator)if(navigator.mozGetUserMedia&&window.mozRTCPeerConnection){if(p.log("This appears to be Firefox"),s="firefox",c=p.extractVersion(navigator.userAgent,/Firefox\/([0-9]+)\./,1),u=31,window.RTCPeerConnection=function(e,t){if(38>c&&e&&e.iceServers){for(var n=[],r=0;rc&&(p.log("spec: "+JSON.stringify(e)),e.audio&&(e.audio=r(e.audio)),e.video&&(e.video=r(e.video)),p.log("ff37: "+JSON.stringify(e))),navigator.mozGetUserMedia(e,t,n)},navigator.getUserMedia=o,navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:r,addEventListener:function(){},removeEventListener:function(){}}),navigator.mediaDevices.enumerateDevices=navigator.mediaDevices.enumerateDevices||function(){return new Promise(function(e){var t=[{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}];e(t)})},41>c){var d=navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);navigator.mediaDevices.enumerateDevices=function(){return d().then(void 0,function(e){if("NotFoundError"===e.name)return[];throw e})}}}else if(navigator.webkitGetUserMedia&&window.webkitRTCPeerConnection){p.log("This appears to be Chrome"),s="chrome",c=p.extractVersion(navigator.userAgent,/Chrom(e|ium)\/([0-9]+)\./,2),u=38,window.RTCPeerConnection=function(e,t){e&&e.iceTransportPolicy&&(e.iceTransports=e.iceTransportPolicy);var n=new webkitRTCPeerConnection(e,t),r=n.getStats.bind(n);return n.getStats=function(e,t){var n=this,o=arguments;if(arguments.length>0&&"function"==typeof e)return r(e,t);var i=function(e){var t={},n=e.result();return n.forEach(function(e){var n={id:e.id,timestamp:e.timestamp,type:e.type};e.names().forEach(function(t){n[t]=e.stat(t)}),t[n.id]=n}),t};if(arguments.length>=2){var a=function(e){o[1](i(e))};return r.apply(this,[a,arguments[0]])}return new Promise(function(t,a){1===o.length&&null===e?r.apply(n,[function(e){t.apply(null,[i(e)])},a]):r.apply(n,[t,a])})},n},["createOffer","createAnswer"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){var e=this;if(arguments.length<1||1===arguments.length&&"object"==typeof arguments[0]){var n=1===arguments.length?arguments[0]:void 0;return new Promise(function(r,o){t.apply(e,[r,o,n])})}return t.apply(this,arguments)}}),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){var e=arguments,n=this;return new Promise(function(r,o){t.apply(n,[e[0],function(){r(),e.length>=2&&e[1].apply(null,[])},function(t){o(t),e.length>=3&&e[2].apply(null,[t])}])})}});var f=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var i={};"number"==typeof r.ideal?(i[o("min",n)]=r.ideal,t.optional.push(i),i={},i[o("max",n)]=r.ideal,t.optional.push(i)):(i[o("",n)]=r.ideal,t.optional.push(i))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[o("",n)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[o(e,n)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t};if(o=function(e,t,n){return e.audio&&(e.audio=f(e.audio)),e.video&&(e.video=f(e.video)),p.log("chrome: "+JSON.stringify(e)),navigator.webkitGetUserMedia(e,t,n)},navigator.getUserMedia=o,navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:r,enumerateDevices:function(){return new Promise(function(e){var t={audio:"audioinput",video:"videoinput"};return MediaStreamTrack.getSources(function(n){e(n.map(function(e){return{label:e.label,kind:t[e.kind],deviceId:e.id,groupId:""}}))})})}}),navigator.mediaDevices.getUserMedia){var l=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(e){return p.log("spec: "+JSON.stringify(e)),e.audio=f(e.audio),e.video=f(e.video),p.log("chrome: "+JSON.stringify(e)),l(e)}}else navigator.mediaDevices.getUserMedia=function(e){return r(e)};"undefined"==typeof navigator.mediaDevices.addEventListener&&(navigator.mediaDevices.addEventListener=function(){p.log("Dummy mediaDevices.addEventListener called.")}),"undefined"==typeof navigator.mediaDevices.removeEventListener&&(navigator.mediaDevices.removeEventListener=function(){p.log("Dummy mediaDevices.removeEventListener called.")}),i=function(e,t){c>=43?e.srcObject=t:"undefined"!=typeof e.src?e.src=URL.createObjectURL(t):p.log("Error attaching stream to element.")},a=function(e,t){c>=43?e.srcObject=t.srcObject:e.src=t.src}}else navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?(p.log("This appears to be Edge"),s="edge",c=p.extractVersion(navigator.userAgent,/Edge\/(\d+).(\d+)$/,2),u=12):p.log("Browser does not appear to be WebRTC-capable");else p.log("This does not appear to be a browser"),s="not a browser";var h={};try{Object.defineProperty(h,"version",{set:function(e){c=e}})}catch(g){}if("undefined"!=typeof n){var m;"undefined"!=typeof window&&(m=window.RTCPeerConnection),n.exports={RTCPeerConnection:m,getUserMedia:o,attachMediaStream:i,reattachMediaStream:a,webrtcDetectedBrowser:s,webrtcDetectedVersion:c,webrtcMinimumVersion:u,webrtcTesting:h,webrtcUtils:p}}else"function"==typeof t&&"function"==typeof e&&e([],function(){return{RTCPeerConnection:window.RTCPeerConnection,getUserMedia:o,attachMediaStream:i,reattachMediaStream:a,webrtcDetectedBrowser:s,webrtcDetectedVersion:c,webrtcMinimumVersion:u,webrtcTesting:h,webrtcUtils:p}})},{}],14:[function(e,t){var n=t.exports={};n.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.binding=function(){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw new Error("process.chdir is not supported")}},{}],12:[function(e,t,n){function r(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;no;o++)r[o].apply(this,n);return!0}return!1},i.prototype.addListener=function(e,t){if("function"!=typeof t)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",e,t),this._events[e])if(a(this._events[e])){if(!this._events[e].warned){var n;n=void 0!==this._events.maxListeners?this._events.maxListeners:s,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}this._events[e].push(t)}else this._events[e]=[this._events[e],t];else this._events[e]=t;return this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){var n=this;return n.on(e,function r(){n.removeListener(e,r),t.apply(this,arguments)}),this},i.prototype.removeListener=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[e])return this;var n=this._events[e];if(a(n)){var o=r(n,t);if(0>o)return this;n.splice(o,1),0==n.length&&delete this._events[e]}else this._events[e]===t&&delete this._events[e];return this},i.prototype.removeAllListeners=function(e){return 0===arguments.length?(this._events={},this):(e&&this._events&&this._events[e]&&(this._events[e]=null),this)},i.prototype.listeners=function(e){return this._events||(this._events={}),this._events[e]||(this._events[e]=[]),a(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},i.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?"function"==typeof e._events[t]?1:e._events[t].length:0}},{__browserify_process:14}],9:[function(e,t){function n(e){var t=this;a.call(this),this.id=e.id,this.parent=e.parent,this.type=e.type||"video",this.oneway=e.oneway||!1,this.sharemyscreen=e.sharemyscreen||!1,this.browserPrefix=e.prefix,this.stream=e.stream,this.enableDataChannels=void 0===e.enableDataChannels?this.parent.config.enableDataChannels:e.enableDataChannels,this.receiveMedia=e.receiveMedia||this.parent.config.receiveMedia,this.channels={},this.sid=e.sid||Date.now().toString(),this.pc=new i(this.parent.config.peerConnectionConfig,this.parent.config.peerConnectionConstraints),this.pc.on("ice",this.onIceCandidate.bind(this)),this.pc.on("endOfCandidates",function(e){t.send("endOfCandidates",e)}),this.pc.on("offer",function(e){t.parent.config.nick&&(e.nick=t.parent.config.nick),t.send("offer",e)}),this.pc.on("answer",function(e){t.parent.config.nick&&(e.nick=t.parent.config.nick),t.send("answer",e)}),this.pc.on("addStream",this.handleRemoteStreamAdded.bind(this)),this.pc.on("addChannel",this.handleDataChannelAdded.bind(this)),this.pc.on("removeStream",this.handleStreamRemoved.bind(this)),this.pc.on("negotiationNeeded",this.emit.bind(this,"negotiationNeeded")),this.pc.on("iceConnectionStateChange",this.emit.bind(this,"iceConnectionStateChange")),this.pc.on("iceConnectionStateChange",function(){switch(t.pc.iceConnectionState){case"failed":"offer"===t.pc.pc.peerconnection.localDescription.type&&(t.parent.emit("iceFailed",t),t.send("connectivityError"))}}),this.pc.on("signalingStateChange",this.emit.bind(this,"signalingStateChange")),this.logger=this.parent.logger,"screen"===e.type?this.parent.localScreen&&this.sharemyscreen&&(this.logger.log("adding local screen stream to peer connection"),this.pc.addStream(this.parent.localScreen),this.broadcaster=e.broadcaster):this.parent.localStreams.forEach(function(e){t.pc.addStream(e)}),this.on("channelOpen",function(e){e.protocol===c&&(e.onmessage=function(n){var r=JSON.parse(n.data),o=new s.Receiver;o.receive(r,e),t.emit("fileTransfer",r,o),o.on("receivedFile",function(){o.channel.close()})})}),this.on("*",function(){t.parent.emit.apply(t.parent,arguments)})}var r=e("util"),o=e("webrtcsupport"),i=e("rtcpeerconnection"),a=e("wildemitter"),s=e("filetransfer"),c="https://simplewebrtc.com/protocol/filetransfer#inband-v1";r.inherits(n,a),n.prototype.handleMessage=function(e){var t=this;if(this.logger.log("getting",e.type,e),e.prefix&&(this.browserPrefix=e.prefix),"offer"===e.type)this.nick||(this.nick=e.payload.nick),delete e.payload.nick,this.pc.handleOffer(e.payload,function(e){e||t.pc.answer(function(){}) -});else if("answer"===e.type)this.nick||(this.nick=e.payload.nick),delete e.payload.nick,this.pc.handleAnswer(e.payload);else if("candidate"===e.type)this.pc.processIce(e.payload);else if("connectivityError"===e.type)this.parent.emit("connectivityError",t);else if("mute"===e.type)this.parent.emit("mute",{id:e.from,name:e.payload.name});else if("unmute"===e.type)this.parent.emit("unmute",{id:e.from,name:e.payload.name});else if("endOfCandidates"===e.type){var n=this.pc.pc.peerconnection.transceivers||[];n.forEach(function(e){e.iceTransport&&e.iceTransport.addRemoteCandidate({})})}},n.prototype.send=function(e,t){var n={to:this.id,sid:this.sid,broadcaster:this.broadcaster,roomType:this.type,type:e,payload:t,prefix:o.prefix};this.logger.log("sending",e,n),this.parent.emit("message",n)},n.prototype.sendDirectly=function(e,t,n){var r={type:t,payload:n};this.logger.log("sending via datachannel",e,t,r);var o=this.getDataChannel(e);return"open"!=o.readyState?!1:(o.send(JSON.stringify(r)),!0)},n.prototype._observeDataChannel=function(e){var t=this;e.onclose=this.emit.bind(this,"channelClose",e),e.onerror=this.emit.bind(this,"channelError",e),e.onmessage=function(n){t.emit("channelMessage",t,e.label,JSON.parse(n.data),e,n)},e.onopen=this.emit.bind(this,"channelOpen",e)},n.prototype.getDataChannel=function(e,t){if(!o.supportDataChannel)return this.emit("error",new Error("createDataChannel not supported"));var n=this.channels[e];return t||(t={}),n?n:(n=this.channels[e]=this.pc.createDataChannel(e,t),this._observeDataChannel(n),n)},n.prototype.onIceCandidate=function(e){if(!this.closed)if(e){var t=this.parent.config.peerConnectionConfig;"moz"===o.prefix&&t&&t.iceTransports&&e.candidate&&e.candidate.candidate&&e.candidate.candidate.indexOf(t.iceTransports)<0?this.logger.log("Ignoring ice candidate not matching pcConfig iceTransports type: ",t.iceTransports):this.send("candidate",e)}else this.logger.log("End of candidates.")},n.prototype.start=function(){this.enableDataChannels&&this.getDataChannel("simplewebrtc"),this.pc.offer(this.receiveMedia,function(){})},n.prototype.icerestart=function(){var e=this.receiveMedia;e.mandatory.IceRestart=!0,this.pc.offer(e,function(){})},n.prototype.end=function(){this.closed||(this.pc.close(),this.handleStreamRemoved())},n.prototype.handleRemoteStreamAdded=function(e){var t=this;this.stream?this.logger.warn("Already have a remote stream"):(this.stream=e.stream,this.stream.onended=function(){t.end()},this.parent.emit("peerStreamAdded",this))},n.prototype.handleStreamRemoved=function(){this.parent.peers.splice(this.parent.peers.indexOf(this),1),this.closed=!0,this.parent.emit("peerStreamRemoved",this)},n.prototype.handleDataChannelAdded=function(e){this.channels[e.label]=e,this._observeDataChannel(e)},n.prototype.sendFile=function(e){var t=new s.Sender,n=this.getDataChannel("filetransfer"+(new Date).getTime(),{protocol:c});return n.onopen=function(){n.send(JSON.stringify({size:e.size,name:e.name})),t.send(e,n)},n.onclose=function(){console.log("sender received transfer"),t.emit("complete")},t},t.exports=n},{filetransfer:16,rtcpeerconnection:15,util:8,webrtcsupport:4,wildemitter:5}],11:[function(e,t){t.exports=e("./lib/")},{"./lib/":17}],18:[function(e,t){var n,r;window.mozRTCPeerConnection||navigator.mozGetUserMedia?(n="moz",r=parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1],10)):(window.webkitRTCPeerConnection||navigator.webkitGetUserMedia)&&(n="webkit",r=navigator.userAgent.match(/Chrom(e|ium)/)&&parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2],10));var o=window.mozRTCPeerConnection||window.webkitRTCPeerConnection,i=window.mozRTCIceCandidate||window.RTCIceCandidate,a=window.mozRTCSessionDescription||window.RTCSessionDescription,s=window.webkitMediaStream||window.MediaStream,c="https:"===window.location.protocol&&("webkit"===n&&r>=26||"moz"===n&&r>=33),u=window.AudioContext||window.webkitAudioContext,p=document.createElement("video"),d=p&&p.canPlayType&&"probably"===p.canPlayType('video/webm; codecs="vp8", vorbis'),f=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.msGetUserMedia||navigator.mozGetUserMedia;t.exports={prefix:n,browserVersion:r,support:!!o&&d&&!!f,supportRTCPeerConnection:!!o,supportVp8:d,supportGetUserMedia:!!f,supportDataChannel:!!(o&&o.prototype&&o.prototype.createDataChannel),supportWebAudio:!(!u||!u.prototype.createMediaStreamSource),supportMediaStream:!(!s||!s.prototype.removeTrack),supportScreenSharing:!!c,dataChannel:!!(o&&o.prototype&&o.prototype.createDataChannel),webAudio:!(!u||!u.prototype.createMediaStreamSource),mediaStream:!(!s||!s.prototype.removeTrack),screenSharing:!!c,AudioContext:u,PeerConnection:o,SessionDescription:a,IceCandidate:i,MediaStream:s,getUserMedia:f}},{}],10:[function(e,t){function n(e){c.call(this);var t,n=this.config={autoAdjustMic:!1,detectSpeakingEvents:!1,audioFallback:!1,media:{audio:!0,video:!0},logger:p};for(t in e)this.config[t]=e[t];this.logger=n.logger,this._log=this.logger.log.bind(this.logger,"LocalMedia:"),this._logerror=this.logger.error.bind(this.logger,"LocalMedia:"),this.screenSharingSupport=i.screenSharing,this.localStreams=[],this.localScreens=[],i.support||this._logerror("Your browser does not support local media capture.")}var r=e("util"),o=e("hark"),i=e("webrtcsupport"),a=e("getusermedia"),s=e("getscreenmedia"),c=e("wildemitter"),u=e("mediastream-gain"),p=e("mockconsole");r.inherits(n,c),n.prototype.start=function(e,t){var n=this,r=e||this.config.media;a(r,function(e,o){if(e){if(n.config.audioFallback&&"DevicesNotFoundError"===e.name&&r.video!==!1)return r.video=!1,n.start(r,t),void 0}else r.audio&&n.config.detectSpeakingEvents&&n.setupAudioMonitor(o,n.config.harkOptions),n.localStreams.push(o),n.config.autoAdjustMic&&(n.gainController=new u(o),n.setMicIfEnabled(.5)),o.onended=function(){},n.emit("localStream",o);return t?t(e,o):void 0})},n.prototype.stop=function(e){var t=this;if(e){e.getTracks().forEach(function(e){e.stop()});var n=t.localStreams.indexOf(e);n>-1?(t.emit("localStreamStopped",e),t.localStreams=t.localStreams.splice(n,1)):(n=t.localScreens.indexOf(e),n>-1&&(t.emit("localScreenStopped",e),t.localScreens=t.localScreens.splice(n,1)))}else this.stopStreams(),this.stopScreenShare()},n.prototype.stopStreams=function(){var e=this;this.audioMonitor&&(this.audioMonitor.stop(),delete this.audioMonitor),this.localStreams.forEach(function(t){t.getTracks().forEach(function(e){e.stop()}),e.emit("localStreamStopped",t)}),this.localStreams=[]},n.prototype.startScreenShare=function(e){var t=this;s(function(n,r){return n||(t.localScreens.push(r),r.onended=function(){var e=t.localScreens.indexOf(r);e>-1&&t.localScreens.splice(e,1),t.emit("localScreenStopped",r)},t.emit("localScreen",r)),e?e(n,r):void 0})},n.prototype.stopScreenShare=function(e){var t=this;e?(e.getTracks().forEach(function(e){e.stop()}),this.emit("localScreenStopped",e)):(this.localScreens.forEach(function(e){e.getTracks().forEach(function(e){e.stop()}),t.emit("localScreenStopped",e)}),this.localScreens=[])},n.prototype.mute=function(){this._audioEnabled(!1),this.hardMuted=!0,this.emit("audioOff")},n.prototype.unmute=function(){this._audioEnabled(!0),this.hardMuted=!1,this.emit("audioOn")},n.prototype.setupAudioMonitor=function(e,t){this._log("Setup audio");var n,r=this.audioMonitor=o(e,t),i=this;r.on("speaking",function(){i.emit("speaking"),i.hardMuted||i.setMicIfEnabled(1)}),r.on("stopped_speaking",function(){n&&clearTimeout(n),n=setTimeout(function(){i.emit("stoppedSpeaking"),i.hardMuted||i.setMicIfEnabled(.5)},1e3)}),r.on("volume_change",function(e,t){i.emit("volumeChange",e,t)})},n.prototype.setMicIfEnabled=function(e){this.config.autoAdjustMic&&this.gainController.setGain(e)},n.prototype.pauseVideo=function(){this._videoEnabled(!1),this.emit("videoOff")},n.prototype.resumeVideo=function(){this._videoEnabled(!0),this.emit("videoOn")},n.prototype.pause=function(){this.mute(),this.pauseVideo()},n.prototype.resume=function(){this.unmute(),this.resumeVideo()},n.prototype._audioEnabled=function(e){this.setMicIfEnabled(e?1:0),this.localStreams.forEach(function(t){t.getAudioTracks().forEach(function(t){t.enabled=!!e})})},n.prototype._videoEnabled=function(e){this.localStreams.forEach(function(t){t.getVideoTracks().forEach(function(t){t.enabled=!!e})})},n.prototype.isAudioEnabled=function(){var e=!0;return this.localStreams.forEach(function(t){t.getAudioTracks().forEach(function(t){e=e&&t.enabled})}),e},n.prototype.isVideoEnabled=function(){var e=!0;return this.localStreams.forEach(function(t){t.getVideoTracks().forEach(function(t){e=e&&t.enabled})}),e},n.prototype.startLocalMedia=n.prototype.start,n.prototype.stopLocalMedia=n.prototype.stop,Object.defineProperty(n.prototype,"localStream",{get:function(){return this.localStreams.length>0?this.localStreams[0]:null}}),Object.defineProperty(n.prototype,"localScreen",{get:function(){return this.localScreens.length>0?this.localScreens[0]:null}}),t.exports=n},{getscreenmedia:20,getusermedia:21,hark:19,"mediastream-gain":22,mockconsole:7,util:8,webrtcsupport:18,wildemitter:5}],23:[function(t,n){"use strict";function r(e){return new Promise(function(t,n){o(e,t,n)})}var o=null,i=null,a=null,s=null,c=null,u=null,p={log:function(){"undefined"!=typeof n||"function"==typeof t&&"function"==typeof e||console.log.apply(console,arguments)},extractVersion:function(e,t,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n])}};if("object"==typeof window&&(!window.HTMLMediaElement||"srcObject"in window.HTMLMediaElement.prototype||Object.defineProperty(window.HTMLMediaElement.prototype,"srcObject",{get:function(){return"mozSrcObject"in this?this.mozSrcObject:this._srcObject},set:function(e){"mozSrcObject"in this?this.mozSrcObject=e:(this._srcObject=e,this.src=URL.createObjectURL(e))}}),o=window.navigator&&window.navigator.getUserMedia),i=function(e,t){e.srcObject=t},a=function(e,t){e.srcObject=t.srcObject},"undefined"!=typeof window&&window.navigator)if(navigator.mozGetUserMedia&&window.mozRTCPeerConnection){if(p.log("This appears to be Firefox"),s="firefox",c=p.extractVersion(navigator.userAgent,/Firefox\/([0-9]+)\./,1),u=31,window.RTCPeerConnection=function(e,t){if(38>c&&e&&e.iceServers){for(var n=[],r=0;rc&&(p.log("spec: "+JSON.stringify(e)),e.audio&&(e.audio=r(e.audio)),e.video&&(e.video=r(e.video)),p.log("ff37: "+JSON.stringify(e))),navigator.mozGetUserMedia(e,t,n)},navigator.getUserMedia=o,navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:r,addEventListener:function(){},removeEventListener:function(){}}),navigator.mediaDevices.enumerateDevices=navigator.mediaDevices.enumerateDevices||function(){return new Promise(function(e){var t=[{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}];e(t)})},41>c){var d=navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);navigator.mediaDevices.enumerateDevices=function(){return d().then(void 0,function(e){if("NotFoundError"===e.name)return[];throw e})}}}else if(navigator.webkitGetUserMedia&&window.webkitRTCPeerConnection){p.log("This appears to be Chrome"),s="chrome",c=p.extractVersion(navigator.userAgent,/Chrom(e|ium)\/([0-9]+)\./,2),u=38,window.RTCPeerConnection=function(e,t){e&&e.iceTransportPolicy&&(e.iceTransports=e.iceTransportPolicy);var n=new webkitRTCPeerConnection(e,t),r=n.getStats.bind(n);return n.getStats=function(e,t){var n=this,o=arguments;if(arguments.length>0&&"function"==typeof e)return r(e,t);var i=function(e){var t={},n=e.result();return n.forEach(function(e){var n={id:e.id,timestamp:e.timestamp,type:e.type};e.names().forEach(function(t){n[t]=e.stat(t)}),t[n.id]=n}),t};if(arguments.length>=2){var a=function(e){o[1](i(e))};return r.apply(this,[a,arguments[0]])}return new Promise(function(t,a){1===o.length&&null===e?r.apply(n,[function(e){t.apply(null,[i(e)])},a]):r.apply(n,[t,a])})},n},["createOffer","createAnswer"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){var e=this;if(arguments.length<1||1===arguments.length&&"object"==typeof arguments[0]){var n=1===arguments.length?arguments[0]:void 0;return new Promise(function(r,o){t.apply(e,[r,o,n])})}return t.apply(this,arguments)}}),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){var e=arguments,n=this;return new Promise(function(r,o){t.apply(n,[e[0],function(){r(),e.length>=2&&e[1].apply(null,[])},function(t){o(t),e.length>=3&&e[2].apply(null,[t])}])})}});var f=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var i={};"number"==typeof r.ideal?(i[o("min",n)]=r.ideal,t.optional.push(i),i={},i[o("max",n)]=r.ideal,t.optional.push(i)):(i[o("",n)]=r.ideal,t.optional.push(i))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[o("",n)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[o(e,n)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t};if(o=function(e,t,n){return e.audio&&(e.audio=f(e.audio)),e.video&&(e.video=f(e.video)),p.log("chrome: "+JSON.stringify(e)),navigator.webkitGetUserMedia(e,t,n)},navigator.getUserMedia=o,navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:r,enumerateDevices:function(){return new Promise(function(e){var t={audio:"audioinput",video:"videoinput"};return MediaStreamTrack.getSources(function(n){e(n.map(function(e){return{label:e.label,kind:t[e.kind],deviceId:e.id,groupId:""}}))})})}}),navigator.mediaDevices.getUserMedia){var l=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(e){return p.log("spec: "+JSON.stringify(e)),e.audio=f(e.audio),e.video=f(e.video),p.log("chrome: "+JSON.stringify(e)),l(e)}}else navigator.mediaDevices.getUserMedia=function(e){return r(e)};"undefined"==typeof navigator.mediaDevices.addEventListener&&(navigator.mediaDevices.addEventListener=function(){p.log("Dummy mediaDevices.addEventListener called.")}),"undefined"==typeof navigator.mediaDevices.removeEventListener&&(navigator.mediaDevices.removeEventListener=function(){p.log("Dummy mediaDevices.removeEventListener called.")}),i=function(e,t){c>=43?e.srcObject=t:"undefined"!=typeof e.src?e.src=URL.createObjectURL(t):p.log("Error attaching stream to element.")},a=function(e,t){c>=43?e.srcObject=t.srcObject:e.src=t.src}}else navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?(p.log("This appears to be Edge"),s="edge",c=p.extractVersion(navigator.userAgent,/Edge\/(\d+).(\d+)$/,2),u=12):p.log("Browser does not appear to be WebRTC-capable");else p.log("This does not appear to be a browser"),s="not a browser";var h={};try{Object.defineProperty(h,"version",{set:function(e){c=e}})}catch(g){}if("undefined"!=typeof n){var m;"undefined"!=typeof window&&(m=window.RTCPeerConnection),n.exports={RTCPeerConnection:m,getUserMedia:o,attachMediaStream:i,reattachMediaStream:a,webrtcDetectedBrowser:s,webrtcDetectedVersion:c,webrtcMinimumVersion:u,webrtcTesting:h,webrtcUtils:p}}else"function"==typeof t&&"function"==typeof e&&e([],function(){return{RTCPeerConnection:window.RTCPeerConnection,getUserMedia:o,attachMediaStream:i,reattachMediaStream:a,webrtcDetectedBrowser:s,webrtcDetectedVersion:c,webrtcMinimumVersion:u,webrtcTesting:h,webrtcUtils:p}})},{}],15:[function(e,t){function n(e,t){var n,r=this;s.call(this),e=e||{},e.iceServers=e.iceServers||[],this.enableChromeNativeSimulcast=!1,t&&t.optional&&"chrome"===u.webrtcDetectedBrowser&&null===navigator.appVersion.match(/Chromium\//)&&t.optional.forEach(function(e){e.enableChromeNativeSimulcast&&(r.enableChromeNativeSimulcast=!0)}),this.enableMultiStreamHacks=!1,t&&t.optional&&"chrome"===u.webrtcDetectedBrowser&&t.optional.forEach(function(e){e.enableMultiStreamHacks&&(r.enableMultiStreamHacks=!0)}),this.restrictBandwidth=0,t&&t.optional&&t.optional.forEach(function(e){e.andyetRestrictBandwidth&&(r.restrictBandwidth=e.andyetRestrictBandwidth)}),this.batchIceCandidates=0,t&&t.optional&&t.optional.forEach(function(e){e.andyetBatchIce&&(r.batchIceCandidates=e.andyetBatchIce)}),this.batchedIceCandidates=[],t&&t.optional&&"chrome"===u.webrtcDetectedBrowser&&t.optional.forEach(function(e){e.andyetFasterICE&&(r.eliminateDuplicateCandidates=e.andyetFasterICE)}),t&&t.optional&&t.optional.forEach(function(e){e.andyetDontSignalCandidates&&(r.dontSignalCandidates=e.andyetDontSignalCandidates)}),this.assumeSetLocalSuccess=!1,t&&t.optional&&t.optional.forEach(function(e){e.andyetAssumeSetLocalSuccess&&(r.assumeSetLocalSuccess=e.andyetAssumeSetLocalSuccess)}),"firefox"===u.webrtcDetectedBrowser&&t&&t.optional&&(this.wtFirefox=0,t.optional.forEach(function(e){e.andyetFirefoxMakesMeSad&&(r.wtFirefox=e.andyetFirefoxMakesMeSad,r.wtFirefox>0&&(r.firefoxcandidatebuffer=[]))})),this.pc=new c(e,t),this.getLocalStreams=this.pc.getLocalStreams.bind(this.pc),this.getRemoteStreams=this.pc.getRemoteStreams.bind(this.pc),this.addStream=this.pc.addStream.bind(this.pc),this.removeStream=this.pc.removeStream.bind(this.pc),this.pc.on("*",function(){r.emit.apply(r,arguments)}),this.pc.onremovestream=this.emit.bind(this,"removeStream"),this.pc.onaddstream=this.emit.bind(this,"addStream"),this.pc.onnegotiationneeded=this.emit.bind(this,"negotiationNeeded"),this.pc.oniceconnectionstatechange=this.emit.bind(this,"iceConnectionStateChange"),this.pc.onsignalingstatechange=this.emit.bind(this,"signalingStateChange"),this.pc.onicecandidate=this._onIce.bind(this),this.pc.ondatachannel=this._onDataChannel.bind(this),this.localDescription={contents:[]},this.remoteDescription={contents:[]},this.config={debug:!1,ice:{},sid:"",isInitiator:!0,sdpSessionID:Date.now(),useJingle:!1};for(n in e)this.config[n]=e[n];this.config.debug&&this.on("*",function(){var t=e.logger||console;t.log("PeerConnection event:",arguments)}),this.hadLocalStunCandidate=!1,this.hadRemoteStunCandidate=!1,this.hadLocalRelayCandidate=!1,this.hadRemoteRelayCandidate=!1,this.hadLocalIPv6Candidate=!1,this.hadRemoteIPv6Candidate=!1,this._remoteDataChannels=[],this._localDataChannels=[],this._candidateBuffer=[]}var r=e("util"),o=e("lodash.foreach"),i=e("lodash.pluck"),a=e("sdp-jingle-json"),s=e("wildemitter"),c=e("traceablepeerconnection"),u=e("webrtc-adapter-test");r.inherits(n,s),Object.defineProperty(n.prototype,"signalingState",{get:function(){return this.pc.signalingState}}),Object.defineProperty(n.prototype,"iceConnectionState",{get:function(){return this.pc.iceConnectionState}}),n.prototype._role=function(){return this.isInitiator?"initiator":"responder"},n.prototype.addStream=function(e){this.localStream=e,this.pc.addStream(e)},n.prototype._checkLocalCandidate=function(e){var t=a.toCandidateJSON(e);"srflx"==t.type?this.hadLocalStunCandidate=!0:"relay"==t.type&&(this.hadLocalRelayCandidate=!0),-1!=t.ip.indexOf(":")&&(this.hadLocalIPv6Candidate=!0)},n.prototype._checkRemoteCandidate=function(e){var t=a.toCandidateJSON(e);"srflx"==t.type?this.hadRemoteStunCandidate=!0:"relay"==t.type&&(this.hadRemoteRelayCandidate=!0),-1!=t.ip.indexOf(":")&&(this.hadRemoteIPv6Candidate=!0)},n.prototype.processIce=function(e,t){t=t||function(){};var n=this;if("closed"===this.pc.signalingState)return t();if(e.contents||e.jingle&&e.jingle.contents){var r=i(this.remoteDescription.contents,"name"),o=e.contents||e.jingle.contents;o.forEach(function(e){var t=e.transport||{},o=t.candidates||[],i=r.indexOf(e.name),s=e.name;o.forEach(function(e){var t=a.toCandidateSDP(e)+"\r\n";n.pc.addIceCandidate(new RTCIceCandidate({candidate:t,sdpMLineIndex:i,sdpMid:s}),function(){},function(e){n.emit("error",e)}),n._checkRemoteCandidate(t)})})}else{if(e.candidate&&0!==e.candidate.candidate.indexOf("a=")&&(e.candidate.candidate="a="+e.candidate.candidate),this.wtFirefox&&null!==this.firefoxcandidatebuffer&&this.pc.localDescription&&"offer"===this.pc.localDescription.type)return this.firefoxcandidatebuffer.push(e.candidate),t();n.pc.addIceCandidate(new RTCIceCandidate(e.candidate),function(){},function(e){n.emit("error",e)}),n._checkRemoteCandidate(e.candidate.candidate)}t()},n.prototype.offer=function(e,t){var n=this,r=2===arguments.length,i=r&&e?e:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};return t=r?t:e,t=t||function(){},"closed"===this.pc.signalingState?t("Already closed"):(this.pc.createOffer(function(e){var r={type:"offer",sdp:e.sdp};n.assumeSetLocalSuccess&&(n.emit("offer",r),t(null,r)),n._candidateBuffer=[],n.pc.setLocalDescription(e,function(){var i;n.config.useJingle&&(i=a.toSessionJSON(e.sdp,{role:n._role(),direction:"outgoing"}),i.sid=n.config.sid,n.localDescription=i,o(i.contents,function(e){var t=e.transport||{};t.ufrag&&(n.config.ice[e.name]={ufrag:t.ufrag,pwd:t.pwd})}),r.jingle=i),r.sdp.split("\r\n").forEach(function(e){0===e.indexOf("a=candidate:")&&n._checkLocalCandidate(e)}),n.assumeSetLocalSuccess||(n.emit("offer",r),t(null,r))},function(e){n.emit("error",e),t(e)})},function(e){n.emit("error",e),t(e)},i),void 0)},n.prototype.handleOffer=function(e,t){t=t||function(){};var n=this;if(e.type="offer",e.jingle){if(this.enableChromeNativeSimulcast&&e.jingle.contents.forEach(function(e){"video"===e.name&&(e.description.googConferenceFlag=!0)}),this.enableMultiStreamHacks&&e.jingle.contents.forEach(function(e){if("video"===e.name){var t=e.description.sources||[];(0===t.length||"3735928559"!==t[0].ssrc)&&(t.unshift({ssrc:"3735928559",parameters:[{key:"cname",value:"deadbeef"},{key:"msid",value:"mixyourfecintothis please"}]}),e.description.sources=t)}}),n.restrictBandwidth>0&&e.jingle.contents.length>=2&&"video"===e.jingle.contents[1].name){var r=e.jingle.contents[1],o=r.description&&r.description.bandwidth;o||(e.jingle.contents[1].description.bandwidth={type:"AS",bandwidth:n.restrictBandwidth.toString()},e.sdp=a.toSessionSDP(e.jingle,{sid:n.config.sdpSessionID,role:n._role(),direction:"outgoing"}))}e.sdp=a.toSessionSDP(e.jingle,{sid:n.config.sdpSessionID,role:n._role(),direction:"incoming"}),n.remoteDescription=e.jingle}e.sdp.split("\r\n").forEach(function(e){0===e.indexOf("a=candidate:")&&n._checkRemoteCandidate(e)}),n.pc.setRemoteDescription(new RTCSessionDescription(e),function(){t()},t)},n.prototype.answerAudioOnly=function(e){var t={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!1}};this._answer(t,e)},n.prototype.answerBroadcastOnly=function(e){var t={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}};this._answer(t,e)},n.prototype.answer=function(e,t){var n=2===arguments.length,r=n?t:e,o=n&&e?e:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};this._answer(o,r)},n.prototype.handleAnswer=function(e,t){t=t||function(){};var n=this;e.jingle&&(e.sdp=a.toSessionSDP(e.jingle,{sid:n.config.sdpSessionID,role:n._role(),direction:"incoming"}),n.remoteDescription=e.jingle),e.sdp.split("\r\n").forEach(function(e){0===e.indexOf("a=candidate:")&&n._checkRemoteCandidate(e)}),n.pc.setRemoteDescription(new RTCSessionDescription(e),function(){n.wtFirefox&&window.setTimeout(function(){n.firefoxcandidatebuffer.forEach(function(e){n.pc.addIceCandidate(new RTCIceCandidate(e),function(){},function(e){n.emit("error",e)}),n._checkRemoteCandidate(e.candidate)}),n.firefoxcandidatebuffer=null},n.wtFirefox),t(null)},t)},n.prototype.close=function(){this.pc.close(),this._localDataChannels=[],this._remoteDataChannels=[],this.emit("close")},n.prototype._answer=function(e,t){t=t||function(){};var n=this;if(!this.pc.remoteDescription)throw new Error("remoteDescription not set");return"closed"===this.pc.signalingState?t("Already closed"):(n.pc.createAnswer(function(e){var r=[];if(n.enableChromeNativeSimulcast&&(e.jingle=a.toSessionJSON(e.sdp,{role:n._role(),direction:"outgoing"}),e.jingle.contents.length>=2&&"video"===e.jingle.contents[1].name)){var o=e.jingle.contents[1].description.sourceGroups||[],i=!1;if(o.forEach(function(e){"SIM"==e.semantics&&(i=!0)}),!i&&e.jingle.contents[1].description.sources.length){var s=JSON.parse(JSON.stringify(e.jingle.contents[1].description.sources[0]));s.ssrc=""+Math.floor(4294967295*Math.random()),e.jingle.contents[1].description.sources.push(s),r.push(e.jingle.contents[1].description.sources[0].ssrc),r.push(s.ssrc),o.push({semantics:"SIM",sources:r});var c=JSON.parse(JSON.stringify(s));c.ssrc=""+Math.floor(4294967295*Math.random()),e.jingle.contents[1].description.sources.push(c),o.push({semantics:"FID",sources:[s.ssrc,c.ssrc]}),e.jingle.contents[1].description.sourceGroups=o,e.sdp=a.toSessionSDP(e.jingle,{sid:n.config.sdpSessionID,role:n._role(),direction:"outgoing"})}}var u={type:"answer",sdp:e.sdp};n.assumeSetLocalSuccess&&(n.emit("answer",u),t(null,u)),n._candidateBuffer=[],n.pc.setLocalDescription(e,function(){if(n.config.useJingle){var r=a.toSessionJSON(e.sdp,{role:n._role(),direction:"outgoing"});r.sid=n.config.sid,n.localDescription=r,u.jingle=r}n.enableChromeNativeSimulcast&&(u.jingle||(u.jingle=a.toSessionJSON(e.sdp,{role:n._role(),direction:"outgoing"})),u.jingle.contents[1].description.sources.forEach(function(e,t){e.parameters=e.parameters.map(function(e){return"msid"===e.key&&(e.value+="-"+Math.floor(t/2)),e})}),u.sdp=a.toSessionSDP(u.jingle,{sid:n.sdpSessionID,role:n._role(),direction:"outgoing"})),u.sdp.split("\r\n").forEach(function(e){0===e.indexOf("a=candidate:")&&n._checkLocalCandidate(e)}),n.assumeSetLocalSuccess||(n.emit("answer",u),t(null,u))},function(e){n.emit("error",e),t(e)})},function(e){n.emit("error",e),t(e)},e),void 0)},n.prototype._onIce=function(e){var t=this;if(e.candidate){if(this.dontSignalCandidates)return;var n=e.candidate,r={candidate:{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex}};this._checkLocalCandidate(n.candidate);var i,s,c=a.toCandidateJSON(n.candidate);if(this.eliminateDuplicateCandidates&&"relay"===c.type&&(i=this._candidateBuffer.filter(function(e){return"relay"===e.type}).map(function(e){return e.foundation+":"+e.component}),s=i.indexOf(c.foundation+":"+c.component),s>-1&&c.priority>>24>=i[s].priority>>24))return;if("max-bundle"===this.config.bundlePolicy&&(i=this._candidateBuffer.filter(function(e){return c.type===e.type}).map(function(e){return e.address+":"+e.port}),s=i.indexOf(c.address+":"+c.port),s>-1))return;if("require"===this.config.rtcpMuxPolicy&&"2"===c.component)return;if(this._candidateBuffer.push(c),t.config.useJingle){if(n.sdpMid||(n.sdpMid=t.pc.remoteDescription&&"offer"===t.pc.remoteDescription.type?t.remoteDescription.contents[n.sdpMLineIndex].name:t.localDescription.contents[n.sdpMLineIndex].name),!t.config.ice[n.sdpMid]){var u=a.toSessionJSON(t.pc.localDescription.sdp,{role:t._role(),direction:"outgoing"});o(u.contents,function(e){var n=e.transport||{};n.ufrag&&(t.config.ice[e.name]={ufrag:n.ufrag,pwd:n.pwd})})}if(r.jingle={contents:[{name:n.sdpMid,creator:t._role(),transport:{transType:"iceUdp",ufrag:t.config.ice[n.sdpMid].ufrag,pwd:t.config.ice[n.sdpMid].pwd,candidates:[c]}}]},t.batchIceCandidates>0)return 0===t.batchedIceCandidates.length&&window.setTimeout(function(){var e={};t.batchedIceCandidates.forEach(function(t){t=t.contents[0],e[t.name]||(e[t.name]=t),e[t.name].transport.candidates.push(t.transport.candidates[0])});var n={jingle:{contents:[]}};Object.keys(e).forEach(function(t){n.jingle.contents.push(e[t])}),t.batchedIceCandidates=[],t.emit("ice",n)},t.batchIceCandidates),t.batchedIceCandidates.push(r.jingle),void 0}this.emit("ice",r)}else this.emit("endOfCandidates")},n.prototype._onDataChannel=function(e){var t=e.channel;this._remoteDataChannels.push(t),this.emit("addChannel",t)},n.prototype.createDataChannel=function(e,t){var n=this.pc.createDataChannel(e,t);return this._localDataChannels.push(n),n},n.prototype.getStats=function(e){this.pc.getStats(null,function(t){e(null,t)},function(t){e(t)})},t.exports=n},{"lodash.foreach":26,"lodash.pluck":27,"sdp-jingle-json":24,traceablepeerconnection:25,util:8,"webrtc-adapter-test":23,wildemitter:5}],16:[function(e,t){function n(e){o.call(this);var t=e||{};this.config={chunksize:16384,pacing:0};var n;for(n in t)this.config[n]=t[n];this.file=null,this.channel=null}function r(){o.call(this),this.receiveBuffer=[],this.received=0,this.metadata={},this.channel=null}var o=e("wildemitter"),i=e("util");i.inherits(n,o),n.prototype.send=function(e,t){var n=this;this.file=e,this.channel=t;var r=function(t){var o=new window.FileReader;o.onload=function(){return function(o){n.channel.send(o.target.result),n.emit("progress",t,e.size,o.target.result),e.size>t+o.target.result.byteLength?window.setTimeout(r,n.config.pacing,t+n.config.chunksize):(n.emit("progress",e.size,e.size,null),n.emit("sentFile"))}}(e);var i=e.slice(t,t+n.config.chunksize);o.readAsArrayBuffer(i)};window.setTimeout(r,0,0)},i.inherits(r,o),r.prototype.receive=function(e,t){var n=this;e&&(this.metadata=e),this.channel=t,t.binaryType="arraybuffer",this.channel.onmessage=function(e){var t=e.data.byteLength;n.received+=t,n.receiveBuffer.push(e.data),n.emit("progress",n.received,n.metadata.size,e.data),n.received===n.metadata.size?(n.emit("receivedFile",new window.Blob(n.receiveBuffer),n.metadata),n.receiveBuffer=[]):n.received>n.metadata.size&&(console.error("received more than expected, discarding..."),n.receiveBuffer=[])}},t.exports={},t.exports.support="undefined"!=typeof window&&window&&window.File&&window.FileReader&&window.Blob,t.exports.Sender=n,t.exports.Receiver=r},{util:8,wildemitter:5}],19:[function(e,t){function n(e,t){var n=-1/0;e.getFloatFrequencyData(t);for(var r=4,o=t.length;o>r;r++)t[r]>n&&t[r]<0&&(n=t[r]);return n}var r=e("wildemitter"),o=window.AudioContext||window.webkitAudioContext,i=null;t.exports=function(e,t){var a=new r;if(!o)return a;var t=t||{},s=t.smoothing||.1,c=t.interval||50,u=t.threshold,p=t.play,d=t.history||10,f=!0;i||(i=new o);var l,h,g;g=i.createAnalyser(),g.fftSize=512,g.smoothingTimeConstant=s,h=new Float32Array(g.fftSize),e.jquery&&(e=e[0]),e instanceof HTMLAudioElement||e instanceof HTMLVideoElement?(l=i.createMediaElementSource(e),"undefined"==typeof p&&(p=!0),u=u||-50):(l=i.createMediaStreamSource(e),u=u||-50),l.connect(g),p&&g.connect(i.destination),a.speaking=!1,a.setThreshold=function(e){u=e},a.setInterval=function(e){c=e},a.stop=function(){f=!1,a.emit("volume_change",-100,u),a.speaking&&(a.speaking=!1,a.emit("stopped_speaking"))},a.speakingHistory=[];for(var m=0;d>m;m++)a.speakingHistory.push(0);var v=function(){setTimeout(function(){if(f){var e=n(g,h);a.emit("volume_change",e,u);var t=0;if(e>u&&!a.speaking){for(var r=a.speakingHistory.length-3;r=2&&(a.speaking=!0,a.emit("speaking"))}else if(u>e&&a.speaking){for(var r=0;ru)),v()}},c)};return v(),a}},{wildemitter:28}],21:[function(e,t){e("webrtc-adapter-test"),t.exports=function(e,t){var n,r=2===arguments.length,o={video:!0,audio:!0},i="PermissionDeniedError",a="PERMISSION_DENIED",s="ConstraintNotSatisfiedError";return r||(t=e,e=o),navigator.getUserMedia?e.audio||e.video?(localStorage&&"true"===localStorage.useFirefoxFakeDevice&&(e.fake=!0),navigator.getUserMedia(e,function(e){t(null,e)},function(e){var n;"string"==typeof e?(n=new Error("MediaStreamError"),n.name=e===i||e===a?i:s):(n=e,n.name||(e.name=n[i]?i:s)),t(n)}),void 0):(n=new Error("MediaStreamError"),n.name="NoMediaRequestedError",window.setTimeout(function(){t(n)},0)):(n=new Error("MediaStreamError"),n.name="NotSupportedError",window.setTimeout(function(){t(n)},0))}},{"webrtc-adapter-test":29}],28:[function(e,t){function n(){}t.exports=n,n.mixin=function(e){var t=e.prototype||e;t.isWildEmitter=!0,t.on=function(e){this.callbacks=this.callbacks||{};var t=3===arguments.length,n=t?arguments[1]:void 0,r=t?arguments[2]:arguments[1];return r._groupName=n,(this.callbacks[e]=this.callbacks[e]||[]).push(r),this},t.once=function(e){function t(){n.off(e,t),i.apply(this,arguments)}var n=this,r=3===arguments.length,o=r?arguments[1]:void 0,i=r?arguments[2]:arguments[1];return this.on(e,o,t),this},t.releaseGroup=function(e){this.callbacks=this.callbacks||{};var t,n,r,o;for(t in this.callbacks)for(o=this.callbacks[t],n=0,r=o.length;r>n;n++)o[n]._groupName===e&&(o.splice(n,1),n--,r--);return this},t.off=function(e,t){this.callbacks=this.callbacks||{};var n,r=this.callbacks[e];return r?1===arguments.length?(delete this.callbacks[e],this):(n=r.indexOf(t),r.splice(n,1),0===r.length&&delete this.callbacks[e],this):this},t.emit=function(e){this.callbacks=this.callbacks||{};var t,n,r,o=[].slice.call(arguments,1),i=this.callbacks[e],a=this.getWildcardCallbacks(e);if(i)for(r=i.slice(),t=0,n=r.length;n>t&&r[t];++t)r[t].apply(this,o);if(a)for(n=a.length,r=a.slice(),t=0,n=r.length;n>t&&r[t];++t)r[t].apply(this,[e].concat(o));return this},t.getWildcardCallbacks=function(e){this.callbacks=this.callbacks||{};var t,n,r=[];for(t in this.callbacks)n=t.split("*"),("*"===t||2===n.length&&e.slice(0,n[0].length)===n[0])&&(r=r.concat(this.callbacks[t]));return r}},n.mixin(n)},{}],29:[function(t,n){"use strict";function r(e){return new Promise(function(t,n){o(e,t,n)})}var o=null,i=null,a=null,s=null,c=null,u=null,p={log:function(){"undefined"!=typeof n||"function"==typeof t&&"function"==typeof e||console.log.apply(console,arguments)},extractVersion:function(e,t,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n])}};if("object"==typeof window&&(!window.HTMLMediaElement||"srcObject"in window.HTMLMediaElement.prototype||Object.defineProperty(window.HTMLMediaElement.prototype,"srcObject",{get:function(){return"mozSrcObject"in this?this.mozSrcObject:this._srcObject},set:function(e){"mozSrcObject"in this?this.mozSrcObject=e:(this._srcObject=e,this.src=URL.createObjectURL(e))}}),o=window.navigator&&window.navigator.getUserMedia),i=function(e,t){e.srcObject=t},a=function(e,t){e.srcObject=t.srcObject},"undefined"!=typeof window&&window.navigator)if(navigator.mozGetUserMedia&&window.mozRTCPeerConnection){if(p.log("This appears to be Firefox"),s="firefox",c=p.extractVersion(navigator.userAgent,/Firefox\/([0-9]+)\./,1),u=31,window.RTCPeerConnection=function(e,t){if(38>c&&e&&e.iceServers){for(var n=[],r=0;rc&&(p.log("spec: "+JSON.stringify(e)),e.audio&&(e.audio=r(e.audio)),e.video&&(e.video=r(e.video)),p.log("ff37: "+JSON.stringify(e))),navigator.mozGetUserMedia(e,t,n)},navigator.getUserMedia=o,navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:r,addEventListener:function(){},removeEventListener:function(){}}),navigator.mediaDevices.enumerateDevices=navigator.mediaDevices.enumerateDevices||function(){return new Promise(function(e){var t=[{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}];e(t)})},41>c){var d=navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);navigator.mediaDevices.enumerateDevices=function(){return d().then(void 0,function(e){if("NotFoundError"===e.name)return[];throw e})}}}else if(navigator.webkitGetUserMedia&&window.webkitRTCPeerConnection){p.log("This appears to be Chrome"),s="chrome",c=p.extractVersion(navigator.userAgent,/Chrom(e|ium)\/([0-9]+)\./,2),u=38,window.RTCPeerConnection=function(e,t){e&&e.iceTransportPolicy&&(e.iceTransports=e.iceTransportPolicy);var n=new webkitRTCPeerConnection(e,t),r=n.getStats.bind(n);return n.getStats=function(e,t){var n=this,o=arguments;if(arguments.length>0&&"function"==typeof e)return r(e,t);var i=function(e){var t={},n=e.result();return n.forEach(function(e){var n={id:e.id,timestamp:e.timestamp,type:e.type};e.names().forEach(function(t){n[t]=e.stat(t)}),t[n.id]=n}),t};if(arguments.length>=2){var a=function(e){o[1](i(e))};return r.apply(this,[a,arguments[0]])}return new Promise(function(t,a){1===o.length&&null===e?r.apply(n,[function(e){t.apply(null,[i(e)])},a]):r.apply(n,[t,a])})},n},["createOffer","createAnswer"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){var e=this;if(arguments.length<1||1===arguments.length&&"object"==typeof arguments[0]){var n=1===arguments.length?arguments[0]:void 0;return new Promise(function(r,o){t.apply(e,[r,o,n])})}return t.apply(this,arguments)}}),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){var e=arguments,n=this;return new Promise(function(r,o){t.apply(n,[e[0],function(){r(),e.length>=2&&e[1].apply(null,[])},function(t){o(t),e.length>=3&&e[2].apply(null,[t])}])})}});var f=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var i={};"number"==typeof r.ideal?(i[o("min",n)]=r.ideal,t.optional.push(i),i={},i[o("max",n)]=r.ideal,t.optional.push(i)):(i[o("",n)]=r.ideal,t.optional.push(i))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[o("",n)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[o(e,n)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t};if(o=function(e,t,n){return e.audio&&(e.audio=f(e.audio)),e.video&&(e.video=f(e.video)),p.log("chrome: "+JSON.stringify(e)),navigator.webkitGetUserMedia(e,t,n)},navigator.getUserMedia=o,navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:r,enumerateDevices:function(){return new Promise(function(e){var t={audio:"audioinput",video:"videoinput"};return MediaStreamTrack.getSources(function(n){e(n.map(function(e){return{label:e.label,kind:t[e.kind],deviceId:e.id,groupId:""}}))})})}}),navigator.mediaDevices.getUserMedia){var l=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(e){return p.log("spec: "+JSON.stringify(e)),e.audio=f(e.audio),e.video=f(e.video),p.log("chrome: "+JSON.stringify(e)),l(e)}}else navigator.mediaDevices.getUserMedia=function(e){return r(e)};"undefined"==typeof navigator.mediaDevices.addEventListener&&(navigator.mediaDevices.addEventListener=function(){p.log("Dummy mediaDevices.addEventListener called.")}),"undefined"==typeof navigator.mediaDevices.removeEventListener&&(navigator.mediaDevices.removeEventListener=function(){p.log("Dummy mediaDevices.removeEventListener called.")}),i=function(e,t){c>=43?e.srcObject=t:"undefined"!=typeof e.src?e.src=URL.createObjectURL(t):p.log("Error attaching stream to element.")},a=function(e,t){c>=43?e.srcObject=t.srcObject:e.src=t.src}}else navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?(p.log("This appears to be Edge"),s="edge",c=p.extractVersion(navigator.userAgent,/Edge\/(\d+).(\d+)$/,2),u=12):p.log("Browser does not appear to be WebRTC-capable");else p.log("This does not appear to be a browser"),s="not a browser";var h={};try{Object.defineProperty(h,"version",{set:function(e){c=e}})}catch(g){}if("undefined"!=typeof n){var m;"undefined"!=typeof window&&(m=window.RTCPeerConnection),n.exports={RTCPeerConnection:m,getUserMedia:o,attachMediaStream:i,reattachMediaStream:a,webrtcDetectedBrowser:s,webrtcDetectedVersion:c,webrtcMinimumVersion:u,webrtcTesting:h,webrtcUtils:p}}else"function"==typeof t&&"function"==typeof e&&e([],function(){return{RTCPeerConnection:window.RTCPeerConnection,getUserMedia:o,attachMediaStream:i,reattachMediaStream:a,webrtcDetectedBrowser:s,webrtcDetectedVersion:c,webrtcMinimumVersion:u,webrtcTesting:h,webrtcUtils:p}})},{}],24:[function(e,t,n){var r=e("./lib/tosdp"),o=e("./lib/tojson");n.toIncomingSDPOffer=function(e){return r.toSessionSDP(e,{role:"responder",direction:"incoming"})},n.toOutgoingSDPOffer=function(e){return r.toSessionSDP(e,{role:"initiator",direction:"outgoing"})},n.toIncomingSDPAnswer=function(e){return r.toSessionSDP(e,{role:"initiator",direction:"incoming"})},n.toOutgoingSDPAnswer=function(e){return r.toSessionSDP(e,{role:"responder",direction:"outgoing"})},n.toIncomingMediaSDPOffer=function(e){return r.toMediaSDP(e,{role:"responder",direction:"incoming"})},n.toOutgoingMediaSDPOffer=function(e){return r.toMediaSDP(e,{role:"initiator",direction:"outgoing"})},n.toIncomingMediaSDPAnswer=function(e){return r.toMediaSDP(e,{role:"initiator",direction:"incoming"})},n.toOutgoingMediaSDPAnswer=function(e){return r.toMediaSDP(e,{role:"responder",direction:"outgoing"})},n.toCandidateSDP=r.toCandidateSDP,n.toMediaSDP=r.toMediaSDP,n.toSessionSDP=r.toSessionSDP,n.toIncomingJSONOffer=function(e,t){return o.toSessionJSON(e,{role:"responder",direction:"incoming",creators:t})},n.toOutgoingJSONOffer=function(e,t){return o.toSessionJSON(e,{role:"initiator",direction:"outgoing",creators:t})},n.toIncomingJSONAnswer=function(e,t){return o.toSessionJSON(e,{role:"initiator",direction:"incoming",creators:t})},n.toOutgoingJSONAnswer=function(e,t){return o.toSessionJSON(e,{role:"responder",direction:"outgoing",creators:t})},n.toIncomingMediaJSONOffer=function(e,t){return o.toMediaJSON(e,{role:"responder",direction:"incoming",creator:t})},n.toOutgoingMediaJSONOffer=function(e,t){return o.toMediaJSON(e,{role:"initiator",direction:"outgoing",creator:t})},n.toIncomingMediaJSONAnswer=function(e,t){return o.toMediaJSON(e,{role:"initiator",direction:"incoming",creator:t})},n.toOutgoingMediaJSONAnswer=function(e,t){return o.toMediaJSON(e,{role:"responder",direction:"outgoing",creator:t})},n.toCandidateJSON=o.toCandidateJSON,n.toMediaJSON=o.toMediaJSON,n.toSessionJSON=o.toSessionJSON},{"./lib/tojson":30,"./lib/tosdp":31}],20:[function(e,t){var n=e("getusermedia"),r={};t.exports=function(e,t){var o,i=2===arguments.length,a=i?t:e;if("undefined"==typeof window||"http:"===window.location.protocol)return o=new Error("NavigatorUserMediaError"),o.name="HTTPS_REQUIRED",a(o);if(window.navigator.userAgent.match("Chrome")){var s=parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1],10),c=33,u=!window.chrome.webstore;if(window.navigator.userAgent.match("Linux")&&(c=35),sessionStorage.getScreenMediaJSExtensionId)chrome.runtime.sendMessage(sessionStorage.getScreenMediaJSExtensionId,{type:"getScreen",id:1},null,function(t){if(t&&""!==t.sourceId)e=i&&e||{audio:!1,video:{mandatory:{chromeMediaSource:"desktop",maxWidth:window.screen.width,maxHeight:window.screen.height,maxFrameRate:3},optional:[{googLeakyBucket:!0},{googTemporalLayeredScreencast:!0}]}},e.video.mandatory.chromeMediaSourceId=t.sourceId,n(e,a);else{var r=new Error("NavigatorUserMediaError");r.name="PERMISSION_DENIED",a(r)}});else if(window.cefGetScreenMedia)window.cefGetScreenMedia(function(t){if(t)e=i&&e||{audio:!1,video:{mandatory:{chromeMediaSource:"desktop",maxWidth:window.screen.width,maxHeight:window.screen.height,maxFrameRate:3},optional:[{googLeakyBucket:!0},{googTemporalLayeredScreencast:!0}]}},e.video.mandatory.chromeMediaSourceId=t,n(e,a);else{var r=new Error("cefGetScreenMediaError");r.name="CEF_GETSCREENMEDIA_CANCELED",a(r)}});else if(u||s>=26&&c>=s)e=i&&e||{video:{mandatory:{googLeakyBucket:!0,maxWidth:window.screen.width,maxHeight:window.screen.height,maxFrameRate:3,chromeMediaSource:"screen"}}},n(e,a);else{var p=window.setTimeout(function(){return o=new Error("NavigatorUserMediaError"),o.name="EXTENSION_UNAVAILABLE",a(o)},1e3);r[p]=[a,i?e:null],window.postMessage({type:"getScreen",id:p},"*")}}else if(window.navigator.userAgent.match("Firefox")){var d=parseInt(window.navigator.userAgent.match(/Firefox\/(.*)/)[1],10);d>=33?(e=i&&e||{video:{mozMediaSource:"window",mediaSource:"window"}},n(e,function(e,t){if(a(e,t),!e)var n=t.currentTime,r=window.setInterval(function(){t||window.clearInterval(r),t.currentTime==n&&(window.clearInterval(r),t.onended&&t.onended()),n=t.currentTime},500)})):(o=new Error("NavigatorUserMediaError"),o.name="EXTENSION_UNAVAILABLE")}},window.addEventListener("message",function(e){if(e.origin==window.location.origin)if("gotScreen"==e.data.type&&r[e.data.id]){var t=r[e.data.id],o=t[1],i=t[0];if(delete r[e.data.id],""===e.data.sourceId){var a=new Error("NavigatorUserMediaError");a.name="PERMISSION_DENIED",i(a)}else o=o||{audio:!1,video:{mandatory:{chromeMediaSource:"desktop",maxWidth:window.screen.width,maxHeight:window.screen.height,maxFrameRate:3},optional:[{googLeakyBucket:!0},{googTemporalLayeredScreencast:!0}]}},o.video.mandatory.chromeMediaSourceId=e.data.sourceId,n(o,i)}else"getScreenPending"==e.data.type&&window.clearTimeout(e.data.id)})},{getusermedia:21}],22:[function(e,t){function n(e){if(this.support=r.webAudio&&r.mediaStream,this.gain=1,this.support){var t=this.context=new r.AudioContext;this.microphone=t.createMediaStreamSource(e),this.gainFilter=t.createGain(),this.destination=t.createMediaStreamDestination(),this.outputStream=this.destination.stream,this.microphone.connect(this.gainFilter),this.gainFilter.connect(this.destination),e.addTrack(this.outputStream.getAudioTracks()[0]),e.removeTrack(e.getAudioTracks()[0])}this.stream=e}var r=e("webrtcsupport");n.prototype.setGain=function(e){this.support&&(this.gainFilter.gain.value=e,this.gain=e)},n.prototype.getGain=function(){return this.gain},n.prototype.off=function(){return this.setGain(0)},n.prototype.on=function(){this.setGain(1)},t.exports=n},{webrtcsupport:18}],17:[function(e,t,n){function r(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n,r=o(e),i=r.source,u=r.id;return t.forceNew||t["force new connection"]||!1===t.multiplex?(s("ignoring socket cache for %s",i),n=a(i,t)):(c[u]||(s("new io instance for %s",i),c[u]=a(i,t)),n=c[u]),n.socket(r.path)}var o=e("./url"),i=e("socket.io-parser"),a=e("./manager"),s=e("debug")("socket.io-client");t.exports=n=r;var c=n.managers={};n.protocol=i.protocol,n.connect=r,n.Manager=e("./manager"),n.Socket=e("./socket")},{"./manager":33,"./socket":34,"./url":32,debug:35,"socket.io-parser":36}],35:[function(e,t){function n(e){return n.enabled(e)?function(t){t=r(t);var o=new Date,i=o-(n[e]||o);n[e]=o,t=e+" "+t+" +"+n.humanize(i),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function r(e){return e instanceof Error?e.stack||e.message:e}t.exports=n,n.names=[],n.skips=[],n.enable=function(e){try{localStorage.debug=e}catch(t){}for(var r=(e||"").split(/[\s,]+/),o=r.length,i=0;o>i;i++)e=r[i].replace("*",".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$"))},n.disable=function(){n.enable("")},n.humanize=function(e){var t=1e3,n=6e4,r=60*n;return e>=r?(e/r).toFixed(1)+"h":e>=n?(e/n).toFixed(1)+"m":e>=t?(0|e/t)+"s":e+"ms"},n.enabled=function(e){for(var t=0,r=n.skips.length;r>t;t++)if(n.skips[t].test(e))return!1;for(var t=0,r=n.names.length;r>t;t++)if(n.names[t].test(e))return!0;return!1};try{window.localStorage&&n.enable(localStorage.debug)}catch(o){}},{}],37:[function(e,t){function n(e,t,n){return e.on(t,n),{destroy:function(){e.removeListener(t,n)}}}t.exports=n},{}],27:[function(e,t){function n(e){return function(t){return null==t?void 0:t[e]}}function r(e){var t=e+"";return e=p(e),function(n){return u(n,e,t)}}function o(e,t){var n=typeof e;if("string"==n&&h.test(e)||"number"==n)return!0;if(d(e))return!1;var r=!l.test(e);return r||null!=t&&e in i(t)}function i(e){return s(e)?e:Object(e)}function a(e,t){return f(e,c(t))}function s(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function c(e){return o(e)?n(e):r(e)}var u=e("lodash._baseget"),p=e("lodash._topath"),d=e("lodash.isarray"),f=e("lodash.map"),l=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,h=/^\w*$/;t.exports=a},{"lodash._baseget":38,"lodash._topath":39,"lodash.isarray":40,"lodash.map":41}],26:[function(e,t){function n(e,t){return function(n,r,o){return"function"==typeof r&&void 0===o&&a(n)?e(n,r):t(n,i(r,o,3))}}var r=e("lodash._arrayeach"),o=e("lodash._baseeach"),i=e("lodash._bindcallback"),a=e("lodash.isarray"),s=n(r,o);t.exports=s},{"lodash._arrayeach":42,"lodash._baseeach":45,"lodash._bindcallback":43,"lodash.isarray":44}],30:[function(e,t,n){var r=e("./senders"),o=e("./parsers"),i=Math.random();n._setIdCounter=function(e){i=e},n.toSessionJSON=function(e,t){var r,i=t.creators||[],a=t.role||"initiator",s=t.direction||"outgoing",c=e.split("\r\nm=");for(r=1;r0||p.length>0?d.push("RTP/SAVPF"):d.push("RTP/AVPF"),u.forEach(function(e){d.push(e.id)})),o.push("m="+d.join(" ")),o.push("c=IN IP4 0.0.0.0"),s.bandwidth&&s.bandwidth.type&&s.bandwidth.bandwidth&&o.push("b="+s.bandwidth.type+":"+s.bandwidth.bandwidth),"rtp"==s.descType&&o.push("a=rtcp:1 IN IP4 0.0.0.0"),c){c.ufrag&&o.push("a=ice-ufrag:"+c.ufrag),c.pwd&&o.push("a=ice-pwd:"+c.pwd);var f=!1;p.forEach(function(e){o.push("a=fingerprint:"+e.hash+" "+e.value),e.setup&&!f&&o.push("a=setup:"+e.setup)}),c.sctp&&c.sctp.forEach(function(e){o.push("a=sctpmap:"+e.number+" "+e.protocol+" "+e.streams)})}"rtp"==s.descType&&o.push("a="+(r[i][a][e.senders]||"sendrecv")),o.push("a=mid:"+e.name),s.sources&&s.sources.length&&(s.sources[0].parameters||[]).forEach(function(e){"msid"===e.key&&o.push("a=msid:"+e.value)}),s.mux&&o.push("a=rtcp-mux");var l=s.encryption||[];l.forEach(function(e){o.push("a=crypto:"+e.tag+" "+e.cipherSuite+" "+e.keyParams+(e.sessionParams?" "+e.sessionParams:""))}),s.googConferenceFlag&&o.push("a=x-google-flag:conference"),u.forEach(function(e){var t="a=rtpmap:"+e.id+" "+e.name+"/"+e.clockrate;if(e.channels&&"1"!=e.channels&&(t+="/"+e.channels),o.push(t),e.parameters&&e.parameters.length){var n=["a=fmtp:"+e.id],r=[];e.parameters.forEach(function(e){r.push((e.key?e.key+"=":"")+e.value)}),n.push(r.join(";")),o.push(n.join(" "))}e.feedback&&e.feedback.forEach(function(t){"trr-int"===t.type?o.push("a=rtcp-fb:"+e.id+" trr-int "+(t.value?t.value:"0")):o.push("a=rtcp-fb:"+e.id+" "+t.type+(t.subtype?" "+t.subtype:""))})}),s.feedback&&s.feedback.forEach(function(e){"trr-int"===e.type?o.push("a=rtcp-fb:* trr-int "+(e.value?e.value:"0")):o.push("a=rtcp-fb:* "+e.type+(e.subtype?" "+e.subtype:""))});var h=s.headerExtensions||[];h.forEach(function(e){o.push("a=extmap:"+e.id+(e.senders?"/"+r[i][a][e.senders]:"")+" "+e.uri)});var g=s.sourceGroups||[];g.forEach(function(e){o.push("a=ssrc-group:"+e.semantics+" "+e.sources.join(" "))});var m=s.sources||[];m.forEach(function(e){for(var t=0;to;)e=e[t[o++]];return o&&o==i?e:void 0}}function r(e){return o(e)?e:Object(e)}function o(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}t.exports=n},{}],40:[function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e,t){var n=null==e?void 0:e[t];return s(n)?n:void 0}function o(e){return"number"==typeof e&&e>-1&&0==e%1&&v>=e}function i(e){return a(e)&&h.call(e)==u}function a(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function s(e){return null==e?!1:i(e)?g.test(f.call(e)):n(e)&&p.test(e)}var c="[object Array]",u="[object Function]",p=/^\[object .+?Constructor\]$/,d=Object.prototype,f=Function.prototype.toString,l=d.hasOwnProperty,h=d.toString,g=RegExp("^"+f.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),m=r(Array,"isArray"),v=9007199254740991,y=m||function(e){return n(e)&&o(e.length)&&h.call(e)==c};t.exports=y},{}],42:[function(e,t){function n(e,t){for(var n=-1,r=e.length;++n-1&&0==e%1&&v>=e}function i(e){return a(e)&&h.call(e)==u}function a(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function s(e){return null==e?!1:i(e)?g.test(f.call(e)):n(e)&&p.test(e)}var c="[object Array]",u="[object Function]",p=/^\[object .+?Constructor\]$/,d=Object.prototype,f=Function.prototype.toString,l=d.hasOwnProperty,h=d.toString,g=RegExp("^"+f.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),m=r(Array,"isArray"),v=9007199254740991,y=m||function(e){return n(e)&&o(e.length)&&h.call(e)==c};t.exports=y},{}],32:[function(e,t){function n(e,t){var n=e,t=t||r.location;return null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"==e.charAt(0)&&(e="/"==e.charAt(1)?t.protocol+e:t.hostname+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e="undefined"!=typeof t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),n=o(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/",n.id=n.protocol+"://"+n.host+":"+n.port,n.href=n.protocol+"://"+n.host+(t&&t.port==n.port?"":":"+n.port),n}var r=self,o=e("parseuri"),i=e("debug")("socket.io-client:url");t.exports=n},{debug:35,parseuri:48}],33:[function(e,t){function n(e,t){return this instanceof n?(e&&"object"==typeof e&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new d({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connected=[],this.encoding=!1,this.packetBuffer=[],this.encoder=new a.Encoder,this.decoder=new a.Decoder,this.autoConnect=t.autoConnect!==!1,this.autoConnect&&this.open(),void 0):new n(e,t)}e("./url");var r=e("engine.io-client"),o=e("./socket"),i=e("component-emitter"),a=e("socket.io-parser"),s=e("./on"),c=e("component-bind");e("object-component");var u=e("debug")("socket.io-client:manager"),p=e("indexof"),d=e("backo2");t.exports=n,n.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var e in this.nsps)this.nsps[e].emit.apply(this.nsps[e],arguments)},n.prototype.updateSocketIds=function(){for(var e in this.nsps)this.nsps[e].id=this.engine.id},i(n.prototype),n.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},n.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},n.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},n.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},n.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},n.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},n.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},n.prototype.open=n.prototype.connect=function(e){if(u("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=r(this.uri,this.opts);var t=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var o=s(t,"open",function(){n.onopen(),e&&e()}),i=s(t,"error",function(t){if(u("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",t),e){var r=new Error("Connection error");r.data=t,e(r)}else n.maybeReconnectOnOpen()});if(!1!==this._timeout){var a=this._timeout;u("connect attempt will timeout after %d",a);var c=setTimeout(function(){u("connect attempt timed out after %d",a),o.destroy(),t.close(),t.emit("error","timeout"),n.emitAll("connect_timeout",a)},a);this.subs.push({destroy:function(){clearTimeout(c)}})}return this.subs.push(o),this.subs.push(i),this},n.prototype.onopen=function(){u("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(s(e,"data",c(this,"ondata"))),this.subs.push(s(this.decoder,"decoded",c(this,"ondecoded"))),this.subs.push(s(e,"error",c(this,"onerror"))),this.subs.push(s(e,"close",c(this,"onclose")))},n.prototype.ondata=function(e){this.decoder.add(e)},n.prototype.ondecoded=function(e){this.emit("packet",e)},n.prototype.onerror=function(e){u("error",e),this.emitAll("error",e) -},n.prototype.socket=function(e){var t=this.nsps[e];if(!t){t=new o(this,e),this.nsps[e]=t;var n=this;t.on("connect",function(){t.id=n.engine.id,~p(n.connected,t)||n.connected.push(t)})}return t},n.prototype.destroy=function(e){var t=p(this.connected,e);~t&&this.connected.splice(t,1),this.connected.length||this.close()},n.prototype.packet=function(e){u("writing packet %j",e);var t=this;t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(e){for(var n=0;n0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},n.prototype.cleanup=function(){for(var e;e=this.subs.shift();)e.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},n.prototype.close=n.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},n.prototype.onclose=function(e){u("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},n.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();u("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(u("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(u("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(u("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},n.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},{"./on":37,"./socket":34,"./url":32,backo2:54,"component-bind":51,"component-emitter":49,debug:35,"engine.io-client":50,indexof:53,"object-component":52,"socket.io-parser":36}],34:[function(e,t,n){function r(e,t){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var o=e("socket.io-parser"),i=e("component-emitter"),a=e("to-array"),s=e("./on"),c=e("component-bind"),u=e("debug")("socket.io-client:socket"),p=e("has-binary");t.exports=n=r;var d={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1},f=i.prototype.emit;i(r.prototype),r.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[s(e,"open",c(this,"onopen")),s(e,"packet",c(this,"onpacket")),s(e,"close",c(this,"onclose"))]}},r.prototype.open=r.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"==this.io.readyState&&this.onopen(),this)},r.prototype.send=function(){var e=a(arguments);return e.unshift("message"),this.emit.apply(this,e),this},r.prototype.emit=function(e){if(d.hasOwnProperty(e))return f.apply(this,arguments),this;var t=a(arguments),n=o.EVENT;p(t)&&(n=o.BINARY_EVENT);var r={type:n,data:t};return"function"==typeof t[t.length-1]&&(u("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),r.id=this.ids++),this.connected?this.packet(r):this.sendBuffer.push(r),this},r.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},r.prototype.onopen=function(){u("transport is open - connecting"),"/"!=this.nsp&&this.packet({type:o.CONNECT})},r.prototype.onclose=function(e){u("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},r.prototype.onpacket=function(e){if(e.nsp==this.nsp)switch(e.type){case o.CONNECT:this.onconnect();break;case o.EVENT:this.onevent(e);break;case o.BINARY_EVENT:this.onevent(e);break;case o.ACK:this.onack(e);break;case o.BINARY_ACK:this.onack(e);break;case o.DISCONNECT:this.ondisconnect();break;case o.ERROR:this.emit("error",e.data)}},r.prototype.onevent=function(e){var t=e.data||[];u("emitting event %j",t),null!=e.id&&(u("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?f.apply(this,t):this.receiveBuffer.push(t)},r.prototype.ack=function(e){var t=this,n=!1;return function(){if(!n){n=!0;var r=a(arguments);u("sending ack %j",r);var i=p(r)?o.BINARY_ACK:o.ACK;t.packet({type:i,id:e,data:r})}}},r.prototype.onack=function(e){u("calling ack %s with %j",e.id,e.data);var t=this.acks[e.id];t.apply(this,e.data),delete this.acks[e.id]},r.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},r.prototype.emitBuffered=function(){var e;for(e=0;e0})},n.findLine=function(e,t,n){for(var r=e.length,o=0;o=0?(n.id=r.substr(0,o),n.senders=r.substr(o+1)):(n.id=r,n.senders="sendrecv"),n.uri=t.shift()||"",n},n.rtcpfb=function(e){var t=e.substr(10).split(" "),n={};return n.id=t.shift(),n.type=t.shift(),"trr-int"===n.type?n.value=t.shift():n.subtype=t.shift()||"",n.parameters=t,n},n.candidate=function(e){var t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");for(var n={foundation:t[0],component:t[1],protocol:t[2].toLowerCase(),priority:t[3],ip:t[4],port:t[5],type:t[7],generation:"0"},r=8;rr;++r)n[r].apply(this,t)}return this},n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},{}],48:[function(e,t){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(e){for(var t=n.exec(e||""),o={},i=14;i--;)o[r[i]]=t[i]||"";return o}},{}],25:[function(e,t){function n(e){return{type:e.type,sdp:e.sdp}}function r(e){var t={label:e.id};return e.getAudioTracks().length&&(t.audio=e.getAudioTracks().map(function(e){return e.id})),e.getVideoTracks().length&&(t.video=e.getVideoTracks().map(function(e){return e.id})),t}function o(e,t){var n=this;a.call(this),this.peerconnection=new window.RTCPeerConnection(e,t),this.trace=function(e,t){n.emit("PeerConnectionTrace",{time:new Date,type:e,value:t||""})},this.onicecandidate=null,this.peerconnection.onicecandidate=function(e){n.trace("onicecandidate",e.candidate),null!==n.onicecandidate&&n.onicecandidate(e)},this.onaddstream=null,this.peerconnection.onaddstream=function(e){n.trace("onaddstream",r(e.stream)),null!==n.onaddstream&&n.onaddstream(e)},this.onremovestream=null,this.peerconnection.onremovestream=function(e){n.trace("onremovestream",r(e.stream)),null!==n.onremovestream&&n.onremovestream(e)},this.onsignalingstatechange=null,this.peerconnection.onsignalingstatechange=function(e){n.trace("onsignalingstatechange",n.signalingState),null!==n.onsignalingstatechange&&n.onsignalingstatechange(e)},this.oniceconnectionstatechange=null,this.peerconnection.oniceconnectionstatechange=function(e){n.trace("oniceconnectionstatechange",n.iceConnectionState),null!==n.oniceconnectionstatechange&&n.oniceconnectionstatechange(e)},this.onnegotiationneeded=null,this.peerconnection.onnegotiationneeded=function(e){n.trace("onnegotiationneeded"),null!==n.onnegotiationneeded&&n.onnegotiationneeded(e)},n.ondatachannel=null,this.peerconnection.ondatachannel=function(e){n.trace("ondatachannel",e),null!==n.ondatachannel&&n.ondatachannel(e)},this.getLocalStreams=this.peerconnection.getLocalStreams.bind(this.peerconnection),this.getRemoteStreams=this.peerconnection.getRemoteStreams.bind(this.peerconnection)}var i=e("util");e("webrtc-adapter-test");var a=e("wildemitter");i.inherits(o,a),["signalingState","iceConnectionState","localDescription","remoteDescription"].forEach(function(e){Object.defineProperty(o.prototype,e,{get:function(){return this.peerconnection[e]}})}),o.prototype.addStream=function(e){this.trace("addStream",r(e)),this.peerconnection.addStream(e)},o.prototype.removeStream=function(e){this.trace("removeStream",r(e)),this.peerconnection.removeStream(e)},o.prototype.createDataChannel=function(e,t){return this.trace("createDataChannel",e,t),this.peerconnection.createDataChannel(e,t)},o.prototype.setLocalDescription=function(e,t,r){var o=this;this.trace("setLocalDescription",n(e)),this.peerconnection.setLocalDescription(e,function(){o.trace("setLocalDescriptionOnSuccess"),t&&t()},function(e){o.trace("setLocalDescriptionOnFailure",e),r&&r(e)})},o.prototype.setRemoteDescription=function(e,t,r){var o=this;this.trace("setRemoteDescription",n(e)),this.peerconnection.setRemoteDescription(e,function(){o.trace("setRemoteDescriptionOnSuccess"),t&&t()},function(e){o.trace("setRemoteDescriptionOnFailure",e),r&&r(e)})},o.prototype.close=function(){this.trace("stop"),"closed"!=this.peerconnection.signalingState&&this.peerconnection.close()},o.prototype.createOffer=function(e,t,r){var o=this;this.trace("createOffer",r),this.peerconnection.createOffer(function(t){o.trace("createOfferOnSuccess",n(t)),e&&e(t)},function(e){o.trace("createOfferOnFailure",e),t&&t(e)},r)},o.prototype.createAnswer=function(e,t,r){var o=this;this.trace("createAnswer",r),this.peerconnection.createAnswer(function(t){o.trace("createAnswerOnSuccess",n(t)),e&&e(t)},function(e){o.trace("createAnswerOnFailure",e),t&&t(e)},r)},o.prototype.addIceCandidate=function(e,t,n){var r=this;this.trace("addIceCandidate",e),this.peerconnection.addIceCandidate(e,function(){t&&t()},function(e){r.trace("addIceCandidateOnFailure",e),n&&n(e)})},o.prototype.getStats=function(){this.peerconnection.getStats.apply(this.peerconnection,arguments)},t.exports=o},{util:8,"webrtc-adapter-test":23,wildemitter:5}],51:[function(e,t){var n=[].slice;t.exports=function(e,t){if("string"==typeof t&&(t=e[t]),"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)))}}},{}],52:[function(e,t,n){var r=Object.prototype.hasOwnProperty;n.keys=Object.keys||function(e){var t=[];for(var n in e)r.call(e,n)&&t.push(n);return t},n.values=function(e){var t=[];for(var n in e)r.call(e,n)&&t.push(e[n]);return t},n.merge=function(e,t){for(var n in t)r.call(t,n)&&(e[n]=t[n]);return e},n.length=function(e){return n.keys(e).length},n.isEmpty=function(e){return 0==n.length(e)}},{}],53:[function(e,t){var n=[].indexOf;t.exports=function(e,t){if(n)return e.indexOf(t);for(var r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}t.exports=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},{}],55:[function(e,t){function n(e,t){var n=[];t=t||0;for(var r=t||0;r1)))/4)-w((e-1901+t)/100)+w((e-1601+t)/400)};(o={}.hasOwnProperty)||(o=function(e){var t,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=s?o=function(e){var t=this.__proto__,n=(this.__proto__=null,e in this);return this.__proto__=t,n}:(t=n.constructor,o=function(e){var n=(this.constructor||t).prototype;return e in this&&!(e in n&&this[e]===n[e])}),n=null,o.call(this,e)});var C={"boolean":1,number:1,string:1,undefined:1},x=function(e,t){var n=typeof e[t];return"object"==n?!!e[t]:!C[n]};if(i=function(e,t){var n,r,a,c=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n;for(a in r)o.call(r,a)&&c++;return n=r=null,c?i=2==c?function(e,t){var n,r={},i=s.call(e)==l;for(n in e)i&&"prototype"==n||o.call(r,n)||!(r[n]=1)||!o.call(e,n)||t(n)}:function(e,t){var n,r,i=s.call(e)==l;for(n in e)i&&"prototype"==n||!o.call(e,n)||(r="constructor"===n)||t(n);(r||o.call(e,n="constructor"))&&t(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],i=function(e,t){var n,i,a=s.call(e)==l,c=!a&&"function"!=typeof e.constructor&&x(e,"hasOwnProperty")?e.hasOwnProperty:o;for(n in e)a&&"prototype"==n||!c.call(e,n)||t(n);for(i=r.length;n=r[--i];c.call(e,n)&&t(n));}),i(e,t)},!n("json-stringify")){var E={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},j="000000",O=function(e,t){return(j+(t||0)).slice(-e)},T="\\u00",D=function(e){var t,n='"',r=0,o=e.length,i=o>10&&b;for(i&&(t=e.split(""));o>r;r++){var a=e.charCodeAt(r);switch(a){case 8:case 9:case 10:case 12:case 13:case 34:case 92:n+=E[a];break;default:if(32>a){n+=T+O(2,a.toString(16));break}n+=i?t[r]:b?e.charAt(r):e[r]}}return n+'"'},A=function(e,t,n,r,c,u,p){var d,f,l,b,S,C,x,E,j,T,R,M,P,_,I,L;try{d=t[e]}catch(N){}if("object"==typeof d&&d)if(f=s.call(d),f!=h||o.call(d,"toJSON"))"function"==typeof d.toJSON&&(f!=g&&f!=m&&f!=v||o.call(d,"toJSON"))&&(d=d.toJSON(e));else if(d>-1/0&&1/0>d){if(k){for(S=w(d/864e5),l=w(S/365.2425)+1970-1;k(l+1,0)<=S;l++);for(b=w((S-k(l,0))/30.42);k(l,b+1)<=S;b++);S=1+S-k(l,b),C=(d%864e5+864e5)%864e5,x=w(C/36e5)%24,E=w(C/6e4)%60,j=w(C/1e3)%60,T=C%1e3}else l=d.getUTCFullYear(),b=d.getUTCMonth(),S=d.getUTCDate(),x=d.getUTCHours(),E=d.getUTCMinutes(),j=d.getUTCSeconds(),T=d.getUTCMilliseconds();d=(0>=l||l>=1e4?(0>l?"-":"+")+O(6,0>l?-l:l):O(4,l))+"-"+O(2,b+1)+"-"+O(2,S)+"T"+O(2,x)+":"+O(2,E)+":"+O(2,j)+"."+O(3,T)+"Z"}else d=null;if(n&&(d=n.call(t,e,d)),null===d)return"null";if(f=s.call(d),f==y)return""+d;if(f==g)return d>-1/0&&1/0>d?""+d:"null";if(f==m)return D(""+d);if("object"==typeof d){for(_=p.length;_--;)if(p[_]===d)throw TypeError();if(p.push(d),R=[],I=u,u+=c,f==v){for(P=0,_=d.length;_>P;P++)M=A(P,d,n,r,c,u,p),R.push(M===a?"null":M);L=R.length?c?"[\n"+u+R.join(",\n"+u)+"\n"+I+"]":"["+R.join(",")+"]":"[]"}else i(r||d,function(e){var t=A(e,d,n,r,c,u,p);t!==a&&R.push(D(e)+":"+(c?" ":"")+t)}),L=R.length?c?"{\n"+u+R.join(",\n"+u)+"\n"+I+"}":"{"+R.join(",")+"}":"{}";return p.pop(),L}};p.stringify=function(e,t,n){var r,o,i,a;if("function"==typeof t||"object"==typeof t&&t)if((a=s.call(t))==l)o=t;else if(a==v){i={};for(var c,u=0,p=t.length;p>u;c=t[u++],a=s.call(c),(a==m||a==g)&&(i[c]=1));}if(n)if((a=s.call(n))==g){if((n-=n%1)>0)for(r="",n>10&&(n=10);r.lengthR;)switch(o=i.charCodeAt(R)){case 9:case 10:case 13:case 32:R++;break;case 123:case 125:case 91:case 93:case 58:case 44:return e=b?i.charAt(R):i[R],R++,e;case 34:for(e="@",R++;a>R;)if(o=i.charCodeAt(R),32>o)I();else if(92==o)switch(o=i.charCodeAt(++R)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:e+=_[o],R++;break;case 117:for(t=++R,n=R+4;n>R;R++)o=i.charCodeAt(R),o>=48&&57>=o||o>=97&&102>=o||o>=65&&70>=o||I();e+=P("0x"+i.slice(t,R));break;default:I()}else{if(34==o)break;for(o=i.charCodeAt(R),t=R;o>=32&&92!=o&&34!=o;)o=i.charCodeAt(++R);e+=i.slice(t,R)}if(34==i.charCodeAt(R))return R++,e;I();default:if(t=R,45==o&&(r=!0,o=i.charCodeAt(++R)),o>=48&&57>=o){for(48==o&&(o=i.charCodeAt(R+1),o>=48&&57>=o)&&I(),r=!1;a>R&&(o=i.charCodeAt(R),o>=48&&57>=o);R++);if(46==i.charCodeAt(R)){for(n=++R;a>n&&(o=i.charCodeAt(n),o>=48&&57>=o);n++);n==R&&I(),R=n}if(o=i.charCodeAt(R),101==o||69==o){for(o=i.charCodeAt(++R),(43==o||45==o)&&R++,n=R;a>n&&(o=i.charCodeAt(n),o>=48&&57>=o);n++);n==R&&I(),R=n}return+i.slice(t,R)}if(r&&I(),"true"==i.slice(R,R+4))return R+=4,!0;if("false"==i.slice(R,R+5))return R+=5,!1;if("null"==i.slice(R,R+4))return R+=4,null;I()}return"$"},N=function(e){var t,n;if("$"==e&&I(),"string"==typeof e){if("@"==(b?e.charAt(0):e[0]))return e.slice(1);if("["==e){for(t=[];e=L(),"]"!=e;n||(n=!0))n&&(","==e?(e=L(),"]"==e&&I()):I()),","==e&&I(),t.push(N(e));return t}if("{"==e){for(t={};e=L(),"}"!=e;n||(n=!0))n&&(","==e?(e=L(),"}"==e&&I()):I()),(","==e||"string"!=typeof e||"@"!=(b?e.charAt(0):e[0])||":"!=L())&&I(),t[e.slice(1)]=N(L());return t}I()}return e},B=function(e,t,n){var r=U(e,t,n);r===a?delete e[t]:e[t]=r},U=function(e,t,n){var r,o=e[t];if("object"==typeof o&&o)if(s.call(o)==v)for(r=o.length;r--;)B(o,r,n);else i(o,function(e){B(o,e,n)});return n.call(e,t,o)};p.parse=function(e,t){var n,r;return R=0,M=""+e,n=N(L()),"$"!=L()&&I(),R=M=null,t&&s.call(t)==l?U((r={},r[""]=n,r),"",t):n}}}c&&e(function(){return p})}(this)},{}],36:[function(e,t,n){function r(){}function o(e){var t="",r=!1;return t+=e.type,(n.BINARY_EVENT==e.type||n.BINARY_ACK==e.type)&&(t+=e.attachments,t+="-"),e.nsp&&"/"!=e.nsp&&(r=!0,t+=e.nsp),null!=e.id&&(r&&(t+=",",r=!1),t+=e.id),null!=e.data&&(r&&(t+=","),t+=d.stringify(e.data)),p("encoded %j as %s",e,t),t}function i(e,t){function n(e){var n=l.deconstructPacket(e),r=o(n.packet),i=n.buffers;i.unshift(r),t(i)}l.removeBlobs(e,n)}function a(){this.reconstructor=null}function s(e){var t={},r=0;if(t.type=Number(e.charAt(0)),null==n.types[t.type])return u();if(n.BINARY_EVENT==t.type||n.BINARY_ACK==t.type){for(var o="";"-"!=e.charAt(++r)&&(o+=e.charAt(r),r!=e.length););if(o!=Number(o)||"-"!=e.charAt(r))throw new Error("Illegal attachments");t.attachments=Number(o)}if("/"==e.charAt(r+1))for(t.nsp="";++r;){var i=e.charAt(r);if(","==i)break;if(t.nsp+=i,r==e.length)break}else t.nsp="/";var a=e.charAt(r+1);if(""!==a&&Number(a)==a){for(t.id="";++r;){var i=e.charAt(r);if(null==i||Number(i)!=i){--r;break}if(t.id+=e.charAt(r),r==e.length)break}t.id=Number(t.id)}if(e.charAt(++r))try{t.data=d.parse(e.substr(r))}catch(s){return u()}return p("decoded %s as %j",e,t),t}function c(e){this.reconPack=e,this.buffers=[]}function u(){return{type:n.ERROR,data:"parser error"}}var p=e("debug")("socket.io-parser"),d=e("json3");e("isarray");var f=e("component-emitter"),l=e("./binary"),h=e("./is-buffer");n.protocol=4,n.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"],n.CONNECT=0,n.DISCONNECT=1,n.EVENT=2,n.ACK=3,n.ERROR=4,n.BINARY_EVENT=5,n.BINARY_ACK=6,n.Encoder=r,n.Decoder=a,r.prototype.encode=function(e,t){if(p("encoding packet %j",e),n.BINARY_EVENT==e.type||n.BINARY_ACK==e.type)i(e,t);else{var r=o(e);t([r])}},f(a.prototype),a.prototype.add=function(e){var t;if("string"==typeof e)t=s(e),n.BINARY_EVENT==t.type||n.BINARY_ACK==t.type?(this.reconstructor=new c(t),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",t)):this.emit("decoded",t);else{if(!h(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,this.emit("decoded",t))}},a.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},c.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length==this.reconPack.attachments){var t=l.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},c.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},{"./binary":60,"./is-buffer":57,"component-emitter":49,debug:35,isarray:58,json3:59}],45:[function(e,t){function n(e,t){return f(e,t,u)}function r(e){return function(t){return null==t?void 0:t[e]}}function o(e,t){return function(n,r){var o=n?l(n):0;if(!a(o))return e(n,r);for(var i=t?o:-1,c=s(n);(t?i--:++i-1&&0==e%1&&p>=e}function s(e){return c(e)?e:Object(e)}function c(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var u=e("lodash.keys"),p=9007199254740991,d=o(n),f=i(),l=r("length");t.exports=d},{"lodash.keys":61}],50:[function(e,t){t.exports=e("./lib/")},{"./lib/":62}],60:[function(e,t,n){var r=self,o=e("isarray"),i=e("./is-buffer");n.deconstructPacket=function(e){function t(e){if(!e)return e;if(i(e)){var r={_placeholder:!0,num:n.length};return n.push(e),r}if(o(e)){for(var a=new Array(e.length),s=0;s-1&&0==e%1&&d>=e}function a(e,t,r){var o=p(e)?s:n;return t=c(t,r,3),o(e,t)}var s=e("lodash._arraymap"),c=e("lodash._basecallback"),u=e("lodash._baseeach"),p=e("lodash.isarray"),d=9007199254740991,f=r("length");t.exports=a},{"lodash._arraymap":64,"lodash._basecallback":65,"lodash._baseeach":66,"lodash.isarray":40}],63:[function(e,t){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],67:[function(e,t){function n(e,t,n){if("function"!=typeof e)return r;if(void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,o){return e.call(t,n,r,o)};case 4:return function(n,r,o,i){return e.call(t,n,r,o,i)};case 5:return function(n,r,o,i,a){return e.call(t,n,r,o,i,a)}}return function(){return e.apply(t,arguments)}}function r(e){return e}t.exports=n},{}],68:[function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e,t){var n=null==e?void 0:e[t];return a(n)?n:void 0}function o(e){return i(e)&&f.call(e)==s}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function a(e){return null==e?!1:o(e)?l.test(p.call(e)):n(e)&&c.test(e)}var s="[object Function]",c=/^\[object .+?Constructor\]$/,u=Object.prototype,p=Function.prototype.toString,d=u.hasOwnProperty,f=u.toString,l=RegExp("^"+p.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},{}],69:[function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e){return function(t){return null==t?void 0:t[e]}}function o(e){return null!=e&&i(d(e))}function i(e){return"number"==typeof e&&e>-1&&0==e%1&&p>=e}function a(e){return n(e)&&o(e)&&c.call(e,"callee")&&!u.call(e,"callee")}var s=Object.prototype,c=s.hasOwnProperty,u=s.propertyIsEnumerable,p=9007199254740991,d=r("length");t.exports=a},{}],66:[function(e,t){function n(e,t){return f(e,t,u)}function r(e){return function(t){return null==t?void 0:t[e]}}function o(e,t){return function(n,r){var o=n?l(n):0;if(!a(o))return e(n,r);for(var i=t?o:-1,c=s(n);(t?i--:++i-1&&0==e%1&&p>=e}function s(e){return c(e)?e:Object(e)}function c(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var u=e("lodash.keys"),p=9007199254740991,d=o(n),f=i(),l=r("length");t.exports=d},{"lodash.keys":70}],62:[function(e,t){t.exports=e("./socket"),t.exports.parser=e("engine.io-parser")},{"./socket":71,"engine.io-parser":72}],65:[function(e,t){function n(e){return null==e?"":e+""}function r(e,t,n){var r=typeof e;return"function"==r?void 0===t?e:S(e,t,n):null==e?y:"object"==r?a(e):void 0===t?b(e):s(e,t)}function o(e,t,n){if(null!=e){void 0!==n&&n in h(e)&&(t=[n]);for(var r=0,o=t.length;null!=e&&o>r;)e=e[t[r++]];return r&&r==o?e:void 0}}function i(e,t,n){var r=t.length,o=r,i=!n;if(null==e)return!o;for(e=h(e);r--;){var a=t[r];if(i&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++rt&&(t=-t>o?0:o+t),n=void 0===n||n>o?o:+n||0,0>n&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r-1&&0==e%1&&t>e}function i(e){return"number"==typeof e&&e>-1&&0==e%1&&m>=e}function a(e){for(var t=c(e),n=t.length,r=n&&e.length,a=!!r&&i(r)&&(d(e)||p(e)),s=-1,u=[];++s0;++r-1&&0==e%1&&R>=e}function o(e){return n(e)&&r(e.length)&&!!T[A.call(e)]}var i="[object Arguments]",a="[object Array]",s="[object Boolean]",c="[object Date]",u="[object Error]",p="[object Function]",d="[object Map]",f="[object Number]",l="[object Object]",h="[object RegExp]",g="[object Set]",m="[object String]",v="[object WeakMap]",y="[object ArrayBuffer]",b="[object Float32Array]",w="[object Float64Array]",S="[object Int8Array]",k="[object Int16Array]",C="[object Int32Array]",x="[object Uint8Array]",E="[object Uint8ClampedArray]",j="[object Uint16Array]",O="[object Uint32Array]",T={};T[b]=T[w]=T[S]=T[k]=T[C]=T[x]=T[E]=T[j]=T[O]=!0,T[i]=T[a]=T[y]=T[s]=T[c]=T[u]=T[p]=T[d]=T[f]=T[l]=T[h]=T[g]=T[m]=T[v]=!1;var D=Object.prototype,A=D.toString,R=9007199254740991;t.exports=o},{}],82:[function(e,t){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(e){var t=e,o=e.indexOf("["),i=e.indexOf("]");-1!=o&&-1!=i&&(e=e.substring(0,o)+e.substring(o,i).replace(/:/g,";")+e.substring(i,e.length));for(var a=n.exec(e||""),s={},c=14;c--;)s[r[c]]=a[c]||"";return-1!=o&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s}},{}],83:[function(e,t){var n=self,r=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,i=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,a=/(?:^|:|,)(?:\s*\[)+/g,s=/^\s+/,c=/\s+$/;t.exports=function(e){return"string"==typeof e&&e?(e=e.replace(s,"").replace(c,""),n.JSON&&JSON.parse?JSON.parse(e):r.test(e.replace(o,"@").replace(i,"]").replace(a,""))?new Function("return "+e)():void 0):null}},{}],84:[function(e,t,n){n.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},n.decode=function(e){for(var t={},n=e.split("&"),r=0,o=n.length;o>r;r++){var i=n[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}},{}],71:[function(e,t){function n(e,t){if(!(this instanceof n))return new n(e,t);if(t=t||{},e&&"object"==typeof e&&(t=e,e=null),e&&(e=p(e),t.host=e.host,t.secure="https"==e.protocol||"wss"==e.protocol,t.port=e.port,e.query&&(t.query=e.query)),this.secure=null!=t.secure?t.secure:o.location&&"https:"==location.protocol,t.host){var r=t.host.split(":");t.hostname=r.shift(),r.length?t.port=r.pop():t.port||(t.port=this.secure?"443":"80")}this.agent=t.agent||!1,this.hostname=t.hostname||(o.location?location.hostname:"localhost"),this.port=t.port||(o.location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=f.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=t.rejectUnauthorized||null,this.open()}function r(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var o=self,i=e("./transports"),a=e("component-emitter"),s=e("debug")("engine.io-client:socket"),c=e("indexof"),u=e("engine.io-parser"),p=e("parseuri"),d=e("parsejson"),f=e("parseqs");t.exports=n,n.priorWebsocketSuccess=!1,a(n.prototype),n.protocol=u.protocol,n.Socket=n,n.Transport=e("./transport"),n.transports=e("./transports"),n.parser=e("engine.io-parser"),n.prototype.createTransport=function(e){s('creating transport "%s"',e);var t=r(this.query);t.EIO=u.protocol,t.transport=e,this.id&&(t.sid=this.id);var n=new i[e]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:t,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized});return n},n.prototype.open=function(){var e;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&-1!=this.transports.indexOf("websocket"))e="websocket";else{if(0==this.transports.length){var t=this;return setTimeout(function(){t.emit("error","No transports available")},0),void 0}e=this.transports[0]}this.readyState="opening";var e;try{e=this.createTransport(e)}catch(r){return this.transports.shift(),this.open(),void 0}e.open(),this.setTransport(e)},n.prototype.setTransport=function(e){s("setting transport %s",e.name);var t=this;this.transport&&(s("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},n.prototype.probe=function(e){function t(){if(f.onlyBinaryUpgrades){var t=!this.supportsBinary&&f.transport.supportsBinary;d=d||t}d||(s('probe transport "%s" opened',e),p.send([{type:"ping",data:"probe"}]),p.once("packet",function(t){if(!d)if("pong"==t.type&&"probe"==t.data){if(s('probe transport "%s" pong',e),f.upgrading=!0,f.emit("upgrading",p),!p)return;n.priorWebsocketSuccess="websocket"==p.name,s('pausing current transport "%s"',f.transport.name),f.transport.pause(function(){d||"closed"!=f.readyState&&(s("changing transport and sending upgrade packet"),u(),f.setTransport(p),p.send([{type:"upgrade"}]),f.emit("upgrade",p),p=null,f.upgrading=!1,f.flush())})}else{s('probe transport "%s" failed',e);var r=new Error("probe error");r.transport=p.name,f.emit("upgradeError",r)}}))}function r(){d||(d=!0,u(),p.close(),p=null)}function o(t){var n=new Error("probe error: "+t);n.transport=p.name,r(),s('probe transport "%s" failed because of error: %s',e,t),f.emit("upgradeError",n)}function i(){o("transport closed")}function a(){o("socket closed")}function c(e){p&&e.name!=p.name&&(s('"%s" works - aborting "%s"',e.name,p.name),r())}function u(){p.removeListener("open",t),p.removeListener("error",o),p.removeListener("close",i),f.removeListener("close",a),f.removeListener("upgrading",c)}s('probing transport "%s"',e);var p=this.createTransport(e,{probe:1}),d=!1,f=this;n.priorWebsocketSuccess=!1,p.once("open",t),p.once("error",o),p.once("close",i),this.once("close",a),this.once("upgrading",c),p.open()},n.prototype.onOpen=function(){if(s("socket open"),this.readyState="open",n.priorWebsocketSuccess="websocket"==this.transport.name,this.emit("open"),this.flush(),"open"==this.readyState&&this.upgrade&&this.transport.pause){s("starting upgrade probes");for(var e=0,t=this.upgrades.length;t>e;e++)this.probe(this.upgrades[e])}},n.prototype.onPacket=function(e){if("opening"==this.readyState||"open"==this.readyState)switch(s('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(d(e.data));break;case"pong":this.setPing();break;case"error":var t=new Error("server error");t.code=e.data,this.emit("error",t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else s('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!=this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){"closed"!=t.readyState&&t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)},n.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout(function(){s("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)},e.pingInterval)},n.prototype.ping=function(){this.sendPacket("ping")},n.prototype.onDrain=function(){for(var e=0;en;n++)~c(this.transports,e[n])&&t.push(e[n]);return t}},{"./transport":85,"./transports":75,"component-emitter":49,debug:86,"engine.io-parser":72,indexof:53,parsejson:83,parseqs:84,parseuri:82}],87:[function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e){return function(t){return null==t?void 0:t[e]}}function o(e){return null!=e&&i(d(e))}function i(e){return"number"==typeof e&&e>-1&&0==e%1&&p>=e}function a(e){return n(e)&&o(e)&&c.call(e,"callee")&&!u.call(e,"callee")}var s=Object.prototype,c=s.hasOwnProperty,u=s.propertyIsEnumerable,p=9007199254740991,d=r("length");t.exports=a},{}],88:[function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e,t){var n=null==e?void 0:e[t];return a(n)?n:void 0}function o(e){return i(e)&&f.call(e)==s}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function a(e){return null==e?!1:o(e)?l.test(p.call(e)):n(e)&&c.test(e)}var s="[object Function]",c=/^\[object .+?Constructor\]$/,u=Object.prototype,p=Function.prototype.toString,d=u.hasOwnProperty,f=u.toString,l=RegExp("^"+p.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},{}],86:[function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var o=0,i=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))}),e.splice(i,0,r),e}function i(){return"object"==typeof console&&"function"==typeof console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?localStorage.removeItem("debug"):localStorage.debug=e}catch(t){}}function s(){var e;try{e=localStorage.debug}catch(t){}return e}n=t.exports=e("./debug"),n.log=i,n.formatArgs=o,n.save=a,n.load=s,n.useColors=r,n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(s())},{"./debug":89}],74:[function(e,t){function n(e){return r(e)?e:Object(e)}function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function o(e){e=n(e);for(var t=-1,r=i(e),o=r.length,a=Array(o);++to;)t=e.charCodeAt(o++),t>=55296&&56319>=t&&i>o?(n=e.charCodeAt(o++),56320==(64512&n)?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),o--)):r.push(t);return r}function a(e){for(var t,n=e.length,r=-1,o="";++r65535&&(t-=65536,o+=w(55296|1023&t>>>10),t=56320|1023&t),o+=w(t);return o}function s(e){if(e>=55296&&57343>=e)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function c(e,t){return w(128|63&e>>t)}function u(e){if(0==(4294967168&e))return w(e);var t="";return 0==(4294965248&e)?t=w(192|31&e>>6):0==(4294901760&e)?(s(e),t=w(224|15&e>>12),t+=c(e,6)):0==(4292870144&e)&&(t=w(240|7&e>>18),t+=c(e,12),t+=c(e,6)),t+=w(128|63&e)}function p(e){for(var t,n=i(e),r=n.length,o=-1,a="";++o=y)throw Error("Invalid byte index");var e=255&v[b];if(b++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function f(){var e,t,n,r,o;if(b>y)throw Error("Invalid byte index");if(b==y)return!1;if(e=255&v[b],b++,0==(128&e))return e;if(192==(224&e)){var t=d();if(o=(31&e)<<6|t,o>=128)return o;throw Error("Invalid continuation byte")}if(224==(240&e)){if(t=d(),n=d(),o=(15&e)<<12|t<<6|n,o>=2048)return s(o),o;throw Error("Invalid continuation byte")}if(240==(248&e)&&(t=d(),n=d(),r=d(),o=(15&e)<<18|t<<12|n<<6|r,o>=65536&&1114111>=o))return o;throw Error("Invalid UTF-8 detected")}function l(e){v=i(e),y=v.length,b=0;for(var t,n=[];(t=f())!==!1;)n.push(t);return a(n)}var h="object"==typeof r&&r,g="object"==typeof n&&n&&n.exports==h&&n,m="object"==typeof o&&o;(m.global===m||m.window===m)&&(t=m);var v,y,b,w=String.fromCharCode,S={version:"2.0.0",encode:p,decode:l};if("function"==typeof e&&"object"==typeof e.amd&&e.amd)e(function(){return S});else if(h&&!h.nodeType)if(g)g.exports=S;else{var k={},C=k.hasOwnProperty;for(var x in S)C.call(S,x)&&(h[x]=S[x])}else t.utf8=S}(this)},{}],73:[function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e,t){for(var n=-1,r=e.length;++nu))return!1;for(;++c-1&&0==e%1&&t>e}function i(e){return"number"==typeof e&&e>-1&&0==e%1&&m>=e}function a(e){for(var t=c(e),n=t.length,r=n&&e.length,a=!!r&&i(r)&&(d(e)||p(e)),s=-1,u=[];++s0;++rt&&(t+=r),0>n&&(n+=r),n>r&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(e),i=new Uint8Array(n-t),a=t,s=0;n>a;a++,s++)i[s]=o[a];return i.buffer}},{}],92:[function(e,t,n){!function(e){"use strict";n.encode=function(t){var n,r=new Uint8Array(t),o=r.length,i="";for(n=0;o>n;n+=3)i+=e[r[n]>>2],i+=e[(3&r[n])<<4|r[n+1]>>4],i+=e[(15&r[n+1])<<2|r[n+2]>>6],i+=e[63&r[n+2]];return 2===o%3?i=i.substring(0,i.length-1)+"=":1===o%3&&(i=i.substring(0,i.length-2)+"=="),i},n.decode=function(t){var n,r,o,i,a,s=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var p=new ArrayBuffer(s),d=new Uint8Array(p);for(n=0;c>n;n+=4)r=e.indexOf(t[n]),o=e.indexOf(t[n+1]),i=e.indexOf(t[n+2]),a=e.indexOf(t[n+3]),d[u++]=r<<2|o>>4,d[u++]=(15&o)<<4|i>>2,d[u++]=(3&i)<<6|63&a;return p}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],93:[function(e,t){function n(e,t,n){function o(e,r){if(o.count<=0)throw new Error("after called too many times");--o.count,e?(i=!0,t(e),t=n):0!==o.count||i||t(null,r)}var i=!1;return n=n||r,o.count=e,0===e?t():o}function r(){}t.exports=n},{}],94:[function(e,t){function n(e){for(var t=0;t1?{type:b[i],data:e.substring(1)}:{type:b[i]}:w}var a=new Uint8Array(e),i=a[0],s=d(e,1);return S&&"blob"===t&&(s=new S([s])),{type:b[i],data:s}},n.decodeBase64Packet=function(e,t){var n=b[e.charAt(0)];if(!c.ArrayBuffer)return{type:n,data:{base64:!0,data:e.substr(1)}};var r=f.decode(e.substr(1));return"blob"===t&&S&&(r=new S([r])),{type:n,data:r}},n.encodePayload=function(e,t,r){function o(e){return e.length+":"+e}function i(e,r){n.encodePacket(e,a?t:!1,!0,function(e){r(null,o(e))})}"function"==typeof t&&(r=t,t=null);var a=p(e);return t&&a?S&&!v?n.encodePayloadAsBlob(e,r):n.encodePayloadAsArrayBuffer(e,r):e.length?(s(e,i,function(e,t){return r(t.join(""))}),void 0):r("0:")},n.decodePayload=function(e,t,r){if("string"!=typeof e)return n.decodePayloadAsBinary(e,t,r);"function"==typeof t&&(r=t,t=null);var o;if(""==e)return r(w,0,1);for(var i,a,s="",c=0,u=e.length;u>c;c++){var p=e.charAt(c);if(":"!=p)s+=p;else{if(""==s||s!=(i=Number(s)))return r(w,0,1);if(a=e.substr(c+1,i),s!=a.length)return r(w,0,1);if(a.length){if(o=n.decodePacket(a,t,!0),w.type==o.type&&w.data==o.data)return r(w,0,1);var d=r(o,c+i,u);if(!1===d)return}c+=i,s=""}}return""!=s?r(w,0,1):void 0},n.encodePayloadAsArrayBuffer=function(e,t){function r(e,t){n.encodePacket(e,!0,!0,function(e){return t(null,e)})}return e.length?(s(e,r,function(e,n){var r=n.reduce(function(e,t){var n;return n="string"==typeof t?t.length:t.byteLength,e+n.toString().length+n+2},0),o=new Uint8Array(r),i=0;return n.forEach(function(e){var t="string"==typeof e,n=e;if(t){for(var r=new Uint8Array(e.length),a=0;a0;){for(var s=new Uint8Array(o),c=0===s[0],u="",p=1;255!=s[p];p++){if(u.length>310){a=!0;break}u+=s[p]}if(a)return r(w,0,1);o=d(o,2+u.length),u=parseInt(u);var f=d(o,0,u);if(c)try{f=String.fromCharCode.apply(null,new Uint8Array(f))}catch(l){var h=new Uint8Array(f);f="";for(var p=0;po;o++)t[o]&&(e=t[o].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function a(){n.enable("")}function s(e){var t,r;for(t=0,r=n.skips.length;r>t;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;r>t;t++)if(n.names[t].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}n=t.exports=o,n.coerce=c,n.disable=a,n.enable=i,n.enabled=s,n.humanize=e("ms"),n.names=[],n.skips=[],n.formatters={};var u,p=0},{ms:96}],96:[function(e,t){function n(e){var t=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"y":return n*p;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"h":return n*c;case"minutes":case"minute":case"m":return n*s;case"seconds":case"second":case"s":return n*a;case"ms":return n}}}function r(e){return e>=u?Math.round(e/u)+"d":e>=c?Math.round(e/c)+"h":e>=s?Math.round(e/s)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function o(e){return i(e,u,"day")||i(e,c,"hour")||i(e,s,"minute")||i(e,a,"second")||e+" ms"}function i(e,t,n){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var a=1e3,s=60*a,c=60*s,u=24*c,p=365.25*u;t.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t.long?o(e):r(e)}},{}],78:[function(e,t){function n(){}function r(e){i.call(this,e),this.query=this.query||{},s||(o.___eio||(o.___eio=[]),s=o.___eio),this.index=s.length;var t=this;s.push(function(e){t.onData(e)}),this.query.j=this.index,o.document&&o.addEventListener&&o.addEventListener("beforeunload",function(){t.script&&(t.script.onerror=n)},!1)}var o=self,i=e("./polling"),a=e("component-inherit");t.exports=r;var s,c=/\n/g,u=/\\n/g;a(r,i),r.prototype.supportsBinary=!1,r.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),i.prototype.doClose.call(this)},r.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n),this.script=t;var r="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);r&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},r.prototype.doWrite=function(e,t){function n(){r(),t()}function r(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(e){o.onError("jsonp polling iframe removal error",e)}try{var t='