diff --git a/dist/js/callcenter-component.js b/dist/js/callcenter-component.js index 2fd45b8..4b1dd19 100644 --- a/dist/js/callcenter-component.js +++ b/dist/js/callcenter-component.js @@ -17,4 +17,4 @@ object-assign * @return {boolean} True if the event is supported. * @internal * @license Modernizr 3.0.0pre (Custom Build) | MIT - */,e.exports=function(e,t){if(!o.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,i=n in document;if(!i){var a=document.createElement("div");a.setAttribute(n,"return;"),i="function"==typeof a[n]}return!i&&r&&"wheel"===e&&(i=document.implementation.hasFeature("Events.wheel","3.0")),i}},function(e,t,n){"use strict";var r={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function o(e){var t=this.nativeEvent;if(t.getModifierState)return t.getModifierState(e);var n=r[e];return!!n&&!!t[n]}e.exports=function(e){return o}},function(e,t,n){"use strict";var r=n(40),o=n(316),i=(n(8),n(15),n(106)),a=n(78),s=n(160);function u(e,t){return Array.isArray(t)&&(t=t[1]),t?t.nextSibling:e.firstChild}var c=i(function(e,t,n){e.insertBefore(t,n)});function l(e,t,n){r.insertTreeBefore(e,t,n)}function p(e,t,n){Array.isArray(t)?function(e,t,n,r){var o=t;for(;;){var i=o.nextSibling;if(c(e,o,r),o===n)break;o=i}}(e,t[0],t[1],n):c(e,t,n)}function f(e,t){if(Array.isArray(t)){var n=t[1];d(e,t=t[0],n),e.removeChild(n)}e.removeChild(t)}function d(e,t,n){for(;;){var r=t.nextSibling;if(r===n)break;e.removeChild(r)}}var h={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,replaceDelimitedText:function(e,t,n){var r=e.parentNode,o=e.nextSibling;o===t?n&&c(r,document.createTextNode(n),o):n?(s(o,n),d(r,o,t)):d(r,e,t)},processUpdates:function(e,t){for(var n=0;n0&&r.length<20?n+" (keys: "+r.join(", ")+")":n}(e))}};e.exports=u},function(e,t,n){"use strict";n(7);var r=n(20),o=(n(6),r);e.exports=o},function(e,t,n){"use strict";e.exports=function(e){var t,n=e.keyCode;return"charCode"in e?0===(t=e.charCode)&&13===n&&(t=13):t=n,t>=32||13===t?t:0}},function(e,t,n){var r=n(116),o=n(49),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var a=e[t];i.call(e,t)&&o(a,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t,n){var r=n(179);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n"),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,t)&&(e+=";".concat(t),null!==this._parameters[t]&&(e+="=".concat(this._parameters[t])));return e}},{key:"uri",get:function(){return this._uri}},{key:"display_name",get:function(){return this._display_name},set:function(e){this._display_name=0===e?"0":e}}]),e}()},function(e,t,n){var r=n(455)("socket.io-parser"),o=n(458),i=n(460),a=n(461),s=n(195);function u(){}function c(e){var n="",i=!1;return n+=e.type,t.BINARY_EVENT!=e.type&&t.BINARY_ACK!=e.type||(n+=e.attachments,n+="-"),e.nsp&&"/"!=e.nsp&&(i=!0,n+=e.nsp),null!=e.id&&(i&&(n+=",",i=!1),n+=e.id),null!=e.data&&(i&&(n+=","),n+=o.stringify(e.data)),r("encoded %j as %s",e,n),n}function l(){this.reconstructor=null}function p(e){this.reconPack=e,this.buffers=[]}function f(e){return{type:t.ERROR,data:"parser error"}}t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=u,t.Decoder=l,u.prototype.encode=function(e,n){(r("encoding packet %j",e),t.BINARY_EVENT==e.type||t.BINARY_ACK==e.type)?function(e,t){a.removeBlobs(e,function(e){var n=a.deconstructPacket(e),r=c(n.packet),o=n.buffers;o.unshift(r),t(o)})}(e,n):n([c(e)])},i(l.prototype),l.prototype.add=function(e){var n;if("string"==typeof e)n=function(e){var n={},i=0;if(n.type=Number(e.charAt(0)),null==t.types[n.type])return f();if(t.BINARY_EVENT==n.type||t.BINARY_ACK==n.type){for(var a="";"-"!=e.charAt(++i)&&(a+=e.charAt(i),i!=e.length););if(a!=Number(a)||"-"!=e.charAt(i))throw new Error("Illegal attachments");n.attachments=Number(a)}if("/"==e.charAt(i+1))for(n.nsp="";++i;){var s=e.charAt(i);if(","==s)break;if(n.nsp+=s,i==e.length)break}else n.nsp="/";var u=e.charAt(i+1);if(""!==u&&Number(u)==u){for(n.id="";++i;){var s=e.charAt(i);if(null==s||Number(s)!=s){--i;break}if(n.id+=e.charAt(i),i==e.length)break}n.id=Number(n.id)}e.charAt(++i)&&(n=function(e,t){try{e.data=o.parse(t)}catch(e){return f()}return e}(n,e.substr(i)));return r("decoded %s as %j",e,n),n}(e),t.BINARY_EVENT==n.type||t.BINARY_ACK==n.type?(this.reconstructor=new p(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!s(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,this.emit("decoded",n))}},l.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length==this.reconPack.attachments){var t=a.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,n){(function(t){var r=n(466);e.exports=function(e){var n=e.xdomain,o=e.xscheme,i=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!n||r))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!o&&i)return new XDomainRequest}catch(e){}if(!n)try{return new(t[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}}).call(this,n(10))},function(e,t,n){var r=n(43),o=n(59);function i(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}e.exports=i,o(i.prototype),i.prototype.onError=function(e,t){var n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},i.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},i.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},i.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},i.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},i.prototype.onData=function(e){var t=r.decodePacket(e,this.socket.binaryType);this.onPacket(t)},i.prototype.onPacket=function(e){this.emit("packet",e)},i.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),r=0,o=n.length;rf))return!1;var h=l.get(e);if(h&&l.get(t))return h==t;var m=-1,v=!0,g=n&s?new r:void 0;for(l.set(e,t),l.set(t,e);++m.":"function"==typeof t?" Instead of passing a class like Foo, pass React.createElement(Foo) or .":null!=t&&void 0!==t.props?" This may be caused by unintentionally loading two independent copies of React.":"");var i,s=a.createElement(P,{child:t});if(e){var u=f.get(e);i=u._processChildContext(u._context)}else i=g;var c=q(n);if(c){var l=c._currentElement.props.child;if(b(l,t)){var p=c._renderedComponent.getPublicInstance(),d=o&&function(){o.call(p)};return N._updateRootComponent(c,s,i,n,d),p}N.unmountComponentAtNode(n)}var h,v=V(n),y=v&&!(!(h=v).getAttribute||!h.getAttribute(A)),_=O(n),C=y&&!c&&!_,E=N._renderNewRootComponent(s,n,C,i)._renderedComponent.getPublicInstance();return o&&o.call(E),E},render:function(e,t,n){return N._renderSubtreeIntoContainer(null,e,t,n)},unmountComponentAtNode:function(e){x(e)||r("40");var t=q(e);if(!t){O(e),1===e.nodeType&&e.hasAttribute(C);return!1}return delete w[t._instance.rootID],v.batchedUpdates(I,t,e,!1),!0},_mountImageIntoNode:function(e,t,n,i,a){if(x(t)||r("41"),i){var s=V(t);if(d.canReuseMarkup(e,s))return void u.precacheNode(n,s);var c=s.getAttribute(d.CHECKSUM_ATTR_NAME);s.removeAttribute(d.CHECKSUM_ATTR_NAME);var l=s.outerHTML;s.setAttribute(d.CHECKSUM_ATTR_NAME,c);var p=e,f=function(e,t){for(var n=Math.min(e.length,t.length),r=0;r0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},r.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),o=0;o-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},r.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(function(e){return parseInt(e,10)})}},r.getMid=function(e){var t=r.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},r.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},r.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:r.matchPrefix(e+t,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},r.getIceParameters=function(e,t){var n=r.splitLines(e);return{usernameFragment:(n=n.concat(r.splitLines(t))).filter(function(e){return 0===e.indexOf("a=ice-ufrag:")})[0].substr(12),password:n.filter(function(e){return 0===e.indexOf("a=ice-pwd:")})[0].substr(10)}},r.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},r.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=r.splitLines(e)[0].split(" "),o=3;o0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=t.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(function(e){n+=r.writeRtpMap(e),n+=r.writeFmtp(e),n+=r.writeRtcpFb(e)});var o=0;return t.codecs.forEach(function(e){e.maxptime>o&&(o=e.maxptime)}),o>0&&(n+="a=maxptime:"+o+"\r\n"),n+="a=rtcp-mux\r\n",t.headerExtensions&&t.headerExtensions.forEach(function(e){n+=r.writeExtmap(e)}),n},r.parseRtpEncodingParameters=function(e){var t,n=[],o=r.parseRtpParameters(e),i=-1!==o.fecMechanisms.indexOf("RED"),a=-1!==o.fecMechanisms.indexOf("ULPFEC"),s=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),u=s.length>0&&s[0].ssrc,c=r.matchPrefix(e,"a=ssrc-group:FID").map(function(e){return e.substr(17).split(" ").map(function(e){return parseInt(e,10)})});c.length>0&&c[0].length>1&&c[0][0]===u&&(t=c[0][1]),o.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var r={ssrc:u,codecPayloadType:parseInt(e.parameters.apt,10)};u&&t&&(r.rtx={ssrc:t}),n.push(r),i&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:u,mechanism:a?"red+ulpfec":"red"},n.push(r))}}),0===n.length&&u&&n.push({ssrc:u});var l=r.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,n.forEach(function(e){e.maxBitrate=l})),n},r.parseRtcpParameters=function(e){var t={},n=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);var o=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=o.length>0,t.compound=0===o.length;var i=r.matchPrefix(e,"a=rtcp-mux");return t.mux=i.length>0,t},r.parseMsid=function(e){var t,n=r.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(t=n[0].substr(7).split(" "))[0],track:t[1]};var o=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return o.length>0?{stream:(t=o[0].value.split(" "))[0],track:t[1]}:void 0},r.generateSessionId=function(){return Math.random().toString().substr(2,21)},r.writeSessionBoilerplate=function(e,t,n){var o=void 0!==t?t:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||r.generateSessionId())+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.writeMediaSection=function(e,t,n,o){var i=r.writeRtpDescription(e.kind,t);if(i+=r.writeIceParameters(e.iceGatherer.getLocalParameters()),i+=r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),i+="a=mid:"+e.mid+"\r\n",e.direction?i+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?i+="a=sendrecv\r\n":e.rtpSender?i+="a=sendonly\r\n":e.rtpReceiver?i+="a=recvonly\r\n":i+="a=inactive\r\n",e.rtpSender){var a="msid:"+o.id+" "+e.rtpSender.track.id+"\r\n";i+="a="+a,i+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(i+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,i+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return i+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+r.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(i+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+r.localCName+"\r\n"),i},r.getDirection=function(e,t){for(var n=r.splitLines(e),o=0;o1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,s&&o(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),t=Object(t);++r (https://github.com/jmillan)",contributors:["Iñaki Baz Castillo (https://github.com/ibc)"],main:"lib-es5/JsSIP.js",keywords:["sip","websocket","webrtc","node","browser","library"],license:"MIT",repository:{type:"git",url:"https://github.com/versatica/JsSIP.git"},bugs:{url:"https://github.com/versatica/JsSIP/issues"},dependencies:{debug:"^4.1.1",events:"^3.0.0","sdp-transform":"^2.7.0"},devDependencies:{"@babel/core":"^7.3.4","@babel/preset-env":"^7.3.4","ansi-colors":"^3.2.3",browserify:"^16.2.3",eslint:"^5.14.1","fancy-log":"^1.3.3",gulp:"^4.0.0","gulp-babel":"^8.0.0","gulp-eslint":"^5.0.0","gulp-expect-file":"^1.0.1","gulp-header":"^2.0.7","gulp-nodeunit-runner":"^0.2.2","gulp-plumber":"^1.2.1","gulp-rename":"^1.4.0","gulp-uglify-es":"^1.0.4",pegjs:"^0.7.0","vinyl-buffer":"^1.0.1","vinyl-source-stream":"^2.0.0"},scripts:{lint:"gulp lint",test:"gulp test",prepublishOnly:"gulp babel"}}},function(e,t,n){var r=n(426),o=n(427);t.write=o,t.parse=r.parse,t.parseFmtpConfig=r.parseFmtpConfig,t.parseParams=r.parseParams,t.parsePayloads=r.parsePayloads,t.parseRemoteCandidates=r.parseRemoteCandidates,t.parseImageAttributes=r.parseImageAttributes,t.parseSimulcastStreamList=r.parseSimulcastStreamList},function(e,t){var n=e.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w\/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-\.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%d trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))? (\S*)(?: (\S*))?/,names:["value","direction","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+" %s"+(e.config?" %s":"")}},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_\/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"invalid",names:["value"]}]};Object.keys(n).forEach(function(e){n[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})},function(e,t,n){"use strict";var r=500;e.exports={T1:r,T2:4e3,T4:5e3,TIMER_B:32e3,TIMER_D:0,TIMER_F:32e3,TIMER_H:32e3,TIMER_I:0,TIMER_J:0,TIMER_K:0,TIMER_L:32e3,TIMER_M:32e3,PROVISIONAL_RESPONSE_INTERVAL:6e4}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;E("connect()");var r=e,o=t.eventHandlers||{},i=h.cloneArray(t.extraHeaders),a=t.mediaConstraints||{audio:!0,video:!0},s=t.mediaStream||null,u=t.pcConfig||{iceServers:[]},c=t.rtcConstraints||null,l=t.rtcOfferConstraints||null;if(this._rtcOfferConstraints=l,this._rtcAnswerConstraints=t.rtcAnswerConstraints||null,this._data=t.data||this._data,void 0===e)throw new TypeError("Not enough arguments");if(this._status!==T.STATUS_NULL)throw new f.InvalidStateError(this._status);if(!window.RTCPeerConnection)throw new f.NotSupportedError("WebRTC not supported");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(r));for(var d in this._sessionTimers.enabled&&h.isDecimal(t.sessionTimersExpires)&&(t.sessionTimersExpires>=p.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=t.sessionTimersExpires:this._sessionTimers.defaultExpires=p.SESSION_EXPIRES),o)Object.prototype.hasOwnProperty.call(o,d)&&this.on(d,o[d]);this._from_tag=h.newTag();var m=t.anonymous||!1,g={from_tag:this._from_tag};this._contact=this._ua.contact.toString({anonymous:m,outbound:!0}),m&&(g.from_display_name="Anonymous",g.from_uri="sip:anonymous@anonymous.invalid",i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())),i.push("Privacy: id")),i.push("Contact: ".concat(this._contact)),i.push("Content-Type: application/sdp"),this._sessionTimers.enabled&&i.push("Session-Expires: ".concat(this._sessionTimers.defaultExpires)),this._request=new v.InitialOutgoingInviteRequest(e,this._ua,g,i),this._id=this._request.call_id+this._from_tag,this._createRTCConnection(u,c),this._direction="outgoing",this._local_identity=this._request.from,this._remote_identity=this._request.to,n&&n(this),this._newRTCSession("local",this._request),this._sendInitialRequest(a,l,s)}},{key:"init_incoming",value:function(e,t){var n,r=this;E("init_incoming()");var o=e.getHeader("Content-Type");e.body&&"application/sdp"!==o?e.reply(415):(this._status=T.STATUS_INVITE_RECEIVED,this._from_tag=e.from_tag,this._id=e.call_id+this._from_tag,this._request=e,this._contact=this._ua.contact.toString(),e.hasHeader("expires")&&(n=1e3*e.getHeader("expires")),e.to_tag=h.newTag(),this._createDialog(e,"UAS",!0)?(e.body?this._late_sdp=!1:this._late_sdp=!0,this._status=T.STATUS_WAITING_FOR_ANSWER,this._timers.userNoAnswerTimer=setTimeout(function(){e.reply(408),r._failed("local",null,p.causes.NO_ANSWER)},this._ua.configuration.no_answer_timeout),n&&(this._timers.expiresTimer=setTimeout(function(){r._status===T.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),r._failed("system",null,p.causes.EXPIRES))},n)),this._direction="incoming",this._local_identity=e.to,this._remote_identity=e.from,t&&t(this),this._newRTCSession("remote",e),this._status!==T.STATUS_TERMINATED&&(e.reply(180,null,["Contact: ".concat(this._contact)]),this._progress("local",null))):e.reply(500,"Missing Contact header field"))}},{key:"answer",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};E("answer()");var n,r=this._request,o=h.cloneArray(t.extraHeaders),i=t.mediaConstraints||{},a=t.mediaStream||null,s=t.pcConfig||{iceServers:[]},u=t.rtcConstraints||null,c=t.rtcAnswerConstraints||null,l=!1,d=!1,m=!1,v=!1;if(this._rtcAnswerConstraints=c,this._rtcOfferConstraints=t.rtcOfferConstraints||null,this._data=t.data||this._data,"incoming"!==this._direction)throw new f.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this._status!==T.STATUS_WAITING_FOR_ANSWER)throw new f.InvalidStateError(this._status);if(this._sessionTimers.enabled&&h.isDecimal(t.sessionTimersExpires)&&(t.sessionTimersExpires>=p.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=t.sessionTimersExpires:this._sessionTimers.defaultExpires=p.SESSION_EXPIRES),this._status=T.STATUS_ANSWERED,this._createDialog(r,"UAS")){clearTimeout(this._timers.userNoAnswerTimer),o.unshift("Contact: ".concat(this._contact));var g=r.parseSDP();Array.isArray(g.media)||(g.media=[g.media]);var y=!0,_=!1,b=void 0;try{for(var A,C=g.media[Symbol.iterator]();!(y=(A=C.next()).done);y=!0){var w=A.value;"audio"===w.type&&(l=!0,w.direction&&"sendrecv"!==w.direction||(m=!0)),"video"===w.type&&(d=!0,w.direction&&"sendrecv"!==w.direction||(v=!0))}}catch(e){_=!0,b=e}finally{try{y||null==C.return||C.return()}finally{if(_)throw b}}if(a&&!1===i.audio){n=a.getAudioTracks();var V=!0,k=!1,R=void 0;try{for(var I,O=n[Symbol.iterator]();!(V=(I=O.next()).done);V=!0){var x=I.value;a.removeTrack(x)}}catch(e){k=!0,R=e}finally{try{V||null==O.return||O.return()}finally{if(k)throw R}}}if(a&&!1===i.video){n=a.getVideoTracks();var q=!0,M=!1,P=void 0;try{for(var N,D=n[Symbol.iterator]();!(q=(N=D.next()).done);q=!0){var U=N.value;a.removeTrack(U)}}catch(e){M=!0,P=e}finally{try{q||null==D.return||D.return()}finally{if(M)throw P}}}a||void 0!==i.audio||(i.audio=m),a||void 0!==i.video||(i.video=v),a||l||(i.audio=!1),a||d||(i.video=!1),this._createRTCConnection(s,u),Promise.resolve().then(function(){return a||(i.audio||i.video?(e._localMediaStreamLocallyGenerated=!0,navigator.mediaDevices.getUserMedia(i).catch(function(t){if(e._status===T.STATUS_TERMINATED)throw new Error("terminated");throw r.reply(480),e._failed("local",null,p.causes.USER_DENIED_MEDIA_ACCESS),S('emit "getusermediafailed" [error:%o]',t),e.emit("getusermediafailed",t),new Error("getUserMedia() failed")})):void 0)}).then(function(t){if(e._status===T.STATUS_TERMINATED)throw new Error("terminated");e._localMediaStream=t,t&&t.getTracks().forEach(function(n){e._connection.addTrack(n,t)})}).then(function(){if(!e._late_sdp){var t={originator:"remote",type:"offer",sdp:r.body};E('emit "sdp"'),e.emit("sdp",t);var n=new RTCSessionDescription({type:"offer",sdp:t.sdp});return e._connectionPromiseQueue=e._connectionPromiseQueue.then(function(){return e._connection.setRemoteDescription(n)}).catch(function(t){throw r.reply(488),e._failed("system",null,p.causes.WEBRTC_ERROR),S('emit "peerconnection:setremotedescriptionfailed" [error:%o]',t),e.emit("peerconnection:setremotedescriptionfailed",t),new Error("peerconnection.setRemoteDescription() failed")}),e._connectionPromiseQueue}}).then(function(){if(e._status===T.STATUS_TERMINATED)throw new Error("terminated");return e._connecting(r),e._late_sdp?e._createLocalDescription("offer",e._rtcOfferConstraints).catch(function(){throw r.reply(500),new Error("_createLocalDescription() failed")}):e._createLocalDescription("answer",c).catch(function(){throw r.reply(500),new Error("_createLocalDescription() failed")})}).then(function(t){if(e._status===T.STATUS_TERMINATED)throw new Error("terminated");e._handleSessionTimersInIncomingRequest(r,o),r.reply(200,null,o,t,function(){e._status=T.STATUS_WAITING_FOR_ACK,e._setInvite2xxTimer(r,t),e._setACKTimer(),e._accepted("local")},function(){e._failed("system",null,p.causes.CONNECTION_ERROR)})}).catch(function(t){e._status!==T.STATUS_TERMINATED&&S(t)})}else r.reply(500,"Error creating dialog")}},{key:"terminate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};E("terminate()");var n,r=t.cause||p.causes.BYE,o=h.cloneArray(t.extraHeaders),i=t.body,a=t.status_code,s=t.reason_phrase;if(this._status===T.STATUS_TERMINATED)throw new f.InvalidStateError(this._status);switch(this._status){case T.STATUS_NULL:case T.STATUS_INVITE_SENT:case T.STATUS_1XX_RECEIVED:if(E("canceling session"),a&&(a<200||a>=700))throw new TypeError("Invalid status_code: ".concat(a));a&&(s=s||p.REASON_PHRASE[a]||"",n="SIP ;cause=".concat(a,' ;text="').concat(s,'"')),this._status===T.STATUS_NULL||this._status===T.STATUS_INVITE_SENT?(this._is_canceled=!0,this._cancel_reason=n):this._status===T.STATUS_1XX_RECEIVED&&this._request.cancel(n),this._status=T.STATUS_CANCELED,this._failed("local",null,p.causes.CANCELED);break;case T.STATUS_WAITING_FOR_ANSWER:case T.STATUS_ANSWERED:if(E("rejecting session"),(a=a||480)<300||a>=700)throw new TypeError("Invalid status_code: ".concat(a));this._request.reply(a,s,o,i),this._failed("local",null,p.causes.REJECTED);break;case T.STATUS_WAITING_FOR_ACK:case T.STATUS_CONFIRMED:if(E("terminating session"),s=t.reason_phrase||p.REASON_PHRASE[a]||"",a&&(a<200||a>=700))throw new TypeError("Invalid status_code: ".concat(a));if(a&&o.push("Reason: SIP ;cause=".concat(a,'; text="').concat(s,'"')),this._status===T.STATUS_WAITING_FOR_ACK&&"incoming"===this._direction&&this._request.server_transaction.state!==d.C.STATUS_TERMINATED){var u=this._dialog;this.receiveRequest=function(t){t.method===p.ACK&&(e.sendRequest(p.BYE,{extraHeaders:o,body:i}),u.terminate())},this._request.server_transaction.on("stateChanged",function(){e._request.server_transaction.state===d.C.STATUS_TERMINATED&&(e.sendRequest(p.BYE,{extraHeaders:o,body:i}),u.terminate())}),this._ended("local",null,r),this._dialog=u,this._ua.newDialog(u)}else this.sendRequest(p.BYE,{extraHeaders:o,body:i}),this._ended("local",null,r)}}},{key:"sendDTMF",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};E("sendDTMF() | tones: %s",e);var n=0,r=t.duration||null,o=t.interToneGap||null;if(void 0===e)throw new TypeError("Not enough arguments");if(this._status!==T.STATUS_CONFIRMED&&this._status!==T.STATUS_WAITING_FOR_ACK)throw new f.InvalidStateError(this._status);if("number"==typeof e&&(e=e.toString()),!e||"string"!=typeof e||!e.match(/^[0-9A-DR#*,]+$/i))throw new TypeError("Invalid tones: ".concat(e));if(r&&!h.isDecimal(r))throw new TypeError("Invalid tone duration: ".concat(r));if(r?r<_.C.MIN_DURATION?(E('"duration" value is lower than the minimum allowed, setting it to '.concat(_.C.MIN_DURATION," milliseconds")),r=_.C.MIN_DURATION):r>_.C.MAX_DURATION?(E('"duration" value is greater than the maximum allowed, setting it to '.concat(_.C.MAX_DURATION," milliseconds")),r=_.C.MAX_DURATION):r=Math.abs(r):r=_.C.DEFAULT_DURATION,t.duration=r,o&&!h.isDecimal(o))throw new TypeError("Invalid interToneGap: ".concat(o));o?o<_.C.MIN_INTER_TONE_GAP?(E('"interToneGap" value is lower than the minimum allowed, setting it to '.concat(_.C.MIN_INTER_TONE_GAP," milliseconds")),o=_.C.MIN_INTER_TONE_GAP):o=Math.abs(o):o=_.C.DEFAULT_INTER_TONE_GAP,this._tones?this._tones+=e:(this._tones=e,function e(){var i=this;var a;if(this._status===T.STATUS_TERMINATED||!this._tones||n>=this._tones.length)return void(this._tones=null);var s=this._tones[n];n+=1;if(","===s)a=2e3;else{var u=new _(this);t.eventHandlers={onFailed:function(){i._tones=null}},u.send(s,t),a=r+o}setTimeout(e.bind(this),a)}.call(this))}},{key:"sendInfo",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(E("sendInfo()"),this._status!==T.STATUS_CONFIRMED&&this._status!==T.STATUS_WAITING_FOR_ACK)throw new f.InvalidStateError(this._status);new b(this).send(e,t,n)}},{key:"mute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!1};E("mute()");var t=!1,n=!1;!1===this._audioMuted&&e.audio&&(t=!0,this._audioMuted=!0,this._toggleMuteAudio(!0)),!1===this._videoMuted&&e.video&&(n=!0,this._videoMuted=!0,this._toggleMuteVideo(!0)),!0!==t&&!0!==n||this._onmute({audio:t,video:n})}},{key:"unmute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!0};E("unmute()");var t=!1,n=!1;!0===this._audioMuted&&e.audio&&(t=!0,this._audioMuted=!1,!1===this._localHold&&this._toggleMuteAudio(!1)),!0===this._videoMuted&&e.video&&(n=!0,this._videoMuted=!1,!1===this._localHold&&this._toggleMuteVideo(!1)),!0!==t&&!0!==n||this._onunmute({audio:t,video:n})}},{key:"hold",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(E("hold()"),this._status!==T.STATUS_WAITING_FOR_ACK&&this._status!==T.STATUS_CONFIRMED)return!1;if(!0===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!0,this._onhold("local");var r={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:p.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Hold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:r,extraHeaders:t.extraHeaders}),!0}},{key:"unhold",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(E("unhold()"),this._status!==T.STATUS_WAITING_FOR_ACK&&this._status!==T.STATUS_CONFIRMED)return!1;if(!1===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!1,this._onunhold("local");var r={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:p.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Unhold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:r,extraHeaders:t.extraHeaders}),!0}},{key:"renegotiate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;E("renegotiate()");var r=t.rtcOfferConstraints||null;if(this._status!==T.STATUS_WAITING_FOR_ACK&&this._status!==T.STATUS_CONFIRMED)return!1;if(!this._isReadyToReOffer())return!1;var o={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:p.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Media Renegotiation Failed"})}};return this._setLocalMediaStatus(),t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:o,rtcOfferConstraints:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:o,rtcOfferConstraints:r,extraHeaders:t.extraHeaders}),!0}},{key:"refer",value:function(e,t){var n=this;E("refer()");var r=e;if(this._status!==T.STATUS_WAITING_FOR_ACK&&this._status!==T.STATUS_CONFIRMED)return!1;if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(r));var o=new C(this);o.sendRefer(e,t);var i=o.id;return this._referSubscribers[i]=o,o.on("requestFailed",function(){delete n._referSubscribers[i]}),o.on("accepted",function(){delete n._referSubscribers[i]}),o.on("failed",function(){delete n._referSubscribers[i]}),o}},{key:"sendRequest",value:function(e,t){return E("sendRequest()"),this._dialog.sendRequest(e,t)}},{key:"receiveRequest",value:function(e){var t=this;if(E("receiveRequest()"),e.method===p.CANCEL)this._status!==T.STATUS_WAITING_FOR_ANSWER&&this._status!==T.STATUS_ANSWERED||(this._status=T.STATUS_CANCELED,this._request.reply(487),this._failed("remote",e,p.causes.CANCELED));else switch(e.method){case p.ACK:if(this._status!==T.STATUS_WAITING_FOR_ACK)return;if(this._status=T.STATUS_CONFIRMED,clearTimeout(this._timers.ackTimer),clearTimeout(this._timers.invite2xxTimer),this._late_sdp){if(!e.body){this.terminate({cause:p.causes.MISSING_SDP,status_code:400});break}var n={originator:"remote",type:"answer",sdp:e.body};E('emit "sdp"'),this.emit("sdp",n);var r=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(r)}).then(function(){t._is_confirmed||t._confirmed("remote",e)}).catch(function(e){t.terminate({cause:p.causes.BAD_MEDIA_DESCRIPTION,status_code:488}),S('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else this._is_confirmed||this._confirmed("remote",e);break;case p.BYE:this._status===T.STATUS_CONFIRMED?(e.reply(200),this._ended("remote",e,p.causes.BYE)):this._status===T.STATUS_INVITE_RECEIVED?(e.reply(200),this._request.reply(487,"BYE Received"),this._ended("remote",e,p.causes.BYE)):e.reply(403,"Wrong Status");break;case p.INVITE:this._status===T.STATUS_CONFIRMED?e.hasHeader("replaces")?this._receiveReplaces(e):this._receiveReinvite(e):e.reply(403,"Wrong Status");break;case p.INFO:if(this._status===T.STATUS_1XX_RECEIVED||this._status===T.STATUS_WAITING_FOR_ANSWER||this._status===T.STATUS_ANSWERED||this._status===T.STATUS_WAITING_FOR_ACK||this._status===T.STATUS_CONFIRMED){var o=e.getHeader("content-type");o&&o.match(/^application\/dtmf-relay/i)?new _(this).init_incoming(e):void 0!==o?new b(this).init_incoming(e):e.reply(415)}else e.reply(403,"Wrong Status");break;case p.UPDATE:this._status===T.STATUS_CONFIRMED?this._receiveUpdate(e):e.reply(403,"Wrong Status");break;case p.REFER:this._status===T.STATUS_CONFIRMED?this._receiveRefer(e):e.reply(403,"Wrong Status");break;case p.NOTIFY:this._status===T.STATUS_CONFIRMED?this._receiveNotify(e):e.reply(403,"Wrong Status");break;default:e.reply(501)}}},{key:"onTransportError",value:function(){S("onTransportError()"),this._status!==T.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:p.causes.CONNECTION_ERROR,cause:p.causes.CONNECTION_ERROR})}},{key:"onRequestTimeout",value:function(){S("onRequestTimeout()"),this._status!==T.STATUS_TERMINATED&&this.terminate({status_code:408,reason_phrase:p.causes.REQUEST_TIMEOUT,cause:p.causes.REQUEST_TIMEOUT})}},{key:"onDialogError",value:function(){S("onDialogError()"),this._status!==T.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:p.causes.DIALOG_ERROR,cause:p.causes.DIALOG_ERROR})}},{key:"newDTMF",value:function(e){E("newDTMF()"),this.emit("newDTMF",e)}},{key:"newInfo",value:function(e){E("newInfo()"),this.emit("newInfo",e)}},{key:"_isReadyToReOffer",value:function(){return this._rtcReady?this._dialog?!0!==this._dialog.uac_pending_reply&&!0!==this._dialog.uas_pending_reply||(E("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"),!1):(E("_isReadyToReOffer() | session not established yet"),!1):(E("_isReadyToReOffer() | internal WebRTC status not ready"),!1)}},{key:"_close",value:function(){if(E("close()"),this._status!==T.STATUS_TERMINATED){if(this._status=T.STATUS_TERMINATED,this._connection)try{this._connection.close()}catch(e){S("close() | error closing the RTCPeerConnection: %o",e)}for(var e in this._localMediaStream&&this._localMediaStreamLocallyGenerated&&(E("close() | closing local MediaStream"),h.closeMediaStream(this._localMediaStream)),this._timers)Object.prototype.hasOwnProperty.call(this._timers,e)&&clearTimeout(this._timers[e]);for(var t in clearTimeout(this._sessionTimers.timer),this._dialog&&(this._dialog.terminate(),delete this._dialog),this._earlyDialogs)Object.prototype.hasOwnProperty.call(this._earlyDialogs,t)&&(this._earlyDialogs[t].terminate(),delete this._earlyDialogs[t]);for(var n in this._referSubscribers)Object.prototype.hasOwnProperty.call(this._referSubscribers,n)&&delete this._referSubscribers[n];this._ua.destroyRTCSession(this)}}},{key:"_setInvite2xxTimer",value:function(e,t){var n=m.T1;this._timers.invite2xxTimer=setTimeout(function r(){this._status===T.STATUS_WAITING_FOR_ACK&&(e.reply(200,null,["Contact: ".concat(this._contact)],t),nm.T2&&(n=m.T2),this._timers.invite2xxTimer=setTimeout(r.bind(this),n))}.bind(this),n)}},{key:"_setACKTimer",value:function(){var e=this;this._timers.ackTimer=setTimeout(function(){e._status===T.STATUS_WAITING_FOR_ACK&&(E("no ACK received, terminating the session"),clearTimeout(e._timers.invite2xxTimer),e.sendRequest(p.BYE),e._ended("remote",null,p.causes.NO_ACK))},m.TIMER_H)}},{key:"_createRTCConnection",value:function(e,t){var n=this;this._connection=new RTCPeerConnection(e,t),this._connection.addEventListener("iceconnectionstatechange",function(){"failed"===n._connection.iceConnectionState&&n.terminate({cause:p.causes.RTP_TIMEOUT,status_code:408,reason_phrase:p.causes.RTP_TIMEOUT})}),E('emit "peerconnection"'),this.emit("peerconnection",{peerconnection:this._connection})}},{key:"_createLocalDescription",value:function(e,t){var n=this;if(E("createLocalDescription()"),"offer"!==e&&"answer"!==e)throw new Error('createLocalDescription() | invalid type "'.concat(e,'"'));var r=this._connection;return this._rtcReady=!1,Promise.resolve().then(function(){return"offer"===e?r.createOffer(t).catch(function(e){return S('emit "peerconnection:createofferfailed" [error:%o]',e),n.emit("peerconnection:createofferfailed",e),Promise.reject(e)}):r.createAnswer(t).catch(function(e){return S('emit "peerconnection:createanswerfailed" [error:%o]',e),n.emit("peerconnection:createanswerfailed",e),Promise.reject(e)})}).then(function(e){return r.setLocalDescription(e).catch(function(e){return n._rtcReady=!0,S('emit "peerconnection:setlocaldescriptionfailed" [error:%o]',e),n.emit("peerconnection:setlocaldescriptionfailed",e),Promise.reject(e)})}).then(function(){if("complete"===r.iceGatheringState){n._rtcReady=!0;var t={originator:"local",type:e,sdp:r.localDescription.sdp};return E('emit "sdp"'),n.emit("sdp",t),Promise.resolve(t.sdp)}return new Promise(function(t){var o,i=!1,a=function(){r.removeEventListener("icecandidate",o),i=!0,n._rtcReady=!0;var a={originator:"local",type:e,sdp:r.localDescription.sdp};E('emit "sdp"'),n.emit("sdp",a),t(a.sdp)};r.addEventListener("icecandidate",o=function(e){var t=e.candidate;t?n.emit("icecandidate",{candidate:t,ready:a}):i||a()})})})}},{key:"_createDialog",value:function(e,t,n){var r="UAS"===t?e.to_tag:e.from_tag,o="UAS"===t?e.from_tag:e.to_tag,i=e.call_id+r+o,a=this._earlyDialogs[i];if(n)return!!a||((a=new g(this,e,t,g.C.STATUS_EARLY)).error?(E(a.error),this._failed("remote",e,p.causes.INTERNAL_ERROR),!1):(this._earlyDialogs[i]=a,!0));if(this._from_tag=e.from_tag,this._to_tag=e.to_tag,a)return a.update(e,t),this._dialog=a,delete this._earlyDialogs[i],!0;var s=new g(this,e,t);return s.error?(E(s.error),this._failed("remote",e,p.causes.INTERNAL_ERROR),!1):(this._dialog=s,!0)}},{key:"_receiveReinvite",value:function(e){var t=this;E("receiveReinvite()");var n=e.getHeader("Content-Type"),r={request:e,callback:void 0,reject:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o=!0;var n=t.status_code||403,r=t.reason_phrase||"",i=h.cloneArray(t.extraHeaders);if(this._status!==T.STATUS_CONFIRMED)return!1;if(n<300||n>=700)throw new TypeError("Invalid status_code: ".concat(n));e.reply(n,r,i)}.bind(this)},o=!1;if(this.emit("reinvite",r),!o){if(this._late_sdp=!1,!e.body)return this._late_sdp=!0,void(this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._createLocalDescription("offer",t._rtcOfferConstraints)}).then(function(e){i.call(t,e)}).catch(function(){e.reply(500)}));if("application/sdp"!==n)return E("invalid Content-Type"),void e.reply(415);this._processInDialogSdpOffer(e).then(function(e){t._status!==T.STATUS_TERMINATED&&i.call(t,e)}).catch(function(e){S(e)})}function i(t){var n=this,o=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(e,o),this._late_sdp&&(t=this._mangleOffer(t)),e.reply(200,null,o,t,function(){n._status=T.STATUS_WAITING_FOR_ACK,n._setInvite2xxTimer(e,t),n._setACKTimer()}),"function"==typeof r.callback&&r.callback()}}},{key:"_receiveUpdate",value:function(e){var t=this;E("receiveUpdate()");var n=e.getHeader("Content-Type"),r={request:e,callback:void 0,reject:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o=!0;var n=t.status_code||403,r=t.reason_phrase||"",i=h.cloneArray(t.extraHeaders);if(this._status!==T.STATUS_CONFIRMED)return!1;if(n<300||n>=700)throw new TypeError("Invalid status_code: ".concat(n));e.reply(n,r,i)}.bind(this)},o=!1;if(this.emit("update",r),!o)if(e.body){if("application/sdp"!==n)return E("invalid Content-Type"),void e.reply(415);this._processInDialogSdpOffer(e).then(function(e){t._status!==T.STATUS_TERMINATED&&i.call(t,e)}).catch(function(e){S(e)})}else i.call(this,null);function i(t){var n=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(e,n),e.reply(200,null,n,t),"function"==typeof r.callback&&r.callback()}}},{key:"_processInDialogSdpOffer",value:function(e){var t=this;E("_processInDialogSdpOffer()");var n=e.parseSDP(),r=!1,o=!0,i=!1,a=void 0;try{for(var s,u=n.media[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value;if(-1!==w.indexOf(c.type)){var l=c.direction||n.direction||"sendrecv";if("sendonly"!==l&&"inactive"!==l){r=!1;break}r=!0}}}catch(e){i=!0,a=e}finally{try{o||null==u.return||u.return()}finally{if(i)throw a}}var p={originator:"remote",type:"offer",sdp:e.body};E('emit "sdp"'),this.emit("sdp",p);var f=new RTCSessionDescription({type:"offer",sdp:p.sdp});return this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if(t._status===T.STATUS_TERMINATED)throw new Error("terminated");return t._connection.setRemoteDescription(f).catch(function(n){throw e.reply(488),S('emit "peerconnection:setremotedescriptionfailed" [error:%o]',n),t.emit("peerconnection:setremotedescriptionfailed",n),new Error("peerconnection.setRemoteDescription() failed")})}).then(function(){if(t._status===T.STATUS_TERMINATED)throw new Error("terminated");!0===t._remoteHold&&!1===r?(t._remoteHold=!1,t._onunhold("remote")):!1===t._remoteHold&&!0===r&&(t._remoteHold=!0,t._onhold("remote"))}).then(function(){if(t._status===T.STATUS_TERMINATED)throw new Error("terminated");return t._createLocalDescription("answer",t._rtcAnswerConstraints).catch(function(){throw e.reply(500),new Error("_createLocalDescription() failed")})}),this._connectionPromiseQueue}},{key:"_receiveRefer",value:function(e){var n=this;if(E("receiveRefer()"),!e.refer_to)return E("no Refer-To header field present in REFER"),void e.reply(400);if(e.refer_to.uri.scheme!==p.SIP)return E("Refer-To header field points to a non-SIP URI scheme"),void e.reply(416);e.reply(202);var r=new A(this,e.cseq);E('emit "refer"'),this.emit("refer",{request:e,accept:function(o,i){(function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n="function"==typeof n?n:null,this._status!==T.STATUS_WAITING_FOR_ACK&&this._status!==T.STATUS_CONFIRMED)return!1;var i=new t(this._ua);if(i.on("progress",function(e){var t=e.response;r.notify(t.status_code,t.reason_phrase)}),i.on("accepted",function(e){var t=e.response;r.notify(t.status_code,t.reason_phrase)}),i.on("_failed",function(e){var t=e.message,n=e.cause;t?r.notify(t.status_code,t.reason_phrase):r.notify(487,n)}),e.refer_to.uri.hasHeader("replaces")){var a=decodeURIComponent(e.refer_to.uri.getHeader("replaces"));o.extraHeaders=h.cloneArray(o.extraHeaders),o.extraHeaders.push("Replaces: ".concat(a))}i.connect(e.refer_to.uri.toAor(),o,n)}).call(n,o,i)},reject:function(){(function(){r.notify(603)}).call(n)}})}},{key:"_receiveNotify",value:function(e){switch(E("receiveNotify()"),e.event||e.reply(400),e.event.event){case"refer":var t,n;if(e.event.params&&e.event.params.id)t=e.event.params.id,n=this._referSubscribers[t];else{if(1!==Object.keys(this._referSubscribers).length)return void e.reply(400,"Missing event id parameter");n=this._referSubscribers[Object.keys(this._referSubscribers)[0]]}if(!n)return void e.reply(481,"Subscription does not exist");n.receiveNotify(e),e.reply(200);break;default:e.reply(489)}}},{key:"_receiveReplaces",value:function(e){var n=this;E("receiveReplaces()"),this.emit("replaces",{request:e,accept:function(r){(function(n){var r=this;if(this._status!==T.STATUS_WAITING_FOR_ACK&&this._status!==T.STATUS_CONFIRMED)return!1;var o=new t(this._ua);o.on("confirmed",function(){r.terminate()}),o.init_incoming(e,n)}).call(n,r)},reject:function(){(function(){E("Replaced INVITE rejected by the user"),e.reply(486)}).call(n)}})}},{key:"_sendInitialRequest",value:function(e,t,n){var r=this,o=new y(this._ua,this._request,{onRequestTimeout:function(){r.onRequestTimeout()},onTransportError:function(){r.onTransportError()},onAuthenticated:function(e){r._request=e},onReceiveResponse:function(e){r._receiveInviteResponse(e)}});Promise.resolve().then(function(){return n||(e.audio||e.video?(r._localMediaStreamLocallyGenerated=!0,navigator.mediaDevices.getUserMedia(e).catch(function(e){if(r._status===T.STATUS_TERMINATED)throw new Error("terminated");throw r._failed("local",null,p.causes.USER_DENIED_MEDIA_ACCESS),S('emit "getusermediafailed" [error:%o]',e),r.emit("getusermediafailed",e),e})):void 0)}).then(function(e){if(r._status===T.STATUS_TERMINATED)throw new Error("terminated");return r._localMediaStream=e,e&&e.getTracks().forEach(function(t){r._connection.addTrack(t,e)}),r._connecting(r._request),r._createLocalDescription("offer",t).catch(function(e){throw r._failed("local",null,p.causes.WEBRTC_ERROR),e})}).then(function(e){if(r._is_canceled||r._status===T.STATUS_TERMINATED)throw new Error("terminated");r._request.body=e,r._status=T.STATUS_INVITE_SENT,E('emit "sending" [request:%o]',r._request),r.emit("sending",{request:r._request}),o.send()}).catch(function(e){r._status!==T.STATUS_TERMINATED&&S(e)})}},{key:"_receiveInviteResponse",value:function(e){var t=this;if(E("receiveInviteResponse()"),this._dialog&&e.status_code>=200&&e.status_code<=299){if(this._dialog.id.call_id===e.call_id&&this._dialog.id.local_tag===e.from_tag&&this._dialog.id.remote_tag===e.to_tag)return void this.sendRequest(p.ACK);var n=new g(this,e,"UAC");return void 0!==n.error?void E(n.error):(this.sendRequest(p.ACK),void this.sendRequest(p.BYE))}if(this._is_canceled)e.status_code>=100&&e.status_code<200?this._request.cancel(this._cancel_reason):e.status_code>=200&&e.status_code<299&&this._acceptAndTerminate(e);else if(this._status===T.STATUS_INVITE_SENT||this._status===T.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(e.status_code):this._status=T.STATUS_1XX_RECEIVED;break;case/^1[0-9]{2}$/.test(e.status_code):if(!e.to_tag){E("1xx response received without to tag");break}if(e.hasHeader("contact")&&!this._createDialog(e,"UAC",!0))break;if(this._status=T.STATUS_1XX_RECEIVED,this._progress("remote",e),!e.body)break;var r={originator:"remote",type:"answer",sdp:e.body};E('emit "sdp"'),this.emit("sdp",r);var o=new RTCSessionDescription({type:"answer",sdp:r.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(o)}).catch(function(e){S('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)});break;case/^2[0-9]{2}$/.test(e.status_code):if(this._status=T.STATUS_CONFIRMED,!e.body){this._acceptAndTerminate(e,400,p.causes.MISSING_SDP),this._failed("remote",e,p.causes.BAD_MEDIA_DESCRIPTION);break}if(!this._createDialog(e,"UAC"))break;var i={originator:"remote",type:"answer",sdp:e.body};E('emit "sdp"'),this.emit("sdp",i);var a=new RTCSessionDescription({type:"answer",sdp:i.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if("stable"===t._connection.signalingState)return t._connection.createOffer(t._rtcOfferConstraints).then(function(e){return t._connection.setLocalDescription(e)}).catch(function(n){t._acceptAndTerminate(e,500,n.toString()),t._failed("local",e,p.causes.WEBRTC_ERROR)})}).then(function(){t._connection.setRemoteDescription(a).then(function(){t._handleSessionTimersInIncomingResponse(e),t._accepted("remote",e),t.sendRequest(p.ACK),t._confirmed("local",null)}).catch(function(n){t._acceptAndTerminate(e,488,"Not Acceptable Here"),t._failed("remote",e,p.causes.BAD_MEDIA_DESCRIPTION),S('emit "peerconnection:setremotedescriptionfailed" [error:%o]',n),t.emit("peerconnection:setremotedescriptionfailed",n)})});break;default:var s=h.sipErrorCause(e.status_code);this._failed("remote",e,s)}}},{key:"_sendReinvite",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};E("sendReinvite()");var n=h.cloneArray(t.extraHeaders),r=t.eventHandlers||{},o=t.rtcOfferConstraints||this._rtcOfferConstraints||null,i=!1;function a(e){r.failed&&r.failed(e)}n.push("Contact: ".concat(this._contact)),n.push("Content-Type: application/sdp"),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return e._createLocalDescription("offer",o)}).then(function(t){var o={originator:"local",type:"offer",sdp:t=e._mangleOffer(t)};E('emit "sdp"'),e.emit("sdp",o),e.sendRequest(p.INVITE,{extraHeaders:n,body:t,eventHandlers:{onSuccessResponse:function(t){(function(e){var t=this;if(this._status===T.STATUS_TERMINATED)return;if(this.sendRequest(p.ACK),i)return;if(this._handleSessionTimersInIncomingResponse(e),!e.body)return void a.call(this);if("application/sdp"!==e.getHeader("Content-Type"))return void a.call(this);var n={originator:"remote",type:"answer",sdp:e.body};E('emit "sdp"'),this.emit("sdp",n);var o=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(o)}).then(function(){r.succeeded&&r.succeeded(e)}).catch(function(e){a.call(t),S('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}).call(e,t),i=!0},onErrorResponse:function(t){a.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})}).catch(function(){a()})}},{key:"_sendUpdate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};E("sendUpdate()");var n=h.cloneArray(t.extraHeaders),r=t.eventHandlers||{},o=t.rtcOfferConstraints||this._rtcOfferConstraints||null,i=t.sdpOffer||!1,a=!1;function s(e){var t=this;if(this._status!==T.STATUS_TERMINATED&&!a)if(this._handleSessionTimersInIncomingResponse(e),i){if(!e.body)return void u.call(this);if("application/sdp"!==e.getHeader("Content-Type"))return void u.call(this);var n={originator:"remote",type:"answer",sdp:e.body};E('emit "sdp"'),this.emit("sdp",n);var o=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(o)}).then(function(){r.succeeded&&r.succeeded(e)}).catch(function(e){u.call(t),S('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else r.succeeded&&r.succeeded(e)}function u(e){r.failed&&r.failed(e)}n.push("Contact: ".concat(this._contact)),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),i?(n.push("Content-Type: application/sdp"),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return e._createLocalDescription("offer",o)}).then(function(t){var r={originator:"local",type:"offer",sdp:t=e._mangleOffer(t)};E('emit "sdp"'),e.emit("sdp",r),e.sendRequest(p.UPDATE,{extraHeaders:n,body:t,eventHandlers:{onSuccessResponse:function(t){s.call(e,t),a=!0},onErrorResponse:function(t){u.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})}).catch(function(){u.call(e)})):this.sendRequest(p.UPDATE,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(t){s.call(e,t)},onErrorResponse:function(t){u.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})}},{key:"_acceptAndTerminate",value:function(e,t,n){E("acceptAndTerminate()");var r=[];t&&(n=n||p.REASON_PHRASE[t]||"",r.push("Reason: SIP ;cause=".concat(t,'; text="').concat(n,'"'))),(this._dialog||this._createDialog(e,"UAC"))&&(this.sendRequest(p.ACK),this.sendRequest(p.BYE,{extraHeaders:r})),this._status=T.STATUS_TERMINATED}},{key:"_mangleOffer",value:function(e){if(!this._localHold&&!this._remoteHold)return e;if(e=l.parse(e),this._localHold&&!this._remoteHold){E("mangleOffer() | me on hold, mangling offer");var t=!0,n=!1,r=void 0;try{for(var o,i=e.media[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;-1!==w.indexOf(a.type)&&(a.direction?"sendrecv"===a.direction?a.direction="sendonly":"recvonly"===a.direction&&(a.direction="inactive"):a.direction="sendonly")}}catch(e){n=!0,r=e}finally{try{t||null==i.return||i.return()}finally{if(n)throw r}}}else if(this._localHold&&this._remoteHold){E("mangleOffer() | both on hold, mangling offer");var s=!0,u=!1,c=void 0;try{for(var p,f=e.media[Symbol.iterator]();!(s=(p=f.next()).done);s=!0){var d=p.value;-1!==w.indexOf(d.type)&&(d.direction="inactive")}}catch(e){u=!0,c=e}finally{try{s||null==f.return||f.return()}finally{if(u)throw c}}}else if(this._remoteHold){E("mangleOffer() | remote on hold, mangling offer");var h=!0,m=!1,v=void 0;try{for(var g,y=e.media[Symbol.iterator]();!(h=(g=y.next()).done);h=!0){var _=g.value;-1!==w.indexOf(_.type)&&(_.direction?"sendrecv"===_.direction?_.direction="recvonly":"recvonly"===_.direction&&(_.direction="inactive"):_.direction="recvonly")}}catch(e){m=!0,v=e}finally{try{h||null==y.return||y.return()}finally{if(m)throw v}}}return l.write(e)}},{key:"_setLocalMediaStatus",value:function(){var e=!0,t=!0;(this._localHold||this._remoteHold)&&(e=!1,t=!1),this._audioMuted&&(e=!1),this._videoMuted&&(t=!1),this._toggleMuteAudio(!e),this._toggleMuteVideo(!t)}},{key:"_handleSessionTimersInIncomingRequest",value:function(e,t){var n;this._sessionTimers.enabled&&(e.session_expires&&e.session_expires>=p.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,n=e.session_expires_refresher||"uas"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,n="uas"),t.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(n)),this._sessionTimers.refresher="uas"===n,this._runSessionTimer())}},{key:"_handleSessionTimersInIncomingResponse",value:function(e){var t;this._sessionTimers.enabled&&(e.session_expires&&e.session_expires>=p.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,t=e.session_expires_refresher||"uac"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,t="uac"),this._sessionTimers.refresher="uac"===t,this._runSessionTimer())}},{key:"_runSessionTimer",value:function(){var e=this,t=this._sessionTimers.currentExpires;this._sessionTimers.running=!0,clearTimeout(this._sessionTimers.timer),this._sessionTimers.refresher?this._sessionTimers.timer=setTimeout(function(){e._status!==T.STATUS_TERMINATED&&(E("runSessionTimer() | sending session refresh request"),e._sessionTimers.refreshMethod===p.UPDATE?e._sendUpdate():e._sendReinvite())},500*t):this._sessionTimers.timer=setTimeout(function(){e._status!==T.STATUS_TERMINATED&&(S("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:p.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))},1100*t)}},{key:"_toggleMuteAudio",value:function(e){var t=this._connection.getSenders().filter(function(e){return e.track&&"audio"===e.track.kind}),n=!0,r=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){i.value.track.enabled=!e}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}}},{key:"_toggleMuteVideo",value:function(e){var t=this._connection.getSenders().filter(function(e){return e.track&&"video"===e.track.kind}),n=!0,r=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){i.value.track.enabled=!e}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}}},{key:"_newRTCSession",value:function(e,t){E("newRTCSession()"),this._ua.newRTCSession(this,{originator:e,session:this,request:t})}},{key:"_connecting",value:function(e){E("session connecting"),E('emit "connecting"'),this.emit("connecting",{request:e})}},{key:"_progress",value:function(e,t){E("session progress"),E('emit "progress"'),this.emit("progress",{originator:e,response:t||null})}},{key:"_accepted",value:function(e,t){E("session accepted"),this._start_time=new Date,E('emit "accepted"'),this.emit("accepted",{originator:e,response:t||null})}},{key:"_confirmed",value:function(e,t){E("session confirmed"),this._is_confirmed=!0,E('emit "confirmed"'),this.emit("confirmed",{originator:e,ack:t||null})}},{key:"_ended",value:function(e,t,n){E("session ended"),this._end_time=new Date,this._close(),E('emit "ended"'),this.emit("ended",{originator:e,message:t||null,cause:n})}},{key:"_failed",value:function(e,t,n){E("session failed"),E('emit "_failed"'),this.emit("_failed",{originator:e,message:t||null,cause:n}),this._close(),E('emit "failed"'),this.emit("failed",{originator:e,message:t||null,cause:n})}},{key:"_onhold",value:function(e){E("session onhold"),this._setLocalMediaStatus(),E('emit "hold"'),this.emit("hold",{originator:e})}},{key:"_onunhold",value:function(e){E("session onunhold"),this._setLocalMediaStatus(),E('emit "unhold"'),this.emit("unhold",{originator:e})}},{key:"_onmute",value:function(e){var t=e.audio,n=e.video;E("session onmute"),this._setLocalMediaStatus(),E('emit "muted"'),this.emit("muted",{audio:t,video:n})}},{key:"_onunmute",value:function(e){var t=e.audio,n=e.video;E("session onunmute"),this._setLocalMediaStatus(),E('emit "unmuted"'),this.emit("unmuted",{audio:t,video:n})}},{key:"C",get:function(){return T}},{key:"causes",get:function(){return p.causes}},{key:"id",get:function(){return this._id}},{key:"connection",get:function(){return this._connection}},{key:"contact",get:function(){return this._contact}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}},{key:"start_time",get:function(){return this._start_time}},{key:"end_time",get:function(){return this._end_time}},{key:"data",get:function(){return this._data},set:function(e){this._data=e}},{key:"status",get:function(){return this._status}}]),t}()},function(e,t,n){"use strict";var r=n(12),o=n(16),i=n(4)("JsSIP:ERROR:Socket");i.log=console.warn.bind(console),t.isSocket=function(e){if(Array.isArray(e))return!1;if(void 0===e)return i("undefined JsSIP.Socket instance"),!1;try{if(!r.isString(e.url))throw i("missing or invalid JsSIP.Socket url property"),new Error;if(!r.isString(e.via_transport))throw i("missing or invalid JsSIP.Socket via_transport property"),new Error;if(-1===o.parse(e.sip_uri,"SIP_URI"))throw i("missing or invalid JsSIP.Socket sip_uri property"),new Error}catch(e){return!1}try{["connect","disconnect","send"].forEach(function(t){if(!r.isFunction(e[t]))throw i("missing or invalid JsSIP.Socket method: ".concat(t)),new Error})}catch(e){return!1}return!0}},function(e,t,n){var r=n(116),o=n(49);e.exports=function(e,t,n){(void 0===n||o(e[t],n))&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t){e.exports=function(e,t){if("__proto__"!=t)return e[t]}},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"];e.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={},u=14;u--;)s[r[u]]=a[u]||"";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}},function(e,t,n){(function(t){e.exports=function(e){return t.Buffer&&t.Buffer.isBuffer(e)||t.ArrayBuffer&&e instanceof ArrayBuffer}}).call(this,n(10))},function(e,t,n){var r=n(463),o=n(202),i=n(59),a=n(121),s=n(203),u=n(204),c=n(82)("socket.io-client:manager"),l=n(201),p=n(482),f=Object.prototype.hasOwnProperty;function d(e,t){if(!(this instanceof d))return new d(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new p({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[],this.encoder=new a.Encoder,this.decoder=new a.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}e.exports=d,d.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)f.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},d.prototype.updateSocketIds=function(){for(var e in this.nsps)f.call(this.nsps,e)&&(this.nsps[e].id=this.engine.id)},i(d.prototype),d.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},d.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},d.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},d.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},d.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},d.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},d.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},d.prototype.open=d.prototype.connect=function(e,t){if(c("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;c("opening %s",this.uri),this.engine=r(this.uri,this.opts);var n=this.engine,o=this;this.readyState="opening",this.skipReconnect=!1;var i=s(n,"open",function(){o.onopen(),e&&e()}),a=s(n,"error",function(t){if(c("connect_error"),o.cleanup(),o.readyState="closed",o.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else o.maybeReconnectOnOpen()});if(!1!==this._timeout){var u=this._timeout;c("connect attempt will timeout after %d",u);var l=setTimeout(function(){c("connect attempt timed out after %d",u),i.destroy(),n.close(),n.emit("error","timeout"),o.emitAll("connect_timeout",u)},u);this.subs.push({destroy:function(){clearTimeout(l)}})}return this.subs.push(i),this.subs.push(a),this},d.prototype.onopen=function(){c("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(s(e,"data",u(this,"ondata"))),this.subs.push(s(e,"ping",u(this,"onping"))),this.subs.push(s(e,"pong",u(this,"onpong"))),this.subs.push(s(e,"error",u(this,"onerror"))),this.subs.push(s(e,"close",u(this,"onclose"))),this.subs.push(s(this.decoder,"decoded",u(this,"ondecoded")))},d.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},d.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},d.prototype.ondata=function(e){this.decoder.add(e)},d.prototype.ondecoded=function(e){this.emit("packet",e)},d.prototype.onerror=function(e){c("error",e),this.emitAll("error",e)},d.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new o(this,e,t),this.nsps[e]=n;var r=this;n.on("connecting",i),n.on("connect",function(){n.id=r.engine.id}),this.autoConnect&&i()}function i(){~l(r.connecting,n)||r.connecting.push(n)}return n},d.prototype.destroy=function(e){var t=l(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},d.prototype.packet=function(e){c("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(n){for(var r=0;r0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},d.prototype.cleanup=function(){c("cleanup");for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();c("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(c("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(c("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(c("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},d.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){(function(e){var r=n(122),o=n(467),i=n(477),a=n(478);t.polling=function(t){var n=!1,a=!1,s=!1!==t.jsonp;if(e.location){var u="https:"===location.protocol,c=location.port;c||(c=u?443:80),n=t.hostname!==location.hostname||c!==t.port,a=t.secure!==u}if(t.xdomain=n,t.xscheme=a,"open"in new r(t)&&!t.forceJSONP)return new o(t);if(!s)throw new Error("JSONP disabled");return new i(t)},t.websocket=a}).call(this,n(10))},function(e,t,n){var r=n(123),o=n(124),i=n(43),a=n(83),s=n(200),u=n(84)("engine.io-client:polling");e.exports=l;var c=null!=new(n(122))({xdomain:!1}).responseType;function l(e){var t=e&&e.forceBase64;c&&!t||(this.supportsBinary=!1),r.call(this,e)}a(l,r),l.prototype.name="polling",l.prototype.doOpen=function(){this.poll()},l.prototype.pause=function(e){var t=this;function n(){u("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(u("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){u("pre-pause polling complete"),--r||n()})),this.writable||(u("we are currently writing - waiting to pause"),r++,this.once("drain",function(){u("pre-pause writing complete"),--r||n()}))}else n()},l.prototype.poll=function(){u("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},l.prototype.onData=function(e){var t=this;u("polling got data %s",e);i.decodePayload(e,this.socket.binaryType,function(e,n,r){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():u('ignoring poll - transport state "%s"',this.readyState))},l.prototype.doClose=function(){var e=this;function t(){u("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(u("transport open - closing"),t()):(u("transport not open - deferring close"),this.once("open",t))},l.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};i.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,n)})},l.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=s()),this.supportsBinary||e.sid||(e.b64=1),e=o.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(e,t,n){(function(t){var r=n(469);e.exports=function(e){return function e(n){if(!n)return!1;if(t.Buffer&&t.Buffer.isBuffer&&t.Buffer.isBuffer(n)||t.ArrayBuffer&&n instanceof ArrayBuffer||t.Blob&&n instanceof Blob||t.File&&n instanceof File)return!0;if(r(n)){for(var o=0;o0);return t}function l(){var e=c(+new Date);return e!==r?(s=0,r=e):e+"."+c(s++)}for(;u-1}},function(e,t,n){var r=n(68);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},function(e,t,n){var r=n(67);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(67),o=n(91),i=n(92),a=200;e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!o||s.length8&&p<=11);var m=32,v=String.fromCharCode(m),g={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:["topBlur","topCompositionEnd","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:["topBlur","topCompositionStart","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:["topBlur","topCompositionUpdate","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]}},y=!1;function _(e,t){switch(e){case"topKeyUp":return-1!==u.indexOf(t.keyCode);case"topKeyDown":return t.keyCode!==c;case"topKeyPress":case"topMouseDown":case"topBlur":return!0;default:return!1}}function b(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}var A=null;function C(e,t,n,o){var s,u;if(l?s=function(e){switch(e){case"topCompositionStart":return g.compositionStart;case"topCompositionEnd":return g.compositionEnd;case"topCompositionUpdate":return g.compositionUpdate}}(e):A?_(e,n)&&(s=g.compositionEnd):function(e,t){return"topKeyDown"===e&&t.keyCode===c}(e,n)&&(s=g.compositionStart),!s)return null;h&&(A||s!==g.compositionStart?s===g.compositionEnd&&A&&(u=A.getData()):A=i.getPooled(o));var p=a.getPooled(s,t,n,o);if(u)p.data=u;else{var f=b(n);null!==f&&(p.data=f)}return r.accumulateTwoPhaseDispatches(p),p}function E(e,t,n,o){var a;if(!(a=d?function(e,t){switch(e){case"topCompositionEnd":return b(t);case"topKeyPress":return t.which!==m?null:(y=!0,v);case"topTextInput":var n=t.data;return n===v&&y?null:n;default:return null}}(e,n):function(e,t){if(A){if("topCompositionEnd"===e||!l&&_(e,t)){var n=A.getData();return i.release(A),A=null,n}return null}switch(e){case"topPaste":return null;case"topKeyPress":return t.which&&!function(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}(t)?String.fromCharCode(t.which):null;case"topCompositionEnd":return h?null:t.data;default:return null}}(e,n)))return null;var u=s.getPooled(g.beforeInput,t,n,o);return u.data=a,r.accumulateTwoPhaseDispatches(u),u}var S={eventTypes:g,extractEvents:function(e,t,n,r){return[C(e,t,n,r),E(e,t,n,r)]}};e.exports=S},function(e,t,n){"use strict";var r=n(7),o=n(30),i=n(154);function a(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}r(a.prototype,{destructor:function(){this._root=null,this._startText=null,this._fallbackText=null},getText:function(){return"value"in this._root?this._root.value:this._root[i()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,o=this.getText(),i=o.length;for(e=0;e1?1-t:void 0;return this._fallbackText=o.slice(e,s),this._fallbackText}}),o.addPoolingTo(a),e.exports=a},function(e,t,n){"use strict";var r=n(24);function o(e,t,n,o){return r.call(this,e,t,n,o)}r.augmentClass(o,{data:null}),e.exports=o},function(e,t,n){"use strict";var r=n(24);function o(e,t,n,o){return r.call(this,e,t,n,o)}r.augmentClass(o,{data:null}),e.exports=o},function(e,t,n){"use strict";var r=n(53),o=n(52),i=n(13),a=n(8),s=n(21),u=n(24),c=n(157),l=n(101),p=n(102),f=n(158),d={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:["topBlur","topChange","topClick","topFocus","topInput","topKeyDown","topKeyUp","topSelectionChange"]}};function h(e,t,n){var r=u.getPooled(d.change,e,t,n);return r.type="change",o.accumulateTwoPhaseDispatches(r),r}var m=null,v=null;var g=!1;function y(e){var t=h(v,e,l(e));s.batchedUpdates(_,t)}function _(e){r.enqueueEvents(e),r.processEventQueue(!1)}function b(){m&&(m.detachEvent("onchange",y),m=null,v=null)}function A(e,t){var n=c.updateValueIfChanged(e),r=!0===t.simulated&&O._allowSimulatedPassThrough;if(n||r)return e}function C(e,t){if("topChange"===e)return t}function E(e,t,n){"topFocus"===e?(b(),function(e,t){v=t,(m=e).attachEvent("onchange",y)}(t,n)):"topBlur"===e&&b()}i.canUseDOM&&(g=p("change")&&(!document.documentMode||document.documentMode>8));var S=!1;function T(){m&&(m.detachEvent("onpropertychange",w),m=null,v=null)}function w(e){"value"===e.propertyName&&A(v,e)&&y(e)}function V(e,t,n){"topFocus"===e?(T(),function(e,t){v=t,(m=e).attachEvent("onpropertychange",w)}(t,n)):"topBlur"===e&&T()}function k(e,t,n){if("topSelectionChange"===e||"topKeyUp"===e||"topKeyDown"===e)return A(v,n)}function R(e,t,n){if("topClick"===e)return A(t,n)}function I(e,t,n){if("topInput"===e||"topChange"===e)return A(t,n)}i.canUseDOM&&(S=p("input")&&(!document.documentMode||document.documentMode>9));var O={eventTypes:d,_allowSimulatedPassThrough:!0,_isInputEventSupported:S,extractEvents:function(e,t,n,r){var o,i,s,u,c=t?a.getNodeFromInstance(t):window;if("select"===(u=(s=c).nodeName&&s.nodeName.toLowerCase())||"input"===u&&"file"===s.type?g?o=C:i=E:f(c)?S?o=I:(o=k,i=V):function(e){var t=e.nodeName;return t&&"input"===t.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}(c)&&(o=R),o){var l=o(e,t,n);if(l)return h(l,n,r)}i&&i(e,c,t),"topBlur"===e&&function(e,t){if(null!=e){var n=e._wrapperState||t._wrapperState;if(n&&n.controlled&&"number"===t.type){var r=""+t.value;t.getAttribute("value")!==r&&t.setAttribute("value",r)}}}(t,c)}};e.exports=O},function(e,t,n){"use strict";var r=n(311),o={};o.attachRefs=function(e,t){if(null!==t&&"object"==typeof t){var n=t.ref;null!=n&&function(e,t,n){"function"==typeof e?e(t.getPublicInstance()):r.addComponentAsRefTo(t,e,n)}(n,e,t._owner)}},o.shouldUpdateRefs=function(e,t){var n=null,r=null;null!==e&&"object"==typeof e&&(n=e.ref,r=e._owner);var o=null,i=null;return null!==t&&"object"==typeof t&&(o=t.ref,i=t._owner),n!==o||"string"==typeof o&&i!==r},o.detachRefs=function(e,t){if(null!==t&&"object"==typeof t){var n=t.ref;null!=n&&function(e,t,n){"function"==typeof e?e(null):r.removeComponentAsRefFrom(t,e,n)}(n,e,t._owner)}},e.exports=o},function(e,t,n){"use strict";var r=n(5);n(3);function o(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)}var i={addComponentAsRefTo:function(e,t,n){o(n)||r("119"),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){o(n)||r("120");var i=n.getPublicInstance();i&&i.refs[t]===e.getPublicInstance()&&n.detachRef(t)}};e.exports=i},function(e,t,n){"use strict";e.exports=["ResponderEventPlugin","SimpleEventPlugin","TapEventPlugin","EnterLeaveEventPlugin","ChangeEventPlugin","SelectEventPlugin","BeforeInputEventPlugin"]},function(e,t,n){"use strict";var r=n(52),o=n(8),i=n(77),a={mouseEnter:{registrationName:"onMouseEnter",dependencies:["topMouseOut","topMouseOver"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["topMouseOut","topMouseOver"]}},s={eventTypes:a,extractEvents:function(e,t,n,s){if("topMouseOver"===e&&(n.relatedTarget||n.fromElement))return null;if("topMouseOut"!==e&&"topMouseOver"!==e)return null;var u,c,l;if(s.window===s)u=s;else{var p=s.ownerDocument;u=p?p.defaultView||p.parentWindow:window}if("topMouseOut"===e){c=t;var f=n.relatedTarget||n.toElement;l=f?o.getClosestInstanceFromNode(f):null}else c=null,l=t;if(c===l)return null;var d=null==c?u:o.getNodeFromInstance(c),h=null==l?u:o.getNodeFromInstance(l),m=i.getPooled(a.mouseLeave,c,n,s);m.type="mouseleave",m.target=d,m.relatedTarget=h;var v=i.getPooled(a.mouseEnter,l,n,s);return v.type="mouseenter",v.target=h,v.relatedTarget=d,r.accumulateEnterLeaveDispatches(m,v,c,l),[m,v]}};e.exports=s},function(e,t,n){"use strict";var r=n(38),o=r.injection.MUST_USE_PROPERTY,i=r.injection.HAS_BOOLEAN_VALUE,a=r.injection.HAS_NUMERIC_VALUE,s=r.injection.HAS_POSITIVE_NUMERIC_VALUE,u=r.injection.HAS_OVERLOADED_BOOLEAN_VALUE,c={isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+r.ATTRIBUTE_NAME_CHAR+"]*$")),Properties:{accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:i,allowTransparency:0,alt:0,as:0,async:i,autoComplete:0,autoPlay:i,capture:i,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:o|i,cite:0,classID:0,className:0,cols:s,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:i,controlsList:0,coords:0,crossOrigin:0,data:0,dateTime:0,default:i,defer:i,dir:0,disabled:i,download:u,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:i,formTarget:0,frameBorder:0,headers:0,height:0,hidden:i,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:i,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:o|i,muted:o|i,name:0,nonce:0,noValidate:i,open:i,optimum:0,pattern:0,placeholder:0,playsInline:i,poster:0,preload:0,profile:0,radioGroup:0,readOnly:i,referrerPolicy:0,rel:0,required:i,reversed:i,role:0,rows:s,rowSpan:a,sandbox:0,scope:0,scoped:i,scrolling:0,seamless:i,selected:o|i,shape:0,size:s,sizes:0,span:s,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:a,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:0,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,typeof:0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:i,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{},DOMMutationMethods:{value:function(e,t){if(null==t)return e.removeAttribute("value");"number"!==e.type||!1===e.hasAttribute("value")?e.setAttribute("value",""+t):e.validity&&!e.validity.badInput&&e.ownerDocument.activeElement!==e&&e.setAttribute("value",""+t)}}};e.exports=c},function(e,t,n){"use strict";var r=n(104),o={processChildrenUpdates:n(320).dangerouslyProcessChildrenUpdates,replaceNodeWithMarkup:r.dangerouslyReplaceNodeWithMarkup};e.exports=o},function(e,t,n){"use strict";var r=n(5),o=n(40),i=n(13),a=n(317),s=n(20),u=(n(3),{dangerouslyReplaceNodeWithMarkup:function(e,t){if(i.canUseDOM||r("56"),t||r("57"),"HTML"===e.nodeName&&r("58"),"string"==typeof t){var n=a(t,s)[0];e.parentNode.replaceChild(n,e)}else o.replaceChildWithTree(e,t)}});e.exports=u},function(e,t,n){"use strict";var r=n(13),o=n(318),i=n(319),a=n(3),s=r.canUseDOM?document.createElement("div"):null,u=/^\s*<(\w+)/;e.exports=function(e,t){var n=s;s||a(!1);var r=function(e){var t=e.match(u);return t&&t[1].toLowerCase()}(e),c=r&&i(r);if(c){n.innerHTML=c[1]+e+c[2];for(var l=c[0];l--;)n=n.lastChild}else n.innerHTML=e;var p=n.getElementsByTagName("script");p.length&&(t||a(!1),o(p).forEach(t));for(var f=Array.from(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return f}},function(e,t,n){"use strict";var r=n(3);e.exports=function(e){return function(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}(e)?Array.isArray(e)?e.slice():function(e){var t=e.length;if((Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e)&&r(!1),"number"!=typeof t&&r(!1),0===t||t-1 in e||r(!1),"function"==typeof e.callee&&r(!1),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(e){}for(var n=Array(t),o=0;o',""],u=[1,"","
"],c=[3,"","
"],l=[1,'',""],p={"*":[1,"?
","
"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:s,option:s,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:c,th:c};["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"].forEach(function(e){p[e]=l,a[e]=!0}),e.exports=function(e){return i||o(!1),p.hasOwnProperty(e)||(e="*"),a.hasOwnProperty(e)||(i.innerHTML="*"===e?"":"<"+e+">",a[e]=!i.firstChild),a[e]?p[e]:null}},function(e,t,n){"use strict";var r=n(104),o=n(8),i={dangerouslyProcessChildrenUpdates:function(e,t){var n=o.getNodeFromInstance(e);r.processUpdates(n,t)}};e.exports=i},function(e,t,n){"use strict";var r=n(5),o=n(7),i=n(322),a=n(323),s=n(40),u=n(105),c=n(38),l=n(163),p=n(53),f=n(98),d=n(80),h=n(151),m=n(8),v=n(333),g=n(335),y=n(164),_=n(336),b=(n(15),n(337)),A=n(344),C=(n(20),n(79)),E=(n(3),n(102),n(109),n(157)),S=(n(113),n(6),h),T=p.deleteListener,w=m.getNodeFromInstance,V=d.listenTo,k=f.registrationNameModules,R={string:!0,number:!0},I="__html",O={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null},x=11;function q(e,t){t&&(H[e._tag]&&(null!=t.children||null!=t.dangerouslySetInnerHTML)&&r("137",e._tag,e._currentElement._owner?" Check the render method of "+e._currentElement._owner.getName()+".":""),null!=t.dangerouslySetInnerHTML&&(null!=t.children&&r("60"),"object"==typeof t.dangerouslySetInnerHTML&&I in t.dangerouslySetInnerHTML||r("61")),null!=t.style&&"object"!=typeof t.style&&r("62",function(e){if(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" This DOM node was rendered by `"+n+"`."}}return""}(e)))}function M(e,t,n,r){if(!(r instanceof A)){0;var o=e._hostContainerInfo,i=o._node&&o._node.nodeType===x?o._node:o._ownerDocument;V(t,i),r.getReactMountReady().enqueue(P,{inst:e,registrationName:t,listener:n})}}function P(){p.putListener(this.inst,this.registrationName,this.listener)}function N(){v.postMountWrapper(this)}function D(){_.postMountWrapper(this)}function U(){g.postMountWrapper(this)}var j={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"};function L(){E.track(this)}function B(){this._rootNodeID||r("63");var e=w(this);switch(e||r("64"),this._tag){case"iframe":case"object":this._wrapperState.listeners=[d.trapBubbledEvent("topLoad","load",e)];break;case"video":case"audio":for(var t in this._wrapperState.listeners=[],j)j.hasOwnProperty(t)&&this._wrapperState.listeners.push(d.trapBubbledEvent(t,j[t],e));break;case"source":this._wrapperState.listeners=[d.trapBubbledEvent("topError","error",e)];break;case"img":this._wrapperState.listeners=[d.trapBubbledEvent("topError","error",e),d.trapBubbledEvent("topLoad","load",e)];break;case"form":this._wrapperState.listeners=[d.trapBubbledEvent("topReset","reset",e),d.trapBubbledEvent("topSubmit","submit",e)];break;case"input":case"select":case"textarea":this._wrapperState.listeners=[d.trapBubbledEvent("topInvalid","invalid",e)]}}function F(){y.postUpdateWrapper(this)}var G={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Y={listing:!0,pre:!0,textarea:!0},H=o({menuitem:!0},G),W=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Q={},K={}.hasOwnProperty;function Z(e,t){return e.indexOf("-")>=0||null!=t.is}var J=1;function z(e){var t=e.type;!function(e){K.call(Q,e)||(W.test(e)||r("65",e),Q[e]=!0)}(t),this._currentElement=e,this._tag=t.toLowerCase(),this._namespaceURI=null,this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._hostNode=null,this._hostParent=null,this._rootNodeID=0,this._domID=0,this._hostContainerInfo=null,this._wrapperState=null,this._topLevelWrapper=null,this._flags=0}z.displayName="ReactDOMComponent",z.Mixin={mountComponent:function(e,t,n,r){this._rootNodeID=J++,this._domID=n._idCounter++,this._hostParent=t,this._hostContainerInfo=n;var o,a,c,p=this._currentElement.props;switch(this._tag){case"audio":case"form":case"iframe":case"img":case"link":case"object":case"source":case"video":this._wrapperState={listeners:null},e.getReactMountReady().enqueue(B,this);break;case"input":v.mountWrapper(this,p,t),p=v.getHostProps(this,p),e.getReactMountReady().enqueue(L,this),e.getReactMountReady().enqueue(B,this);break;case"option":g.mountWrapper(this,p,t),p=g.getHostProps(this,p);break;case"select":y.mountWrapper(this,p,t),p=y.getHostProps(this,p),e.getReactMountReady().enqueue(B,this);break;case"textarea":_.mountWrapper(this,p,t),p=_.getHostProps(this,p),e.getReactMountReady().enqueue(L,this),e.getReactMountReady().enqueue(B,this)}if(q(this,p),null!=t?(o=t._namespaceURI,a=t._tag):n._tag&&(o=n._namespaceURI,a=n._tag),(null==o||o===u.svg&&"foreignobject"===a)&&(o=u.html),o===u.html&&("svg"===this._tag?o=u.svg:"math"===this._tag&&(o=u.mathml)),this._namespaceURI=o,e.useCreateElement){var f,d=n._ownerDocument;if(o===u.html)if("script"===this._tag){var h=d.createElement("div"),b=this._currentElement.type;h.innerHTML="<"+b+">",f=h.removeChild(h.firstChild)}else f=p.is?d.createElement(this._currentElement.type,p.is):d.createElement(this._currentElement.type);else f=d.createElementNS(o,this._currentElement.type);m.precacheNode(this,f),this._flags|=S.hasCachedChildNodes,this._hostParent||l.setAttributeForRoot(f),this._updateDOMProperties(null,p,e);var A=s(f);this._createInitialChildren(e,p,r,A),c=A}else{var C=this._createOpenTagMarkupAndPutListeners(e,p),E=this._createContentMarkup(e,p,r);c=!E&&G[this._tag]?C+"/>":C+">"+E+""}switch(this._tag){case"input":e.getReactMountReady().enqueue(N,this),p.autoFocus&&e.getReactMountReady().enqueue(i.focusDOMComponent,this);break;case"textarea":e.getReactMountReady().enqueue(D,this),p.autoFocus&&e.getReactMountReady().enqueue(i.focusDOMComponent,this);break;case"select":case"button":p.autoFocus&&e.getReactMountReady().enqueue(i.focusDOMComponent,this);break;case"option":e.getReactMountReady().enqueue(U,this)}return c},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(null!=i)if(k.hasOwnProperty(r))i&&M(this,r,i,e);else{"style"===r&&(i&&(i=this._previousStyleCopy=o({},t.style)),i=a.createMarkupForStyles(i,this));var s=null;null!=this._tag&&Z(this._tag,t)?O.hasOwnProperty(r)||(s=l.createMarkupForCustomAttribute(r,i)):s=l.createMarkupForProperty(r,i),s&&(n+=" "+s)}}return e.renderToStaticMarkup?n:(this._hostParent||(n+=" "+l.createMarkupForRoot()),n+=" "+l.createMarkupForID(this._domID))},_createContentMarkup:function(e,t,n){var r="",o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&(r=o.__html);else{var i=R[typeof t.children]?t.children:null,a=null!=i?null:t.children;if(null!=i)r=C(i);else if(null!=a){r=this.mountChildren(a,e,n).join("")}}return Y[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&s.queueHTML(r,o.__html);else{var i=R[typeof t.children]?t.children:null,a=null!=i?null:t.children;if(null!=i)""!==i&&s.queueText(r,i);else if(null!=a)for(var u=this.mountChildren(a,e,n),c=0;c0;)e=e._hostParent,n--;for(;i-n>0;)t=t._hostParent,i--;for(var s=n;s--;){if(e===t)return e;e=e._hostParent,t=t._hostParent}return null}e.exports={isAncestor:function(e,t){"_hostNode"in e||r("35"),"_hostNode"in t||r("35");for(;t;){if(t===e)return!0;t=t._hostParent}return!1},getLowestCommonAncestor:o,getParentInstance:function(e){return"_hostNode"in e||r("36"),e._hostParent},traverseTwoPhase:function(e,t,n){for(var r,o=[];e;)o.push(e),e=e._hostParent;for(r=o.length;r-- >0;)t(o[r],"captured",n);for(r=0;r0;)n(c[u],"captured",i)}}},function(e,t,n){"use strict";var r=n(5),o=n(7),i=n(104),a=n(40),s=n(8),u=n(79),c=(n(3),n(113),function(e){this._currentElement=e,this._stringText=""+e,this._hostNode=null,this._hostParent=null,this._domID=0,this._mountIndex=0,this._closingComment=null,this._commentNodes=null});o(c.prototype,{mountComponent:function(e,t,n,r){var o=n._idCounter++,i=" react-text: "+o+" ";if(this._domID=o,this._hostParent=t,e.useCreateElement){var c=n._ownerDocument,l=c.createComment(i),p=c.createComment(" /react-text "),f=a(c.createDocumentFragment());return a.queueChild(f,a(l)),this._stringText&&a.queueChild(f,a(c.createTextNode(this._stringText))),a.queueChild(f,a(p)),s.precacheNode(this,l),this._closingComment=p,f}var d=u(this._stringText);return e.renderToStaticMarkup?d:"\x3c!--"+i+"--\x3e"+d+"\x3c!-- /react-text --\x3e"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var r=this.getHostNode();i.replaceDelimitedText(r[0],r[1],n)}}},getHostNode:function(){var e=this._commentNodes;if(e)return e;if(!this._closingComment)for(var t=s.getNodeFromInstance(this).nextSibling;;){if(null==t&&r("67",this._domID),8===t.nodeType&&" /react-text "===t.nodeValue){this._closingComment=t;break}t=t.nextSibling}return e=[this._hostNode,this._closingComment],this._commentNodes=e,e},unmountComponent:function(){this._closingComment=null,this._commentNodes=null,s.uncacheNode(this)}}),e.exports=c},function(e,t,n){"use strict";var r=n(7),o=n(21),i=n(76),a=n(20),s={initialize:a,close:function(){p.isBatchingUpdates=!1}},u=[{initialize:a,close:o.flushBatchedUpdates.bind(o)},s];function c(){this.reinitializeTransaction()}r(c.prototype,i,{getTransactionWrappers:function(){return u}});var l=new c,p={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,o,i){var a=p.isBatchingUpdates;return p.isBatchingUpdates=!0,a?e(t,n,r,o,i):l.perform(e,null,t,n,r,o,i)}};e.exports=p},function(e,t,n){"use strict";var r=n(7),o=n(171),i=n(13),a=n(30),s=n(8),u=n(21),c=n(101),l=n(351);function p(e){for(;e._hostParent;)e=e._hostParent;var t=s.getNodeFromInstance(e).parentNode;return s.getClosestInstanceFromNode(t)}function f(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function d(e){var t=c(e.nativeEvent),n=s.getClosestInstanceFromNode(t),r=n;do{e.ancestors.push(r),r=r&&p(r)}while(r);for(var o=0;ot.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}:function(e,t){if(window.getSelection){var n=window.getSelection(),r=e[i()].length,a=Math.min(t.start,r),s=void 0===t.end?a:Math.min(t.end,r);if(!n.extend&&a>s){var u=s;s=a,a=u}var c=o(e,a),l=o(e,s);if(c&&l){var p=document.createRange();p.setStart(c.node,c.offset),n.removeAllRanges(),a>s?(n.addRange(p),n.extend(l.node,l.offset)):(p.setEnd(l.node,l.offset),n.addRange(p))}}}};e.exports=u},function(e,t,n){"use strict";function r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function o(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}e.exports=function(e,t){for(var n=r(e),i=0,a=0;n;){if(3===n.nodeType){if(a=i+n.textContent.length,i<=t&&a>=t)return{node:n,offset:t-i};i=a}n=r(o(n))}}},function(e,t,n){"use strict";var r=n(357);e.exports=function e(t,n){return!(!t||!n)&&(t===n||!r(t)&&(r(n)?e(t,n.parentNode):"contains"in t?t.contains(n):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(n))))}},function(e,t,n){"use strict";var r=n(358);e.exports=function(e){return r(e)&&3==e.nodeType}},function(e,t,n){"use strict";e.exports=function(e){var t=(e?e.ownerDocument||e:document).defaultView||window;return!(!e||!("function"==typeof t.Node?e instanceof t.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}},function(e,t,n){"use strict";var r="http://www.w3.org/1999/xlink",o="http://www.w3.org/XML/1998/namespace",i={accentHeight:"accent-height",accumulate:0,additive:0,alignmentBaseline:"alignment-baseline",allowReorder:"allowReorder",alphabetic:0,amplitude:0,arabicForm:"arabic-form",ascent:0,attributeName:"attributeName",attributeType:"attributeType",autoReverse:"autoReverse",azimuth:0,baseFrequency:"baseFrequency",baseProfile:"baseProfile",baselineShift:"baseline-shift",bbox:0,begin:0,bias:0,by:0,calcMode:"calcMode",capHeight:"cap-height",clip:0,clipPath:"clip-path",clipRule:"clip-rule",clipPathUnits:"clipPathUnits",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",contentScriptType:"contentScriptType",contentStyleType:"contentStyleType",cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:"diffuseConstant",direction:0,display:0,divisor:0,dominantBaseline:"dominant-baseline",dur:0,dx:0,dy:0,edgeMode:"edgeMode",elevation:0,enableBackground:"enable-background",end:0,exponent:0,externalResourcesRequired:"externalResourcesRequired",fill:0,fillOpacity:"fill-opacity",fillRule:"fill-rule",filter:0,filterRes:"filterRes",filterUnits:"filterUnits",floodColor:"flood-color",floodOpacity:"flood-opacity",focusable:0,fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",glyphRef:"glyphRef",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",hanging:0,horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",ideographic:0,imageRendering:"image-rendering",in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:"kernelMatrix",kernelUnitLength:"kernelUnitLength",kerning:0,keyPoints:"keyPoints",keySplines:"keySplines",keyTimes:"keyTimes",lengthAdjust:"lengthAdjust",letterSpacing:"letter-spacing",lightingColor:"lighting-color",limitingConeAngle:"limitingConeAngle",local:0,markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",markerHeight:"markerHeight",markerUnits:"markerUnits",markerWidth:"markerWidth",mask:0,maskContentUnits:"maskContentUnits",maskUnits:"maskUnits",mathematical:0,mode:0,numOctaves:"numOctaves",offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pathLength:"pathLength",patternContentUnits:"patternContentUnits",patternTransform:"patternTransform",patternUnits:"patternUnits",pointerEvents:"pointer-events",points:0,pointsAtX:"pointsAtX",pointsAtY:"pointsAtY",pointsAtZ:"pointsAtZ",preserveAlpha:"preserveAlpha",preserveAspectRatio:"preserveAspectRatio",primitiveUnits:"primitiveUnits",r:0,radius:0,refX:"refX",refY:"refY",renderingIntent:"rendering-intent",repeatCount:"repeatCount",repeatDur:"repeatDur",requiredExtensions:"requiredExtensions",requiredFeatures:"requiredFeatures",restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:"shape-rendering",slope:0,spacing:0,specularConstant:"specularConstant",specularExponent:"specularExponent",speed:0,spreadMethod:"spreadMethod",startOffset:"startOffset",stdDeviation:"stdDeviation",stemh:0,stemv:0,stitchTiles:"stitchTiles",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",string:0,stroke:0,strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",surfaceScale:"surfaceScale",systemLanguage:"systemLanguage",tableValues:"tableValues",targetX:"targetX",targetY:"targetY",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",textLength:"textLength",to:0,transform:0,u1:0,u2:0,underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicode:0,unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",values:0,vectorEffect:"vector-effect",version:0,vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",viewBox:"viewBox",viewTarget:"viewTarget",visibility:0,widths:0,wordSpacing:"word-spacing",writingMode:"writing-mode",x:0,xHeight:"x-height",x1:0,x2:0,xChannelSelector:"xChannelSelector",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlns:0,xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xmlSpace:"xml:space",y:0,y1:0,y2:0,yChannelSelector:"yChannelSelector",z:0,zoomAndPan:"zoomAndPan"},a={Properties:{},DOMAttributeNamespaces:{xlinkActuate:r,xlinkArcrole:r,xlinkHref:r,xlinkRole:r,xlinkShow:r,xlinkTitle:r,xlinkType:r,xmlBase:o,xmlLang:o,xmlSpace:o},DOMAttributeNames:{}};Object.keys(i).forEach(function(e){a.Properties[e]=0,i[e]&&(a.DOMAttributeNames[e]=i[e])}),e.exports=a},function(e,t,n){"use strict";var r=n(52),o=n(13),i=n(8),a=n(172),s=n(24),u=n(173),c=n(158),l=n(109),p=o.canUseDOM&&"documentMode"in document&&document.documentMode<=11,f={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:["topBlur","topContextMenu","topFocus","topKeyDown","topKeyUp","topMouseDown","topMouseUp","topSelectionChange"]}},d=null,h=null,m=null,v=!1,g=!1;function y(e,t){if(v||null==d||d!==u())return null;var n=function(e){if("selectionStart"in e&&a.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}(d);if(!m||!l(m,n)){m=n;var o=s.getPooled(f.select,h,e,t);return o.type="select",o.target=d,r.accumulateTwoPhaseDispatches(o),o}return null}var _={eventTypes:f,extractEvents:function(e,t,n,r){if(!g)return null;var o=t?i.getNodeFromInstance(t):window;switch(e){case"topFocus":(c(o)||"true"===o.contentEditable)&&(d=o,h=t,m=null);break;case"topBlur":d=null,h=null,m=null;break;case"topMouseDown":v=!0;break;case"topContextMenu":case"topMouseUp":return v=!1,y(n,r);case"topSelectionChange":if(p)break;case"topKeyDown":case"topKeyUp":return y(n,r)}return null},didPutListener:function(e,t,n){"onSelect"===t&&(g=!0)}};e.exports=_},function(e,t,n){"use strict";var r=n(5),o=n(171),i=n(52),a=n(8),s=n(362),u=n(363),c=n(24),l=n(364),p=n(365),f=n(77),d=n(367),h=n(368),m=n(369),v=n(54),g=n(370),y=n(20),_=n(114),b=(n(3),{}),A={};["abort","animationEnd","animationIteration","animationStart","blur","canPlay","canPlayThrough","click","contextMenu","copy","cut","doubleClick","drag","dragEnd","dragEnter","dragExit","dragLeave","dragOver","dragStart","drop","durationChange","emptied","encrypted","ended","error","focus","input","invalid","keyDown","keyPress","keyUp","load","loadedData","loadedMetadata","loadStart","mouseDown","mouseMove","mouseOut","mouseOver","mouseUp","paste","pause","play","playing","progress","rateChange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeUpdate","touchCancel","touchEnd","touchMove","touchStart","transitionEnd","volumeChange","waiting","wheel"].forEach(function(e){var t=e[0].toUpperCase()+e.slice(1),n="on"+t,r="top"+t,o={phasedRegistrationNames:{bubbled:n,captured:n+"Capture"},dependencies:[r]};b[e]=o,A[r]=o});var C={};function E(e){return"."+e._rootNodeID}function S(e){return"button"===e||"input"===e||"select"===e||"textarea"===e}var T={eventTypes:b,extractEvents:function(e,t,n,o){var a,y=A[e];if(!y)return null;switch(e){case"topAbort":case"topCanPlay":case"topCanPlayThrough":case"topDurationChange":case"topEmptied":case"topEncrypted":case"topEnded":case"topError":case"topInput":case"topInvalid":case"topLoad":case"topLoadedData":case"topLoadedMetadata":case"topLoadStart":case"topPause":case"topPlay":case"topPlaying":case"topProgress":case"topRateChange":case"topReset":case"topSeeked":case"topSeeking":case"topStalled":case"topSubmit":case"topSuspend":case"topTimeUpdate":case"topVolumeChange":case"topWaiting":a=c;break;case"topKeyPress":if(0===_(n))return null;case"topKeyDown":case"topKeyUp":a=p;break;case"topBlur":case"topFocus":a=l;break;case"topClick":if(2===n.button)return null;case"topDoubleClick":case"topMouseDown":case"topMouseMove":case"topMouseUp":case"topMouseOut":case"topMouseOver":case"topContextMenu":a=f;break;case"topDrag":case"topDragEnd":case"topDragEnter":case"topDragExit":case"topDragLeave":case"topDragOver":case"topDragStart":case"topDrop":a=d;break;case"topTouchCancel":case"topTouchEnd":case"topTouchMove":case"topTouchStart":a=h;break;case"topAnimationEnd":case"topAnimationIteration":case"topAnimationStart":a=s;break;case"topTransitionEnd":a=m;break;case"topScroll":a=v;break;case"topWheel":a=g;break;case"topCopy":case"topCut":case"topPaste":a=u}a||r("86",e);var b=a.getPooled(y,t,n,o);return i.accumulateTwoPhaseDispatches(b),b},didPutListener:function(e,t,n){if("onClick"===t&&!S(e._tag)){var r=E(e),i=a.getNodeFromInstance(e);C[r]||(C[r]=o.listen(i,"click",y))}},willDeleteListener:function(e,t){if("onClick"===t&&!S(e._tag)){var n=E(e);C[n].remove(),delete C[n]}}};e.exports=T},function(e,t,n){"use strict";var r=n(24);function o(e,t,n,o){return r.call(this,e,t,n,o)}r.augmentClass(o,{animationName:null,elapsedTime:null,pseudoElement:null}),e.exports=o},function(e,t,n){"use strict";var r=n(24),o={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};function i(e,t,n,o){return r.call(this,e,t,n,o)}r.augmentClass(i,o),e.exports=i},function(e,t,n){"use strict";var r=n(54);function o(e,t,n,o){return r.call(this,e,t,n,o)}r.augmentClass(o,{relatedTarget:null}),e.exports=o},function(e,t,n){"use strict";var r=n(54),o=n(114),i={key:n(366),location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:n(103),charCode:function(e){return"keypress"===e.type?o(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?o(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};function a(e,t,n,o){return r.call(this,e,t,n,o)}r.augmentClass(a,i),e.exports=a},function(e,t,n){"use strict";var r=n(114),o={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};e.exports=function(e){if(e.key){var t=o[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=r(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?i[e.keyCode]||"Unidentified":""}},function(e,t,n){"use strict";var r=n(77);function o(e,t,n,o){return r.call(this,e,t,n,o)}r.augmentClass(o,{dataTransfer:null}),e.exports=o},function(e,t,n){"use strict";var r=n(54),o={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:n(103)};function i(e,t,n,o){return r.call(this,e,t,n,o)}r.augmentClass(i,o),e.exports=i},function(e,t,n){"use strict";var r=n(24);function o(e,t,n,o){return r.call(this,e,t,n,o)}r.augmentClass(o,{propertyName:null,elapsedTime:null,pseudoElement:null}),e.exports=o},function(e,t,n){"use strict";var r=n(77);function o(e,t,n,o){return r.call(this,e,t,n,o)}r.augmentClass(o,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),e.exports=o},function(e,t,n){"use strict";n(113);var r=9;e.exports=function(e,t){return{_topLevelWrapper:e,_idCounter:1,_ownerDocument:t?t.nodeType===r?t:t.ownerDocument:null,_node:t,_tag:t?t.nodeName.toLowerCase():null,_namespaceURI:t?t.namespaceURI:null}}},function(e,t,n){"use strict";e.exports={useCreateElement:!0,useFiber:!1}},function(e,t,n){"use strict";var r=n(374),o=/\/?>/,i=/^<\!\-\-/,a={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return i.test(e)?e:e.replace(o," "+a.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(a.CHECKSUM_ATTR_NAME);return n=n&&parseInt(n,10),r(e)===n}};e.exports=a},function(e,t,n){"use strict";var r=65521;e.exports=function(e){for(var t=1,n=0,o=0,i=e.length,a=-4&i;o0&&arguments[0]instanceof e.MediaStreamTrack){var t,n,r,o=arguments[0];return this.getSenders().forEach(function(e){e.track===o&&(t?r=!0:t=e)}),this.getReceivers().forEach(function(e){return e.track===o&&(n?r=!0:n=e),e.track===o}),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return s.apply(this,arguments)}}}},shimSourceObject:function(e){var t=e&&e.URL;"object"===r(e)&&(!e.HTMLMediaElement||"srcObject"in e.HTMLMediaElement.prototype||Object.defineProperty(e.HTMLMediaElement.prototype,"srcObject",{get:function(){return this._srcObject},set:function(e){var n=this;this._srcObject=e,this.src&&t.revokeObjectURL(this.src),e?(this.src=t.createObjectURL(e),e.addEventListener("addtrack",function(){n.src&&t.revokeObjectURL(n.src),n.src=t.createObjectURL(e)}),e.addEventListener("removetrack",function(){n.src&&t.revokeObjectURL(n.src),n.src=t.createObjectURL(e)})):this.src=""}}))},shimAddTrackRemoveTrackWithNative:function(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(function(t){return e._shimmedLocalStreams[t][0]})};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(function(e){if(t.getSenders().find(function(t){return t.track===e}))throw new DOMException("Track already exists.","InvalidAccessError")});var r=t.getSenders();n.apply(this,arguments);var o=t.getSenders().filter(function(e){return-1===r.indexOf(e)});this._shimmedLocalStreams[e.id]=[e].concat(o)};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};var o=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(function(n){var r=t._shimmedLocalStreams[n].indexOf(e);-1!==r&&t._shimmedLocalStreams[n].splice(r,1),1===t._shimmedLocalStreams[n].length&&delete t._shimmedLocalStreams[n]}),o.apply(this,arguments)}},shimAddTrackRemoveTrack:function(e){if(e.RTCPeerConnection){var t=o.detectBrowser(e);if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return this.shimAddTrackRemoveTrackWithNative(e);var n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=n.apply(this);return e._reverseStreams=e._reverseStreams||{},t.map(function(t){return e._reverseStreams[t.id]})};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var n=this;if(n._streams=n._streams||{},n._reverseStreams=n._reverseStreams||{},t.getTracks().forEach(function(e){if(n.getSenders().find(function(t){return t.track===e}))throw new DOMException("Track already exists.","InvalidAccessError")}),!n._reverseStreams[t.id]){var o=new e.MediaStream(t.getTracks());n._streams[t.id]=o,n._reverseStreams[o.id]=t,t=o}r.apply(n,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;t._streams=t._streams||{},t._reverseStreams=t._reverseStreams||{},i.apply(t,[t._streams[e.id]||e]),delete t._reverseStreams[t._streams[e.id]?t._streams[e.id].id:e.id],delete t._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){var r=this;if("closed"===r.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var o=[].slice.call(arguments,1);if(1!==o.length||!o[0].getTracks().find(function(e){return e===t}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(r.getSenders().find(function(e){return e.track===t}))throw new DOMException("Track already exists.","InvalidAccessError");r._streams=r._streams||{},r._reverseStreams=r._reverseStreams||{};var i=r._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(function(){r.dispatchEvent(new Event("negotiationneeded"))});else{var a=new e.MediaStream([t]);r._streams[n.id]=a,r._reverseStreams[a.id]=n,r.addStream(a)}return r.getSenders().find(function(e){return e.track===t})},["createOffer","createAnswer"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=this,t=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(e,[function(n){var r=u(e,n);t[0].apply(null,[r])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(e,arguments).then(function(t){return u(e,t)})}});var a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(t){var r=e._reverseStreams[t],o=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),o.id)}),new RTCSessionDescription({type:t.type,sdp:n})}(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};var s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=s.get.apply(this);return""===e.type?e:u(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,n=this;if("closed"===n.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===n))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");n._streams=n._streams||{},Object.keys(n._streams).forEach(function(r){n._streams[r].getTracks().find(function(t){return e.track===t})&&(t=n._streams[r])}),t&&(1===t.getTracks().length?n.removeStream(n._reverseStreams[t.id]):t.removeTrack(e.track),n.dispatchEvent(new Event("negotiationneeded")))}}function u(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(t){var r=e._reverseStreams[t],o=e._streams[r.id];n=n.replace(new RegExp(o.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}},shimPeerConnection:function(e){var t=o.detectBrowser(e);if(!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=function(t,n){return i("PeerConnection"),t&&t.iceTransportPolicy&&(t.iceTransports=t.iceTransportPolicy),new e.webkitRTCPeerConnection(t,n)},e.RTCPeerConnection.prototype=e.webkitRTCPeerConnection.prototype,e.webkitRTCPeerConnection.generateCertificate&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return e.webkitRTCPeerConnection.generateCertificate}})),e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(e,t,r){var o=this,i=arguments;if(arguments.length>0&&"function"==typeof e)return n.apply(this,arguments);if(0===n.length&&(0===arguments.length||"function"!=typeof arguments[0]))return n.apply(this,[]);var a=function(e){var t={};return e.result().forEach(function(e){var n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(function(t){n[t]=e.stat(t)}),t[n.id]=n}),t},s=function(e){return new Map(Object.keys(e).map(function(t){return[t,e[t]]}))};if(arguments.length>=2){return n.apply(this,[function(e){i[1](s(a(e)))},arguments[0]])}return new Promise(function(e,t){n.apply(o,[function(t){e(s(a(t)))},t])}).then(t,r)},t.version<51&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=arguments,t=this,r=new Promise(function(r,o){n.apply(t,[e[0],r,o])});return e.length<2?r:r.then(function(){e[1].apply(null,[])},function(t){e.length>=3&&e[2].apply(null,[t])})}}),t.version<52&&["createOffer","createAnswer"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=this;if(arguments.length<1||1===arguments.length&&"object"===r(arguments[0])){var t=1===arguments.length?arguments[0]:void 0;return new Promise(function(r,o){n.apply(e,[r,o,t])})}return n.apply(this,arguments)}}),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}});var a=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?a.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}},fixNegotiationNeeded:function(e){o.wrapPeerConnectionEvent(e,"negotiationneeded",function(e){if("stable"===e.target.signalingState)return e})},shimGetDisplayMedia:function(e,t){!e.navigator||!e.navigator.mediaDevices||"getDisplayMedia"in e.navigator.mediaDevices||("function"==typeof t?(e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then(function(t){var r=n.video&&n.video.width,o=n.video&&n.video.height,i=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:i||3}},r&&(n.video.mandatory.maxWidth=r),o&&(n.video.mandatory.maxHeight=o),e.navigator.mediaDevices.getUserMedia(n)})},e.navigator.getDisplayMedia=function(t){return o.deprecated("navigator.getDisplayMedia","navigator.mediaDevices.getDisplayMedia"),e.navigator.mediaDevices.getDisplayMedia(t)}):console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=n(25),i=o.log;e.exports=function(e){var t=o.detectBrowser(e),n=e&&e.navigator,a=function(e){if("object"!==r(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var o="object"===r(e[n])?e[n]:{ideal:e[n]};void 0!==o.exact&&"number"==typeof o.exact&&(o.min=o.max=o.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==o.ideal){t.optional=t.optional||[];var a={};"number"==typeof o.ideal?(a[i("min",n)]=o.ideal,t.optional.push(a),(a={})[i("max",n)]=o.ideal,t.optional.push(a)):(a[i("",n)]=o.ideal,t.optional.push(a))}void 0!==o.exact&&"number"!=typeof o.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=o.exact):["min","max"].forEach(function(e){void 0!==o[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=o[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},s=function(e,o){if(t.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===r(e.audio)){var s=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};s((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),s(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=a(e.audio)}if(e&&"object"===r(e.video)){var u=e.video.facingMode;u=u&&("object"===r(u)?u:{ideal:u});var c,l=t.version<66;if(u&&("user"===u.exact||"environment"===u.exact||"user"===u.ideal||"environment"===u.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||l))if(delete e.video.facingMode,"environment"===u.exact||"environment"===u.ideal?c=["back","rear"]:"user"!==u.exact&&"user"!==u.ideal||(c=["front"]),c)return n.mediaDevices.enumerateDevices().then(function(t){var n=(t=t.filter(function(e){return"videoinput"===e.kind})).find(function(e){return c.some(function(t){return-1!==e.label.toLowerCase().indexOf(t)})});return!n&&t.length&&-1!==c.indexOf("back")&&(n=t[t.length-1]),n&&(e.video.deviceId=u.exact?{exact:n.deviceId}:{ideal:n.deviceId}),e.video=a(e.video),i("chrome: "+JSON.stringify(e)),o(e)});e.video=a(e.video)}return i("chrome: "+JSON.stringify(e)),o(e)},u=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};n.getUserMedia=function(e,t,r){s(e,function(e){n.webkitGetUserMedia(e,t,function(e){r&&r(u(e))})})};var c=function(e){return new Promise(function(t,r){n.getUserMedia(e,t,r)})};if(n.mediaDevices||(n.mediaDevices={getUserMedia:c,enumerateDevices:function(){return new Promise(function(t){var n={audio:"audioinput",video:"videoinput"};return e.MediaStreamTrack.getSources(function(e){t(e.map(function(e){return{label:e.label,kind:n[e.kind],deviceId:e.id,groupId:""}}))})})},getSupportedConstraints:function(){return{deviceId:!0,echoCancellation:!0,facingMode:!0,frameRate:!0,height:!0,width:!0}}}),n.mediaDevices.getUserMedia){var l=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return s(e,function(e){return l(e).then(function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(function(e){e.stop()}),new DOMException("","NotFoundError");return t},function(e){return Promise.reject(u(e))})})}}else n.mediaDevices.getUserMedia=function(e){return c(e)};void 0===n.mediaDevices.addEventListener&&(n.mediaDevices.addEventListener=function(){i("Dummy mediaDevices.addEventListener called.")}),void 0===n.mediaDevices.removeEventListener&&(n.mediaDevices.removeEventListener=function(){i("Dummy mediaDevices.removeEventListener called.")})}},function(e,t,n){"use strict";var r=n(25),o=n(383),i=n(384);e.exports={shimGetUserMedia:n(385),shimPeerConnection:function(e){var t=r.detectBrowser(e);if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){var n=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){n.set.call(this,e);var t=new Event("enabled");t.enabled=e,this.dispatchEvent(t)}})}!e.RTCRtpSender||"dtmf"in e.RTCRtpSender.prototype||Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);var a=i(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=o(e.iceServers)),new a(e)},e.RTCPeerConnection.prototype=a.prototype},shimReplaceTrack:function(e){!e.RTCRtpSender||"replaceTrack"in e.RTCRtpSender.prototype||(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)},shimGetDisplayMedia:function(e,t){if("getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&!("getDisplayMedia"in e.navigator.mediaDevices)){var n=e.navigator.getDisplayMedia;e.navigator.mediaDevices.getDisplayMedia=function(t){return n.call(e.navigator,t)},e.navigator.getDisplayMedia=function(t){return r.deprecated("navigator.getDisplayMedia","navigator.mediaDevices.getDisplayMedia"),n.call(e.navigator,t)}}}}},function(e,t,n){"use strict";var r=n(25);e.exports=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var o=e.urls||e.url;e.url&&!e.urls&&r.deprecated("RTCIceServer.url","RTCIceServer.urls");var i="string"==typeof o;return i&&(o=[o]),o=o.filter(function(e){return 0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")&&-1===e.indexOf("turn:[")&&!n?(n=!0,!0):0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp")}),delete e.url,e.urls=i?o[0]:o,!!o.length}})}},function(e,t,n){"use strict";var r=n(176);function o(e,t,n,o,i){var a=r.writeRtpDescription(e.kind,t);if(a+=r.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":i||"active"),a+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var s=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=s;var u="msid:"+(o?o.id:"-")+" "+s+"\r\n";a+="a="+u,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+u,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+u,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+r.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+r.localCName+"\r\n"),a}function i(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n=14393&&-1===e.indexOf("?transport=udp"):(n=!0,!0)}),delete e.url,e.urls=o?r[0]:r,!!r.length}})}(n.iceServers||[],t),this._iceGatherers=[],n.iceCandidatePoolSize)for(var a=n.iceCandidatePoolSize;a>0;a--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=r.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(l.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(l.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),l.prototype.onicecandidate=null,l.prototype.onaddstream=null,l.prototype.ontrack=null,l.prototype.onremovestream=null,l.prototype.onsignalingstatechange=null,l.prototype.oniceconnectionstatechange=null,l.prototype.onconnectionstatechange=null,l.prototype.onicegatheringstatechange=null,l.prototype.onnegotiationneeded=null,l.prototype.ondatachannel=null,l.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},l.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},l.prototype.getConfiguration=function(){return this._config},l.prototype.getLocalStreams=function(){return this.localStreams},l.prototype.getRemoteStreams=function(){return this.remoteStreams},l.prototype._createTransceiver=function(e,t){var n=this.transceivers.length>0,r={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&n)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var o=this._createIceAndDtlsTransports();r.iceTransport=o.iceTransport,r.dtlsTransport=o.dtlsTransport}return t||this.transceivers.push(r),r},l.prototype.addTrack=function(t,n){if(this._isClosed)throw u("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find(function(e){return e.track===t}))throw u("InvalidAccessError","Track already exists.");for(var o=0;o=15025)e.getTracks().forEach(function(t){n.addTrack(t,e)});else{var r=e.clone();e.getTracks().forEach(function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",function(e){n.enabled=e.enabled})}),r.getTracks().forEach(function(e){n.addTrack(e,r)})}},l.prototype.removeTrack=function(t){if(this._isClosed)throw u("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find(function(e){return e.rtpSender===t});if(!n)throw u("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map(function(e){return e.stream}).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},l.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(e){var n=t.getSenders().find(function(t){return t.track===e});n&&t.removeTrack(n)})},l.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},l.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},l.prototype._createIceGatherer=function(t,n){var r=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var o=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(o,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var n=!e.candidate||0===Object.keys(e.candidate).length;o.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},o.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),o},l.prototype._gather=function(t,n){var o=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var a=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(o.usingBundle&&n>0)){var a=new Event("icecandidate");a.candidate={sdpMid:t,sdpMLineIndex:n};var s=e.candidate,u=!s||0===Object.keys(s).length;if(u)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),s.component=1,s.ufrag=i.getLocalParameters().usernameFragment;var c=r.writeCandidate(s);a.candidate=Object.assign(a.candidate,r.parseCandidate(c)),a.candidate.candidate=c,a.candidate.toJSON=function(){return{candidate:a.candidate.candidate,sdpMid:a.candidate.sdpMid,sdpMLineIndex:a.candidate.sdpMLineIndex,usernameFragment:a.candidate.usernameFragment}}}var l=r.getMediaSections(o._localDescription.sdp);l[a.candidate.sdpMLineIndex]+=u?"a=end-of-candidates\r\n":"a="+a.candidate.candidate+"\r\n",o._localDescription.sdp=r.getDescription(o._localDescription.sdp)+l.join("");var p=o.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});"gathering"!==o.iceGatheringState&&(o.iceGatheringState="gathering",o._emitGatheringStateChange()),u||o._dispatchEvent("icecandidate",a),p&&(o._dispatchEvent("icecandidate",new Event("icecandidate")),o.iceGatheringState="complete",o._emitGatheringStateChange())}},e.setTimeout(function(){a.forEach(function(e){i.onlocalcandidate(e)})},0)}},l.prototype._createIceAndDtlsTransports=function(){var t=this,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var r=new e.RTCDtlsTransport(n);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:r}},l.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},l.prototype._transceive=function(e,n,o){var a=i(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(a.encodings=e.sendEncodingParameters,a.rtcp={cname:r.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(a.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(a)),o&&e.rtpReceiver&&a.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach(function(e){delete e.rtx}),e.recvEncodingParameters.length?a.encodings=e.recvEncodingParameters:a.encodings=[{}],a.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(a.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(a.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(a))},l.prototype.setLocalDescription=function(e){var t,n,o=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(u("TypeError",'Unsupported type "'+e.type+'"'));if(!a("setLocalDescription",e.type,o.signalingState)||o._isClosed)return Promise.reject(u("InvalidStateError","Can not set local "+e.type+" in state "+o.signalingState));if("offer"===e.type)t=r.splitSections(e.sdp),n=t.shift(),t.forEach(function(e,t){var n=r.parseRtpParameters(e);o.transceivers[t].localCapabilities=n}),o.transceivers.forEach(function(e,t){o._gather(e.mid,t)});else if("answer"===e.type){t=r.splitSections(o._remoteDescription.sdp),n=t.shift();var s=r.matchPrefix(n,"a=ice-lite").length>0;t.forEach(function(e,t){var a=o.transceivers[t],u=a.iceGatherer,c=a.iceTransport,l=a.dtlsTransport,p=a.localCapabilities,f=a.remoteCapabilities;if(!(r.isRejected(e)&&0===r.matchPrefix(e,"a=bundle-only").length)&&!a.rejected){var d=r.getIceParameters(e,n),h=r.getDtlsParameters(e,n);s&&(h.role="server"),o.usingBundle&&0!==t||(o._gather(a.mid,t),"new"===c.state&&c.start(u,d,s?"controlling":"controlled"),"new"===l.state&&l.start(h));var m=i(p,f);o._transceive(a,m.codecs.length>0,!1)}})}return o._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?o._updateSignalingState("have-local-offer"):o._updateSignalingState("stable"),Promise.resolve()},l.prototype.setRemoteDescription=function(o){var l=this;if(-1===["offer","answer"].indexOf(o.type))return Promise.reject(u("TypeError",'Unsupported type "'+o.type+'"'));if(!a("setRemoteDescription",o.type,l.signalingState)||l._isClosed)return Promise.reject(u("InvalidStateError","Can not set remote "+o.type+" in state "+l.signalingState));var p={};l.remoteStreams.forEach(function(e){p[e.id]=e});var f=[],d=r.splitSections(o.sdp),h=d.shift(),m=r.matchPrefix(h,"a=ice-lite").length>0,v=r.matchPrefix(h,"a=group:BUNDLE ").length>0;l.usingBundle=v;var g=r.matchPrefix(h,"a=ice-options:")[0];return l.canTrickleIceCandidates=!!g&&g.substr(14).split(" ").indexOf("trickle")>=0,d.forEach(function(a,u){var c=r.splitLines(a),d=r.getKind(a),g=r.isRejected(a)&&0===r.matchPrefix(a,"a=bundle-only").length,y=c[0].substr(2).split(" ")[2],_=r.getDirection(a,h),b=r.parseMsid(a),A=r.getMid(a)||r.generateIdentifier();if(g||"application"===d&&("DTLS/SCTP"===y||"UDP/DTLS/SCTP"===y))l.transceivers[u]={mid:A,kind:d,protocol:y,rejected:!0};else{var C,E,S,T,w,V,k,R,I;!g&&l.transceivers[u]&&l.transceivers[u].rejected&&(l.transceivers[u]=l._createTransceiver(d,!0));var O,x,q=r.parseRtpParameters(a);g||(O=r.getIceParameters(a,h),(x=r.getDtlsParameters(a,h)).role="client"),k=r.parseRtpEncodingParameters(a);var M=r.parseRtcpParameters(a),P=r.matchPrefix(a,"a=end-of-candidates",h).length>0,N=r.matchPrefix(a,"a=candidate:").map(function(e){return r.parseCandidate(e)}).filter(function(e){return 1===e.component});if(("offer"===o.type||"answer"===o.type)&&!g&&v&&u>0&&l.transceivers[u]&&(l._disposeIceAndDtlsTransports(u),l.transceivers[u].iceGatherer=l.transceivers[0].iceGatherer,l.transceivers[u].iceTransport=l.transceivers[0].iceTransport,l.transceivers[u].dtlsTransport=l.transceivers[0].dtlsTransport,l.transceivers[u].rtpSender&&l.transceivers[u].rtpSender.setTransport(l.transceivers[0].dtlsTransport),l.transceivers[u].rtpReceiver&&l.transceivers[u].rtpReceiver.setTransport(l.transceivers[0].dtlsTransport)),"offer"!==o.type||g){if("answer"===o.type&&!g){E=(C=l.transceivers[u]).iceGatherer,S=C.iceTransport,T=C.dtlsTransport,w=C.rtpReceiver,V=C.sendEncodingParameters,R=C.localCapabilities,l.transceivers[u].recvEncodingParameters=k,l.transceivers[u].remoteCapabilities=q,l.transceivers[u].rtcpParameters=M,N.length&&"new"===S.state&&(!m&&!P||v&&0!==u?N.forEach(function(e){s(C.iceTransport,e)}):S.setRemoteCandidates(N)),v&&0!==u||("new"===S.state&&S.start(E,O,"controlling"),"new"===T.state&&T.start(x)),!i(C.localCapabilities,C.remoteCapabilities).codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&C.sendEncodingParameters[0].rtx&&delete C.sendEncodingParameters[0].rtx,l._transceive(C,"sendrecv"===_||"recvonly"===_,"sendrecv"===_||"sendonly"===_),!w||"sendrecv"!==_&&"sendonly"!==_?delete C.rtpReceiver:(I=w.track,b?(p[b.stream]||(p[b.stream]=new e.MediaStream),n(I,p[b.stream]),f.push([I,w,p[b.stream]])):(p.default||(p.default=new e.MediaStream),n(I,p.default),f.push([I,w,p.default])))}}else{(C=l.transceivers[u]||l._createTransceiver(d)).mid=A,C.iceGatherer||(C.iceGatherer=l._createIceGatherer(u,v)),N.length&&"new"===C.iceTransport.state&&(!P||v&&0!==u?N.forEach(function(e){s(C.iceTransport,e)}):C.iceTransport.setRemoteCandidates(N)),R=e.RTCRtpReceiver.getCapabilities(d),t<15019&&(R.codecs=R.codecs.filter(function(e){return"rtx"!==e.name})),V=C.sendEncodingParameters||[{ssrc:1001*(2*u+2)}];var D,U=!1;if("sendrecv"===_||"sendonly"===_){if(U=!C.rtpReceiver,w=C.rtpReceiver||new e.RTCRtpReceiver(C.dtlsTransport,d),U)I=w.track,b&&"-"===b.stream||(b?(p[b.stream]||(p[b.stream]=new e.MediaStream,Object.defineProperty(p[b.stream],"id",{get:function(){return b.stream}})),Object.defineProperty(I,"id",{get:function(){return b.track}}),D=p[b.stream]):(p.default||(p.default=new e.MediaStream),D=p.default)),D&&(n(I,D),C.associatedRemoteMediaStreams.push(D)),f.push([I,w,D])}else C.rtpReceiver&&C.rtpReceiver.track&&(C.associatedRemoteMediaStreams.forEach(function(t){var n,r,o=t.getTracks().find(function(e){return e.id===C.rtpReceiver.track.id});o&&(n=o,(r=t).removeTrack(n),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:n})))}),C.associatedRemoteMediaStreams=[]);C.localCapabilities=R,C.remoteCapabilities=q,C.rtpReceiver=w,C.rtcpParameters=M,C.sendEncodingParameters=V,C.recvEncodingParameters=k,l._transceive(l.transceivers[u],!1,U)}}}),void 0===l._dtlsRole&&(l._dtlsRole="offer"===o.type?"active":"passive"),l._remoteDescription={type:o.type,sdp:o.sdp},"offer"===o.type?l._updateSignalingState("have-remote-offer"):l._updateSignalingState("stable"),Object.keys(p).forEach(function(t){var n=p[t];if(n.getTracks().length){if(-1===l.remoteStreams.indexOf(n)){l.remoteStreams.push(n);var r=new Event("addstream");r.stream=n,e.setTimeout(function(){l._dispatchEvent("addstream",r)})}f.forEach(function(e){var t=e[0],r=e[1];n.id===e[2].id&&c(l,t,r,[n])})}}),f.forEach(function(e){e[2]||c(l,e[0],e[1],[])}),e.setTimeout(function(){l&&l.transceivers&&l.transceivers.forEach(function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},l.prototype.close=function(){this.transceivers.forEach(function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},l.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},l.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}},0))},l.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++}),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},l.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)}),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var n=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",n)}},l.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(u("InvalidStateError","Can not call createOffer after close"));var i=n.transceivers.filter(function(e){return"audio"===e.kind}).length,a=n.transceivers.filter(function(e){return"video"===e.kind}).length,s=arguments[0];if(s){if(s.mandatory||s.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==s.offerToReceiveAudio&&(i=!0===s.offerToReceiveAudio?1:!1===s.offerToReceiveAudio?0:s.offerToReceiveAudio),void 0!==s.offerToReceiveVideo&&(a=!0===s.offerToReceiveVideo?1:!1===s.offerToReceiveVideo?0:s.offerToReceiveVideo)}for(n.transceivers.forEach(function(e){"audio"===e.kind?--i<0&&(e.wantReceive=!1):"video"===e.kind&&--a<0&&(e.wantReceive=!1)});i>0||a>0;)i>0&&(n._createTransceiver("audio"),i--),a>0&&(n._createTransceiver("video"),a--);var c=r.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach(function(o,i){var a=o.track,s=o.kind,u=o.mid||r.generateIdentifier();o.mid=u,o.iceGatherer||(o.iceGatherer=n._createIceGatherer(i,n.usingBundle));var c=e.RTCRtpSender.getCapabilities(s);t<15019&&(c.codecs=c.codecs.filter(function(e){return"rtx"!==e.name})),c.codecs.forEach(function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),o.remoteCapabilities&&o.remoteCapabilities.codecs&&o.remoteCapabilities.codecs.forEach(function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)})}),c.headerExtensions.forEach(function(e){(o.remoteCapabilities&&o.remoteCapabilities.headerExtensions||[]).forEach(function(t){e.uri===t.uri&&(e.id=t.id)})});var l=o.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];a&&t>=15019&&"video"===s&&!l[0].rtx&&(l[0].rtx={ssrc:l[0].ssrc+1}),o.wantReceive&&(o.rtpReceiver=new e.RTCRtpReceiver(o.dtlsTransport,s)),o.localCapabilities=c,o.sendEncodingParameters=l}),"max-compat"!==n._config.bundlePolicy&&(c+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),c+="a=ice-options:trickle\r\n",n.transceivers.forEach(function(e,t){c+=o(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),c+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,c+="a="+r.writeCandidate(e)+"\r\n"}),"completed"===e.iceGatherer.state&&(c+="a=end-of-candidates\r\n"))});var l=new e.RTCSessionDescription({type:"offer",sdp:c});return Promise.resolve(l)},l.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(u("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(u("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var a=r.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(a+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n";var s=r.getMediaSections(n._remoteDescription.sdp).length;n.transceivers.forEach(function(e,r){if(!(r+1>s)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?a+="m=application 0 DTLS/SCTP 5000\r\n":a+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?a+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(a+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(a+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var u;if(e.stream)"audio"===e.kind?u=e.stream.getAudioTracks()[0]:"video"===e.kind&&(u=e.stream.getVideoTracks()[0]),u&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var c=i(e.localCapabilities,e.remoteCapabilities);!c.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,a+=o(e,c,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(a+="a=rtcp-rsize\r\n")}});var c=new e.RTCSessionDescription({type:"answer",sdp:a});return Promise.resolve(c)},l.prototype.addIceCandidate=function(e){var t,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(o,i){if(!n._remoteDescription)return i(u("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var a=e.sdpMLineIndex;if(e.sdpMid)for(var c=0;c0?r.parseCandidate(e.candidate):{};if("tcp"===p.protocol&&(0===p.port||9===p.port))return o();if(p.component&&1!==p.component)return o();if((0===a||a>0&&l.iceTransport!==n.transceivers[0].iceTransport)&&!s(l.iceTransport,p))return i(u("OperationError","Can not add ICE candidate"));var f=e.candidate.trim();0===f.indexOf("a=")&&(f=f.substr(2)),(t=r.getMediaSections(n._remoteDescription.sdp))[a]+="a="+(p.type?f:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=r.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var d=0;d55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var p=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},f=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(e){return"object"===r(e)&&"object"===r(e.audio)&&(e=JSON.parse(JSON.stringify(e)),p(e.audio,"autoGainControl","mozAutoGainControl"),p(e.audio,"noiseSuppression","mozNoiseSuppression")),f(e)},a&&a.prototype.getSettings){var d=a.prototype.getSettings;a.prototype.getSettings=function(){var e=d.apply(this,arguments);return p(e,"mozAutoGainControl","autoGainControl"),p(e,"mozNoiseSuppression","noiseSuppression"),e}}if(a&&a.prototype.applyConstraints){var h=a.prototype.applyConstraints;a.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===r(e)&&(e=JSON.parse(JSON.stringify(e)),p(e,"autoGainControl","mozAutoGainControl"),p(e,"noiseSuppression","mozNoiseSuppression")),h.apply(this,[e])}}}n.getUserMedia=function(e,r,i){if(t.version<44)return u(e,r,i);o.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(r,i)}}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=n(25);e.exports={shimLocalStreamsAPI:function(e){if("object"===r(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),"getStreamById"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getStreamById=function(e){var t=null;return this._localStreams&&this._localStreams.forEach(function(n){n.id===e&&(t=n)}),this._remoteStreams&&this._remoteStreams.forEach(function(n){n.id===e&&(t=n)}),t}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),-1===this._localStreams.indexOf(e)&&this._localStreams.push(e);var n=this;e.getTracks().forEach(function(r){t.call(n,r,e)})},e.RTCPeerConnection.prototype.addTrack=function(e,n){return n&&(this._localStreams?-1===this._localStreams.indexOf(n)&&this._localStreams.push(n):this._localStreams=[n]),t.call(this,e,n)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);var t=this._localStreams.indexOf(e);if(-1!==t){this._localStreams.splice(t,1);var n=this,r=e.getTracks();this.getSenders().forEach(function(e){-1!==r.indexOf(e.track)&&n.removeTrack(e)})}})}},shimRemoteStreamsAPI:function(e){if("object"===r(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){this._onaddstream&&this.removeEventListener("addstream",this._onaddstream),this.addEventListener("addstream",this._onaddstream=e)}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}})}),t.apply(e,arguments)}}},shimCallbacksAPI:function(e){if("object"===r(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,n=t.createOffer,o=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],o=n.apply(this,[r]);return t?(o.then(e,t),Promise.resolve()):o},t.createAnswer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],r=o.apply(this,[n]);return t?(r.then(e,t),Promise.resolve()):r};var u=function(e,t,n){var r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=u,u=function(e,t,n){var r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=u,u=function(e,t,n){var r=s.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=u}},shimGetUserMedia:function(e){var t=e&&e.navigator;t.getUserMedia||(t.webkitGetUserMedia?t.getUserMedia=t.webkitGetUserMedia.bind(t):t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t)))},shimRTCIceServerUrls:function(e){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){for(var r=[],i=0;i0?r=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r}(arguments[0],u);s=0===c&&0===l?Number.POSITIVE_INFINITY:0===c||0===l?Math.max(c,l):Math.min(c,l);var p={};Object.defineProperty(p,"maxMessageSize",{get:function(){return s}}),this._sctp=p}return n.apply(this,arguments)}}},shimSendThrowTypeError:function(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return n(e,this),e},i.wrapPeerConnectionEvent(e,"datachannel",function(e){return n(e.channel,e.target),e})}function n(e,t){var n=e.send;e.send=function(){var r=arguments[0],o=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&o>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}}}},function(e,t,n){},function(e,t,n){var r=n(18),o=n(65),i=n(392),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=o(e),n=[];for(var s in e)("constructor"!=s||!t&&a.call(e,s))&&n.push(s);return n}},function(e,t){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},function(e,t,n){var r=n(394),o=n(64),i=Array.prototype.splice;e.exports=function(e,t){for(var n=e?t.length:0,a=n-1;n--;){var s=t[n];if(n==a||s!==u){var u=s;o(s)?i.call(e,s,1):r(e,s)}}return e}},function(e,t,n){var r=n(95),o=n(395),i=n(396),a=n(50);e.exports=function(e,t){return t=r(t,e),null==(e=i(e,t))||delete e[a(o(t))]}},function(e,t){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},function(e,t,n){var r=n(94),o=n(397);e.exports=function(e,t){return t.length<2?e:r(e,o(t,0,-1))}},function(e,t){e.exports=function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r-1?s[u?t[c]:c]:void 0}}},function(e,t,n){var r=n(129),o=n(35),i=n(131),a=Math.max;e.exports=function(e,t,n){var s=null==e?0:e.length;if(!s)return-1;var u=null==n?0:i(n);return u<0&&(u=a(s+u,0)),r(e,o(t,3),u)}},function(e,t,n){var r=n(73),o=n(401),i=n(403);e.exports=function(e,t){return i(o(e,t,r),e+"")}},function(e,t,n){var r=n(402),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,s=o(i.length-t,0),u=Array(s);++a0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){var r=n(74);e.exports=function(e,t){var n;return r(e,function(e,r,o){return!(n=t(e,r,o))}),!!n}},function(e,t,n){var r=n(66),o=n(177),i=n(115),a=n(409),s=n(410),u=n(182),c=n(117),l=n(411),p=n(412),f=n(139),d=n(413),h=n(72),m=n(414),v=n(415),g=n(185),y=n(11),_=n(63),b=n(420),A=n(18),C=n(422),E=n(26),S=1,T=2,w=4,V="[object Arguments]",k="[object Function]",R="[object GeneratorFunction]",I="[object Object]",O={};O[V]=O["[object Array]"]=O["[object ArrayBuffer]"]=O["[object DataView]"]=O["[object Boolean]"]=O["[object Date]"]=O["[object Float32Array]"]=O["[object Float64Array]"]=O["[object Int8Array]"]=O["[object Int16Array]"]=O["[object Int32Array]"]=O["[object Map]"]=O["[object Number]"]=O[I]=O["[object RegExp]"]=O["[object Set]"]=O["[object String]"]=O["[object Symbol]"]=O["[object Uint8Array]"]=O["[object Uint8ClampedArray]"]=O["[object Uint16Array]"]=O["[object Uint32Array]"]=!0,O["[object Error]"]=O[k]=O["[object WeakMap]"]=!1,e.exports=function e(t,n,x,q,M,P){var N,D=n&S,U=n&T,j=n&w;if(x&&(N=M?x(t,q,M,P):x(t)),void 0!==N)return N;if(!A(t))return t;var L=y(t);if(L){if(N=m(t),!D)return c(t,N)}else{var B=h(t),F=B==k||B==R;if(_(t))return u(t,D);if(B==I||B==V||F&&!M){if(N=U||F?{}:g(t),!D)return U?p(t,s(N,t)):l(t,a(N,t))}else{if(!O[B])return M?t:{};N=v(t,B,D)}}P||(P=new r);var G=P.get(t);if(G)return G;if(P.set(t,N),C(t))return t.forEach(function(r){N.add(e(r,n,x,r,t,P))}),N;if(b(t))return t.forEach(function(r,o){N.set(o,e(r,n,x,o,t,P))}),N;var Y=j?U?d:f:U?keysIn:E,H=L?void 0:Y(t);return o(H||t,function(r,o){H&&(r=t[o=r]),i(N,o,e(r,n,x,o,t,P))}),N}},function(e,t,n){var r=n(41),o=n(26);e.exports=function(e,t){return e&&r(t,o(t),e)}},function(e,t,n){var r=n(41),o=n(57);e.exports=function(e,t){return e&&r(t,o(t),e)}},function(e,t,n){var r=n(41),o=n(93);e.exports=function(e,t){return r(e,o(e),t)}},function(e,t,n){var r=n(41),o=n(183);e.exports=function(e,t){return r(e,o(e),t)}},function(e,t,n){var r=n(140),o=n(183),i=n(57);e.exports=function(e){return r(e,i,o)}},function(e,t){var n=Object.prototype.hasOwnProperty;e.exports=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&n.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},function(e,t,n){var r=n(119),o=n(416),i=n(417),a=n(418),s=n(184),u="[object Boolean]",c="[object Date]",l="[object Map]",p="[object Number]",f="[object RegExp]",d="[object Set]",h="[object String]",m="[object Symbol]",v="[object ArrayBuffer]",g="[object DataView]",y="[object Float32Array]",_="[object Float64Array]",b="[object Int8Array]",A="[object Int16Array]",C="[object Int32Array]",E="[object Uint8Array]",S="[object Uint8ClampedArray]",T="[object Uint16Array]",w="[object Uint32Array]";e.exports=function(e,t,n){var V=e.constructor;switch(t){case v:return r(e);case u:case c:return new V(+e);case g:return o(e,n);case y:case _:case b:case A:case C:case E:case S:case T:case w:return s(e,n);case l:return new V;case p:case h:return new V(e);case f:return i(e);case d:return new V;case m:return a(e)}}},function(e,t,n){var r=n(119);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},function(e,t){var n=/\w*$/;e.exports=function(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}},function(e,t,n){var r=n(34),o=r?r.prototype:void 0,i=o?o.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},function(e,t,n){var r=n(18),o=Object.create,i=function(){function e(){}return function(t){if(!r(t))return{};if(o)return o(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=i},function(e,t,n){var r=n(421),o=n(89),i=n(90),a=i&&i.isMap,s=a?o(a):r;e.exports=s},function(e,t,n){var r=n(72),o=n(19),i="[object Map]";e.exports=function(e){return o(e)&&r(e)==i}},function(e,t,n){var r=n(423),o=n(89),i=n(90),a=i&&i.isSet,s=a?o(a):r;e.exports=s},function(e,t,n){var r=n(72),o=n(19),i="[object Set]";e.exports=function(e){return o(e)&&r(e)==i}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e.anonymous||null,n=e.outbound||null,r="<";return r+=t?this.temp_gruu||"sip:anonymous@anonymous.invalid;transport=ws":this.pub_gruu||this.uri.toString(),!n||(t?this.temp_gruu:this.pub_gruu)||(r+=";ob"),r+=">"}};var r=["password","realm","ha1","display_name","register"];for(var o in this._configuration)Object.prototype.hasOwnProperty.call(this._configuration,o)&&(-1!==r.indexOf(o)?Object.defineProperty(this._configuration,o,{writable:!0,configurable:!1}):Object.defineProperty(this._configuration,o,{writable:!1,configurable:!1}));for(var i in S("configuration parameters after validation:"),this._configuration)if(Object.prototype.hasOwnProperty.call(E.settings,i))switch(i){case"uri":case"registrar_server":S("- ".concat(i,": ").concat(this._configuration[i]));break;case"password":case"ha1":S("- ".concat(i,": NOT SHOWN"));break;default:S("- ".concat(i,": ").concat(JSON.stringify(this._configuration[i])))}}},{key:"C",get:function(){return w}},{key:"status",get:function(){return this._status}},{key:"contact",get:function(){return this._contact}},{key:"configuration",get:function(){return this._configuration}},{key:"transport",get:function(){return this._transport}}]),t}()},function(e,t,n){"use strict";function r(e,t){for(var n=0;n"')}var t,n,c;return t=e,(n=[{key:"setExtraHeaders",value:function(e){Array.isArray(e)||(e=[]),this._extraHeaders=e.slice()}},{key:"setExtraContactParams",value:function(e){for(var t in e instanceof Object||(e={}),this._extraContactParams="",e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];this._extraContactParams+=";".concat(t),n&&(this._extraContactParams+="=".concat(n))}}},{key:"register",value:function(){var e=this;if(this._registering)u("Register request in progress...");else{var t=this._extraHeaders.slice();t.push("Contact: ".concat(this._contact,";expires=").concat(this._expires).concat(this._extraContactParams)),t.push("Expires: ".concat(this._expires));var n=new a.OutgoingRequest(i.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},t),r=new s(this._ua,n,{onRequestTimeout:function(){e._registrationFailure(null,i.causes.REQUEST_TIMEOUT)},onTransportError:function(){e._registrationFailure(null,i.causes.CONNECTION_ERROR)},onAuthenticated:function(){e._cseq+=1},onReceiveResponse:function(t){if(t.cseq===e._cseq)switch(null!==e._registrationTimer&&(clearTimeout(e._registrationTimer),e._registrationTimer=null),!0){case/^1[0-9]{2}$/.test(t.status_code):break;case/^2[0-9]{2}$/.test(t.status_code):if(e._registering=!1,!t.hasHeader("Contact")){u("no Contact header in response to REGISTER, response ignored");break}var n=t.headers.Contact.reduce(function(e,t){return e.concat(t.parsed)},[]).find(function(t){return t.uri.user===e._ua.contact.uri.user});if(!n){u("no Contact header pointing to us, response ignored");break}var r=n.getParam("expires");!r&&t.hasHeader("expires")&&(r=t.getHeader("expires")),r||(r=e._expires),(r=Number(r))<10&&(r=10),e._registrationTimer=setTimeout(function(){e._registrationTimer=null,0===e._ua.listeners("registrationExpiring").length?e.register():e._ua.emit("registrationExpiring")},1e3*r-5e3),n.hasParam("temp-gruu")&&(e._ua.contact.temp_gruu=n.getParam("temp-gruu").replace(/"/g,"")),n.hasParam("pub-gruu")&&(e._ua.contact.pub_gruu=n.getParam("pub-gruu").replace(/"/g,"")),e._registered||(e._registered=!0,e._ua.registered({response:t}));break;case/^423$/.test(t.status_code):t.hasHeader("min-expires")?(e._expires=Number(t.getHeader("min-expires")),e._expires<10&&(e._expires=10),e.register()):(u("423 response received for REGISTER without Min-Expires"),e._registrationFailure(t,i.causes.SIP_FAILURE_CODE));break;default:var a=o.sipErrorCause(t.status_code);e._registrationFailure(t,a)}}});this._registering=!0,r.send()}}},{key:"unregister",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._registered){this._registered=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null);var n=this._extraHeaders.slice();t.all?n.push("Contact: *".concat(this._extraContactParams)):n.push("Contact: ".concat(this._contact,";expires=0").concat(this._extraContactParams)),n.push("Expires: 0");var r=new a.OutgoingRequest(i.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},n);new s(this._ua,r,{onRequestTimeout:function(){e._unregistered(null,i.causes.REQUEST_TIMEOUT)},onTransportError:function(){e._unregistered(null,i.causes.CONNECTION_ERROR)},onAuthenticated:function(){e._cseq+=1},onReceiveResponse:function(t){switch(!0){case/^1[0-9]{2}$/.test(t.status_code):break;case/^2[0-9]{2}$/.test(t.status_code):e._unregistered(t);break;default:var n=o.sipErrorCause(t.status_code);e._unregistered(t,n)}}}).send()}else u("already unregistered")}},{key:"close",value:function(){this._registered&&this.unregister()}},{key:"onTransportClosed",value:function(){this._registering=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null),this._registered&&(this._registered=!1,this._ua.unregistered({}))}},{key:"_registrationFailure",value:function(e,t){this._registering=!1,this._ua.registrationFailed({response:e||null,cause:t}),this._registered&&(this._registered=!1,this._ua.unregistered({response:e||null,cause:t}))}},{key:"_unregistered",value:function(e,t){this._registering=!1,this._registered=!1,this._ua.unregistered({response:e||null,cause:t||null})}},{key:"registered",get:function(){return this._registered}}])&&r(t.prototype,n),c&&r(t,c),e}()},function(e,t,n){var r=function(e){return String(Number(e))===e?Number(e):e},o=function(e,t,n){var o=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:o&&!t[e.name]&&(t[e.name]={});var i=e.push?{}:o?t[e.name]:t;!function(e,t,n,o){if(o&&!n)t[o]=r(e[1]);else for(var i=0;i1&&(e[n[0]]=void 0),e};t.parseParams=function(e){return e.split(/\;\s?/).reduce(s,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],n=e.split(" ").map(r),o=0;o=r)return e;var o=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(o);case"%d":return Number(o);case"%v":return""}})}.apply(null,r)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];e.exports=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var n=t.outerOrder||a,o=t.innerOrder||s,u=[];return n.forEach(function(t){r[t].forEach(function(n){n.name in e&&null!=e[n.name]?u.push(i(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach(function(e){u.push(i(t,n,e))})})}),e.media.forEach(function(e){u.push(i("m",r.m[0],e)),o.forEach(function(t){r[t].forEach(function(n){n.name in e&&null!=e[n.name]?u.push(i(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach(function(e){u.push(i(t,n,e))})})})}),u.join("\r\n")+"\r\n"}},function(e,t,n){function r(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}e.exports=function(e,t){t=t||{};var c=typeof e;if("string"===c&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var u=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*s;case"weeks":case"week":case"w":return u*a;case"days":case"day":case"d":return u*i;case"hours":case"hour":case"hrs":case"hr":case"h":return u*o;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(e);if("number"===c&&!1===isNaN(e))return t.long?function(e){var t=Math.abs(e);if(t>=i)return u(e,t,i,"day");if(t>=o)return u(e,t,o,"hour");if(t>=r)return u(e,t,r,"minute");if(t>=n)return u(e,t,n,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=i)return Math.round(e/i)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=r)return Math.round(e/r)+"m";if(t>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){"use strict";function r(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:null;if(this._algorithm=t.algorithm,this._realm=t.realm,this._nonce=t.nonce,this._opaque=t.opaque,this._stale=t.stale,this._algorithm){if("MD5"!==this._algorithm)return a('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this._algorithm="MD5";if(!this._nonce)return a("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this._realm)return a("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this._credentials.password){if(!this._credentials.ha1)return a("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this._credentials.realm!==this._realm)return a('authenticate() | no plain SIP password, and stored `realm` does not match the given `realm`, cannot authenticate [stored:"%s", given:"%s"]',this._credentials.realm,this._realm),!1}if(t.qop)if(t.qop.indexOf("auth-int")>-1)this._qop="auth-int";else{if(!(t.qop.indexOf("auth")>-1))return a('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this._qop="auth"}else this._qop=null;this._method=n,this._uri=r,this._cnonce=u||o.createRandomToken(12),this._nc+=1;var c,l,p=Number(this._nc).toString(16);return this._ncHex="00000000".substr(0,8-p.length)+p,4294967296===this._nc&&(this._nc=1,this._ncHex="00000001"),this._credentials.password?this._ha1=o.calculateMD5("".concat(this._credentials.username,":").concat(this._realm,":").concat(this._credentials.password)):this._ha1=this._credentials.ha1,"auth"===this._qop?(c="".concat(this._method,":").concat(this._uri),l=o.calculateMD5(c),i('authenticate() | using qop=auth [a2:"%s"]',c),this._response=o.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth:").concat(l))):"auth-int"===this._qop?(c="".concat(this._method,":").concat(this._uri,":").concat(o.calculateMD5(s||"")),l=o.calculateMD5(c),i('authenticate() | using qop=auth-int [a2:"%s"]',c),this._response=o.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth-int:").concat(l))):null===this._qop&&(c="".concat(this._method,":").concat(this._uri),l=o.calculateMD5(c),i('authenticate() | using qop=null [a2:"%s"]',c),this._response=o.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(l))),i("authenticate() | response generated"),!0}},{key:"toString",value:function(){var e=[];if(!this._response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm=".concat(this._algorithm)),e.push('username="'.concat(this._credentials.username,'"')),e.push('realm="'.concat(this._realm,'"')),e.push('nonce="'.concat(this._nonce,'"')),e.push('uri="'.concat(this._uri,'"')),e.push('response="'.concat(this._response,'"')),this._opaque&&e.push('opaque="'.concat(this._opaque,'"')),this._qop&&(e.push("qop=".concat(this._qop)),e.push('cnonce="'.concat(this._cnonce,'"')),e.push("nc=".concat(this._ncHex))),"Digest ".concat(e.join(", "))}}])&&r(t.prototype,n),s&&r(t,s),e}()},function(e,t,n){"use strict";function r(e,t){for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:p.STATUS_CONFIRMED;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._owner=t,this._ua=t._ua,this._uac_pending_reply=!1,this._uas_pending_reply=!1,!n.hasHeader("contact"))return{error:"unable to create a Dialog without Contact header field"};n instanceof i.IncomingResponse&&(o=n.status_code<200?p.STATUS_EARLY:p.STATUS_CONFIRMED);var a=n.parseHeader("contact");"UAS"===r?(this._id={call_id:n.call_id,local_tag:n.to_tag,remote_tag:n.from_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._remote_seqnum=n.cseq,this._local_uri=n.parseHeader("to").uri,this._remote_uri=n.parseHeader("from").uri,this._remote_target=a.uri,this._route_set=n.getHeaders("record-route"),this._ack_seqnum=this._remote_seqnum):"UAC"===r&&(this._id={call_id:n.call_id,local_tag:n.from_tag,remote_tag:n.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._local_seqnum=n.cseq,this._local_uri=n.parseHeader("from").uri,this._remote_uri=n.parseHeader("to").uri,this._remote_target=a.uri,this._route_set=n.getHeaders("record-route").reverse(),this._ack_seqnum=null),this._ua.newDialog(this),l("new ".concat(r," dialog created with status ").concat(this._state===p.STATUS_EARLY?"EARLY":"CONFIRMED"))}return o(e,null,[{key:"C",get:function(){return p}}]),o(e,[{key:"update",value:function(e,t){this._state=p.STATUS_CONFIRMED,l("dialog ".concat(this._id.toString()," changed to CONFIRMED state")),"UAC"===t&&(this._route_set=e.getHeaders("record-route").reverse())}},{key:"terminate",value:function(){l("dialog ".concat(this._id.toString()," deleted")),this._ua.destroyDialog(this)}},{key:"sendRequest",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=c.cloneArray(n.extraHeaders),o=n.eventHandlers||{},i=n.body||null,a=this._createRequest(e,r,i);return o.onAuthenticated=function(){t._local_seqnum+=1},new u(this,a,o).send(),a}},{key:"receiveRequest",value:function(e){this._checkInDialogRequest(e)&&(e.method===a.ACK&&null!==this._ack_seqnum?this._ack_seqnum=null:e.method===a.INVITE&&(this._ack_seqnum=e.cseq),this._owner.receiveRequest(e))}},{key:"_createRequest",value:function(e,t,n){t=c.cloneArray(t),this._local_seqnum||(this._local_seqnum=Math.floor(1e4*Math.random()));var r=e===a.CANCEL||e===a.ACK?this._local_seqnum:this._local_seqnum+=1;return new i.OutgoingRequest(e,this._remote_target,this._ua,{cseq:r,call_id:this._id.call_id,from_uri:this._local_uri,from_tag:this._id.local_tag,to_uri:this._remote_uri,to_tag:this._id.remote_tag,route_set:this._route_set},t,n)}},{key:"_checkInDialogRequest",value:function(e){var t=this;if(this._remote_seqnum)if(e.cseqthis._remote_seqnum&&(this._remote_seqnum=e.cseq);else this._remote_seqnum=e.cseq;if(e.method===a.INVITE||e.method===a.UPDATE&&e.body){if(!0===this._uac_pending_reply)e.reply(491);else{if(!0===this._uas_pending_reply){var n=1+(10*Math.random()|0);return e.reply(500,null,["Retry-After:".concat(n)]),!1}this._uas_pending_reply=!0;e.server_transaction.on("stateChanged",function n(){e.server_transaction.state!==s.C.STATUS_ACCEPTED&&e.server_transaction.state!==s.C.STATUS_COMPLETED&&e.server_transaction.state!==s.C.STATUS_TERMINATED||(e.server_transaction.removeListener("stateChanged",n),t._uas_pending_reply=!1)})}e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===s.C.STATUS_ACCEPTED&&(t._remote_target=e.parseHeader("contact").uri)})}else e.method===a.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===s.C.STATUS_COMPLETED&&(t._remote_target=e.parseHeader("contact").uri)});return!0}},{key:"id",get:function(){return this._id}},{key:"local_seqnum",get:function(){return this._local_seqnum},set:function(e){this._local_seqnum=e}},{key:"owner",get:function(){return this._owner}},{key:"uac_pending_reply",get:function(){return this._uac_pending_reply},set:function(e){this._uac_pending_reply=e}},{key:"uas_pending_reply",get:function(){return this._uas_pending_reply}}]),e}()},function(e,t,n){"use strict";function r(e,t){for(var n=0;n=200&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):e.status_code>=300&&this._eventHandlers.onErrorResponse(e):(this._request.cseq.value=this._dialog.local_seqnum+=1,this._reattemptTimer=setTimeout(function(){t._dialog.owner.status!==a.C.STATUS_TERMINATED&&(t._reattempt=!0,t._request_sender.send())},1e3)):e.status_code>=200&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):e.status_code>=300&&this._eventHandlers.onErrorResponse(e)}},{key:"request",get:function(){return this._request}}])&&r(t.prototype,n),c&&r(t,c),e}()},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw new TypeError("Not enough arguments");if(this._direction="outgoing",this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new l.InvalidStateError(this._session.status);var r=p.cloneArray(n.extraHeaders);if(this.eventHandlers=n.eventHandlers||{},"string"==typeof e)e=e.toUpperCase();else{if("number"!=typeof e)throw new TypeError("Invalid tone: ".concat(e));e=e.toString()}if(!e.match(/^[0-9A-DR#*]$/))throw new TypeError("Invalid tone: ".concat(e));this._tone=e,this._duration=n.duration,r.push("Content-Type: application/dtmf-relay");var o="Signal=".concat(this._tone,"\r\n");o+="Duration=".concat(this._duration),this._session.newDTMF({originator:"local",dtmf:this,request:this._request}),this._session.sendRequest(c.INFO,{extraHeaders:r,eventHandlers:{onSuccessResponse:function(e){t.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){t.eventHandlers.onFailed&&t.eventHandlers.onFailed(),t.emit("failed",{originator:"remote",response:e})},onRequestTimeout:function(){t._session.onRequestTimeout()},onTransportError:function(){t._session.onTransportError()},onDialogError:function(){t._session.onDialogError()}},body:o})}},{key:"init_incoming",value:function(e){var t=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,n=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;if(this._direction="incoming",this._request=e,e.reply(200),e.body){var r=e.body.split("\n");r.length>=1&&t.test(r[0])&&(this._tone=r[0].replace(t,"$2")),r.length>=2&&n.test(r[1])&&(this._duration=parseInt(r[1].replace(n,"$2"),10))}this._duration||(this._duration=d.DEFAULT_DURATION),this._tone?this._session.newDTMF({originator:"remote",dtmf:this,request:e}):f("invalid INFO DTMF received, discarded")}},{key:"tone",get:function(){return this._tone}},{key:"duration",get:function(){return this._duration}}])&&o(n.prototype,r),h&&o(n,h),t}(),e.exports.C=d},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};if(this._direction="outgoing",void 0===e)throw new TypeError("Not enough arguments");if(this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new l.InvalidStateError(this._session.status);this._contentType=e,this._body=t;var o=p.cloneArray(r.extraHeaders);o.push("Content-Type: ".concat(e)),this._session.newInfo({originator:"local",info:this,request:this.request}),this._session.sendRequest(c.INFO,{extraHeaders:o,eventHandlers:{onSuccessResponse:function(e){n.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){n.emit("failed",{originator:"remote",response:e})},onTransportError:function(){n._session.onTransportError()},onRequestTimeout:function(){n._session.onRequestTimeout()},onDialogError:function(){n._session.onDialogError()}},body:t})}},{key:"init_incoming",value:function(e){this._direction="incoming",this.request=e,e.reply(200),this._contentType=e.getHeader("content-type"),this._body=e.body,this._session.newInfo({originator:"remote",info:this,request:e})}},{key:"contentType",get:function(){return this._contentType}},{key:"body",get:function(){return this._body}}])&&o(n.prototype,r),f&&o(n,f),t}()},function(e,t,n){"use strict";function r(e,t){for(var n=0;n=200?"terminated;reason=noresource":"active;expires=".concat(this._expires),this._session.sendRequest(o.NOTIFY,{extraHeaders:["Event: ".concat(a.event_type,";id=").concat(this._id),"Subscription-State: ".concat(n),"Content-Type: ".concat(a.body_type)],body:"SIP/2.0 ".concat(e," ").concat(t),eventHandlers:{onErrorResponse:function(){this._active=!1}}}))}}])&&r(t.prototype,n),s&&r(t,s),e}()},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};f("sendRefer()");var r=p.cloneArray(n.extraHeaders),o=n.eventHandlers||{};for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&this.on(i,o[i]);var a=null;n.replaces&&(a=n.replaces._request.call_id,a+=";to-tag=".concat(n.replaces._to_tag),a+=";from-tag=".concat(n.replaces._from_tag),a=encodeURIComponent(a));var s="Refer-To: <".concat(e).concat(a?"?Replaces=".concat(a):"",">");r.push(s),r.push("Contact: ".concat(this._session.contact));var u=this._session.sendRequest(c.REFER,{extraHeaders:r,eventHandlers:{onSuccessResponse:function(e){t._requestSucceeded(e)},onErrorResponse:function(e){t._requestFailed(e,c.causes.REJECTED)},onTransportError:function(){t._requestFailed(null,c.causes.CONNECTION_ERROR)},onRequestTimeout:function(){t._requestFailed(null,c.causes.REQUEST_TIMEOUT)},onDialogError:function(){t._requestFailed(null,c.causes.DIALOG_ERROR)}}});this._id=u.cseq}},{key:"receiveNotify",value:function(e){if(f("receiveNotify()"),e.body){var t=l.parse(e.body.trim(),"Status_Line");if(-1!==t)switch(!0){case/^100$/.test(t.status_code):this.emit("trying",{request:e,status_line:t});break;case/^1[0-9]{2}$/.test(t.status_code):this.emit("progress",{request:e,status_line:t});break;case/^2[0-9]{2}$/.test(t.status_code):this.emit("accepted",{request:e,status_line:t});break;default:this.emit("failed",{request:e,status_line:t})}else f('receiveNotify() | error parsing NOTIFY body: "'.concat(e.body,'"'))}}},{key:"_requestSucceeded",value:function(e){f("REFER succeeded"),f('emit "requestSucceeded"'),this.emit("requestSucceeded",{response:e})}},{key:"_requestFailed",value:function(e,t){f("REFER failed"),f('emit "requestFailed"'),this.emit("requestFailed",{response:e||null,cause:t})}},{key:"id",get:function(){return this._id}}])&&o(n.prototype,r),d&&o(n,d),t}()},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{},o=e;if(void 0===e||void 0===t)throw new TypeError("Not enough arguments");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));var i=p.cloneArray(r.extraHeaders),a=r.eventHandlers||{},s=r.contentType||"text/plain";for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&this.on(u,a[u]);i.push("Content-Type: ".concat(s)),this._request=new l.OutgoingRequest(c.MESSAGE,e,this._ua,null,i),t&&(this._request.body=t);var d=new f(this._ua,this._request,{onRequestTimeout:function(){n._onRequestTimeout()},onTransportError:function(){n._onTransportError()},onReceiveResponse:function(e){n._receiveResponse(e)}});this._newMessage("local",this._request),d.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newMessage("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=p.cloneArray(e.extraHeaders),n=e.body;if("incoming"!==this._direction)throw new d.NotSupportedError('"accept" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");this._is_replied=!0,this._request.reply(200,null,t,n)}},{key:"reject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,n=e.reason_phrase,r=p.cloneArray(e.extraHeaders),o=e.body;if("incoming"!==this._direction)throw new d.NotSupportedError('"reject" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");if(t<300||t>=700)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,n,r,o)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=p.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,c.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,c.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newMessage",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newMessage(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,n){h("MESSAGE failed"),this._close(),h('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:n})}},{key:"_succeeded",value:function(e,t){h("MESSAGE succeeded"),this._close(),h('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}}])&&o(n.prototype,r),m&&o(n,m),t}()},function(e,t,n){"use strict";function r(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:s.recovery_options;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i("new()"),this.status=s.STATUS_DISCONNECTED,this.socket=null,this.sockets=[],this.recovery_options=n,this.recover_attempts=0,this.recovery_timer=null,this.close_requested=!1,void 0===t)throw new TypeError("Invalid argument. undefined 'sockets' argument");t instanceof Array||(t=[t]),t.forEach(function(e){if(!o.isSocket(e.socket))throw new TypeError("Invalid argument. invalid 'JsSIP.Socket' instance");if(e.weight&&!Number(e.weight))throw new TypeError("Invalid argument. 'weight' attribute is not a number");this.sockets.push({socket:e.socket,weight:e.weight||0,status:s.SOCKET_STATUS_READY})},this),this._getSocket()}var t,n,u;return t=e,(n=[{key:"connect",value:function(){i("connect()"),this.isConnected()?i("Transport is already connected"):this.isConnecting()?i("Transport is connecting"):(this.close_requested=!1,this.status=s.STATUS_CONNECTING,this.onconnecting({socket:this.socket,attempts:this.recover_attempts}),this.close_requested||(this.socket.onconnect=this._onConnect.bind(this),this.socket.ondisconnect=this._onDisconnect.bind(this),this.socket.ondata=this._onData.bind(this),this.socket.connect()))}},{key:"disconnect",value:function(){i("close()"),this.close_requested=!0,this.recover_attempts=0,this.status=s.STATUS_DISCONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.socket.onconnect=function(){},this.socket.ondisconnect=function(){},this.socket.ondata=function(){},this.socket.disconnect(),this.ondisconnect({socket:this.socket,error:!1})}},{key:"send",value:function(e){if(i("send()"),!this.isConnected())return a("unable to send message, transport is not connected"),!1;var t=e.toString();return i("sending message:\n\n".concat(t,"\n")),this.socket.send(t)}},{key:"isConnected",value:function(){return this.status===s.STATUS_CONNECTED}},{key:"isConnecting",value:function(){return this.status===s.STATUS_CONNECTING}},{key:"_reconnect",value:function(){var e=this;this.recover_attempts+=1;var t=Math.floor(Math.random()*Math.pow(2,this.recover_attempts)+1);tthis.recovery_options.max_interval&&(t=this.recovery_options.max_interval),i("reconnection attempt: ".concat(this.recover_attempts,". next connection attempt in ").concat(t," seconds")),this.recovery_timer=setTimeout(function(){e.close_requested||e.isConnected()||e.isConnecting()||(e._getSocket(),e.connect())},1e3*t)}},{key:"_getSocket",value:function(){var e=[];if(this.sockets.forEach(function(t){t.status!==s.SOCKET_STATUS_ERROR&&(0===e.length?e.push(t):t.weight>e[0].weight?e=[t]:t.weight===e[0].weight&&e.push(t))}),0===e.length)return this.sockets.forEach(function(e){e.status=s.SOCKET_STATUS_READY}),void this._getSocket();var t=Math.floor(Math.random()*e.length);this.socket=e[t].socket}},{key:"_onConnect",value:function(){this.recover_attempts=0,this.status=s.STATUS_CONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.onconnect({socket:this})}},{key:"_onDisconnect",value:function(e,t,n){this.status=s.STATUS_DISCONNECTED,this.ondisconnect({socket:this.socket,error:e,code:t,reason:n}),this.close_requested||(this.sockets.forEach(function(e){this.socket===e.socket&&(e.status=s.SOCKET_STATUS_ERROR)},this),this._reconnect(e))}},{key:"_onData",value:function(e){if("\r\n"!==e){if("string"!=typeof e){try{e=String.fromCharCode.apply(null,new Uint8Array(e))}catch(e){return void i("received binary message failed to be converted into string, message discarded")}i("received binary message:\n\n".concat(e,"\n"))}else i("received text message:\n\n".concat(e,"\n"));this.ondata({transport:this,message:e})}else i("received message with CRLF Keep Alive response")}},{key:"via_transport",get:function(){return this.socket.via_transport}},{key:"url",get:function(){return this.socket.url}},{key:"sip_uri",get:function(){return this.socket.sip_uri}}])&&r(t.prototype,n),u&&r(t,u),e}()},function(e,t,n){"use strict";var r=n(16),o=n(27),i=n(4)("JsSIP:ERROR:Parser");function a(e,t){var n=t,r=0,o=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;0===r;){if(-1===(o=e.indexOf("\r\n",n)))return o;!e.substring(o+2,o+4).match(/(^\r\n)/)&&e.charAt(o+2).match(/(^\s+)/)?n=o+2:r=o}return r}function s(e,t,n,i){var a,s=t.indexOf(":",n),u=t.substring(n,s).trim(),c=t.substring(s+1,i).trim();switch(u.toLowerCase()){case"via":case"v":e.addHeader("via",c),1===e.getHeaders("via").length?(a=e.parseHeader("Via"))&&(e.via=a,e.via_branch=a.branch):a=0;break;case"from":case"f":e.setHeader("from",c),(a=e.parseHeader("from"))&&(e.from=a,e.from_tag=a.getParam("tag"));break;case"to":case"t":e.setHeader("to",c),(a=e.parseHeader("to"))&&(e.to=a,e.to_tag=a.getParam("tag"));break;case"record-route":if(-1===(a=r.parse(c,"Record_Route")))a=void 0;else{var l=!0,p=!1,f=void 0;try{for(var d,h=a[Symbol.iterator]();!(l=(d=h.next()).done);l=!0){var m=d.value;e.addHeader("record-route",c.substring(m.possition,m.offset)),e.headers["Record-Route"][e.getHeaders("record-route").length-1].parsed=m.parsed}}catch(e){p=!0,f=e}finally{try{l||null==h.return||h.return()}finally{if(p)throw f}}}break;case"call-id":case"i":e.setHeader("call-id",c),(a=e.parseHeader("call-id"))&&(e.call_id=c);break;case"contact":case"m":if(-1===(a=r.parse(c,"Contact")))a=void 0;else{var v=!0,g=!1,y=void 0;try{for(var _,b=a[Symbol.iterator]();!(v=(_=b.next()).done);v=!0){var A=_.value;e.addHeader("contact",c.substring(A.possition,A.offset)),e.headers.Contact[e.getHeaders("contact").length-1].parsed=A.parsed}}catch(e){g=!0,y=e}finally{try{v||null==b.return||b.return()}finally{if(g)throw y}}}break;case"content-length":case"l":e.setHeader("content-length",c),a=e.parseHeader("content-length");break;case"content-type":case"c":e.setHeader("content-type",c),a=e.parseHeader("content-type");break;case"cseq":e.setHeader("cseq",c),(a=e.parseHeader("cseq"))&&(e.cseq=a.value),e instanceof o.IncomingResponse&&(e.method=a.method);break;case"max-forwards":e.setHeader("max-forwards",c),a=e.parseHeader("max-forwards");break;case"www-authenticate":e.setHeader("www-authenticate",c),a=e.parseHeader("www-authenticate");break;case"proxy-authenticate":e.setHeader("proxy-authenticate",c),a=e.parseHeader("proxy-authenticate");break;case"session-expires":case"x":e.setHeader("session-expires",c),(a=e.parseHeader("session-expires"))&&(e.session_expires=a.expires,e.session_expires_refresher=a.refresher);break;case"refer-to":case"r":e.setHeader("refer-to",c),(a=e.parseHeader("refer-to"))&&(e.refer_to=a);break;case"replaces":e.setHeader("replaces",c),(a=e.parseHeader("replaces"))&&(e.replaces=a);break;case"event":case"o":e.setHeader("event",c),(a=e.parseHeader("event"))&&(e.event=a);break;default:e.addHeader(u,c),a=0}return void 0!==a||{error:'error parsing header "'.concat(u,'"')}}i.log=console.warn.bind(console),t.parseMessage=function(e,t){var n,u,c=e.indexOf("\r\n");if(-1!==c){var l=e.substring(0,c),p=r.parse(l,"Request_Response");if(-1!==p){p.status_code?((n=new o.IncomingResponse).status_code=p.status_code,n.reason_phrase=p.reason_phrase):((n=new o.IncomingRequest(t)).method=p.method,n.ruri=p.uri),n.data=e;for(var f=c+2;;){if(-2===(c=a(e,f))){u=f+2;break}if(-1===c)return void i("parseMessage() | malformed message");if(!0!==(p=s(n,e,f,c)))return void i("parseMessage() |",p.error);f=c+2}if(n.hasHeader("content-length")){var d=n.getHeader("content-length");n.body=e.substr(u,d)}else n.body=e.substring(u);return n}i('parseMessage() | error parsing first line of SIP message: "'.concat(l,'"'))}else i("parseMessage() | no CRLF found, not a SIP message")}},function(e,t,n){"use strict";var r,o,i,a=n(9),s=n(27),u=n(12),c=n(4)("JsSIP:sanityCheck"),l=[function(){for(var e=["from","to","call_id","cseq","via"],t=0;t1)return c("more than one Via header field present in the response, dropping the response"),!1},function(){var e=u.str_utf8_length(r.body),t=r.getHeader("content-length");if(e0)return t}},connection_recovery_min_interval:function(e){if(r.isDecimal(e)){var t=Number(e);if(t>0)return t}},contact_uri:function(e){if("string"==typeof e){var t=i.parse(e,"SIP_URI");if(-1!==t)return t}},display_name:function(e){return-1===i.parse('"'.concat(e,'"'),"display_name")?void 0:e},instance_id:function(e){return/^uuid:/i.test(e)&&(e=e.substr(5)),-1===i.parse(e,"uuid")?void 0:e},no_answer_timeout:function(e){if(r.isDecimal(e)){var t=Number(e);if(t>0)return t}},session_timers:function(e){if("boolean"==typeof e)return e},session_timers_refresh_method:function(e){if("string"==typeof e&&((e=e.toUpperCase())===o.INVITE||e===o.UPDATE))return e},password:function(e){return String(e)},realm:function(e){return String(e)},ha1:function(e){return String(e)},register:function(e){if("boolean"==typeof e)return e},register_expires:function(e){if(r.isDecimal(e)){var t=Number(e);if(t>0)return t}},registrar_server:function(e){/^sip:/i.test(e)||(e="".concat(o.SIP,":").concat(e));var t=a.parse(e);return t?t.user?void 0:t:void 0},use_preloaded_route:function(e){if("boolean"==typeof e)return e}}};t.load=function(e,t){for(var n in c.mandatory){if(!t.hasOwnProperty(n))throw new u.ConfigurationError(n);var o=t[n],i=c.mandatory[n](o);if(void 0===i)throw new u.ConfigurationError(n,o);e[n]=i}for(var a in c.optional)if(t.hasOwnProperty(a)){var s=t[a];if(r.isEmpty(s))continue;var l=c.optional[a](s);if(void 0===l)throw new u.ConfigurationError(a,s);e[a]=l}}},function(e,t,n){"use strict";function r(e,t){for(var n=0;n=0;--n)if(1===(e=t[n]).nodeType)return e;return null},nextElementSibling:function(){for(var e=this.nextSibling;e&&1!==e.nodeType;)e=e.nextSibling;return e},previousElementSibling:function(){for(var e=this.previousSibling;e&&1!==e.nodeType;)e=e.previousSibling;return e},childElementCount:function(){for(var e=0,t=this.children,n=0,r=t.length;n0&&i(l)?n>1?e(l,n-1,i,a,s):r(s,l):a||(s[s.length]=l)}return s}},function(e,t,n){var r=n(34),o=n(62),i=n(11),a=r?r.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||o(e)||!!(a&&e&&e[a])}},function(e,t,n){var r=n(74);e.exports=function(e,t){var n=[];return r(e,function(e,r,o){t(e,r,o)&&n.push(e)}),n}},function(e,t,n){(function(t){var r=n(194),o=n(82)("socket.io-client:url");e.exports=function(e,n){var i=e;n=n||t.location,null==e&&(e=n.protocol+"//"+n.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(o("protocol-less url %s",e),e=void 0!==n?n.protocol+"//"+e:"https://"+e),o("parse %s",e),i=r(e));i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443"));i.path=i.path||"/";var a=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+a+":"+i.port,i.href=i.protocol+"://"+a+(n&&n.port===i.port?"":":"+i.port),i}}).call(this,n(10))},function(e,t,n){(t=e.exports=i.debug=i).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){t.save(e);for(var n=(e||"").split(/[\s,]+/),r=n.length,o=0;o0)return function(e){if((e=String(e)).length>1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return s*a;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"hrs":case"hr":case"h":return s*o;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===c&&!1===isNaN(e))return t.long?s(u=e,i,"day")||s(u,o,"hour")||s(u,r,"minute")||s(u,n,"second")||u+" ms":function(e){if(e>=i)return Math.round(e/i)+"d";if(e>=o)return Math.round(e/o)+"h";if(e>=r)return Math.round(e/r)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){function r(){var e;try{e=t.storage.debug}catch(e){}return e}(t=e.exports=n(456)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(){var e=arguments,n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)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},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){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},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(r())},function(e,t,n){(t=e.exports=function(e){function n(){}function i(){var e=i,n=+new Date,a=n-(r||n);e.diff=a,e.prev=r,e.curr=n,r=n,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=t.colors[o++%t.colors.length]);var s=Array.prototype.slice.call(arguments);s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var u=0;s[0]=s[0].replace(/%([a-z%])/g,function(n,r){if("%%"===n)return n;u++;var o=t.formatters[r];if("function"==typeof o){var i=s[u];n=o.call(e,i),s.splice(u,1),u--}return n}),"function"==typeof t.formatArgs&&(s=t.formatArgs.apply(e,s));var c=i.log||t.log||console.log.bind(console);c.apply(e,s)}n.enabled=!1,i.enabled=!0;var a=t.enabled(e)?i:n;return a.namespace=e,a}).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){t.save(e);for(var n=(e||"").split(/[\s,]+/),r=n.length,o=0;o1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return s*a;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"hrs":case"hr":case"h":return s*o;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s}}(e):t.long?s(u=e,i,"day")||s(u,o,"hour")||s(u,r,"minute")||s(u,n,"second")||u+" ms":function(e){return e>=i?Math.round(e/i)+"d":e>=o?Math.round(e/o)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}(e);var u}},function(e,t,n){(function(e,r){var o;/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */(function(){var i=n(459),a={function:!0,object:!0},s=a[typeof t]&&t&&!t.nodeType&&t,u=a[typeof window]&&window||this,c=s&&a[typeof e]&&e&&!e.nodeType&&"object"==typeof r&&r;function l(e,t){e||(e=u.Object()),t||(t=u.Object());var n=e.Number||u.Number,r=e.String||u.String,o=e.Object||u.Object,i=e.Date||u.Date,s=e.SyntaxError||u.SyntaxError,c=e.TypeError||u.TypeError,p=e.Math||u.Math,f=e.JSON||u.JSON;"object"==typeof f&&f&&(t.stringify=f.stringify,t.parse=f.parse);var d,h,m,v=o.prototype,g=v.toString,y=new i(-0xc782b5b800cec);try{y=-109252==y.getUTCFullYear()&&0===y.getUTCMonth()&&1===y.getUTCDate()&&10==y.getUTCHours()&&37==y.getUTCMinutes()&&6==y.getUTCSeconds()&&708==y.getUTCMilliseconds()}catch(e){}function _(e){if(_[e]!==m)return _[e];var o;if("bug-string-char-index"==e)o="a"!="a"[0];else if("json"==e)o=_("json-stringify")&&_("json-parse");else{var a,s='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==e){var u=t.stringify,c="function"==typeof u&&y;if(c){(a=function(){return 1}).toJSON=a;try{c="0"===u(0)&&"0"===u(new n)&&'""'==u(new r)&&u(g)===m&&u(m)===m&&u()===m&&"1"===u(a)&&"[1]"==u([a])&&"[null]"==u([m])&&"null"==u(null)&&"[null,null,null]"==u([m,g,null])&&u({a:[a,!0,!1,null,"\0\b\n\f\r\t"]})==s&&"1"===u(null,a)&&"[\n 1,\n 2\n]"==u([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==u(new i(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==u(new i(864e13))&&'"-000001-01-01T00:00:00.000Z"'==u(new i(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==u(new i(-1))}catch(e){c=!1}}o=c}if("json-parse"==e){var l=t.parse;if("function"==typeof l)try{if(0===l("0")&&!l(!1)){var p=5==(a=l(s)).a.length&&1===a.a[0];if(p){try{p=!l('"\t"')}catch(e){}if(p)try{p=1!==l("01")}catch(e){}if(p)try{p=1!==l("1.")}catch(e){}}}}catch(e){p=!1}o=p}}return _[e]=!!o}if(!_("json")){var b=_("bug-string-char-index");if(!y)var A=p.floor,C=[0,31,59,90,120,151,181,212,243,273,304,334],E=function(e,t){return C[t]+365*(e-1970)+A((e-1969+(t=+(t>1)))/4)-A((e-1901+t)/100)+A((e-1601+t)/400)};if((d=v.hasOwnProperty)||(d=function(e){var t,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=g?d=function(e){var t=this.__proto__,n=e in(this.__proto__=null,this);return this.__proto__=t,n}:(t=n.constructor,d=function(e){var n=(this.constructor||t).prototype;return e in this&&!(e in n&&this[e]===n[e])}),n=null,d.call(this,e)}),h=function(e,t){var n,r,o,i=0;for(o in(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n)d.call(r,o)&&i++;return n=r=null,i?h=2==i?function(e,t){var n,r={},o="[object Function]"==g.call(e);for(n in e)o&&"prototype"==n||d.call(r,n)||!(r[n]=1)||!d.call(e,n)||t(n)}:function(e,t){var n,r,o="[object Function]"==g.call(e);for(n in e)o&&"prototype"==n||!d.call(e,n)||(r="constructor"===n)||t(n);(r||d.call(e,n="constructor"))&&t(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],h=function(e,t){var n,o,i="[object Function]"==g.call(e),s=!i&&"function"!=typeof e.constructor&&a[typeof e.hasOwnProperty]&&e.hasOwnProperty||d;for(n in e)i&&"prototype"==n||!s.call(e,n)||t(n);for(o=r.length;n=r[--o];s.call(e,n)&&t(n));}),h(e,t)},!_("json-stringify")){var S={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},T=function(e,t){return("000000"+(t||0)).slice(-e)},w=function(e){for(var t='"',n=0,r=e.length,o=!b||r>10,i=o&&(b?e.split(""):e);n-1/0&&s<1/0){if(E){for(f=A(s/864e5),l=A(f/365.2425)+1970-1;E(l+1,0)<=f;l++);for(p=A((f-E(l,0))/30.42);E(l,p+1)<=f;p++);f=1+f-E(l,p),y=A((v=(s%864e5+864e5)%864e5)/36e5)%24,_=A(v/6e4)%60,b=A(v/1e3)%60,C=v%1e3}else l=s.getUTCFullYear(),p=s.getUTCMonth(),f=s.getUTCDate(),y=s.getUTCHours(),_=s.getUTCMinutes(),b=s.getUTCSeconds(),C=s.getUTCMilliseconds();s=(l<=0||l>=1e4?(l<0?"-":"+")+T(6,l<0?-l:l):T(4,l))+"-"+T(2,p+1)+"-"+T(2,f)+"T"+T(2,y)+":"+T(2,_)+":"+T(2,b)+"."+T(3,C)+"Z"}else s=null;if(n&&(s=n.call(t,e,s)),null===s)return"null";if("[object Boolean]"==(u=g.call(s)))return""+s;if("[object Number]"==u)return s>-1/0&&s<1/0?""+s:"null";if("[object String]"==u)return w(""+s);if("object"==typeof s){for(I=a.length;I--;)if(a[I]===s)throw c();if(a.push(s),S=[],O=i,i+=o,"[object Array]"==u){for(R=0,I=s.length;R0)for(r="",n>10&&(n=10);r.length=48&&o<=57||o>=97&&o<=102||o>=65&&o<=70||x();e+=I("0x"+i.slice(t,k));break;default:x()}else{if(34==o)break;for(o=i.charCodeAt(k),t=k;o>=32&&92!=o&&34!=o;)o=i.charCodeAt(++k);e+=i.slice(t,k)}if(34==i.charCodeAt(k))return k++,e;x();default:if(t=k,45==o&&(r=!0,o=i.charCodeAt(++k)),o>=48&&o<=57){for(48==o&&((o=i.charCodeAt(k+1))>=48&&o<=57)&&x(),r=!1;k=48&&o<=57);k++);if(46==i.charCodeAt(k)){for(n=++k;n=48&&o<=57);n++);n==k&&x(),k=n}if(101==(o=i.charCodeAt(k))||69==o){for(43!=(o=i.charCodeAt(++k))&&45!=o||k++,n=k;n=48&&o<=57);n++);n==k&&x(),k=n}return+i.slice(t,k)}if(r&&x(),"true"==i.slice(k,k+4))return k+=4,!0;if("false"==i.slice(k,k+5))return k+=5,!1;if("null"==i.slice(k,k+4))return k+=4,null;x()}return"$"},M=function(e){var t,n;if("$"==e&&x(),"string"==typeof e){if("@"==(b?e.charAt(0):e[0]))return e.slice(1);if("["==e){for(t=[];"]"!=(e=q());n||(n=!0))n&&(","==e?"]"==(e=q())&&x():x()),","==e&&x(),t.push(M(e));return t}if("{"==e){for(t={};"}"!=(e=q());n||(n=!0))n&&(","==e?"}"==(e=q())&&x():x()),","!=e&&"string"==typeof e&&"@"==(b?e.charAt(0):e[0])&&":"==q()||x(),t[e.slice(1)]=M(q());return t}x()}return e},P=function(e,t,n){var r=N(e,t,n);r===m?delete e[t]:e[t]=r},N=function(e,t,n){var r,o=e[t];if("object"==typeof o&&o)if("[object Array]"==g.call(o))for(r=o.length;r--;)P(o,r,n);else h(o,function(e){P(o,e,n)});return n.call(e,t,o)};t.parse=function(e,t){var n,r;return k=0,R=""+e,n=M(q()),"$"!=q()&&x(),k=R=null,t&&"[object Function]"==g.call(t)?N(((r={})[""]=n,r),"",t):n}}}return t.runInContext=l,t}if(!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c),s&&!i)l(u,s);else{var p=u.JSON,f=u.JSON3,d=!1,h=l(u,u.JSON3={noConflict:function(){return d||(d=!0,u.JSON=p,u.JSON3=f,p=f=null),h}});u.JSON={parse:h.parse,stringify:h.stringify}}i&&(void 0===(o=function(){return h}.call(t,n,t,e))||(e.exports=o))}).call(this)}).call(this,n(48)(e),n(10))},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t){function n(e){if(e)return function(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}(e)}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[e]=this._callbacks[e]||[]).push(t),this},n.prototype.once=function(e,t){var n=this;function r(){n.off(e,r),t.apply(this,arguments)}return this._callbacks=this._callbacks||{},r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks[e];if(!r)return this;if(1==arguments.length)return delete this._callbacks[e],this;for(var o=0;o0&&(this.extraHeaders=n.extraHeaders),n.localAddress&&(this.localAddress=n.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}e.exports=p,p.priorWebsocketSuccess=!1,o(p.prototype),p.protocol=s.protocol,p.Socket=p,p.Transport=n(123),p.transports=n(197),p.parser=n(43),p.prototype.createTransport=function(e){i('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);return t.EIO=s.protocol,t.transport=e,this.id&&(t.sid=this.id),new r[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,perMessageDeflate:this.perMessageDeflate,extraHeaders:this.extraHeaders,forceNode:this.forceNode,localAddress:this.localAddress})},p.prototype.open=function(){var e;if(this.rememberUpgrade&&p.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},p.prototype.setTransport=function(e){i("setting transport %s",e.name);var t=this;this.transport&&(i("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")})},p.prototype.probe=function(e){i('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function o(){if(r.onlyBinaryUpgrades){var o=!this.supportsBinary&&r.transport.supportsBinary;n=n||o}n||(i('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(o){if(!n)if("pong"===o.type&&"probe"===o.data){if(i('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;p.priorWebsocketSuccess="websocket"===t.name,i('pausing current transport "%s"',r.transport.name),r.transport.pause(function(){n||"closed"!==r.readyState&&(i("changing transport and sending upgrade packet"),f(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())})}else{i('probe transport "%s" failed',e);var a=new Error("probe error");a.transport=t.name,r.emit("upgradeError",a)}}))}function a(){n||(n=!0,f(),t.close(),t=null)}function s(n){var o=new Error("probe error: "+n);o.transport=t.name,a(),i('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",o)}function u(){s("transport closed")}function c(){s("socket closed")}function l(e){t&&e.name!==t.name&&(i('"%s" works - aborting "%s"',e.name,t.name),a())}function f(){t.removeListener("open",o),t.removeListener("error",s),t.removeListener("close",u),r.removeListener("close",c),r.removeListener("upgrading",l)}p.priorWebsocketSuccess=!1,t.once("open",o),t.once("error",s),t.once("close",u),this.once("close",c),this.once("upgrading",l),t.open()},p.prototype.onOpen=function(){if(i("socket open"),this.readyState="open",p.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){i("starting upgrade probes");for(var e=0,t=this.upgrades.length;er&&(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;a=55296&&t<=56319&&o>t&63|128)}function h(e){if(0==(4294967168&e))return p(e);var t="";return 0==(4294965248&e)?t=p(e>>6&31|192):0==(4294901760&e)?(t=p(e>>12&15|224),t+=d(e,6)):0==(4292870144&e)&&(t=p(e>>18&7|240),t+=d(e,12),t+=d(e,6)),t+=p(63&e|128)}function m(){if(l>=c)throw Error("Invalid byte index");var e=255&u[l];if(l++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function v(){var e,t;if(l>c)throw Error("Invalid byte index");if(l==c)return!1;if(e=255&u[l],l++,0==(128&e))return e;if(192==(224&e)){if((t=(31&e)<<6|m())>=128)return t;throw Error("Invalid continuation byte")}if(224==(240&e)){if((t=(15&e)<<12|m()<<6|m())>=2048)return t;throw Error("Invalid continuation byte")}if(240==(248&e)&&(t=(15&e)<<18|m()<<12|m()<<6|m())>=65536&&t<=1114111)return t;throw Error("Invalid WTF-8 detected")}var g={version:"1.0.0",encode:function(e){for(var t=f(e),n=t.length,r=-1,o="";++r65535&&(o+=p((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=p(t);return o}(n)}};void 0===(o=function(){return g}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(48)(e),n(10))},function(e,t){!function(){"use strict";for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),r=0;r>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 o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},t.decode=function(e){var t,r,o,i,a,s=.75*e.length,u=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var l=new ArrayBuffer(s),p=new Uint8Array(l);for(t=0;t>4,p[c++]=(15&o)<<4|i>>2,p[c++]=(3&i)<<6|63&a;return l}}()},function(e,t,n){(function(t){var n=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,r=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),o=r&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),i=n&&n.prototype.append&&n.prototype.getBlob;function a(e){for(var t=0;t0)return function(e){if((e=String(e)).length>1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return s*a;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"hrs":case"hr":case"h":return s*o;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===c&&!1===isNaN(e))return t.long?s(u=e,i,"day")||s(u,o,"hour")||s(u,r,"minute")||s(u,n,"second")||u+" ms":function(e){if(e>=i)return Math.round(e/i)+"d";if(e>=o)return Math.round(e/o)+"h";if(e>=r)return Math.round(e/r)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){(function(t){var r=n(198),o=n(83);e.exports=c;var i,a=/\n/g,s=/\\n/g;function u(){}function c(e){r.call(this,e),this.query=this.query||{},i||(t.___eio||(t.___eio=[]),i=t.___eio),this.index=i.length;var n=this;i.push(function(e){n.onData(e)}),this.query.j=this.index,t.document&&t.addEventListener&&t.addEventListener("beforeunload",function(){n.script&&(n.script.onerror=u)},!1)}o(c,r),c.prototype.supportsBinary=!1,c.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),r.prototype.doClose.call(this)},c.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?n.parentNode.insertBefore(t,n):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},c.prototype.doWrite=function(e,t){var n=this;if(!this.form){var r,o=document.createElement("form"),i=document.createElement("textarea"),u=this.iframeId="eio_iframe_"+this.index;o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=u,o.method="POST",o.setAttribute("accept-charset","utf-8"),i.name="d",o.appendChild(i),document.body.appendChild(o),this.form=o,this.area=i}function c(){l(),t()}function l(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(e){n.onError("jsonp polling iframe removal error",e)}try{var e='