text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.WebRTC=t():e.WebRTC=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var i=n(99),o=r(i),a=n(112),s=(r(a),n(358)),c=r(s),d=n(49),u=n(67),l=n(310),p=r(l),f="5.0.0",h="3.9.0",m=n(220),v=n(277),g=n(286),y=n(287),S=n(288),b=void 0,C=(0,o["default"])({version:f,versionRtc:h},d.constantRtc,u.RtcSupport,p["default"],{install:function(e,t){m.install(e,t),v.install(e,t),e.parser.mixin({configMap:g,serializeMap:y,unserializeMap:S})},getInstance:function(e){return b||(b=new c["default"](e)),b},destroy:function(){b&&(b.destroy(),b=null)}});e.exports=C},,function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var r=n(35)("wks"),i=n(22),o=n(2).Symbol,a="function"==typeof o,s=e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))};s.store=r},function(e,t,n){(function(t){"use strict";var n="'d9af519ff065b5468584d93cd6050379c567621e",r="d9af519'",i="5.0.0",o="2.6.0.328",a="3.9.0",s="47",c="1",d=1,u="https://lbs.netease.im/lbs/webconf.jsp",l="roomserver.netease.im",p="https://dr.netease.im/1.gif",f="development"===t.env.NODE_ENV?6e3:42e3,h={info:{hash:n,shortHash:r,version:i,sdkVersion:s,nrtcVersion:a,nrtcSdkVersion:c,protocolVersion:d},agentVersion:o,lbsUrl:u,roomserver:l,connectTimeout:f,xhrTimeout:f,socketTimeout:f,reconnectionDelay:656.25,reconnectionDelayMax:f,reconnectionJitter:.1,heartbeatInterval:18e4,cmdTimeout:f,defaultReportUrl:p};h.formatSocketUrl=function(e){var t=e.url,n=e.secure,r=n?"https":"http";return t.indexOf("http")===-1?r+"://"+t:t},h.uploadUrl="https://nos.netease.com",h.replaceUrl="https://{bucket}.nosdn.127.net/{object}",h.downloadHost="nos.netease.com",h.downloadUrl="https://{bucket}.nosdn.127.net/{object}",h.httpsEnabled=!1,h.genUploadUrl=function(e){return h.uploadUrl+"/"+e},h.genDownloadUrl=function(e,t){var n=h.replaceUrl;return/^http/.test(n)?h.httpsEnabled&&(n=n.replace("http","https")):n=h.httpsEnabled?"https://"+n:"http://"+n,n.replace("{bucket}",e).replace("{object}",t)},e.exports=h}).call(t,n(31))},function(e,t,n){(function(t,r){/*!
  	 * @overview es6-promise - a tiny implementation of Promises/A+.
  	 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  	 * @license   Licensed under MIT license
  	 *            See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  	 * @version   4.0.5
  	 */
  !function(t,n){e.exports=n()}(this,function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function i(e){return"function"==typeof e}function o(e){Q=e}function a(e){q=e}function s(){return function(){return t.nextTick(p)}}function c(){return"undefined"!=typeof J?function(){J(p)}:l()}function d(){var e=0,t=new Z(p),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function u(){var e=new MessageChannel;return e.port1.onmessage=p,function(){return e.port2.postMessage(0)}}function l(){var e=setTimeout;return function(){return e(p,1)}}function p(){for(var e=0;e<K;e+=2){var t=ne[e],n=ne[e+1];t(n),ne[e]=void 0,ne[e+1]=void 0}K=0}function f(){try{var e=n(96);return J=e.runOnLoop||e.runOnContext,c()}catch(t){return l()}}function h(e,t){var n=arguments,r=this,i=new this.constructor(v);void 0===i[ie]&&L(i);var o=r._state;return o?!function(){var e=n[o-1];q(function(){return M(o,i,e,r._result)})}():P(r,i,e,t),i}function m(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(v);return w(n,e),n}function v(){}function g(){return new TypeError("You cannot resolve a promise with itself")}function y(){return new TypeError("A promises callback cannot return that same promise.")}function S(e){try{return e.then}catch(t){return ce.error=t,ce}}function b(e,t,n,r){try{e.call(t,n,r)}catch(i){return i}}function C(e,t,n){q(function(e){var r=!1,i=b(n,t,function(n){r||(r=!0,t!==n?w(e,n):E(e,n))},function(t){r||(r=!0,O(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,O(e,i))},e)}function _(e,t){t._state===ae?E(e,t._result):t._state===se?O(e,t._result):P(t,void 0,function(t){return w(e,t)},function(t){return O(e,t)})}function T(e,t,n){t.constructor===e.constructor&&n===h&&t.constructor.resolve===m?_(e,t):n===ce?O(e,ce.error):void 0===n?E(e,t):i(n)?C(e,t,n):E(e,t)}function w(t,n){t===n?O(t,g()):e(n)?T(t,n,S(n)):E(t,n)}function R(e){e._onerror&&e._onerror(e._result),k(e)}function E(e,t){e._state===oe&&(e._result=t,e._state=ae,0!==e._subscribers.length&&q(k,e))}function O(e,t){e._state===oe&&(e._state=se,e._result=t,q(R,e))}function P(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+ae]=n,i[o+se]=r,0===o&&e._state&&q(k,e)}function k(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=void 0,i=void 0,o=e._result,a=0;a<t.length;a+=3)r=t[a],i=t[a+n],r?M(n,r,i,o):i(o);e._subscribers.length=0}}function A(){this.error=null}function I(e,t){try{return e(t)}catch(n){return de.error=n,de}}function M(e,t,n,r){var o=i(n),a=void 0,s=void 0,c=void 0,d=void 0;if(o){if(a=I(n,r),a===de?(d=!0,s=a.error,a=null):c=!0,t===a)return void O(t,y())}else a=r,c=!0;t._state!==oe||(o&&c?w(t,a):d?O(t,s):e===ae?E(t,a):e===se&&O(t,a))}function x(e,t){try{t(function(t){w(e,t)},function(t){O(e,t)})}catch(n){O(e,n)}}function D(){return ue++}function L(e){e[ie]=ue++,e._state=void 0,e._result=void 0,e._subscribers=[]}function j(e,t){this._instanceConstructor=e,this.promise=new e(v),this.promise[ie]||L(this.promise),z(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&E(this.promise,this._result))):O(this.promise,N())}function N(){return new Error("Array Methods must be provided an Array")}function U(e){return new j(this,e).promise}function V(e){var t=this;return new t(z(e)?function(n,r){for(var i=e.length,o=0;o<i;o++)t.resolve(e[o]).then(n,r)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function F(e){var t=this,n=new t(v);return O(n,e),n}function B(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function G(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function W(e){this[ie]=D(),this._result=this._state=void 0,this._subscribers=[],v!==e&&("function"!=typeof e&&B(),this instanceof W?x(this,e):G())}function H(){var e=void 0;if("undefined"!=typeof r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;if(n){var i=null;try{i=Object.prototype.toString.call(n.resolve())}catch(t){}if("[object Promise]"===i&&!n.cast)return}e.Promise=W}var Y=void 0;Y=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var z=Y,K=0,J=void 0,Q=void 0,q=function(e,t){ne[K]=e,ne[K+1]=t,K+=2,2===K&&(Q?Q(p):re())},$="undefined"!=typeof window?window:void 0,X=$||{},Z=X.MutationObserver||X.WebKitMutationObserver,ee="undefined"==typeof self&&"undefined"!=typeof t&&"[object process]"==={}.toString.call(t),te="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ne=new Array(1e3),re=void 0;re=ee?s():Z?d():te?u():void 0===$?f():l();var ie=Math.random().toString(36).substring(16),oe=void 0,ae=1,se=2,ce=new A,de=new A,ue=0;return j.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===oe&&n<e;n++)this._eachEntry(t[n],n)},j.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===m){var i=S(e);if(i===h&&e._state!==oe)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===W){var o=new n(v);T(o,e,i),this._willSettleAt(o,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},j.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===oe&&(this._remaining--,e===se?O(r,n):this._result[t]=n),0===this._remaining&&E(r,this._result)},j.prototype._willSettleAt=function(e,t){var n=this;P(e,void 0,function(e){return n._settledAt(ae,t,e)},function(e){return n._settledAt(se,t,e)})},W.all=U,W.race=V,W.resolve=m,W.reject=F,W._setScheduler=o,W._setAsap=a,W._asap=q,W.prototype={constructor:W,then:h,"catch":function(e){return this.then(null,e)}},W.polyfill=H,W.Promise=W,W})}).call(t,n(31),function(){return this}())},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){e.exports=!n(19)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(10),i=n(21);e.exports=n(8)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(14),i=n(51),o=n(37),a=Object.defineProperty;t.f=n(8)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(s){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){var n=e.exports={version:"2.5.3"};"number"==typeof __e&&(__e=n)},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(58),i=n(32);e.exports=function(e){return r(i(e))}},function(e,t,n){var r=n(12);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(76),o=r(i),a=n(75),s=r(a),c="function"==typeof s["default"]&&"symbol"==typeof o["default"]?function(e){return typeof e}:function(e){return e&&"function"==typeof s["default"]&&e.constructor===s["default"]&&e!==s["default"].prototype?"symbol":typeof e};t["default"]="function"==typeof s["default"]&&"symbol"===c(o["default"])?function(e){return"undefined"==typeof e?"undefined":c(e)}:function(e){return e&&"function"==typeof s["default"]&&e.constructor===s["default"]&&e!==s["default"].prototype?"symbol":"undefined"==typeof e?"undefined":c(e)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(122),o=r(i),a=n(121),s=r(a),c=n(15),d=r(c);t["default"]=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":(0,d["default"])(t)));e.prototype=(0,s["default"])(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(o["default"]?(0,o["default"])(e,t):e.__proto__=t)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(15),o=r(i);t["default"]=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":(0,o["default"])(t))&&"function"!=typeof t?e:t}},function(e,t,n){var r=n(2),i=n(11),o=n(45),a=n(9),s="prototype",c=function(e,t,n){var d,u,l,p=e&c.F,f=e&c.G,h=e&c.S,m=e&c.P,v=e&c.B,g=e&c.W,y=f?i:i[t]||(i[t]={}),S=y[s],b=f?r:h?r[t]:(r[t]||{})[s];f&&(n=t);for(d in n)u=!p&&b&&void 0!==b[d],u&&d in y||(l=u?b[d]:n[d],y[d]=f&&"function"!=typeof b[d]?n[d]:v&&u?o(l,r):g&&b[d]==l?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t[s]=e[s],t}(l):m&&"function"==typeof l?o(Function.call,l):l,m&&((y.virtual||(y.virtual={}))[d]=l,e&c.R&&S&&!S[d]&&a(S,d,l)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t,n){"use strict";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(){this._events=new r,this._eventsCount=0}var a=Object.prototype.hasOwnProperty,s="~";Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(s=!1)),o.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)a.call(e,t)&&n.push(s?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},o.prototype.listeners=function(e,t){var n=s?s+e:e,r=this._events[n];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},o.prototype.emit=function(e,t,n,r,i,o){var a=s?s+e:e;if(!this._events[a])return!1;var c,d,u=this._events[a],l=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,r),!0;case 5:return u.fn.call(u.context,t,n,r,i),!0;case 6:return u.fn.call(u.context,t,n,r,i,o),!0}for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];u.fn.apply(u.context,c)}else{var p,f=u.length;for(d=0;d<f;d++)switch(u[d].once&&this.removeListener(e,u[d].fn,void 0,!0),l){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,t);break;case 3:u[d].fn.call(u[d].context,t,n);break;case 4:u[d].fn.call(u[d].context,t,n,r);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];u[d].fn.apply(u[d].context,c)}}return!0},o.prototype.on=function(e,t,n){var r=new i(t,n||this),o=s?s+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],r]:this._events[o].push(r):(this._events[o]=r,this._eventsCount++),this},o.prototype.once=function(e,t,n){var r=new i(t,n||this,!0),o=s?s+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],r]:this._events[o].push(r):(this._events[o]=r,this._eventsCount++),this},o.prototype.removeListener=function(e,t,n,i){var o=s?s+e:e;if(!this._events[o])return this;if(!t)return 0===--this._eventsCount?this._events=new r:delete this._events[o],this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||(0===--this._eventsCount?this._events=new r:delete this._events[o]);else{for(var c=0,d=[],u=a.length;c<u;c++)(a[c].fn!==t||i&&!a[c].once||n&&a[c].context!==n)&&d.push(a[c]);d.length?this._events[o]=1===d.length?d[0]:d:0===--this._eventsCount?this._events=new r:delete this._events[o]}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=s?s+e:e,this._events[t]&&(0===--this._eventsCount?this._events=new r:delete this._events[t])):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prototype.setMaxListeners=function(){return this},o.prefixed=s,o.EventEmitter=o,e.exports=o},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},,function(e,t,n){var r=n(54),i=n(33);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t){e.exports={}},,,function(e,t){e.exports=!0},function(e,t,n){var r=n(10).f,i=n(6),o=n(3)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(u===setTimeout)return setTimeout(e,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function o(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function a(){m&&f&&(m=!1,f.length?h=f.concat(h):v=-1,h.length&&s())}function s(){if(!m){var e=i(a);m=!0;for(var t=h.length;t;){for(f=h,h=[];++v<t;)f&&f[v].run();v=-1,t=h.length}f=null,m=!1,o(e)}}function c(e,t){this.fun=e,this.array=t}function d(){}var u,l,p=e.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(e){u=n}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(e){l=r}}();var f,h=[],m=!1,v=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new c(e,t)),1!==h.length||m||i(s)},c.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=d,p.addListener=d,p.once=d,p.off=d,p.removeListener=d,p.removeAllListeners=d,p.emit=d,p.prependListener=d,p.prependOnceListener=d,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on  "+e);return e}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(35)("keys"),i=n(22);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){var r=n(2),i="__core-js_shared__",o=r[i]||(r[i]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(12);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(2),i=n(11),o=n(29),a=n(39),s=n(10).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:a.f(e)})}},function(e,t,n){t.f=n(3)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(109);Object.defineProperty(t,"ajax",{enumerable:!0,get:function(){return r(i)["default"]}});var o=n(118);Object.defineProperty(t,"element",{enumerable:!0,get:function(){return r(o)["default"]}});var a=n(110);Object.defineProperty(t,"tool",{enumerable:!0,get:function(){return r(a)["default"]}})},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(14),i=n(86),o=n(33),a=n(34)("IE_PROTO"),s=function(){},c="prototype",d=function(){var e,t=n(47)("iframe"),r=o.length,i="<",a=">";for(t.style.display="none",n(68).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(i+"script"+a+"document.F=Object"+i+"/script"+a),e.close(),d=e.F;r--;)delete d[c][o[r]];return d()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[c]=r(e),n=new s,s[c]=null,n[a]=e):n=d(),void 0===t?n:i(n,t)}},function(e,t){t.f=Object.getOwnPropertySymbols},,function(e,t,n){var r=n(56);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r;(function(e,i){(function(){"use strict";function o(e){return e=String(e),e.charAt(0).toUpperCase()+e.slice(1)}function a(e,t,n){var r={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"Server 2008 R2 / 7","6.0":"Server 2008 / Vista",5.2:"Server 2003 / XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return t&&n&&/^Win/i.test(e)&&!/^Windows Phone /i.test(e)&&(r=r[/[\d.]+$/.exec(e)])&&(e="Windows "+r),e=String(e),t&&n&&(e=e.replace(RegExp(t,"i"),n)),e=c(e.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}function s(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=C)for(;++n<r;)t(e[n],n,e);else d(e,t)}function c(e){return e=h(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:o(e)}function d(e,t){for(var n in e)w.call(e,n)&&t(e[n],n,e)}function u(e){return null==e?o(e):R.call(e).slice(8,-1)}function l(e,t){var n=null!=e?typeof e[t]:"number";return!(/^(?:boolean|number|string|undefined)$/.test(n)||"object"==n&&!e[t])}function p(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function f(e,t){var n=null;return s(e,function(r,i){n=t(n,r,i,e)}),n}function h(e){return String(e).replace(/^ +| +$/g,"")}function m(e){function t(t){return f(t,function(t,n){return t||RegExp("\\b"+(n.pattern||p(n))+"\\b","i").exec(e)&&(n.label||n)})}function n(t){return f(t,function(t,n,r){return t||(n[z]||n[/^[a-z]+(?: +[a-z]+\b)*/i.exec(z)]||RegExp("\\b"+p(r)+"(?:\\b|\\w*\\d)","i").exec(e))&&r})}function r(t){return f(t,function(t,n){return t||RegExp("\\b"+(n.pattern||p(n))+"\\b","i").exec(e)&&(n.label||n)})}function i(t){return f(t,function(t,n){var r=n.pattern||p(n);return!t&&(t=RegExp("\\b"+r+"(?:/[\\d.]+|[ \\w.]*)","i").exec(e))&&(t=a(t,r,n.label||n)),t})}function o(t){return f(t,function(t,n){var r=n.pattern||p(n);return!t&&(t=RegExp("\\b"+r+" *\\d+[.\\w_]*","i").exec(e)||RegExp("\\b"+r+" *\\w+-[\\w]*","i").exec(e)||RegExp("\\b"+r+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(e))&&((t=String(n.label&&!RegExp(r,"i").test(n.label)?n.label:t).split("/"))[1]&&!/[\d.]+/.test(t[0])&&(t[0]+=" "+t[1]),n=n.label||n,t=c(t[0].replace(RegExp(r,"i"),n).replace(RegExp("; *(?:"+n+"[_-])?","i")," ").replace(RegExp("("+n+")[-_.]?(\\w)","i"),"$1 $2"))),t})}function s(t){return f(t,function(t,n){return t||(RegExp(n+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(e)||0)[1]||null})}function v(){return this.description||""}var y=g,S=e&&"object"==typeof e&&"String"!=u(e);S&&(y=e,e=null);var b=y.navigator||{},C=b.userAgent||"";e||(e=C);var T,w,E=S?!!b.likeChrome:/\bChrome\b/.test(e)&&!/internal|\n/i.test(R.toString()),O="Object",P=S?O:"ScriptBridgingProxyObject",k=S?O:"Environment",A=S&&y.java?"JavaPackage":u(y.java),I=S?O:"RuntimeObject",M=/\bJava/.test(A)&&y.java,x=M&&u(y.environment)==k,D=M?"a":"α",L=M?"b":"β",j=y.document||{},N=y.operamini||y.opera,U=_.test(U=S&&N?N["[[Class]]"]:u(N))?U:N=null,V=e,F=[],B=null,G=e==C,W=G&&N&&"function"==typeof N.version&&N.version(),H=t([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),Y=r(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"Edge"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Waterfox","WebPositive","Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chrome",{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),z=o([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),K=n({Apple:{iPad:1,iPhone:1,iPod:1},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1}}),J=i(["Windows Phone","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian","Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);if(H&&(H=[H]),K&&!z&&(z=o([K])),(T=/\bGoogle TV\b/.exec(z))&&(z=T[0]),/\bSimulator\b/i.test(e)&&(z=(z?z+" ":"")+"Simulator"),"Opera Mini"==Y&&/\bOPiOS\b/.test(e)&&F.push("running in Turbo/Uncompressed mode"),"IE"==Y&&/\blike iPhone OS\b/.test(e)?(T=m(e.replace(/like iPhone OS/,"")),K=T.manufacturer,z=T.product):/^iP/.test(z)?(Y||(Y="Safari"),J="iOS"+((T=/ OS ([\d_]+)/i.exec(e))?" "+T[1].replace(/_/g,"."):"")):"Konqueror"!=Y||/buntu/i.test(J)?K&&"Google"!=K&&(/Chrome/.test(Y)&&!/\bMobile Safari\b/i.test(e)||/\bVita\b/.test(z))||/\bAndroid\b/.test(J)&&/^Chrome/.test(Y)&&/\bVersion\//i.test(e)?(Y="Android Browser",J=/\bAndroid\b/.test(J)?J:"Android"):"Silk"==Y?(/\bMobi/i.test(e)||(J="Android",F.unshift("desktop mode")),/Accelerated *= *true/i.test(e)&&F.unshift("accelerated")):"PaleMoon"==Y&&(T=/\bFirefox\/([\d.]+)\b/.exec(e))?F.push("identifying as Firefox "+T[1]):"Firefox"==Y&&(T=/\b(Mobile|Tablet|TV)\b/i.exec(e))?(J||(J="Firefox OS"),z||(z=T[1])):!Y||(T=!/\bMinefield\b/i.test(e)&&/\b(?:Firefox|Safari)\b/.exec(Y))?(Y&&!z&&/[\/,]|^[^(]+?\)/.test(e.slice(e.indexOf(T+"/")+8))&&(Y=null),(T=z||K||J)&&(z||K||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(J))&&(Y=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(J)?J:T)+" Browser")):"Electron"==Y&&(T=(/\bChrome\/([\d.]+)\b/.exec(e)||0)[1])&&F.push("Chromium "+T):J="Kubuntu",W||(W=s(["(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))","Version",p(Y),"(?:Firefox|Minefield|NetFront)"])),(T="iCab"==H&&parseFloat(W)>3&&"WebKit"||/\bOpera\b/.test(Y)&&(/\bOPR\b/.test(e)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(e)&&!/^(?:Trident|EdgeHTML)$/.test(H)&&"WebKit"||!H&&/\bMSIE\b/i.test(e)&&("Mac OS"==J?"Tasman":"Trident")||"WebKit"==H&&/\bPlayStation\b(?! Vita\b)/i.test(Y)&&"NetFront")&&(H=[T]),"IE"==Y&&(T=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(e)||0)[1])?(Y+=" Mobile",J="Windows Phone "+(/\+$/.test(T)?T:T+".x"),F.unshift("desktop mode")):/\bWPDesktop\b/i.test(e)?(Y="IE Mobile",J="Windows Phone 8.x",F.unshift("desktop mode"),W||(W=(/\brv:([\d.]+)/.exec(e)||0)[1])):"IE"!=Y&&"Trident"==H&&(T=/\brv:([\d.]+)/.exec(e))&&(Y&&F.push("identifying as "+Y+(W?" "+W:"")),Y="IE",W=T[1]),G){if(l(y,"global"))if(M&&(T=M.lang.System,V=T.getProperty("os.arch"),J=J||T.getProperty("os.name")+" "+T.getProperty("os.version")),x){try{W=y.require("ringo/engine").version.join("."),Y="RingoJS"}catch(Q){(T=y.system)&&T.global.system==y.system&&(Y="Narwhal",J||(J=T[0].os||null))}Y||(Y="Rhino")}else"object"==typeof y.process&&!y.process.browser&&(T=y.process)&&("object"==typeof T.versions&&("string"==typeof T.versions.electron?(F.push("Node "+T.versions.node),Y="Electron",W=T.versions.electron):"string"==typeof T.versions.nw&&(F.push("Chromium "+W,"Node "+T.versions.node),Y="NW.js",W=T.versions.nw)),Y||(Y="Node.js",V=T.arch,J=T.platform,W=/[\d.]+/.exec(T.version),W=W?W[0]:null));else u(T=y.runtime)==P?(Y="Adobe AIR",J=T.flash.system.Capabilities.os):u(T=y.phantom)==I?(Y="PhantomJS",W=(T=T.version||null)&&T.major+"."+T.minor+"."+T.patch):"number"==typeof j.documentMode&&(T=/\bTrident\/(\d+)/i.exec(e))?(W=[W,j.documentMode],(T=+T[1]+4)!=W[1]&&(F.push("IE "+W[1]+" mode"),H&&(H[1]=""),W[1]=T),W="IE"==Y?String(W[1].toFixed(1)):W[0]):"number"==typeof j.documentMode&&/^(?:Chrome|Firefox)\b/.test(Y)&&(F.push("masking as "+Y+" "+W),Y="IE",W="11.0",H=["Trident"],J="Windows");J=J&&c(J)}if(W&&(T=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(W)||/(?:alpha|beta)(?: ?\d)?/i.exec(e+";"+(G&&b.appMinorVersion))||/\bMinefield\b/i.test(e)&&"a")&&(B=/b/i.test(T)?"beta":"alpha",W=W.replace(RegExp(T+"\\+?$"),"")+("beta"==B?L:D)+(/\d+\+?/.exec(T)||"")),"Fennec"==Y||"Firefox"==Y&&/\b(?:Android|Firefox OS)\b/.test(J))Y="Firefox Mobile";else if("Maxthon"==Y&&W)W=W.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(z))"Xbox 360"==z&&(J=null),"Xbox 360"==z&&/\bIEMobile\b/.test(e)&&F.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(Y)&&(!Y||z||/Browser|Mobi/.test(Y))||"Windows CE"!=J&&!/Mobi/i.test(e))if("IE"==Y&&G)try{null===y.external&&F.unshift("platform preview")}catch(Q){F.unshift("embedded")}else(/\bBlackBerry\b/.test(z)||/\bBB10\b/.test(e))&&(T=(RegExp(z.replace(/ +/g," *")+"/([.\\d]+)","i").exec(e)||0)[1]||W)?(T=[T,/BB10/.test(e)],J=(T[1]?(z=null,K="BlackBerry"):"Device Software")+" "+T[0],W=null):this!=d&&"Wii"!=z&&(G&&N||/Opera/.test(Y)&&/\b(?:MSIE|Firefox)\b/i.test(e)||"Firefox"==Y&&/\bOS X (?:\d+\.){2,}/.test(J)||"IE"==Y&&(J&&!/^Win/.test(J)&&W>5.5||/\bWindows XP\b/.test(J)&&W>8||8==W&&!/\bTrident\b/.test(e)))&&!_.test(T=m.call(d,e.replace(_,"")+";"))&&T.name&&(T="ing as "+T.name+((T=T.version)?" "+T:""),_.test(Y)?(/\bIE\b/.test(T)&&"Mac OS"==J&&(J=null),T="identify"+T):(T="mask"+T,Y=U?c(U.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(T)&&(J=null),G||(W=null)),H=["Presto"],F.push(T));else Y+=" Mobile";(T=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(e)||0)[1])&&(T=[parseFloat(T.replace(/\.(\d)$/,".0$1")),T],"Safari"==Y&&"+"==T[1].slice(-1)?(Y="WebKit Nightly",B="alpha",W=T[1].slice(0,-1)):W!=T[1]&&W!=(T[2]=(/\bSafari\/([\d.]+\+?)/i.exec(e)||0)[1])||(W=null),T[1]=(/\bChrome\/([\d.]+)/i.exec(e)||0)[1],537.36==T[0]&&537.36==T[2]&&parseFloat(T[1])>=28&&"WebKit"==H&&(H=["Blink"]),G&&(E||T[1])?(H&&(H[1]="like Chrome"),T=T[1]||(T=T[0],T<530?1:T<532?2:T<532.05?3:T<533?4:T<534.03?5:T<534.07?6:T<534.1?7:T<534.13?8:T<534.16?9:T<534.24?10:T<534.3?11:T<535.01?12:T<535.02?"13+":T<535.07?15:T<535.11?16:T<535.19?17:T<536.05?18:T<536.1?19:T<537.01?20:T<537.11?"21+":T<537.13?23:T<537.18?24:T<537.24?25:T<537.36?26:"Blink"!=H?"27":"28")):(H&&(H[1]="like Safari"),T=T[0],T=T<400?1:T<500?2:T<526?3:T<533?4:T<534?"4+":T<535?5:T<537?6:T<538?7:T<601?8:"8"),H&&(H[1]+=" "+(T+="number"==typeof T?".x":/[.+]/.test(T)?"":"+")),"Safari"==Y&&(!W||parseInt(W)>45)&&(W=T)),"Opera"==Y&&(T=/\bzbov|zvav$/.exec(J))?(Y+=" ",F.unshift("desktop mode"),"zvav"==T?(Y+="Mini",W=null):Y+="Mobile",J=J.replace(RegExp(" *"+T+"$"),"")):"Safari"==Y&&/\bChrome\b/.exec(H&&H[1])&&(F.unshift("desktop mode"),Y="Chrome Mobile",W=null,/\bOS X\b/.test(J)?(K="Apple",J="iOS 4.3+"):J=null),W&&0==W.indexOf(T=/[\d.]+$/.exec(J))&&e.indexOf("/"+T+"-")>-1&&(J=h(J.replace(T,""))),H&&!/\b(?:Avant|Nook)\b/.test(Y)&&(/Browser|Lunascape|Maxthon/.test(Y)||"Safari"!=Y&&/^iOS/.test(J)&&/\bSafari\b/.test(H[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(Y)&&H[1])&&(T=H[H.length-1])&&F.push(T),F.length&&(F=["("+F.join("; ")+")"]),K&&z&&z.indexOf(K)<0&&F.push("on "+K),z&&F.push((/^on /.test(F[F.length-1])?"":"on ")+z),J&&(T=/ ([\d.+]+)$/.exec(J),w=T&&"/"==J.charAt(J.length-T[0].length-1),J={architecture:32,family:T&&!w?J.replace(T[0],""):J,version:T?T[1]:null,toString:function(){var e=this.version;return this.family+(e&&!w?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(T=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(V))&&!/\bi686\b/i.test(V)?(J&&(J.architecture=64,J.family=J.family.replace(RegExp(" *"+T),"")),Y&&(/\bWOW64\b/i.test(e)||G&&/\w(?:86|32)$/.test(b.cpuClass||b.platform)&&!/\bWin64; x64\b/i.test(e))&&F.unshift("32-bit")):J&&/^OS X/.test(J.family)&&"Chrome"==Y&&parseFloat(W)>=39&&(J.architecture=64),e||(e=null);var q={};return q.description=e,q.layout=H&&H[0],q.manufacturer=K,q.name=Y,q.prerelease=B,q.product=z,q.ua=e,q.version=Y&&W,q.os=J||{architecture:null,family:null,version:null,toString:function(){return"null"}},q.parse=m,q.toString=v,q.version&&F.unshift(W),q.name&&F.unshift(Y),J&&Y&&(J!=String(J).split(" ")[0]||J!=Y.split(" ")[0]&&!z)&&F.push(z?"("+J+")":"on "+J),F.length&&(q.description=F.join(" ")),q}var v={"function":!0,object:!0},g=v[typeof window]&&window||this,y=v[typeof t]&&t,S=v[typeof e]&&e&&!e.nodeType&&e,b=y&&S&&"object"==typeof i&&i;!b||b.global!==b&&b.window!==b&&b.self!==b||(g=b);var C=Math.pow(2,53)-1,_=/\bOpera/,T=Object.prototype,w=T.hasOwnProperty,R=T.toString,E=m();g.platform=E,r=function(){return E}.call(t,n,t,e),!(void 0!==r&&(e.exports=r))}).call(this)}).call(t,n(57)(e),function(){return this}())},function(e,t,n){var r=n(12),i=n(2).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},,function(e,t){"use strict";t.__esModule=!0;var n,r,i,o,a={CONTROL_COMMAND_BUSY:9,CONTROL_COMMAND_SELF_ON_BACKGROUND:12,CONTROL_COMMAND_START_NOTIFY_RECEIVED:13},s={NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_ON:1,NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_OFF:2,NETCALL_CONTROL_COMMAND_NOTIFY_VIDEO_ON:3,NETCALL_CONTROL_COMMAND_NOTIFY_VIDEO_OFF:4,NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO:5,NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO_AGREE:6,NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO_REJECT:7,NETCALL_CONTROL_COMMAND_SWITCH_VIDEO_TO_AUDIO:8,NETCALL_CONTROL_COMMAND_BUSY:9,NETCALL_CONTROL_COMMAND_SELF_CAMERA_INVALID:10,NETCALL_CONTROL_COMMAND_SELF_AUDIO_INVALID:11,NETCALL_CONTROL_COMMAND_SELF_ON_BACKGROUND:12,NETCALL_CONTROL_COMMAND_START_NOTIFY_RECEIVED:13,NETCALL_CONTROL_COMMAND_NOTIFY_RECORD_START:14,NETCALL_CONTROL_COMMAND_NOTIFY_RECORD_STOP:15},c={HANGUP_TYPE_NORMAL:0,HANGUP_TYPE_TIMEOUT:-1},d={NETCALL_TYPE_AUDIO:1,NETCALL_TYPE_VIDEO:2,
  DEVICE_TYPE_AUDIO_IN:0,DEVICE_TYPE_AUDIO_OUT_LOCAL:1,DEVICE_TYPE_AUDIO_OUT_CHAT:2,DEVICE_TYPE_VIDEO:3,DEVICE_TYPE_DESKTOP_SCREEN:4,DEVICE_TYPE_DESKTOP_WINDOW:5,CHAT_VIDEO_QUALITY_NORMAL:0,CHAT_VIDEO_QUALITY_LOW:1,CHAT_VIDEO_QUALITY_MEDIUM:2,CHAT_VIDEO_QUALITY_HIGH:3,CHAT_VIDEO_QUALITY_480P:4,CHAT_VIDEO_QUALITY_540P:5,CHAT_VIDEO_QUALITY_720P:6,CHAT_VIDEO_FRAME_RATE_NORMAL:0,CHAT_VIDEO_FRAME_RATE_5:1,CHAT_VIDEO_FRAME_RATE_10:2,CHAT_VIDEO_FRAME_RATE_15:3,CHAT_VIDEO_FRAME_RATE_20:4,CHAT_VIDEO_FRAME_RATE_25:5,LAYOUT_SPLITBOTTOMHORFLOATING:0,LAYOUT_SPLITTOPHORFLOATING:1,LAYOUT_SPLITLATTICETILE:2,LAYOUT_SPLITLATTICECUTTINGTILE:3,LAYOUT_SPLITCUSTOM:4,ROLE_PLAYER:0,ROLE_AUDIENCE:1},u={WB_TYPE_TCP:2,WB_TYPE_UDP:3,CALL_TYPE_NONE:0,CALL_TYPE_AUDIO:1,HANGUP_TYPE_NORMAL:0,HANGUP_TYPE_TIMEOUT:-1};d.deviceTypeMap=(n={},n[d.DEVICE_TYPE_AUDIO_IN]="audioIn",n[d.DEVICE_TYPE_AUDIO_OUT_CHAT]="audioOut",n[d.DEVICE_TYPE_VIDEO]="video",n),d.deviceTypeMap=(r={},r[d.DEVICE_TYPE_AUDIO_IN]="audioIn",r[d.DEVICE_TYPE_AUDIO_OUT_LOCAL]="audioOut",r[d.DEVICE_TYPE_AUDIO_OUT_CHAT]="audioOut",r[d.DEVICE_TYPE_VIDEO]="video",r),d.videoMap={frame:(i={},i[d.CHAT_VIDEO_QUALITY_NORMAL]="480x320",i[d.CHAT_VIDEO_QUALITY_LOW]="176x144",i[d.CHAT_VIDEO_QUALITY_MEDIUM]="352x288",i[d.CHAT_VIDEO_QUALITY_HIGH]="480x320",i[d.CHAT_VIDEO_QUALITY_480P]="640x480",i[d.CHAT_VIDEO_QUALITY_540P]="960x540",i[d.CHAT_VIDEO_QUALITY_720P]="1280x720",i),frameRate:(o={},o[d.CHAT_VIDEO_FRAME_RATE_NORMAL]=15,o[d.CHAT_VIDEO_FRAME_RATE_5]=5,o[d.CHAT_VIDEO_FRAME_RATE_10]=10,o[d.CHAT_VIDEO_FRAME_RATE_15]=15,o[d.CHAT_VIDEO_FRAME_RATE_20]=20,o[d.CHAT_VIDEO_FRAME_RATE_25]=25,o)};var l={getVideoSessionConfig:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.quality,n=void 0===t?d.CHAT_VIDEO_QUALITY_NORMAL:t,r=e.frameRate,i=void 0===r?d.CHAT_VIDEO_FRAME_RATE_NORMAL:r,o={},a=d.videoMap.frame[n];return o.frameRate=d.videoMap.frameRate[i],o.width=+a.split("x")[0],o.height=+a.split("x")[1],o},getDeviceTypeStr:function(e){return d.deviceTypeMap[e]},getDeviceTypeMap:function(e){return d.deviceTypeMap[e]}},p=Object.assign(d,s,c),f=Object.assign(u,a,c);t.constantTool=l,t.constantRtc=p,t.constantBB=f},,function(e,t,n){e.exports=!n(8)&&!n(19)(function(){return 7!=Object.defineProperty(n(47)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";var r=n(29),i=n(18),o=n(55),a=n(9),s=n(6),c=n(26),d=n(83),u=n(30),l=n(88),p=n(3)("iterator"),f=!([].keys&&"next"in[].keys()),h="@@iterator",m="keys",v="values",g=function(){return this};e.exports=function(e,t,n,y,S,b,C){d(n,t,y);var _,T,w,R=function(e){if(!f&&e in k)return k[e];switch(e){case m:return function(){return new n(this,e)};case v:return function(){return new n(this,e)}}return function(){return new n(this,e)}},E=t+" Iterator",O=S==v,P=!1,k=e.prototype,A=k[p]||k[h]||S&&k[S],I=!f&&A||R(S),M=S?O?R("entries"):I:void 0,x="Array"==t?k.entries||A:A;if(x&&(w=l(x.call(new e)),w!==Object.prototype&&w.next&&(u(w,E,!0),r||s(w,p)||a(w,p,g))),O&&A&&A.name!==v&&(P=!0,I=function(){return A.call(this)}),r&&!C||!f&&!P&&k[p]||a(k,p,I),c[t]=I,c[E]=g,S)if(_={values:O?I:R(v),keys:b?I:R(m),entries:M},C)for(T in _)T in k||o(k,T,_[T]);else i(i.P+i.F*(f||P),t,_);return _}},function(e,t,n){var r=n(54),i=n(33).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},function(e,t,n){var r=n(6),i=n(13),o=n(80)(!1),a=n(34)("IE_PROTO");e.exports=function(e,t){var n,s=i(e),c=0,d=[];for(n in s)n!=a&&r(s,n)&&d.push(n);for(;t.length>c;)r(s,n=t[c++])&&(~o(d,n)||d.push(n));return d}},function(e,t,n){e.exports=n(9)},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t,n){var r=n(41);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(25),i=n(21),o=n(13),a=n(37),s=n(6),c=n(51),d=Object.getOwnPropertyDescriptor;t.f=n(8)?d:function(e,t){if(e=o(e),t=a(t,!0),c)try{return d(e,t)}catch(n){}if(s(e,t))return i(!r.f.call(e,t),e[t])}},function(e,t,n){var r=n(32);e.exports=function(e){return Object(r(e))}},function(e,t){"use strict";t.__esModule=!0;var n,r,i={CURRENT:{SDK_TYPE:null},SDK_TYPE:{NETCALL:1,WEBRTC:2,WHITEBOARD:3,NRTC:4},SDK_NAME:{1:"Netcall",2:"WebRTC",3:"WhiteBoard",4:"NRTC"}};i.STATS_FUN=(n={},n[i.SDK_TYPE.NETCALL]=1,n[i.SDK_TYPE.WEBRTC]=1,n[i.SDK_TYPE.NRTC]=1,n[i.SDK_TYPE.WHITEBOARD]=0,n),i.STATS_RTC=(r={},r[i.SDK_TYPE.WEBRTC]=1,r[i.SDK_TYPE.NRTC]=1,r[i.SDK_TYPE.WHITEBOARD]=0,r),t["default"]=i,e.exports=t["default"]},,,,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(292);Object.defineProperty(t,"RtcUtil",{enumerable:!0,get:function(){return r(i)["default"]}});var o=n(293);Object.defineProperty(t,"SdpUtil",{enumerable:!0,get:function(){return r(o)["default"]}});var a=n(294);Object.defineProperty(t,"RtcStats",{enumerable:!0,get:function(){return r(a)["default"]}});var s=n(295);Object.defineProperty(t,"RtcStatsNew",{enumerable:!0,get:function(){return r(s)["default"]}});var c=n(174);Object.defineProperty(t,"RtcSupport",{enumerable:!0,get:function(){return r(c)["default"]}})},function(e,t,n){var r=n(2).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(36),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t){},function(e,t,n){"use strict";var r=n(89)(!0);n(52)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){n(91);for(var r=n(2),i=n(9),o=n(26),a=n(3)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),c=0;c<s.length;c++){var d=s[c],u=r[d],l=u&&u.prototype;l&&!l[a]&&i(l,a,d),o[d]=o.Array}},function(e,t){"use strict";var n=!0,r=!0,i={disableLog:function(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(n=e,e?"adapter.js logging disabled":"adapter.js logging enabled")},disableWarnings:function(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(r=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))},log:function(){if("object"==typeof window){if(n)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},deprecated:function(e,t){r&&console.warn(e+" is deprecated, please use "+t+" instead.")},extractVersion:function(e,t,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)},detectBrowser:function(e){var t=e&&e.navigator,n={};if(n.browser=null,n.version=null,"undefined"==typeof e||!e.navigator)return n.browser="Not a browser.",n;if(t.mozGetUserMedia)n.browser="firefox",n.version=this.extractVersion(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia)if(e.webkitRTCPeerConnection)n.browser="chrome",n.version=this.extractVersion(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.userAgent.match(/Version\/(\d+).(\d+)/))return n.browser="Unsupported webkit-based browser with GUM support but no WebRTC support.",n;n.browser="safari",n.version=this.extractVersion(t.userAgent,/AppleWebKit\/(\d+)\./,1)}else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))n.browser="edge",n.version=this.extractVersion(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!t.mediaDevices||!t.userAgent.match(/AppleWebKit\/(\d+)\./))return n.browser="Not a supported browser.",n;n.browser="safari",n.version=this.extractVersion(t.userAgent,/AppleWebKit\/(\d+)\./,1)}return n}};e.exports={log:i.log,deprecated:i.deprecated,disableLog:i.disableLog,disableWarnings:i.disableWarnings,extractVersion:i.extractVersion,shimCreateObjectURL:i.shimCreateObjectURL,detectBrowser:i.detectBrowser.bind(i)}},,function(e,t,n){e.exports={"default":n(77),__esModule:!0}},function(e,t,n){e.exports={"default":n(78),__esModule:!0}},function(e,t,n){n(92),n(70),n(93),n(94),e.exports=n(11).Symbol},function(e,t,n){n(71),n(72),e.exports=n(39).f("iterator")},function(e,t){e.exports=function(){}},function(e,t,n){var r=n(13),i=n(69),o=n(90);e.exports=function(e){return function(t,n,a){var s,c=r(t),d=i(c.length),u=o(a,d);if(e&&n!=n){for(;d>u;)if(s=c[u++],s!=s)return!0}else for(;d>u;u++)if((e||u in c)&&c[u]===n)return e||u||0;return!e&&-1}}},function(e,t,n){var r=n(24),i=n(43),o=n(25);e.exports=function(e){var t=r(e),n=i.f;if(n)for(var a,s=n(e),c=o.f,d=0;s.length>d;)c.call(e,a=s[d++])&&t.push(a);return t}},function(e,t,n){var r=n(41);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){"use strict";var r=n(42),i=n(21),o=n(30),a={};n(9)(a,n(3)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(a,{next:i(1,n)}),o(e,t+" Iterator")}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var r=n(22)("meta"),i=n(12),o=n(6),a=n(10).f,s=0,c=Object.isExtensible||function(){return!0},d=!n(19)(function(){return c(Object.preventExtensions({}))}),u=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},l=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!c(e))return"F";if(!t)return"E";u(e)}return e[r].i},p=function(e,t){if(!o(e,r)){if(!c(e))return!0;if(!t)return!1;u(e)}return e[r].w},f=function(e){return d&&h.NEED&&c(e)&&!o(e,r)&&u(e),e},h=e.exports={KEY:r,NEED:!1,fastKey:l,getWeak:p,onFreeze:f}},function(e,t,n){var r=n(10),i=n(14),o=n(24);e.exports=n(8)?Object.defineProperties:function(e,t){i(e);for(var n,a=o(t),s=a.length,c=0;s>c;)r.f(e,n=a[c++],t[n]);return e}},function(e,t,n){var r=n(13),i=n(53).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(e){try{return i(e)}catch(t){return a.slice()}};e.exports.f=function(e){return a&&"[object Window]"==o.call(e)?s(e):i(r(e))}},function(e,t,n){var r=n(6),i=n(60),o=n(34)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var r=n(36),i=n(32);e.exports=function(e){return function(t,n){var o,a,s=String(i(t)),c=r(n),d=s.length;return c<0||c>=d?e?"":void 0:(o=s.charCodeAt(c),o<55296||o>56319||c+1===d||(a=s.charCodeAt(c+1))<56320||a>57343?e?s.charAt(c):o:e?s.slice(c,c+2):(o-55296<<10)+(a-56320)+65536)}}},function(e,t,n){var r=n(36),i=Math.max,o=Math.min;e.exports=function(e,t){return e=r(e),e<0?i(e+t,0):o(e,t)}},function(e,t,n){"use strict";var r=n(79),i=n(84),o=n(26),a=n(13);e.exports=n(52)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,n):"values"==t?i(0,e[n]):i(0,[n,e[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(e,t,n){"use strict";var r=n(2),i=n(6),o=n(8),a=n(18),s=n(55),c=n(85).KEY,d=n(19),u=n(35),l=n(30),p=n(22),f=n(3),h=n(39),m=n(38),v=n(81),g=n(82),y=n(14),S=n(12),b=n(13),C=n(37),_=n(21),T=n(42),w=n(87),R=n(59),E=n(10),O=n(24),P=R.f,k=E.f,A=w.f,I=r.Symbol,M=r.JSON,x=M&&M.stringify,D="prototype",L=f("_hidden"),j=f("toPrimitive"),N={}.propertyIsEnumerable,U=u("symbol-registry"),V=u("symbols"),F=u("op-symbols"),B=Object[D],G="function"==typeof I,W=r.QObject,H=!W||!W[D]||!W[D].findChild,Y=o&&d(function(){return 7!=T(k({},"a",{get:function(){return k(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=P(B,t);r&&delete B[t],k(e,t,n),r&&e!==B&&k(B,t,r)}:k,z=function(e){var t=V[e]=T(I[D]);return t._k=e,t},K=G&&"symbol"==typeof I.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof I},J=function(e,t,n){return e===B&&J(F,t,n),y(e),t=C(t,!0),y(n),i(V,t)?(n.enumerable?(i(e,L)&&e[L][t]&&(e[L][t]=!1),n=T(n,{enumerable:_(0,!1)})):(i(e,L)||k(e,L,_(1,{})),e[L][t]=!0),Y(e,t,n)):k(e,t,n)},Q=function(e,t){y(e);for(var n,r=v(t=b(t)),i=0,o=r.length;o>i;)J(e,n=r[i++],t[n]);return e},q=function(e,t){return void 0===t?T(e):Q(T(e),t)},$=function(e){var t=N.call(this,e=C(e,!0));return!(this===B&&i(V,e)&&!i(F,e))&&(!(t||!i(this,e)||!i(V,e)||i(this,L)&&this[L][e])||t)},X=function(e,t){if(e=b(e),t=C(t,!0),e!==B||!i(V,t)||i(F,t)){var n=P(e,t);return!n||!i(V,t)||i(e,L)&&e[L][t]||(n.enumerable=!0),n}},Z=function(e){for(var t,n=A(b(e)),r=[],o=0;n.length>o;)i(V,t=n[o++])||t==L||t==c||r.push(t);return r},ee=function(e){for(var t,n=e===B,r=A(n?F:b(e)),o=[],a=0;r.length>a;)!i(V,t=r[a++])||n&&!i(B,t)||o.push(V[t]);return o};G||(I=function(){if(this instanceof I)throw TypeError("Symbol is not a constructor!");var e=p(arguments.length>0?arguments[0]:void 0),t=function(n){this===B&&t.call(F,n),i(this,L)&&i(this[L],e)&&(this[L][e]=!1),Y(this,e,_(1,n))};return o&&H&&Y(B,e,{configurable:!0,set:t}),z(e)},s(I[D],"toString",function(){return this._k}),R.f=X,E.f=J,n(53).f=w.f=Z,n(25).f=$,n(43).f=ee,o&&!n(29)&&s(B,"propertyIsEnumerable",$,!0),h.f=function(e){return z(f(e))}),a(a.G+a.W+a.F*!G,{Symbol:I});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)f(te[ne++]);for(var re=O(f.store),ie=0;re.length>ie;)m(re[ie++]);a(a.S+a.F*!G,"Symbol",{"for":function(e){return i(U,e+="")?U[e]:U[e]=I(e)},keyFor:function(e){if(!K(e))throw TypeError(e+" is not a symbol!");for(var t in U)if(U[t]===e)return t},useSetter:function(){H=!0},useSimple:function(){H=!1}}),a(a.S+a.F*!G,"Object",{create:q,defineProperty:J,defineProperties:Q,getOwnPropertyDescriptor:X,getOwnPropertyNames:Z,getOwnPropertySymbols:ee}),M&&a(a.S+a.F*(!G||d(function(){var e=I();return"[null]"!=x([e])||"{}"!=x({a:e})||"{}"!=x(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=t=r[1],(S(t)||void 0!==e)&&!K(e))return g(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!K(t))return t}),r[1]=t,x.apply(M,r)}}),I[D][j]||n(9)(I[D],j,I[D].valueOf),l(I,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(e,t,n){n(38)("asyncIterator")},function(e,t,n){n(38)("observable")},function(e,t,n){var r,i;!function(o,a){"use strict";r=a,i="function"==typeof r?r.call(t,n,t,e):r,!(void 0!==i&&(e.exports=i))}(this,function(){var e,t,n,r,i=Function.call,o=Object.prototype,a=i.bind(o.hasOwnProperty),s=i.bind(o.propertyIsEnumerable),c=i.bind(o.toString),d=a(o,"__defineGetter__");d&&(e=i.bind(o.__defineGetter__),t=i.bind(o.__defineSetter__),n=i.bind(o.__lookupGetter__),r=i.bind(o.__lookupSetter__));var u=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){var t=e.__proto__;return t||null===t?t:"[object Function]"===c(e.constructor)?e.constructor.prototype:e instanceof Object?o:null});var l=function(e){try{return e.sentinel=0,0===Object.getOwnPropertyDescriptor(e,"sentinel").value}catch(t){return!1}};if(Object.defineProperty){var p=l({}),f="undefined"==typeof document||l(document.createElement("div"));if(!f||!p)var h=Object.getOwnPropertyDescriptor}if(!Object.getOwnPropertyDescriptor||h){var m="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(e,t){if(u(e))throw new TypeError(m+e);if(h)try{return h.call(Object,e,t)}catch(i){}var c;if(!a(e,t))return c;if(c={enumerable:s(e,t),configurable:!0},d){var l=e.__proto__,p=e!==o;p&&(e.__proto__=o);var f=n(e,t),v=r(e,t);if(p&&(e.__proto__=l),f||v)return f&&(c.get=f),v&&(c.set=v),c}return c.value=e[t],c.writable=!0,c}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)}),!Object.create){var v,g=!({__proto__:null}instanceof Object),y=function(){if(!document.domain)return!1;try{return!!new ActiveXObject("htmlfile")}catch(e){return!1}},S=function(){var e,t;t=new ActiveXObject("htmlfile");var n="script";return t.write("<"+n+"></"+n+">"),t.close(),e=t.parentWindow.Object.prototype,t=null,e},b=function(){var e,t=document.createElement("iframe"),n=document.body||document.documentElement;return t.style.display="none",n.appendChild(t),t.src="javascript:",e=t.contentWindow.Object.prototype,n.removeChild(t),t=null,e};v=g||"undefined"==typeof document?function(){return{__proto__:null}}:function(){var e=y()?S():b();delete e.constructor,delete e.hasOwnProperty,delete e.propertyIsEnumerable,delete e.isPrototypeOf,delete e.toLocaleString,delete e.toString,delete e.valueOf;var t=function(){};return t.prototype=e,v=function(){return new t},new t},Object.create=function(e,t){var n,r=function(){};if(null===e)n=v();else{if(null!==e&&u(e))throw new TypeError("Object prototype may only be an Object or null");r.prototype=e,n=new r,n.__proto__=e}return void 0!==t&&Object.defineProperties(n,t),n}}var C=function(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){return!1}};if(Object.defineProperty){var _=C({}),T="undefined"==typeof document||C(document.createElement("div"));if(!_||!T)var w=Object.defineProperty,R=Object.defineProperties}if(!Object.defineProperty||w){var E="Property description must be an object: ",O="Object.defineProperty called on non-object: ",P="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(i,a,s){if(u(i))throw new TypeError(O+i);if(u(s))throw new TypeError(E+s);if(w)try{return w.call(Object,i,a,s)}catch(c){}if("value"in s)if(d&&(n(i,a)||r(i,a))){var l=i.__proto__;i.__proto__=o,delete i[a],i[a]=s.value,i.__proto__=l}else i[a]=s.value;else{var p="get"in s,f="set"in s;if(!d&&(p||f))throw new TypeError(P);p&&e(i,a,s.get),f&&t(i,a,s.set)}return i}}Object.defineProperties&&!R||(Object.defineProperties=function(e,t){if(R)try{return R.call(Object,e,t)}catch(n){}return Object.keys(t).forEach(function(n){"__proto__"!==n&&Object.defineProperty(e,n,t[n])}),e}),Object.seal||(Object.seal=function(e){if(Object(e)!==e)throw new TypeError("Object.seal can only be called on Objects.");return e}),Object.freeze||(Object.freeze=function(e){if(Object(e)!==e)throw new TypeError("Object.freeze can only be called on Objects.");return e});try{Object.freeze(function(){})}catch(k){Object.freeze=function(e){return function(t){return"function"==typeof t?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){if(Object(e)!==e)throw new TypeError("Object.preventExtensions can only be called on Objects.");return e}),Object.isSealed||(Object.isSealed=function(e){if(Object(e)!==e)throw new TypeError("Object.isSealed can only be called on Objects.");return!1}),Object.isFrozen||(Object.isFrozen=function(e){if(Object(e)!==e)throw new TypeError("Object.isFrozen can only be called on Objects.");return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)!==e)throw new TypeError("Object.isExtensible can only be called on Objects.");for(var t="";a(e,t);)t+="?";e[t]=!0;var n=a(e,t);return delete e[t],n})})},function(e,t){},,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(120),o=r(i);t["default"]=o["default"]||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},,,,,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(40),s=n(4),c=s.info.nrtcVersion,d="https://statistic.live.126.net/statistic/realtime/sdkFunctioninfo",u=function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,o["default"])(this,p);var t=e.appkey,n=e.platform;this.apis={},this.isRtc=/WebRTC/.test(n),this.init(t,n),this.resetStatus()};t["default"]=u;var l=u.prototype;l.init=function(e,t){this.apis=Object.assign(this.apis,{ver:1,platform:t,sdk_ver:c||"v4.4.0",uid:null,appkey:e,time:null})},l.start=function(e){this.calling=!0,this.apis=Object.assign(this.apis,e)},l.resetStatus=function(){this.calling=!1,this.apis=Object.assign(this.apis,{p2p:{value:0},meeting:{value:0},bypass:{value:0},call_control_type:{value:0},self_mute:{value:-1},self_mic_mute:{value:-1},switch_p2p_type:{value:0},set_speaker:{value:-1},net_detect:{value:this.isRtc?-1:0},beautify:{value:-1},water_mark:{value:-1},audio_samples:{value:-1},video_samples:{value:-1},pre_view_mirror:{value:-1},code_mirror:{value:-1},custom_audio:{value:-1},custom_video:{value:-1},audio_mix:{value:-1},snap_shot:{value:-1},record:{value:0},audio_record:{value:0},display:{value:0},android_compatibility:{value:-1},hd_audio:{value:0},video_quality:{value:0},fps:{value:0},prefered_video_encoder:{value:-1},prefered_video_decoder:{value:-1},video_max_encode_bitrate:{value:this.isRtc?-1:0},audio_scene:{value:-1},video_adaptive_strategy:{value:this.isRtc?-1:0},ans:{value:this.isRtc?-1:0},agc:{value:-1},dtx:{value:-1},aec:{value:this.isRtc?-1:0},awc:{value:this.isRtc?-1:0}})},l.update=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n=e.key,r=e.ext;e.constructor===String&&(n=e),r=r||t,this.apis[n]&&(this.apis[n].value=1,void 0!==r&&(this.apis[n].ext=r),/(p2p|meeting)/.test(n)&&(this.calling=!0))},l.send=function(){var e=this;this.calling&&(this.calling=!1,this.apis.time=Date.now(),(0,a.ajax)({type:"post",url:d,data:this.apis}).then(function(t){e.resetStatus()})["catch"](function(t){console.log("err",t),e.resetStatus()}))},e.exports=t["default"]},,,function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){if(!e.url||!e.data)return Promise.reject("参数不完整，无法发起请求");e.dataType=e.dataType||"json";var t=new XMLHttpRequest;return t.open(e.type||"GET",e.url,!0),t.responseType=""+e.dataType,t.setRequestHeader("Content-type","application/json;charset=UTF-8"),e.header&&Object.keys(e.header).map(function(n){t.setRequestHeader(n,e.header[n])}),new Promise(function(n,r){t.onload=function(){var e=t.response;n(e)},t.onerror=function(e){r(e)},t.send(JSON.stringify(e.data))})};e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0,t["default"]={merge:function(){var e=arguments;return e[0]=Object.assign.apply(Object.assign,arguments),e[0]},verifyOptions:function(){var e=arguments;if(e[0]&&e[0].constructor===Object)for(var t=1;t<arguments.length;t++){var n=e[t];n=n.split(" "),n.map(function(t){if(!e[0][t])throw Error("参数缺失 "+t)})}},guid:function(){var e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return function(){return e()+e()+e()+e()+e()+e()+e()+e()}}()},e.exports=t["default"]},,function(e,t,n){"use strict";function r(e,t){for(var n in t)e[n]=t[n];return e}n(95),n(46),n(5).Promise,window.Object.assign||(console.log("Object.assign polyfill"),window.Object.assign=function(){for(var e=arguments,t=1;t<e.length;t++)e[0]=r(e[0],e[t]);return e[0]})},,,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(147);Object.defineProperty(t,"Device",{enumerable:!0,get:function(){return r(i)["default"]}});var o=n(289);Object.defineProperty(t,"MDevices",{enumerable:!0,get:function(){return r(o)["default"]}});var a=n(290);Object.defineProperty(t,"Recorder",{enumerable:!0,get:function(){return r(a)["default"]}});var s=n(291);Object.defineProperty(t,"MStream",{enumerable:!0,get:function(){return r(s)["default"]}})},function(e,t){"use strict";t.__esModule=!0,t["default"]={html2node:function(e){var t=document.createElement("div");t.innerHTML=e;var n,r,i=[];if(t.children)for(n=0,r=t.children.length;n<r;n++)i.push(t.children[n]);else for(n=0,r=t.childNodes.length;n<r;n++){var o=t.childNodes[n];1===o.nodeType&&i.push(o)}return i.length>1?t:i[0]},n2node:function(e){return e?/HTML.+Element/gi.test(e)?e:e[0]&&/HTML.+Element/gi.test(e[0])?e[0]:null:null}},e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0;var n={gateWay:{login:1,loginAck:2,join:3,keep_alive:4,keep_alive_ack:5,keep_alive_node:6,broadcast:7,toUser:8,logout:9}},r={gateWay:{1:"login",2:"loginAck",3:"join",4:"keep_alive",5:"keep_alive_ack",6:"keep_alive_node",7:"broadcast",8:"toUser",9:"logout"}};t.serializeWb=n,t.unserializeWb=r},function(e,t,n){e.exports={"default":n(125),__esModule:!0}},function(e,t,n){e.exports={"default":n(126),__esModule:!0}},function(e,t,n){e.exports={"default":n(127),__esModule:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(311),o=r(i);t["default"]=function(e){return function(){var t=e.apply(this,arguments);return new o["default"](function(e,n){function r(i,a){try{var s=t[i](a),c=s.value}catch(d){return void n(d)}return s.done?void e(c):o["default"].resolve(c).then(function(e){r("next",e)},function(e){r("throw",e)})}return r("next")})}}},function(e,t,n){e.exports=n(326)},function(e,t,n){n(130),e.exports=n(11).Object.assign},function(e,t,n){n(131);var r=n(11).Object;e.exports=function(e,t){return r.create(e,t)}},function(e,t,n){n(132),e.exports=n(11).Object.setPrototypeOf},function(e,t,n){"use strict";var r=n(24),i=n(43),o=n(25),a=n(60),s=n(58),c=Object.assign;e.exports=!c||n(19)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=c({},e)[n]||Object.keys(c({},t)).join("")!=r})?function(e,t){for(var n=a(e),c=arguments.length,d=1,u=i.f,l=o.f;c>d;)for(var p,f=s(arguments[d++]),h=u?r(f).concat(u(f)):r(f),m=h.length,v=0;m>v;)l.call(f,p=h[v++])&&(n[p]=f[p]);return n}:c},function(e,t,n){var r=n(12),i=n(14),o=function(e,t){if(i(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{r=n(45)(Function.call,n(59).f(Object.prototype,"__proto__").set,2),r(e,[]),t=!(e instanceof Array)}catch(i){t=!0}return function(e,n){return o(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:o}},function(e,t,n){var r=n(18);r(r.S+r.F,"Object",{assign:n(128)})},function(e,t,n){var r=n(18);r(r.S,"Object",{create:n(42)})},function(e,t,n){var r=n(18);r(r.S,"Object",{setPrototypeOf:n(129).set})},,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(17),s=r(a),c=n(16),d=r(c),u=n(61),l=r(u),p=n(119),f=n(20),h=function(e){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,o["default"])(this,t);var r=(0,s["default"])(this,e.call(this));return r.info=Object.assign({},n),r.init(),r.logger=n.logger||window.console,r.autoReconnect=n.autoReconnect||!0,r.isDestroy=!1,r.reConnectCount=0,r.wssUrl=null,r}return(0,d["default"])(t,e),t}(f),m=h.prototype;m.init=function(){this.reset()},m.reset=function(){this.imInfo={}},m.connect=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.url,r=void 0===n?this.wssUrl:n,i=t.imInfo;return this.imInfo=i||this.imInfo,r?new Promise(function(t,n){e.url=r;var i=void 0;try{i=e.ws=new WebSocket("wss://"+r);var o=e;i.onopen=function(n){e.wssUrl=r,o.initSignal(),o.signalConnected=!0,console.log("signalConnected",r),o.emit("signalConnected"),t(o),e.heartbeat()},i.onclose=i.onerror=function(e){o.signalConnected=!1,n(e)}}catch(a){e.logger.error("信令连接建立失败",a),n(a)}}):Promise.reject("信令地址缺失")},m.initSignal=function(){var e=this,t=this.ws,n=t.send;t.send=function(e){n.call(this,JSON.stringify(e))},t.onmessage=function(t){var n=JSON.parse(t.data||null);if(n)return!e.isHeartBeating||"keep_alive_ack"!==n.type&&n.type!==p.serializeWb.gateWay.keep_alive_ack?void e.emit("message",n):void e.onHeartBeat(n)},t.onclose=function(t){e.signalConnected=!1,e.emit("signalTimeout",t)},t.onerror=function(t){e.signalConnected=!1,e.emit("signalError",t)}},m.send=function(e){var t=this;"keep_alive"!==e.type,this.ws&&this.signalConnected&&this.ws.readyState===this.ws.OPEN?(e.browser={},e.browser.name=window.platform.name,e.browser.version=window.platform.version,this.ws.send(e)):this.once("signalConnected",function(){t.send(e)})},m.heartbeat=function(){this.socketData=this.socketData||{uid:this.imInfo.uid,cid:this.imInfo.cid},this.heartBeatList=[],this.bindHearBeat(5)},m.onHeartBeat=function(e){this.heartBeatList.shift(),this.bindHearBeat(5)},m.heartBeatHandler=function(){var e=this.socketData,t=this.heartBeatList;if(t){var n=Date.now(),r=n;if(l["default"].CURRENT.SDK_TYPE===l["default"].SDK_TYPE.WHITEBOARD&&(r=+n.toString().slice(0,-3)),t.constructor===Array&&0===t.length){t.push(n);var i=this.getContentData({type:"keep_alive",uid:l["default"].CURRENT.SDK_TYPE===l["default"].SDK_TYPE.WHITEBOARD?+e.uid:e.uid+"",cid:l["default"].CURRENT.SDK_TYPE===l["default"].SDK_TYPE.WHITEBOARD?+e.cid:e.cid+""},r);return this.send(i),void this.bindHearBeat(5)}var o=Date.now()-t[0];if(o>3e4)this.logger.error("socket error: heartbeat timeout"),this.emit("signalTimeout");else if(o>2e3&&o<3e4){this.logger.warn("socket error: no response, keep heartbeat"),t.push(n);var a=this.getContentData({type:"keep_alive",uid:e.uid,cid:e.cid},r);this.send(a),this.bindHearBeat(2)}}},m.getContentData=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];return l["default"].CURRENT.SDK_TYPE===l["default"].SDK_TYPE.WHITEBOARD?(e.version=31,e.type=p.serializeWb.gateWay[e.type],e.content={params:{timestamp:+t}}):e.params={content:{timestamp:t+""}},e},m.bindHearBeat=function(e){this.isHeartBeating&&clearTimeout(this.isHeartBeating),this.isHeartBeating=setTimeout(this.heartBeatHandler.bind(this),1e3*e)},m.stopHeartBeat=function(){this.isHeartBeating&&(this.isHeartBeating&&clearTimeout(this.isHeartBeating),this.heartBeatTimer&&clearInterval(this.heartBeatTimer),this.isHeartBeating=null,this.heartBeatTimer=null,this.heartBeatList=null,this.heartBeatCount=0)},m.logout=function(){var e=this.socketData,t=Date.now().toString(),n=this.getContentData({type:"logout",uid:e.uid,cid:e.cid},t);this.send(n)},m.destroy=function(){this.logger.log("signal close -> signal.js"),this.stopHeartBeat(),this.isDestroy=!0,this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.readyState===WebSocket.OPEN&&this.ws.close(),this.ws=null)},t["default"]=h,e.exports=t["default"]},,,,,,,,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var i=n(7),o=r(i),a=n(17),s=r(a),c=n(16),d=r(c),u=n(40),l=n(20),p=function(e){function t(n){(0,o["default"])(this,t);var r=(0,s["default"])(this,e.call(this));return n.container=u.element.n2node(n.container),n.remoteContainer=u.element.n2node(n.remoteContainer),u.tool.merge(r,n),r.init(),r}return(0,d["default"])(t,e),t}(l),f=p.prototype;f.init=function(){var e=this;this.resetStatus(),window.addEventListener("beforeunload",this.beforeunload.bind(this));var t=this.nim&&this.nim.logger||window.console;this.logger={log:function(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.debug&&t.log.apply(t,arguments)},error:function(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.debug&&t.error.apply(t,arguments)},warn:function(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.debug&&t.warn.apply(t,arguments)}}},f.resetStatus=function(){this.signalInited=!1,this.channelId=null,this.type=null,this.target={account:null,uid:null},this.sessionConfig={},this.sessionMode=null,this.imInfo={},this.calling=!1,this.isCaller=!1,this.callee=null,this.callAccepted=!1,this.callerInfo=null,this.beCalledInfo=null,this.nim&&(this.nim.protocol&&this.nim.protocol.setCurrentNetcall&&this.nim.protocol.setCurrentNetcall(),this.nim.protocol&&this.nim.protocol.setCurrentWhiteBoard&&this.nim.protocol.setCurrentWhiteBoard()),this.needQueryAccountMap={},
  this.accountUidMap={},this.uidAccountMap={},this.isOnHangup=!1},f.beforeunload=function(){this.signalInited&&(this.callerInfo||this.beCalledInfo?this.hangup():this.leaveChannel())},f.baseGetAccount=function(){return this.nim&&this.nim.account},f.baseGetUid=function(){return this.accountUidMap?this.accountUidMap[this.nim.account]||"-1":"-1"},f.parseAccountUidMap=function(e){var t=this;Object.keys(e).forEach(function(n){t.addAccountUidMap({account:n,uid:e[n]})})},f.addAccountUidMap=function(e){var t=e.account,n=e.uid;this.uidAccountMap||(this.uidAccountMap={}),this.uidAccountMap[n]=t,this.accountUidMap||(this.accountUidMap={}),this.accountUidMap[t]=n},f.getAccountWithUid=function(e){if(this.uidAccountMap)return this.uidAccountMap[e]},f.getUidWithAccount=function(e){if(this.accountUidMap)return this.accountUidMap[e]},f.baseIsCurrentChannelId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.channelId&&this.channelId===e.channelId},f.baseNotCurrentChannelId=function(e){return!this.baseIsCurrentChannelId(e)},f.baseResponse=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.fn||"calleeAck",r=t.beCalledInfo||this.beCalledInfo,i=r.accepted=t.accepted!==!1;return i?(this.sessionMode="p2p",this.type=r.type,this.channelId=r.channelId,this.target.account=r.account,this.calling=!0,this.imInfo=r,this.imInfo.sessionMode=this.sessionMode,this.imInfo.role=0,this.setSessionConfig({signalStartTime:Date.now()})):(this.logger.log("reject call",r),this.packNetcallRecord({type:r.type,channelId:r.channelId,isCaller:!1,target:r.account,recordType:"rejectNetcall"})),this.nim[n](r).then(function(){i&&(t.sessionConfig&&e.setSessionConfig(t.sessionConfig),e.beCalledInfo=r,e.initSession({beCalledInfo:r}))},function(t){throw e.logger.log(t),t})},f.baseControl=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.channelId=t.channelId||this.channelId,t.command&&t.channelId){this.controller.uploadDataApi("update",{key:"call_control_type"});var n=t.fn||"netcallControl";return t.type=t.command,this.nim[n](t)["catch"](function(t){e.logger.log(t)})}},f.baseHangup=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.controller.uploadDataApi("send");var t=e.channelId,n=void 0===t?this.channelId:t,r=e.recordType;if(n){var i=e.fn||"hangup";this.nim[i]({channelId:n})}n===this.channelId&&(this.isCaller&&!this.callAccepted&&(this.logger.log(r,{channelId:n}),this.packNetcallRecord({recordType:r})),this.resetWhenHangup())},f.baseStartSession=function(){this.imInfo.cid=this.imInfo.cid||this.imInfo.channelId;var e=this.sessionMode=this.sessionMode||"p2p";this.imInfo.sessionMode=e,this.imInfo.sessionConfig=this.sessionConfig,this.imInfo.serverMap&&this.imInfo.serverMap.constructor===String&&(this.imInfo.serverMap=JSON.parse(this.imInfo.serverMap))},f.packNetcallRecord=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.recordType,n=e.type||this.type,r=e.channelId||this.channelId,i=e.duration||0,o=e.isCaller||this.isCaller,a=e.target||this.target.account,s=this.baseGetAccount(),c=o?s:a,d=o?a:s,l=+new Date;this.nim.protocol.onMsg({content:{msg:{attach:JSON.stringify({data:{calltype:n,channel:r,duration:i,ids:[s,a],time:l},id:t}),from:c,fromClientType:o?16:0,fromDeviceId:"",fromNick:"",idClient:u.tool.guid(),idServer:u.tool.guid(),scene:0,time:l,to:d,type:5}}})},f.setSessionConfig=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u.tool.merge(this.sessionConfig,e)},f.initSignal=function(){return Promise.resolve()},f.initSession=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.sessionMode="p2p";var n=this.isCaller?this.callerInfo:t.beCalledInfo;this.parseAccountUidMap(n.accountUidMap),!n.account&&n.uid&&(n.account=this.getAccountWithUid(n.uid)),this.callAccepted=!0,this.signalInited=!0,this.setSessionConfig({signalEndTime:Date.now()}),this.controller.uploadDataApi("start",{uid:n.uid}),this.target.uid=this.getUidWithAccount(this.target.account);var r={type:n.type,account:this.target&&this.target.account||n.account,channelId:n.channelId};n.netcallType&&(r.netcallType=n.netcallType),this.imInfo.target=this.target,setTimeout(function(){e.emit("callAccepted",r)},1)},f.onBeCalled=function(e){this.signalInited=!0,this.channelId=e.channelId,this.beCalledInfo=e,this.logger.log("beCalling",e),this.emit("beCalling",e)},f.onUserJoin=function(e){if(this.logger.log("client on userJoined",e),e.type=e.type||this.type,e.account=this.getAccountWithUid(e.uid),e.mode=this.sessionMode,e.account!==this.baseGetAccount()){if(e.account)return this.logger.log("userjoin ----> from signal",e),void this.emit("joinChannel",e);this.needQueryAccountMap[e.uid]=e;var t=this.nim.queryAccountUidMap||this.nim.wbQueryAccountUidMap;t.call(this.nim,this.channelName,[e.uid])}},f.onUserLeft=function(e){var t=this;this.imInfo.channelId&&(this.logger.log("leave channel from signal"),"p2p"===this.imInfo.sessionMode?(this.controller.uploadDataApi("send"),setTimeout(function(){t.logger.log("超时处理 onUserLeft"),t.resetWhenHangup()},1e3),this.emit("hangup",{channelId:e.channelId||e.cid,account:this.target.account,type:e.type||0})):this.emit("leaveChannel",{channelId:e.channelId||e.cid,account:this.getAccountWithUid(e.uid),type:e.type||0}))},f.onNotifyJoin=function(e){if(this.logger){this.logger.log("join channel from IM");var t=e.accountUidMap,n=this.needQueryAccountMap;this.parseAccountUidMap(t);for(var r in t){var i=r,o=t[r];if(o in n){var a=n[o];a.account=i,delete n[o],this.logger.log("userjoin ----> from IM",e),this.emit("joinChannel",a)}}}},f.onCalleeAck=function(e){if(this.logger.log("收到被叫的通知",e),!this.baseNotCurrentChannelId(e)){var t=e.account,n=this.beCalledInfo||this.callerInfo;this.target.account=t,this.setSessionConfig({signalEndTime:Date.now()}),e.accepted?(this.callAccepted=!0,this.initSession()):(this.logger.log("call Rejected",e),this.packNetcallRecord({type:e.type,channelId:e.channelId,isCaller:!0,target:e.account,recordType:"netcallRejected"}),this.resetWhenHangup(),this.emit("callRejected",{type:n.type,account:t}))}},f.onHangup=function(e){var t=this;this.channelId&&"p2p"===this.sessionMode&&(this.logger.log("on hangup from IM"),this.controller.uploadDataApi("send"),setTimeout(function(){t.logger.log("超时处理 onHangup"),t.resetWhenHangup()},1e3),this.emit("hangup",{channelId:e.channelId,account:e.account,type:0}))},f.onControl=function(e){this.emit("control",e)},f.onCalleeAckSync=function(e){this.emit("callerAckSync",e),this.baseIsCurrentChannelId(e)&&this.resetWhenHangup()},f.baseCreateChannel=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.tool.verifyOptions(n,"channelName"),n.custom=n.custom||"",this.setSessionConfig({signalStartTime:Date.now()}),this.nim[e](n).then(function(e){return Promise.resolve(e)})["catch"](function(e){return t.setSessionConfig({signalEndTime:Date.now()}),Promise.reject(e)})},f.baseJoinChannel=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.nim[e](n).then(function(e){return t.setSessionConfig({signalEndTime:Date.now()}),t.signalInited=!0,t.sessionMode=e.sessionMode="meeting",t.parseAccountUidMap(e.accountUidMap),e.uid=t.getUidWithAccount(t.nim.account),Promise.resolve(e)})["catch"](function(e){return t.setSessionConfig({signalEndTime:Date.now()}),Promise.reject(e)})},f.format=function(e){return e.rtcServerMap&&(e.rtcServerMap=JSON.parse(e.rtcServerMap),e.rtcServerMap=e.rtcServerMap.webrtcarray||[e.rtcServerMap.webrtc]||e.rtcServerMap),e.wbServerMap&&(e.wbServerMap=JSON.parse(e.wbServerMap),e.wbServerMap=e.wbServerMap.webrtcarray||[e.wbServerMap.webrtc]||e.wbServerMap),e},f.resetWhenHangup=function(){},e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(17),s=r(a),c=n(16),d=r(c),u=n(135),l=r(u),p=n(61),f=r(p),h=n(106),m=r(h),v=n(20),g=function(e){return new m["default"](e)},y=function(e){function t(n){(0,o["default"])(this,t);var r=(0,s["default"])(this,e.call(this,n));return r.info={},r._init(n),r._reset(),r}return(0,d["default"])(t,e),t.prototype._init=function(e){this.info=Object.assign(this.info,e),this.logger=e.logger||window.console,f["default"].STATS_RTC[f["default"].CURRENT.SDK_TYPE]&&(this.dataApi=g({appkey:this.info.appKey,platform:f["default"].SDK_NAME[f["default"].CURRENT.SDK_TYPE]}))},t.prototype._reset=function(){this.signal&&(this.signal.destroy(),this.signal=null),this.sessionConfig={},this.imInfo={},this.target={},this.userJoinTimeoutId=0,this.remoteNodeStatus={}},t.prototype.resetStatus=function(){this._reset()},t.prototype._startSession=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.imInfo||e;t.uid=+t.uid,t.cid=+t.cid,this.setSessionConfig(t.sessionConfig);var n=t.serverMap||{};t.urlArray=t.serverAddrs||n.webrtcarray||[n.webrtc];var r=void 0;return r=this.signal?Promise.resolve(this.signal):this._initSignal()},t.prototype._initSignal=function(){var e=this;if(this.signal)return Promise.resolve();var t=new l["default"]({logger:this.logger}),n=this.imInfo.urlArray;if(n){var r=n.shift();return r?t.connect({url:r,imInfo:this.imInfo}).then(function(t){return e.signal=t,e._initSignalEvent(),Promise.resolve(t.url)})["catch"](function(t){return e._initSignal()}):Promise.reject("无可用的网关服务器地址, 如果当前应用是WebRTC音视频, 请确保对方打开了WebRTC兼容开关")}},t.prototype._initSignalEvent=function(){var e=this,t=this.signal;t.on("signalTimeout",this.onSignalTimeout.bind(this)),t.on("message",this.onSignalMessage.bind(this)),t.on("signalClosed",function(){e.emit("signalClosed"),e.resetStatus()}),this.signal.on("signalError",function(t){e.emit("signalClosed"),e._stopSignal()})},t.prototype._stopSignal=function(){this.signal&&(this.signal.destroy(),this.signal=null)},t.prototype._stopSession=function(){this._stopSignal(),this._reset()},t.prototype._logout=function(){this.signal&&this.signal.logout()},t.prototype.setAppKey=function(e){e&&(this.info.appKey=e)},t.prototype.setSessionConfig=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.sessionConfig=Object.assign(this.sessionConfig,e)},t.prototype.onSignalMessage=function(e){},t.prototype.onSignalTimeout=function(e){},t.prototype.uploadDataApi=function(e,t){f["default"].STATS_FUN[f["default"].CURRENT.SDK_TYPE]&&this.info.appKey&&("start"===e&&(t.appkey=this.info.appKey),this.dataApi[e]&&this.dataApi[e](t))},t}(v);t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(124),o=r(i),a=n(123),s=r(a);t["default"]={getDevices:function(){var e=this;return(0,s["default"])(o["default"].mark(function t(){var n;return o["default"].wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("开始获取设备列表"),n=null,navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices){e.next=4;break}return e.abrupt("return",Promise.reject("your browser not support this feature, see https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices"));case 4:return e.next=6,navigator.mediaDevices.enumerateDevices().then(function(e){0!==e.length&&(n={video:[],audioIn:[],audioOut:[]},e.forEach(function(e){"videoinput"===e.kind?n.video.push({deviceId:e.deviceId,label:e.label?e.label:"camera "+(n.video.length+1)}):"audioinput"===e.kind?n.audioIn.push({deviceId:e.deviceId,label:e.label?e.label:"microphone "+(n.audioIn.length+1)}):"audiooutput"===e.kind&&n.audioOut.push({deviceId:e.deviceId,label:e.label?e.label:"speaker "+(n.audioOut.length+1)})}))});case 6:return e.abrupt("return",n);case 7:case"end":return e.stop()}},t,e)}))()}},e.exports=t["default"]},,,function(e,t,n){"use strict";function r(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=i(t),this.reject=i(n)}var i=n(56);e.exports.f=function(e){return new r(e)}},,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(106),o=r(i),a=n(172),s=r(a),c=n(173),d=r(c);t["default"]={DataApi:function(e){return new o["default"](e)},DataRtc:function(e){return new s["default"](e)},DataStats:function(e){return new d["default"](e)}},e.exports=t["default"]},,,,,,,,,,function(e,t){"use strict";function n(e){r(e.enable)&&(this.enable=e.enable?1:0),r(e.needBadge)&&(this.needBadge=e.needBadge?1:0),r(e.needPushNick)&&(this.needPushNick=e.needPushNick?1:0),r(e.pushContent)&&(this.pushContent=""+e.pushContent),r(e.custom)&&(this.custom=""+e.custom),r(e.pushPayload)&&(this.pushPayload=""+e.pushPayload),r(e.sound)&&(this.sound=""+e.sound),r(e.webrtcEnable)&&(this.webrtcEnable=e.webrtcEnable?1:0)}t.__esModule=!0,t["default"]=function(e){var t=e.util;return r=t.notundef,n};var r=void 0;e.exports=t["default"]},,,,,,,,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(40),s=n(4),c=s.info.nrtcVersion,d="https://statistic.live.126.net/statistic/realtime/sdkinfo",u=function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,o["default"])(this,f);var t=e.appkey;this.infos={},this.userlist=[],this.localVolumn=0,this.local={},this.remote={},this.init(t),this.resetStatus()};t["default"]=u;var l=u.prototype;l.init=function(e){this.infos=Object.assign(this.infos,{ver:1,device:-1,isp:-1,platform:p.convertPlatform(platform.os.family)+"-"+platform.os.version,browser:platform.name+"-"+platform.version,sdk_ver:c||"3.6.0",appkey:e,interval:60,samples:30,time:null,qos_algorithm:-1,fec_algorithm:-1,qos_scene:-1,qos_strategy:-1})},l.resetStatus=function(){this.infos=Object.assign(this.infos,{uid:null,cid:null,push_url:null,turn_ip:null,proxy_ip:null,meeting:!1,live:!1}),this.clearInfoData(),this.uidSsrcMap={},this.userlist=[]},l.initInfoData=function(e){var t={uid:e,cid:this.imInfo&&this.imInfo.channelId||-1,push_url:this.sessionConfig&&this.sessionConfig.rtmpUrl||-1,turn_ip:this.imInfo&&this.imInfo.turnMap||-1,proxy_ip:this.imInfo&&this.imInfo.turnMap||-1,meeting:/^meeting$/gi.test(this.imInfo.sessionMode),live:this.sessionConfig&&this.sessionConfig.liveEnable||!1,p2p:!1,isp:-1,net:-1,connect_state:this.imInfo&&this.imInfo.code||200,signalling_time:(this.sessionConfig&&this.sessionConfig.signalEndTime||0)-(this.sessionConfig&&this.sessionConfig.signalStartTime||0),connect_time:(this.sessionConfig&&this.sessionConfig.rtcEndTime||0)-(this.sessionConfig&&this.sessionConfig.rtcStartTime||0)};this.infos=Object.assign(this.infos,t)},l.clearInfoData=function(){this.localVolumn=0,this.infos=Object.assign(this.infos,{rx:{audio:[],video:[]},tx:{a_lost:[],v_lost:[],rtt:[],rtt_mdev:[],set_v_fps:[],qos_v_fps:[],v_fps:[],set_v_quality:[],real_v_res:[],real_v_kbps:[],real_v_kbps_n:[],real_a_kbps:[],real_a_kbps_n:[],set_v_kbps:[],qos_v_kbps:[],tx_bw_kbps:[],a_volume:[]}})},l.start=function(e){var t=this,n=e.info,r=e.imInfo,i=e.remoteUidMsidMap,o=e.sessionConfig,a=e.rtcConnection,s=e.uid;r&&i&&a&&(this.infos.appkey=n.appKey||n.appkey||this.infos.appkey,this.imInfo=r||{},this.remoteUidMsidMap=i||{},this.sessionConfig=o||{},this.rtcConnection=a,this.videoConfig=e.videoConfig||{},this.statsTimer||(this.getTurnMap(),this.initInfoData(s),this.format(),this.statsTimer=setInterval(function(){t.sendInfo()},1e3*this.infos.interval)))},l.stop=function(){this.statsTimer&&(clearInterval(this.statsTimer),this.statsTimer=null,this.resetStatus())},l.update=function(e){this.rtcStats=e,this.format(),this.updateRxMediaInfo(),this.updateTxMediaInfo()},l.updateOnce=function(e){var t=e.imInfo,n=e.remoteUidMsidMap,r=e.sessionConfig,i=e.rtcConnection;t&&(this.imInfo=t||{},this.remoteUidMsidMap=n||{},this.sessionConfig=r||{},this.rtcConnection=i||{},this.videoConfig=e.videoConfig||{},this.getTurnMap(),this.initInfoData(),this.sendInfo())},l.updateLocalVolumn=function(e){this.localVolumn=e},l.updateRxMediaInfo=function(){var e=this,t={u:[],g:[],c:[],bn:[],bc:[]},n={u:[],i:[],bn:[],bc:[],r:[],f:[]};this.userlist.map(function(r){var i=e.getMediaStats(r);t.u.push(i.audio.u),t.g.push(-1),t.c.push(-1),t.bn.push(i.audio.bn),t.bc.push(i.audio.bc),n.u.push(i.video.u),n.i.push(i.video.i),n.bn.push(i.video.bn),n.bc.push(i.video.bc),n.r.push(i.video.r),n.f.push(i.video.f)}),this.infos.rx.audio.push(t),this.infos.rx.video.push(n)},l.getMediaStats=function(e){var t=this.rtcStats,n={audio:{u:+e,g:-1,c:-1,bn:0,bc:0},video:{u:+e,i:-1,bn:0,bc:0,r:-1,f:0}},r={},i=this.uidSsrcMap[e];if(!i)return n;i=i.join("|");var o=new RegExp("("+i+")");return t.results.filter(function(e){return o.test(e.ssrc)&&(r[e.mediaType]=e),o.test(e)}),r.audio&&(n.audio.bn=(r.audio.availableBandwidth||0)-0,n.audio.bc=-1),r.video&&(n.video.bn=(r.video.availableBandwidth||0)-0,n.video.bc=r.video.googFrameWidthReceived+"x"+r.video.googFrameHeightReceived,n.video.f=(r.video.googFrameRateDecoded||0)-0),n},l.getLocalMediaStats=function(){var e=this.rtcStats,t={a_lost:-1,v_lost:-1,rtt:0,rtt_mdev:-1,set_v_fps:this.videoConfig.frameRate||0,qos_v_fps:0,v_fps:0,set_v_quality:this.sessionConfig.videoQuality,real_v_res:0,real_v_kbps:0,real_v_kbps_n:0,real_a_kbps:-1,real_a_kbps_n:0,set_v_kbps:-1,qos_v_kbps:0,tx_bw_kbps:0,a_volume:0},n={},r=this.imInfo.uid,i=this.uidSsrcMap[r];if(!i)return t;i=i.join("|");var o=new RegExp("("+i+")");return e.results.filter(function(e){return e.localCandidateId?void(n.rtt=e):(o.test(e.ssrc)&&(n[e.mediaType]=e),o.test(e))}),n.audio&&(t.real_a_kbps_n=(n.audio.availableBandwidth||e.audio.send.availableBandwidth)-0,t.a_volume=this.localVolumn-0),n.video&&(t.qos_v_fps=n.video.googFrameRateInput-0,t.v_fps=n.video.googFrameRateSent-0,t.real_v_res=n.video.googFrameWidthSent+"x"+n.video.googFrameHeightSent,t.real_v_kbps=n.video.googEncodeUsagePercent-0,t.real_v_kbps_n=n.video.availableBandwidth-0),t.rtt=n.rtt.googRtt-0,t.tx_bw_kbps=(e.connectionType.bitsSentPerSecond||0)-0,t},l.updateTxMediaInfo=function(){var e=this.getLocalMediaStats(),t=this.infos.tx;for(var n in e)t[n].push(e[n]);this.infos.net=p.convertNetwork(this.rtcStats.connectionType.local.networkType[0])},l.getTurnMap=function(){var e=this.imInfo;e.serverMap&&(e.turnMap=JSON.parse(e.serverMap||null),e.turnMap=e.turnMap&&e.turnMap.turnaddrs,e.turnMap=e.turnMap&&e.turnMap[0],e.turnMap=e.turnMap.constructor===Array?e.turnMap[0]:e.turnMap,e.turnMap=e.turnMap&&e.turnMap.match(/\d+\.\d+.\d+\.\d+/),e.turnMap=e.turnMap[0])},l.getSsrc=function(e,t){var n=[],r={audio:this.getTypeSsrc("audio",e,t),video:this.getTypeSsrc("video",e,t)};return r.audio&&n.push(r.audio),r.video&&n.push(r.video),n},l.getTypeSsrc=function(e,t,n){var r=void 0,i="";if(r=new RegExp(e+"[.\\r\\n\\s\\S]*ssrc:(\\d+)\\smsid:"+t),i=n.match(r),i=i&&i[0])return r=new RegExp("ssrc:\\d+\\smsid:"+t),i=i.match(r),i=i.map(function(e){return r=new RegExp("ssrc:(\\d+)\\s"),e=e.match(r),e[1]})},l.format=function(){this.formatLocal(),this.formatRemote()},l.formatLocal=function(){this.localSdp=this.rtcConnection.localDescription,this.localStream=this.rtcConnection.getLocalStreams()[0],this.localStream&&(this.uidSsrcMap[this.imInfo.uid]=this.getSsrc(this.localStream.id,this.localSdp.sdp),this.local.ssrc=this.uidSsrcMap[this.imInfo.uid])},l.formatRemote=function(){this.remoteSdp=this.rtcConnection.remoteDescription,this.userlist=[];var e=this.remoteUidMsidMap;for(var t in e)this.userlist.push(t),this.remote[t]={},this.uidSsrcMap[t]=this.getSsrc(e[t],this.remoteSdp.sdp),this.remote[t].ssrc=this.uidSsrcMap[t]},l.sendInfo=function(){var e=this;this.infos.uid&&this.infos.cid&&(this.infos.time=Date.now(),this.infos.samples=this.infos.rx.audio.length,(0,a.ajax)({type:"post",url:d,data:this.infos}).then(function(t){e.clearInfoData()})["catch"](function(t){e.clearInfoData()}))};var p={convertNetwork:function(e){var t={wlan:"wifi",lan:"ethernet"};return t[e]||"unknown"},convertPlatform:function(e){var t=/Windows/i,n=/OS X/i,r=void 0;return r=t.test(e)&&"Win"||e,r=n.test(r)&&"Mac"||r}};e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(40),s=n(4),c=s.info.nrtcVersion,d="//statistic.live.126.net/webrtc/stat",u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,o["default"])(this,e);var n=t.appkey;this.infos={},this.init(n),this.resetStatus()}return e.prototype.resetStatus=function(){},e.prototype.init=function(e){this.infos=Object.assign(this.infos,{interval:30,ver:1,platform:l.convertPlatform(platform.os.family)+"-"+platform.os.version,browser:platform.name+"-"+platform.version,sdk_ver:c||"3.6.0",uid:null,appkey:e,time:null,data:{}})},e.prototype.clear=function(){this.infos.data={}},e.prototype.start=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.infos.appkey=e.appKey||e.appkey||this.infos.appkey,this.infos.cid=e.cid,this.infos.uid=e.uid},e.prototype.stop=function(){this.clear()},e.prototype.update=function(e){this.infos.data["stat_"+Date.now()]=e,Object.keys(this.infos.data).length===this.infos.interval&&this.send()},e.prototype.send=function(){var e=this;0!==Object.keys(this.infos.data).length&&(this.infos.time=Date.now(),(0,a.ajax)({type:"post",url:d,data:this.infos}).then(function(t){e.clear()})["catch"](function(e){console.log("err",e)}))},e}();t["default"]=u;var l={convertNetwork:function(e){var t={wlan:"wifi",lan:"ethernet"};return t[e]||"unknown"},convertPlatform:function(e){var t=/Windows/i,n=/OS X/i,r=void 0;return r=t.test(e)&&"Win"||e,r=n.test(r)&&"Mac"||r}};e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=void 0,n={ogg:'video/ogg; codecs="theora"',h264:'video/mp4; codecs="avc1.42E01E"',webm:'video/webm; codecs="vp8, vorbis"',vp9:'video/webm; codecs="vp9"',hls:'application/x-mpegURL; codecs="avc1.42E01E"'};return t||(t=document.createElement("video")),!!t.canPlayType(n[e]||e)}function o(){var e=window.platform&&window.platform.name,t=window.platform&&window.platform.version;return console.log("platform",window.platform),t=t&&t.match(/(\d|\.)+/)[0],t=t&&t.match(/\d+/)[0],{prefix:e,version:t}}t.__esModule=!0;var a=n(124),s=r(a),c=n(123),d=r(c),u=n(147),l=r(u),p=navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,f=window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext,h=window.RTCPeerConnection=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection,m=window.RTCDataChannel=window.RTCDataChannel||window.DataChannel,v=(window.RTCSessionDescription=window.RTCSessionDescription||window.mozRTCSessionDescription,window.RTCIceCandidate=window.RTCIceCandidate||window.mozRTCIceCandidate,window.MediaStream=window.MediaStream||window.webkitMediaStream),g={WebRTC:!!h&&!!v,RTCPeerConnection:!!h,Vp8:i("webm"),Vp9:i("vp9"),H264:i("h264"),GetUserMedia:!!p&&!!navigator.mediaDevices,DataChannel:!!(h&&m&&h.prototype&&h.prototype.createDataChannel),WebAudio:!(!f||!f.prototype.createMediaStreamSource),MediaStream:!!v};t["default"]={checkWebAudio:function(){return{WebAudio:g.WebAudio,MediaStream:g.MediaStream}},checkCompatibility:function(){var e=Object.assign(o(),{system:window.platform&&window.platform.os.family+" "+window.platform.os.version,browser:window.platform&&window.platform.name,version:window.platform&&window.platform.version}),t=!1;return new Promise(function(n,r){var i=this;(0,d["default"])(s["default"].mark(function o(){var r,a;return s["default"].wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return r=Object.assign(e,g,{ScreenSharing:!!t}),i.next=3,l["default"].getDevices()["catch"](function(e){return console.warn(e),n(r)});case 3:return a=i.sent,r.MicrophoneList=a&&a.audioIn||[],r.CameraList=a&&a.video||[],r.Microphone=a&&a.audioIn&&a.audioIn.length>0||!1,r.Camera=a&&a.video&&a.video.length>0||!1,i.abrupt("return",n(r));case 9:case"end":return i.stop()}},o,i)}))()})},checkVersion:function(){return o()}},e.exports=t["default"]},function(e,t,n){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.stream,n=e.uid,r=e.isAnalyze,i=e.isRemote;this.support=o.WebAudio&&o.MediaStream,this.gain=1,this.stream=t,this.support&&(this.audioIn={},this.uid=n||0,this.isAnalyze=r,this.isRemote=i||!1,this.instant=0,this.slow=0,this.clip=0,this.init())}t.__esModule=!0,t["default"]=r;var i=n(67),o=i.RtcSupport.checkWebAudio();r.ac=o.WebAudio&&o.MediaStream?new window.AudioContext:{},r.destination=r.ac.createMediaStreamDestination?r.ac.createMediaStreamDestination():{};var a=r.prototype;a.context=r.ac,a.init=function(){this.validateInput()&&(this.isAnalyze&&this.initMonitor(),this.formatStreams(),this.initWebAudio(),this.initAudioIn())},a.validateInput=function(){return/(Array|MediaStream|LocalMediaStream)/.test(this.stream.constructor)},a.initMonitor=function(){var e=this,t=this.script=this.context.createScriptProcessor(0,1,1);t.onaudioprocess=function(t){var n,r=t.inputBuffer.getChannelData(0),i=0,o=0;for(n=0;n<r.length;++n)i+=Math.abs(r[n]),Math.abs(r[n])>.99&&(o+=1);e.instant=Math.sqrt(i/r.length),e.slow=.95*e.slow+.05*e.instant,e.clip=o/r.length}},a.initWebAudio=function(){var e=this.context;this.gainFilter=e.createGain(),this.destination=this.isRemote?r.destination:e.createMediaStreamDestination(),this.gainFilter.gain.value=this.gain,this.gainFilter.connect(this.destination)},a.initAudioIn=function(){function e(e){if(!/(MediaStream|LocalMediaStream)/.test(e.constructor))return null;if(0===e.getAudioTracks().length)return null;var t=i.createMediaStreamSource(e);return n.isAnalyze&&n.script&&(t.connect(n.script),n.script.connect(n.gainFilter)),t.connect(n.gainFilter),t}var t=this,n=this,r=this.stream,i=this.context,o=void 0;return/(MediaStream|LocalMediaStream)/.test(r.constructor)?(e(r),void(this.outputStream=this.destination.stream)):void(r.constructor===Array&&(r.forEach(function(n){o=e(n),o&&(t.audioIn[n.id]=o)}),this.outputStream=this.destination.stream))},a.formatStreams=function(){var e=this.stream,t=[];return/(MediaStream|LocalMediaStream)/.test(e.constructor)?(e.getAudioTracks().map(function(e){t.push(new MediaStream([e]))}),void(this.stream=t)):void(e.constructor===Array&&(e.map(function(e){e.getAudioTracks().map(function(e){t.push(new MediaStream([e]))})}),this.stream=t))},a.addStream=function(e){var t=this.context;if(0!==e.getAudioTracks().length){var n=t.createMediaStreamSource(e);this.isAnalyze&&this.script&&n.connect(this.script),n.connect(this.gainFilter),this.audioIn[e.id]=n,this.outputStream=this.destination.stream}},a.updateStream=function(e){if(this.audioIn)for(var t in this.audioIn)this.audioIn[t]&&this.audioIn[t].disconnect(0),this.audioIn[t]=null;this.audioIn={},this.stream=e,this.initAudioIn()},a.setGain=function(e){this.support&&(this.gainFilter.gain.value=e,this.gain=e)},a.getGain=function(){return this.gain},a.off=function(){return this.setGain(0)},a.on=function(){this.setGain(1)},a.destroy=function(){function e(e){e&&e.getTracks().forEach(function(t){e.removeTrack(t)})}if(this.instant=0,this.slow=0,this.clip=0,this.gainFilter&&this.gainFilter.disconnect(0),this.script&&this.script.disconnect(0),this.audioIn)for(var t in this.audioIn)this.audioIn[t]&&this.audioIn[t].disconnect(0);this.audioIn={};var n=this.stream;/(MediaStream|LocalMediaStream)/.test(n.constructor)&&e(n),n.constructor===Array&&n.forEach(function(t){e(t)}),this.stream=null,this.outputStream=null},a.getVolumeData=function(){return this.instant.toFixed(2)},e.exports=t["default"]},,,,,,,,,,,function(e,t,n){var r=n(41),i=n(3)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(n){}};e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(t){return{e:!0,v:t}}}},function(e,t,n){var r=n(14),i=n(12),o=n(150);e.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=o.f(e),a=n.resolve;return a(t),n.promise}},function(e,t,n){var r=n(14),i=n(56),o=n(3)("species");e.exports=function(e,t){var n,a=r(e).constructor;return void 0===a||void 0==(n=r(a)[o])?t:i(n)}},function(e,t,n){var r,i,o,a=n(45),s=n(315),c=n(68),d=n(47),u=n(2),l=u.process,p=u.setImmediate,f=u.clearImmediate,h=u.MessageChannel,m=u.Dispatch,v=0,g={},y="onreadystatechange",S=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},b=function(e){S.call(e.data)};p&&f||(p=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return g[++v]=function(){s("function"==typeof e?e:Function(e),t)},r(v),v},f=function(e){delete g[e]},"process"==n(41)(l)?r=function(e){l.nextTick(a(S,e,1))}:m&&m.now?r=function(e){m.now(a(S,e,1))}:h?(i=new h,o=i.port2,i.port1.onmessage=b,r=a(o.postMessage,o,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(r=function(e){u.postMessage(e+"","*")},u.addEventListener("message",b,!1)):r=y in d("script")?function(e){c.appendChild(d("script"))[y]=function(){c.removeChild(this),S.call(e)}}:function(e){setTimeout(a(S,e,1),0)}),e.exports={set:p,clear:f}},,,,,,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"},{push:"invalid",names:["value"]}]};Object.keys(n).forEach(function(e){var t=n[e];t.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})},function(e,t,n){"use strict";var r={};r.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},r.splitSections=function(e){var t=e.split("\nm=");return t.map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})},r.getDescription=function(e){var t=r.splitSections(e);return t&&t[0]},r.getMediaSections=function(e){var t=r.splitSections(e);return t.shift(),t},r.matchPrefix=function(e,t){return r.splitLines(e).filter(function(e){return 0===e.indexOf(t)})},r.parseCandidate=function(e){var t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");for(var n={foundation:t[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;case"ufrag":n.ufrag=t[r+1],n.usernameFragment=t[r+1];break;default:n[t[r]]=t[r+1]}return n},r.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},r.parseIceOptions=function(e){return e.substr(14).split(" ")},r.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.numChannels=3===t.length?parseInt(t[2],10):1,n},r.writeRtpMap=function(e){var t=e.payloadType;return void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType),"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==e.numChannels?"/"+e.numChannels:"")+"\r\n"},r.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?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(";"),i=0;i<r.length;i++)t=r[i].trim().split("="),n[t[0].trim()]=t[1];return n},r.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach(function(t){r.push(t+"="+e.parameters[t])}),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},r.writeRtcpFb=function(e){var t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},r.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},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){var n=r.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:n.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);n=n.concat(r.splitLines(t));var i={usernameFragment:n.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)};return i},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),i=n[0].split(" "),o=3;o<i.length;o++){var a=i[o],s=r.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(s){var c=r.parseRtpMap(s),d=r.matchPrefix(e,"a=fmtp:"+a+" ");switch(c.parameters=d.length?r.parseFmtp(d[0]):{},c.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(r.parseRtcpFb),t.codecs.push(c),c.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(c.name.toUpperCase())}}}return r.matchPrefix(e,"a=extmap:").forEach(function(e){t.headerExtensions.push(r.parseExtmap(e))}),t},r.writeRtpDescription=function(e,t){var n="";n+="m="+e+" ",n+=t.codecs.length>0?"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 i=0;return t.codecs.forEach(function(e){e.maxptime>i&&(i=e.maxptime)}),i>0&&(n+="a=maxptime:"+i+"\r\n"),n+="a=rtcp-mux\r\n",t.headerExtensions.forEach(function(e){n+=r.writeExtmap(e)}),n},r.parseRtpEncodingParameters=function(e){var t,n=[],i=r.parseRtpParameters(e),o=i.fecMechanisms.indexOf("RED")!==-1,a=i.fecMechanisms.indexOf("ULPFEC")!==-1,s=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),c=s.length>0&&s[0].ssrc,d=r.matchPrefix(e,"a=ssrc-group:FID").map(function(e){var t=e.split(" ");return t.shift(),t.map(function(e){return parseInt(e,10)})});d.length>0&&d[0].length>1&&d[0][0]===c&&(t=d[0][1]),i.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var r={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10),rtx:{ssrc:t}};n.push(r),o&&(r=JSON.parse(JSON.stringify(r)),r.fec={ssrc:t,mechanism:a?"red+ulpfec":"red"},n.push(r))}}),0===n.length&&c&&n.push({ssrc:c});var u=r.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substr(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substr(5),10)*.95-16e3:void 0,n.forEach(function(e){e.maxBitrate=u})),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 i=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=i.length>0,t.compound=0===i.length;var o=r.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},r.parseMsid=function(e){var t,n=r.matchPrefix(e,"a=msid:");if(1===n.length)return t=n[0].substr(7).split(" "),{stream:t[0],track:t[1]};var i=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return i.length>0?(t=i[0].value.split(" "),{stream:t[0],track:t[1]}):void 0},r.generateSessionId=function(){return Math.random().toString().substr(2,21)},r.writeSessionBoilerplate=function(e,t){var n,i=void 0!==t?t:2;return n=e?e:r.generateSessionId(),"v=0\r\no=thisisadapterortc "+n+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.writeMediaSection=function(e,t,n,i){var o=r.writeRtpDescription(e.kind,t);if(o+=r.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",o+=e.direction?"a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?"a=sendrecv\r\n":e.rtpSender?"a=sendonly\r\n":e.rtpReceiver?"a=recvonly\r\n":"a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+r.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+r.localCName+"\r\n"),o},r.getDirection=function(e,t){for(var n=r.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return t?r.getDirection(t):"sendrecv"},r.getKind=function(e){var t=r.splitLines(e),n=t[0].split(" ");return n[0].substr(2)},r.isRejected=function(e){return"0"===e.split(" ",2)[1]},r.parseMLine=function(e){var t=r.splitLines(e),n=t[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},r.parseOLine=function(e){var t=r.matchPrefix(e,"o=")[0],n=t.substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},e.exports=r},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(162),i={};i.install=function(e){var t=e.fn,n=e.util,i=r({util:n});t.initNetcall=function(e){return n.verifyOptions(e,"type accounts","netcall::initNetcall"),e.pushContent="",e.custom="",e.pushConfig||(e.pushConfig={}),e.pushConfig.webrtcEnable=e.webrtcEnable,e.pushConfig=new i(e.pushConfig),this.cbAndSendCmd("initNetcall",e)},t.keepCalling=function(e){return n.verifyOptions(e,"type accounts channelId","netcall::keepCalling"),this.cbAndSendCmd("keepCalling",e)},t.calleeAck=function(e){return n.verifyOptions(e,"account channelId type accepted","netcall::calleeAck"),this.cbAndSendCmd("calleeAck",e)},t.hangup=function(e){return n.verifyOptions(e,"channelId","netcall::hangup"),this.cbAndSendCmd("hangup",e)},t.netcallControl=function(e){return n.verifyOptions(e,"channelId type","netcall::netcallControl"),this.cbAndSendCmd("netcallControl",e)},t.createChannel=function(e){return this.cbAndSendCmd("createChannel",e)},t.joinChannel=function(e){return n.verifyOptions(e,"channelName","netcall::joinChannel"),n.verifyBooleanWithDefault(e,"liveEnable",!1,"","netcall::joinChannel"),n.verifyBooleanWithDefault(e,"webrtcEnable",!1,"","netcall::joinChannel"),this.cbAndSendCmd("joinChannel",{channelName:e.channelName,liveOption:{liveEnable:e.liveEnable?1:0,webrtcEnable:e.webrtcEnable?1:0}})},t.queryAccountUidMap=function(e,t){return this.cbAndSendCmd("queryAccountUidMap",{channelName:e,uids:t})}},e.exports=i},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){"use strict";var n={};n.install=function(e){var t=e.Protocol.fn;t.processNetcall=function(e){switch(e.cmd){case"initNetcall":this.onInitNetcall(e);break;case"beCalled":this.onBeCalled(e);break;case"keepCalling":this.onKeepCalling(e);break;case"calleeAck":break;case"notifyCalleeAck":this.onNotifyCalleeAck(e);break;case"hangup":break;case"notifyHangup":this.onNotifyHangup(e);break;case"notifyNetcallControl":this.onNetcallControl(e);break;case"notifyCalleeAckSync":this.onNotifyCalleeAckSync(e);break;case"notifyNetcallRecord":this.onMsg(e);break;case"createChannel":break;case"joinChannel":this.joinChannel(e);break;case"notifyJoin":this.notifyJoin(e)}},t.onInitNetcall=function(e){if(!e.error){var t=e.obj.type;e.obj=e.content,e.obj.type=t,e.obj.accounts=e.obj.keepCallingAccounts,this.setCurrentNetcall(e.obj.channelId),this.keepCalling(e)}},t.setCurrentNetcall=function(e){this.currentNetcallChannelId=e},t.onKeepCalling=function(e){e.error||e.content.accounts.length&&this.keepCalling(e)},t.keepCalling=function(e){var t=this,n=e.obj,r=n.type,i=n.accounts,o=n.channelId;i&&i.length&&setTimeout(function(){t.currentNetcallChannelId&&t.currentNetcallChannelId===o&&t.api.keepCalling({type:r,accounts:i,channelId:o})["catch"](function(){})},3e3)},t.onBeCalled=function(e){e.error||this.emitAPI({type:"beCalled",obj:e.content})},t.onNotifyCalleeAck=function(e){e.error||this.emitAPI({type:"notifyCalleeAck",obj:e.content})},t.onNotifyHangup=function(e){e.error||this.emitAPI({type:"notifyHangup",obj:e.content})},t.onNetcallControl=function(e){e.error||this.emitAPI({type:"netcallControl",obj:e.content})},t.onNotifyCalleeAckSync=function(e){e.error||this.emitAPI({type:"notifyCalleeAckSync",obj:e.content})},t.notifyJoin=function(e){e.error||this.emitAPI({type:"notifyJoin",obj:e.content})},t.joinChannel=function(e){e.obj=e.content}},e.exports=n},,,,,,,,,function(e,t){"use strict";var n=9,r={netcall:{id:n,initNetcall:1,keepCalling:3,calleeAck:4,notifyCalleeAck:5,hangup:6,notifyHangup:7,netcallControl:8,notifyNetcallControl:9,verifyChannelId:10,createChannel:13,joinChannel:14,queryAccountUidMap:16}},i={initNetcall:{sid:n,cid:r.netcall.initNetcall,params:[{type:"byte",name:"type"},{type:"StrArray",name:"accounts"},{type:"String",name:"pushContent"},{type:"String",name:"custom"},{type:"Property",name:"pushConfig"}]},keepCalling:{sid:n,cid:r.netcall.keepCalling,params:[{type:"byte",name:"type"},{type:"StrArray",name:"accounts"},{type:"long",name:"channelId"}]},calleeAck:{sid:n,cid:r.netcall.calleeAck,params:[{type:"string",name:"account"},{type:"long",name:"channelId"},{type:"byte",name:"type"},{type:"bool",name:"accepted"}]},hangup:{sid:n,cid:r.netcall.hangup,params:[{type:"long",name:"channelId"}]},netcallControl:{sid:n,cid:r.netcall.netcallControl,params:[{type:"long",name:"channelId"},{type:"byte",name:"type"}]},verifyChannelId:{sid:n,cid:r.netcall.verifyChannelId,params:[{type:"long",name:"channelId"},{type:"String",name:"account"}]},createChannel:{sid:n,cid:r.netcall.createChannel,params:[{type:"String",name:"channelName"},{type:"String",name:"custom"},{type:"String",name:"webrtcEnable"}]},joinChannel:{sid:n,cid:r.netcall.joinChannel,params:[{type:"String",name:"channelName"},{type:"Property",name:"liveOption"}]},queryAccountUidMap:{sid:n,cid:r.netcall.queryAccountUidMap,params:[{type:"String",name:"channelName"},{type:"LongArray",name:"uids"}]}},o="netcall",a={"9_1":{service:o,cmd:"initNetcall",response:[{type:"Number",name:"timetag"},{type:"Number",name:"uid"},{type:"Number",name:"channelId"},{type:"StrArray",name:"turnServerList"},{type:"StrArray",name:"sturnServerList"},{type:"StrArray",name:"proxyServerList"},{type:"StrArray",name:"keepCallingAccounts"},{type:"StrLongMap",name:"accountUidMap"},{type:"String",name:"clientConfig"},{type:"String",name:"serverMap"}]},"9_2":{service:o,cmd:"beCalled",response:[{type:"Number",name:"timetag"},{type:"Number",name:"type"},{type:"Number",name:"channelId"},{type:"String",name:"account"},{type:"Number",name:"uid"},{type:"StrArray",name:"turnServerList"},{type:"StrArray",name:"sturnServerList"},{type:"StrArray",name:"proxyServerList"},{type:"StrLongMap",name:"accountUidMap"},{type:"String",name:"clientConfig"},{type:"String",name:"custom"},{type:"Property",name:"pushConfig"},{type:"String",name:"serverMap"}]},"9_3":{service:o,cmd:"keepCalling",response:[{type:"StrArr",name:"accounts"}]},"9_4":{service:o,cmd:"calleeAck",response:[]},"9_5":{service:o,cmd:"notifyCalleeAck",response:[{type:"String",name:"account"},{type:"long",name:"channelId"},{type:"byte",name:"type"},{type:"bool",name:"accepted"}]},"9_6":{service:o,cmd:"hangup",response:[]},"9_7":{service:o,cmd:"notifyHangup",response:[{type:"long",name:"channelId"},{type:"String",name:"account"},{type:"long",name:"timetag"}]},"9_8":{service:o,cmd:"netcallControl",response:[]},"9_9":{service:o,cmd:"notifyNetcallControl",response:[{type:"String",name:"account"},{type:"byte",name:"type"},{type:"long",name:"channelId"}]},"9_10":{service:o,cmd:"verifyChannelId",response:[]},"9_11":{service:o,cmd:"notifyNetcallRecord",response:[{type:"Property",name:"msg"}]},"9_12":{service:o,cmd:"notifyCalleeAckSync",response:[{type:"String",name:"timetag"},{type:"long",name:"channelId"},{type:"byte",name:"type"},{type:"bool",name:"accepted"},{type:"byte",name:"fromClientType"}]},"9_13":{service:o,cmd:"createChannel",response:[{type:"long",name:"timetag"}]},"9_14":{service:o,cmd:"joinChannel",response:[{type:"long",name:"timetag"},{type:"long",name:"channelId"},{type:"StrLongMap",name:"accountUidMap"},{type:"String",name:"serverMap"},{type:"String",name:"clientConfig"},{type:"String",name:"custom"}]},"9_15":{service:o,cmd:"notifyJoin",response:[{type:"Long",name:"channelId"},{type:"StrLongMap",name:"accountUidMap"}]},"9_16":{service:o,cmd:"queryAccountUidMap",response:[]}};e.exports={idMap:r,cmdConfig:i,packetConfig:a}},function(e,t){"use strict";e.exports={pushConfig:{enable:1,needBadge:2,needPushNick:3,pushContent:4,custom:5,pushPayload:6,sound:7,webrtcEnable:10},liveOption:{liveEnable:1,webrtcEnable:2}}},function(e,t){"use strict";e.exports={pushConfig:{1:"enable",2:"needBadge",3:"needPushNick",4:"pushContent",5:"custom",6:"pushPayload",7:"sound",10:"webrtcEnable"},liveOption:{1:"liveEnable",2:"webrtcEnable"}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(124),o=r(i),a=n(123),s=r(a),c=n(7),d=r(c),u=n(17),l=r(u),p=n(16),f=r(p),h=n(147),m=r(h),v=n(20),g=function(e){function t(){(0,d["default"])(this,t);var n=(0,l["default"])(this,e.call(this));return n.init(),n}return(0,f["default"])(t,e),t}(v);t["default"]=g;var y=g.prototype;y.init=function(){if(this.getDevices()["catch"](function(e){console.warn(e)}),navigator.mediaDevices&&navigator.mediaDevices.addEventListener){var e=void 0,t=this;navigator.mediaDevices.ondevicechange=function(n){e&&(clearTimeout(e),e=null);var r=Object.assign({},t.devicesCache);e=setTimeout(function(){e=null,t.getDevices(!0).then(function(){t.emit("deviceStatus",t.devicesCache),t.filterDeviceChange(t.devicesCache,r)})["catch"](function(){})},500)}}},y.filterDeviceChange=function(e,t){function n(e){var t={};return Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[n+e.deviceId]=Object.assign({},e,{type:n})})}),t}var r=n(e),i=n(t),o=Object.keys(r),a=Object.keys(i);if(o.length>a.length){var s=[];o.forEach(function(e){a.indexOf(e)===-1&&s.push(r[e])}),s.length&&this.emit("deviceAdd",s)}else{var c=[];a.forEach(function(e){o.indexOf(e)===-1&&c.push(i[e])}),c.length&&this.emit("deviceRemove",c)}},y.getDevicesOfType=function(e){return void 0!==e?this.getDevices().then(function(t){return[t[e]]}):this.getDevices()},y.getDevices=function(e){var t=this,n=void 0;return!e&&this.devicesCache?Promise.resolve(this.devicesCache):new Promise(function(e,r){var i=this;(0,s["default"])(o["default"].mark(function a(){return o["default"].wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,m["default"].getDevices()["catch"](function(e){return r(e)});case 2:if(n=i.sent){i.next=5;break}return i.abrupt("return",r("没有找到可用设备"));case 5:return t.devicesCache=n,i.abrupt("return",e(n));case 7:case"end":return i.stop()}},a,i)}))()})},y.getDeviceStatus=function(){return{hasAudio:this.devicesCache&&this.devicesCache.audioIn.length>0||!1,hasVideo:this.devicesCache&&this.devicesCache.video.length>0||!1}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(17),s=r(a),c=n(16),d=r(c),u=n(175),l=r(u),p=n(20),f={},h=function(e){function t(){(0,o["default"])(this,t);var n=(0,s["default"])(this,e.call(this));return n.recordedChunks=[],n.isRecording=!1,n.contentTypes=["video/mp4;codecs=opus","video/webm","video/webm;codecs=h264","video/x-matroska;codecs=opus","video/invalid"],n}return(0,d["default"])(t,e),t.init=function(e){f=e||window.Logger},t.prototype.validation=function(e){return e.filter(function(e){return MediaRecorder.isTypeSupported(e)})},t.prototype.format=function(){var e=this,t=this.stream,n=this.option;return new Promise(function(r,i){if(/(LocalMediaStream|MediaStream)/.test(t.constructor)&&(t=[t]),t.constructor!==Array)return i("音视频录制输入错误");if("audio"===n.type)return e.audioController=new l["default"]({stream:t,uid:e.uid}),e.opStream=e.audioController.outputStream,window.audios=e.opStream,r();var o=new MediaStream;return t.forEach(function(e){e&&/(LocalMediaStream|MediaStream)/.test(e.constructor)&&e.getTracks().forEach(function(e){o.addTrack(e)})}),0===o.getTracks().length?i("当前没有任何音视频数据，无法进行录制"):(e.opStream=o,void r())})},t.prototype.start=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{type:"video"};if(!n.uid&&!n.account)return Promise.reject("需要录制的帐号缺失");if(!e)return Promise.reject("获取视频流失败");if(!window.MediaRecorder||!MediaRecorder.isTypeSupported)return Promise.reject("当前浏览器不支持音视频录制功能");this.stream=e,this.option=n,"audio"===n.type&&(this.contentTypes=["audio/wav","audio/ogg","audio/pcm","audio/webm"]);var r=this.mimeType=this.validation(this.contentTypes)[0];return r?this.isRecording?Promise.reject("音视频正在录制中，请勿重复操作"):this.format().then(function(){return t._start()})["catch"](function(e){return Promise.reject(e)}):Promise.reject("当前浏览器不支持对应格式的视频录制")},t.prototype._start=function(){var e={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:this.mimeType},t=this.recorder=new MediaRecorder(this.opStream,e);return t.ondataavailable=this.ondataavailable.bind(this),t.onstop=this.onstop.bind(this),this.isRecording=!0,this.status="started",this.recorder.start(),this.startTimer(),Promise.resolve(this.option)},t.prototype.stop=function(e){if(!this.isRecording||!this.recorder)return Promise.reject("请先开启音视频录制");if(this.status="stopped",f.log("MediaRecorder: stop event",this.recorder.state),"inactive"===this.recorder.state)return f.warn("MediaRecorder already stopped:",this.recorder.state),Promise.reject("音视频录制已结束，请勿重复操作");var t=(this.option.account||this.option.uid)+"--"+Date.now()+"--"+(this.option.type||"video");return this.fileName=e||t,this.recorder.stop(),Promise.resolve()},t.prototype.leave=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.isRecording&&this.recorder){var t=e.uid;t&&this.option&&this.option&&t===+this.option.uid&&this.stop()}},t.prototype.ondataavailable=function(e){return f.log("MediaRecorder: data received"),e.data.size>0?void this.recordedChunks.push(e.data):(this.stop(),Promise.reject("获取视频流失败"))},t.prototype.onstop=function(){if(f.log("MediaRecorder: onstop"),"stopped"!==this.status)return this._start();var e=new Blob(this.recordedChunks,{type:this.mimeType}),t=URL.createObjectURL(e),n=document.createElement("a");document.body.appendChild(n),n.style="display: none",n.href=t,n.download=(this.fileName||Date.now())+".webm",n.click(),window.URL.revokeObjectURL(t),this.destroy(),this.clearTimer(),this.emit("stopRecord")},t.prototype.pause=function(){this.recorder&&this.recorder.pause()},t.prototype.resume=function(){this.recorder&&this.recorder.resume()},t.prototype.destroy=function(){this.stream=null,this.recorder=null,this.recordedChunks=[],this.isRecording=!1,this.audioController&&this.audioController.destroy(),this.audioController=null,this.fileName=this.fileNameDefault="",this.option={},this.status=""},t.prototype.startTimer=function(){var e=this;this.timer||(this.timer=setInterval(function(){f.log((new Date).toLocaleString()+" --> MediaRecorder status: "+e.recorder.state)},2e3))},t.prototype.clearTimer=function(){this.timer&&(clearInterval(this.timer),this.timer=null)},t}(p);t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(17),s=r(a),c=n(16),d=r(c),u=n(175),l=n(20),p={},f=function(e){function t(n){(0,o["default"])(this,t);var r=(0,s["default"])(this,e.call(this));return r.isRemote=!!n.isRemote,r.constraint=n.constraint||{},r.stream=n.stream,r.audioStream=n.stream,r.container=n.container,r.uid=n.uid||"",r.poster=n.poster||"",r.isAudio="audio"===n.type,r.initNode(),r.videoRatioIntervalId=null,r.startVideoRatioMonitor(),r}return(0,d["default"])(t,e),t.init=function(e){p=e||window.console},t.destroyMedia=function(e){var t=this;if(e){var n=e.getTracks();n&&0!==n.length&&n.forEach(function(n){p.log("destroy track",t.uid||e.id,n),n.stop(),e.removeTrack(n)})}},t.getLocalStream=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!0},n=e.audio?"audio":"";return/safari/gi.test(platform.name)&&e.video&&(e.video=!0),console.log("constraint",e),navigator.mediaDevices.getUserMedia(e).then(function(r){return"audio"===n?r:new t({stream:r,type:n,isRemote:!1,constraint:e})})["catch"](function(t){var n=t.constructor===Object?t.name:JSON.stringify(t);return console.error(e,t),Promise.reject(n)})},t.prototype.initNode=function(){this.node||(this.isAudio?this.initAudioNode():this.initVideoNode(),this.isRemote&&!this.isAudio&&this.initVideoEvent())},t.prototype.initAudioNode=function(){this.audioStream=this.stream,/safari/gi.test(platform.name)||(this.webAudio=new u({stream:this.audioStream,uid:this.uid,isAnalyze:!0,isRemote:this.isRemote}),this.stream=this.webAudio.outputStream),this.node=document.createElement("audio"),this.node.dataset.uid=this.uid},t.prototype.initVideoNode=function(){var e=this,t=document.createElement("div");t.style.overflow="hidden",t.style.position="relative",t.style.width="400px",t.style.height="400px",t.style.display="none";var n=document.createElement("video");n.setAttribute("x-webkit-airplay","x-webkit-airplay"),n.setAttribute("playsinline","playsinline"),n.setAttribute("webkit-playsinline","webkit-playsinline"),this.poster&&(n.poster=this.poster),n.preload="auto",n.dataset.uid=this.uid,n.autoplay="autoplay",n.style.position="absolute",n.style.left="50%",n.style.top="50%",n.style.transform="translate(-50%,-50%)",t.appendChild(n),this.node=n,this.videoContainer=t,setTimeout(function(){e.videoContainer&&(e.videoContainer.style.display="inline-block")},1e3),t.style.color="#fff";var r=document.createElement("p");r.textContent=this.uid,r.zIndex=1,t.appendChild(r)},t.prototype.initVideoEvent=function(){},t.prototype.setMuted=function(e){this.muted=!!e,this.node&&(this.node.muted=!!e,this.setPlayVolume(),e||this.show())},t.prototype.getMuted=function(){return!!this.muted},t.prototype.setPlayVolume=function(e){var t=void 0;e?(e.constructor===Number&&(t=e),e.constructor===Object&&(t=void 0===e.volume?1:e.volume)):t=this.volume,this.volume=t,this.getMuted()||this.node&&(t=void 0===t||t>1?1:t,this.node.volume=t)},t.prototype.getPlayVolume=function(){return void 0!==this.volume?this.volume:1},t.prototype.setGain=function(e){if(this.stream&&!this.isRemote){if(void 0===e&&(e=1),this.gainOff)return this.gain=e,e;this.webAudio&&this.webAudio.setGain(e),this.gain=e}},t.prototype.getGain=function(){return void 0!==this.gain?this.gain:1},t.prototype.setGainOff=function(){this.stream&&!this.isRemote&&(this.webAudio&&this.webAudio.setGain(0),this.gainOff=!0)},t.prototype.setGainOn=function(){this.stream&&!this.isRemote&&(this.webAudio&&this.webAudio.setGain(void 0!==this.gain?this.gain:1),this.gainOff=!1)},t.prototype.show=function(e,t){if(this.node){if(this.isAudio)return this.node.srcObject=this.audioStream,this.muted&&this.setMuted(this.muted),this.play(),void(this.enable=!0);this.poster=void 0===t?this.poster:t;var n=this.videoContainer;e=this.container=e||this.container,console.log("node container",n,e),n&&e&&(n.parentNode&&n.parentNode===n||(n.parentNode&&n.parentNode.removeChild(n),e.appendChild(n)),this.node.srcObject||(this.node.srcObject=this.stream),this.poster&&(this.node.poster=this.poster),this.play(),this.resizeOptions&&this.resize(),this.enable=!0)}},t.prototype.hide=function(){var e=this.videoContainer;e&&(this.node.paused||this.node.pause(),e.parentNode&&e.parentNode.removeChild(e),this.enable=!1)},t.prototype.addAudioStream=function(e){e&&this.webAudio&&(this.webAudio.addStream(e),this.stream=this.webAudio.outputStream,p.log("本地添加音频流:",e))},t.prototype.updateStream=function(e){var n=this.node;if(n&&e){if(this.isAudio)return this.webAudio&&(this.webAudio.updateStream(e),this.stream=this.webAudio.outputStream),p.log("webrtc::mediaStream::updateAudioTrack",e.getTracks()),this.audioStream&&t.destroyMedia(this.audioStream),void(this.audioStream=e);p.log("webrtc::mediaStream::updateVideoTrack",e.getTracks()),t.destroyMedia(this.stream),this.stream=e,n.srcObject=this.stream}},t.prototype.isShown=function(){return this.node&&this.node.srcObject&&this.enable},t.prototype.removeTrack=function(e){var t=this.stream;t&&t.removeTrack(e)},t.prototype.resize=function(e){if((e&&e.width&&e.height||this.resizeOptions)&&(this.resizeOptions=e||this.resizeOptions,e=this.resizeOptions,e.cut=void 0===e.cut||e.cut,this.node&&this.videoContainer&&!this.isAudio)){if(this.videoContainer.style.width=e.width+"px",this.videoContainer.style.height=e.height+"px",!e.cut)return this.node.style.height="100%",void(this.node.style.width="100%");if(this.node.videoWidth&&this.node.videoHeight){var t=this.node.videoWidth,n=this.node.videoHeight,r=t/n,i=e.width/e.height;r>i?(this.node.style.height="100%",this.node.style.width="auto"):(this.node.style.width="100%",this.node.style.height="auto")}else this.node.width=e.width,this.node.height=e.height}},t.prototype.startVideoRatioMonitor=function(){var e=this;this.isAudio||null===this.videoRatioIntervalId&&(this.preVideoWidth=this.node.videoWidth,this.preVideoHeight=this.node.videoHeight,
  this.videoRatioIntervalId=setInterval(function(){e.resizeOptions&&(e.preVideoWidth===e.node.videoWidth&&e.preVideoHeight===e.node.videoHeight||(e.resize(e.resizeOptions),e.preVideoWidth=e.node.videoWidth,e.preVideoHeight=e.node.videoHeight))},1e3))},t.prototype.getAudioVolume=function(){return this.webAudio&&this.webAudio.getVolumeData()||0},t.prototype.getMetaWidth=function(e){if(this.node&&!this.isAudio)return this.node.videoWidth},t.prototype.getMetaHeight=function(e){if(this.node&&!this.isAudio)return this.node.videoHeight},t.prototype.resume=function(){this.play()},t.prototype.pause=function(){this.node.pause()},t.prototype.play=function(){var e=this.node;4!==e.readyState&&e.load(),0!==e.played.length&&e.pause();var t=e.play();void 0!==t&&t["catch"](function(e){p.warn(e)}).then(function(){p.log("playing-。-",e,e.parentNode,e.srcObject&&e.srcObject.getTracks())})},t.prototype.stopDevice=function(){this.isAudio?(p.log("销毁音频流",this.uid,this.audioStream),t.destroyMedia(this.audioStream),this.audioStream=null):(t.destroyMedia(this.stream),this.stream=null)},t.prototype.destroy=function(){this.hide(),this.node&&(this.node.pause(),this.node=null),this.videoContainer=null,this.stream&&(t.destroyMedia(this.audioStream),this.isRemote||t.destroyMedia(this.stream),this.stream=null,this.audioStream=null,null!==this.videoRatioIntervalId&&(clearInterval(this.videoRatioIntervalId),this.videoRatioIntervalId=null),this.webAudio&&this.webAudio.context&&this.webAudio.destroy&&this.webAudio.destroy())},t}(l);t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(174),o=r(i),a=n(329),s=null,c={},d=200,u={};t["default"]={init:function(e){s=o["default"].checkVersion(),u=e||window.console},fnShake:function(e){var t=this,n=e.fn,r=e.peer,i=void 0===r?{}:r;if(n)return i.id||(i.id=Object.keys(c).length+1),n="_"+n,c[i.id]||(c[i.id]={}),c[i.id]&&c[i.id][n]&&(u.log("destroy "+n+" timer"),clearTimeout(c[i.id][n]),c[i.id][n]=null),u.log("create "+n+" timer"),new Promise(function(r,o){c[i.id][n]=setTimeout(function(){c[i.id][n]=null,r(t[n](e))},d)})},createOffer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.fnShake({peer:e,fn:"createOffer"})},_createOffer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.peer;u.log("------ do createoffer ------");var n={offerToReceiveVideo:1,offerToReceiveAudio:1};if(t.uid-t.targetUid!==0){var r=t.getLocalStreams(),i=r[0]&&r[0].getTracks()||!1;i&&0!==i.length||t.addTransceiver&&"Safari"===s.prefix&&(t.addTransceiver("audio"),t.addTransceiver("video"))}return t.createOffer(n)},formatSdp:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.offerOrAnswer,r=t.uid,i=t.highAudio,o=t.stero,s=t.targetUid,c=t.stream||new MediaStream,d=n.sdp,l=n.type,p=[],f=[],h=a.parse(d);u.log(s+" 原始sdp "+l+" \n",d),u.log(h);var m=c.getAudioTracks()[0],v=c.getVideoTracks()[0],g=void 0;return h.media&&h.media.map(function(t,a){if(t.candidates&&delete t.candidates,s!==r?t.direction="recvonly":t.direction=/recvonly/.test(t.direction)?"recvonly":"sendonly",(/audio/.test(t.type)&&!m||/video/.test(t.type)&&!v)&&delete t.ssrcs&&delete t.ssrcGroups&&delete t.msid,"audio"===t.type&&(f.push(t.mid),g=t),"video"===t.type&&v&&t.ssrcs.map(function(e){/^label$/.test(e.attribute)&&e.value!==v.id&&p.push(e.id)}),"audio"===t.type&&(t.ptime=60,t.maxptime=60,t.fmtp&&t.fmtp.length)){var c=!1,d=i?48e3:16e3;t.fmtp.map(function(e){e.config&&e.config.indexOf("minptime=")!==-1&&(e.config=e.config.replace(/minptime=\d+/,"minptime=60")),e.config&&e.config.indexOf("sprop-maxcapturerate=")!==-1&&e.config.indexOf("maxplaybackrate")!==-1&&(c=!0,e.config=e.config.replace(/sprop-maxcapturerate=\d+/,"sprop-maxcapturerate="+d),e.config=e.config.replace(/maxplaybackrate=\d+/,"maxplaybackrate="+d)),c||(e.config+=";maxplaybackrate="+d+";sprop-maxcapturerate="+d),o&&(e.config+=";maxaveragebitrate=131072;stereo=1;sprop-stereo=1;cbr=1")})}if("offer"===n.type){var u=t.mid;h.groups&&h.groups.map(function(e){var n=e.mids.split(" ");n.indexOf(u)!==-1&&(n.splice(n.indexOf(u),1,t.mid),e.mids=n.join(" "))})}t.fmtp=e.limitFrame(t.fmtp)}),n.sdp=a.write(h),p.length>0&&p.map(function(e){var t=new RegExp("a=ssrc:"+e+".+\\r\\n","gi");n.sdp=n.sdp.replace(t,"")}),n},limitFrame:function(e){return e.map(function(e){/42e01f/gi.test(e.config)&&(e.config+=";max-fs=12288")}),e},setMediaBitrates:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.sdp,n=e.bit,r=void 0===n?{}:n,i=r.video,o=void 0===i?500:i,s=r.audio,c=void 0===s?500:s,d=a.parse(t);return d.media&&d.media.map(function(e,t){e.bandwidth=[{type:navigator.mozGetUserMedia?"TIAS":"AS",limit:"audio"===e.type?c:o}]}),a.write(d)},formatSSRCChrome:function(e,t,n){return e.map(function(e,r){return e.id=t+"0"+n+"0"+Math.floor(r/4),e.id-=0,e})},formatSSRCFirefox:function(e,t,n){return e.map(function(e,r){return e.id=t+"0"+n+"0"+Math.floor(r/4),e.id-=0,e})},formatSdpRemote:function(e,t){var n=/Chrome/gi.test(navigator.userAgent);return n?this.formatSdpRemoteChrome(e,t):this.formatSdpRemoteFirefox(e,t)},formatSdpRemoteChrome:function(e){return e=e.replace(/a=msid:.+\r\na=ssrc:\d+ cname:.+/gi,function(e,t){var n=e.match(/a=ssrc:(\d+)/),r=e.match(/a=msid:(.+) (.+)/);return n[1]&&(e=e.replace("a=msid","a=ssrc:"+n[1]+" msid")),r[1]&&n[1]&&(e+="\r\na=ssrc:"+n[1]+" mslabel:"+r[1]),r[2]&&n[1]&&(e+="\r\na=ssrc:"+n[1]+" label:"+r[2]),e}),u.log("formated: \n",e),e},formatSdpRemoteFirefox:function(e,t){if(e=e.replace(/\r\na=msid:.+\r\na=ssrc:\d+ cname:.+/gi,function(e,t){var n=e.match(/\r\na=ssrc:\d+ cname:.+/);return e=e.replace(/a=ssrc:\d+ cname:.+/,""),e=e.replace("a=msid",n[0]+"\r\na=msid")}),t&&t.sdp){var n=a.parse(e),r=a.parse(t.sdp);n.media.length!==r.media.length}return u.log("formated: \n",e),e},parse:function(e){var t=a.parse(e);u.log(t)},updateMediaStream:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.fn="updateMediaStream",this.fnShake(e)},_updateMediaStream:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.peer,n=e.currStream,r=e.streams,i=void 0===r?[]:r,o=this.checkCurrStream(t),a={},s=t,c=n||new MediaStream;i.map(function(e){e.getTracks().map(function(e){console.log("_updateMediaStream newTracks",e),a[e.id]=e})});var d=Object.keys(o.tracks).filter(function(e){return!a[e]});console.warn("webrtc-rtc::获取移除的列表",d);var l=Object.keys(a).filter(function(e){return!o.tracks[e]});return console.log("webrtc-rtc::获取新加的列表",l),d&&d.map(function(e){var t=o.tracks[e].sender,n=o.tracks[e].track;u.warn("remove old track",t,n),c.removeTrack(n),s.removeTrack(t)}),l&&l.map(function(e){var t=a[e];u.log("add new track",t),c.addTrack(t),s.addTrack(t,c)}),this.checkCurrStream(t),Promise.resolve(c)},removeTrack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.peer,n=e.currStream,r=e.tracks,i=void 0===r?[]:r;if(0!==i.length){var o=this.checkCurrStream(t);i.map(function(e){o.tracks[e.id]&&(console.log("====remove track",e,e.readyState,o.tracks[e.id].sender),n.removeTrack(e),t.removeTrack(o.tracks[e.id].sender))})}},checkCurrStream:function(e){var t={},n=[],r=e.getSenders();return r&r.map(function(e){var r=e.track;return r?(t[r.id]={sender:e,track:r},void u.log(" --> track id:",r.kind+":"+r.id)):void n.push(e)}),u.log("current track status:",r,t),u.log("current empty sender:",n),{tracks:t,empty:n}},checkMediaStatus:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.audio,n=e.video,r=e.sdp,i=e.uid,o={audio:!1,video:!1},s=a.parse(r),c=t&&t.getAudioTracks()[0],d=n&&n.getVideoTracks()[0];return u.log(i+" checkMediaStatus ----> track status",s),c&&u.log("webrtc::checkMediaStatus audioTrack ----> ",c),d&&u.log("webrtc::checkMediaStatus videoTrack ----> ",d),o.audio=c&&"ended"!==c.readyState&&new RegExp(c.id).test(r),o.video=d&&"ended"!==d.readyState&&new RegExp(d.id).test(r),o},validMediaStream:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.sdp,n=e.msid,r=e.trackid;if(!n||!r)return!1;var i=!1;return n&&(i=new RegExp(n).test(t)),i?(r&&(i=new RegExp(r).test(t)),i):i}},e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0,t["default"]={randomSSRC:function(){var e=Math.floor(1e8*Math.random())+1e7;return e>1e8?99999999:e},_createLocalDescription:function(e,t){function n(e,n){var a={};switch(a.type=n,n){case"audio":case"video":a.protocol="RTP/SAVPF",a.port=9,a.direction="sendrecv";break;case"application":a.protocol="DTLS/SCTP",a.port=0,a.payloads="0",a.direction="inactive"}a.connection={ip:"127.0.0.1",version:4},a.mid=e,a.iceUfrag=i.usernameFragment,a.icePwd=i.password,a.candidates=[];for(var l=o,p=Array.isArray(l),f=0,l=p?l:l[Symbol.iterator]();;){var h;if(p){if(f>=l.length)break;h=l[f++]}else{if(f=l.next(),f.done)break;h=f.value}var m=h,v={};v.component=1,v.foundation=m.foundation,v.ip=m.ip,v.port=m.port,v.priority=m.priority,v.transport=m.protocol.toLowerCase(),v.type=m.type,"tcp"===v.transport&&(v.tcptype=m.tcpType),a.candidates.push(v)}if(a.endOfCandidates="end-of-candidates","offer"===t?a.setup="actpass":a.setup="server"===s.role?"active":"passive","audio"===n||"video"===n){a.rtp=[],a.rtcpFb=[],a.fmtp=[];for(var g=[],y=c.codecs,S=Array.isArray(y),b=0,y=S?y:y[Symbol.iterator]();;){var C;if(S){if(b>=y.length)break;C=y[b++]}else{if(b=y.next(),b.done)break;C=b.value}var _=C;if(!_.kind||_.kind===n){g.push(_.preferredPayloadType);var T={codec:_.name,payload:_.preferredPayloadType,rate:_.clockRate};if(_.numChannels>1&&(T.encoding=_.numChannels),a.rtp.push(T),_.parameters){for(var w={config:"",payload:_.preferredPayloadType},R=Object.keys(_.parameters),E=Array.isArray(R),O=0,R=E?R:R[Symbol.iterator]();;){var P;if(E){if(O>=R.length)break;P=R[O++]}else{if(O=R.next(),O.done)break;P=O.value}var k=P;w.config&&(w.config+=";"),w.config+=k+"="+_.parameters[k]}w.config&&a.fmtp.push(w)}for(var A=_.rtcpFeedback||[],I=Array.isArray(A),M=0,A=I?A:A[Symbol.iterator]();;){var x;if(I){if(M>=A.length)break;x=A[M++]}else{if(M=A.next(),M.done)break;x=M.value}var D=x;a.rtcpFb.push({payload:_.preferredPayloadType,subtype:D.parameter||void 0,type:D.type})}}}0===g.length?(a.payloads="9",a.port=0,a.direction="inactive"):a.payloads=g.join(" "),a.ssrcs=[],a.ssrcGroups=[];for(var L=d.values(),j=Array.isArray(L),N=0,L=j?L:L[Symbol.iterator]();;){var U;if(j){if(N>=L.length)break;U=L[N++]}else{if(N=L.next(),N.done)break;U=N.value}var V=U,F=V.rtpSender,B=V.stream.id,G=F.track;if("ended"!==G.readyState&&G.kind===n){V.ssrc||(V.ssrc=this.randomSSRC());var W=u&&"video"===G.kind;W&&!V.rtxSsrc&&(V.rtxSsrc=V.ssrc+1),a.ssrcs.push({attribute:"cname",id:V.ssrc,value:CNAME}),a.ssrcs.push({attribute:"msid",id:V.ssrc,value:B+" "+G.id}),a.ssrcs.push({attribute:"mslabel",id:V.ssrc,value:B}),a.ssrcs.push({attribute:"label",id:V.ssrc,value:G.id}),W&&(a.ssrcs.push({attribute:"cname",id:V.rtxSsrc,value:CNAME}),a.ssrcs.push({attribute:"msid",id:V.rtxSsrc,value:B+" "+G.id}),a.ssrcs.push({attribute:"mslabel",id:V.rtxSsrc,value:B}),a.ssrcs.push({attribute:"label",id:V.rtxSsrc,value:G.id}),a.ssrcGroups.push({semantics:"FID",ssrcs:V.ssrc+" "+V.rtxSsrc}))}}a.ext=[];for(var H=c.headerExtensions,Y=Array.isArray(H),z=0,H=Y?H:H[Symbol.iterator]();;){var K;if(Y){if(z>=H.length)break;K=H[z++]}else{if(z=H.next(),z.done)break;K=z.value}var J=K;J.kind&&J.kind!==n||a.ext.push({value:J.preferredId,uri:J.uri})}a.rtcpMux="rtcp-mux",a.rtcpRsize="rtcp-rsize"}r.media.push(a)}var r={},i=this._iceGatherer.getLocalParameters(),o=this._iceGatherer.getLocalCandidates(),a=this._dtlsTransport.getLocalParameters(),s=this._dtlsTransport.getRemoteParameters(),c=this._localCapabilities,d=this._localTrackInfos;"offer"===t&&this._sdpGlobalFields.version++,r.version=0,r.origin={address:"127.0.0.1",ipVer:4,netType:"IN",sessionId:this._sdpGlobalFields.id,sessionVersion:this._sdpGlobalFields.version,username:"jitsi-ortc-webrtc-shim"},r.name="-",r.timing={start:0,stop:0},r.msidSemantic={semantic:"WMS",token:"*"},r.groups=[{mids:Array.from(this._mids.keys()).join(" "),type:"BUNDLE"}],r.media=[],r.fingerprint={hash:a.fingerprints[0].value,type:a.fingerprints[0].algorithm};for(var u=!1,l=c.codecs,p=Array.isArray(l),f=0,l=p?l:l[Symbol.iterator]();;){var h;if(p){if(f>=l.length)break;h=l[f++]}else{if(f=l.next(),f.done)break;h=f.value}var m=h;if("video"===m.kind&&"rtx"===m.name){u=!0;break}}for(var v=this._mids,g=Array.isArray(v),y=0,v=g?v:v[Symbol.iterator]();;){var S;if(g){if(y>=v.length)break;S=v[y++]}else{if(y=v.next(),y.done)break;S=y.value}var b=S,C=b[0],_=b[1];n.call(this,C,_)}var T=new RTCSessionDescription({type:t,_sdpObject:r});return T},mergeConstraints:function(e,t){if(!e||!t)return e||t;var n=e;for(var r in t)n[r]=t[r];return n},iceCandidateType:function(e){return e.split(" ")[7]},formatTypePreference:function(e){if(/Chrome\/\d+/.test(navigator.userAgent))switch(e){case 0:return"TURN/TLS";case 1:return"TURN/TCP";case 2:return"TURN/UDP"}else if(/Firefox\/\d+/.test(navigator.userAgent))switch(e){case 0:return"TURN/TCP";case 5:return"TURN/UDP"}return""},maybeSetOpusOptions:function(e,t){return"true"===t.opusStereo?e=this.setCodecParam(e,"opus/48000","stereo","1"):"false"===t.opusStereo&&(e=this.removeCodecParam(e,"opus/48000","stereo")),"true"===t.opusFec?e=this.setCodecParam(e,"opus/48000","useinbandfec","1"):"false"===t.opusFec&&(e=this.removeCodecParam(e,"opus/48000","useinbandfec")),"true"===t.opusDtx?e=this.setCodecParam(e,"opus/48000","usedtx","1"):"false"===t.opusDtx&&(e=this.removeCodecParam(e,"opus/48000","usedtx")),t.opusMaxPbr&&(e=this.setCodecParam(e,"opus/48000","maxplaybackrate",t.opusMaxPbr)),e},maybeSetAudioSendBitRate:function(e,t){return t.audioSendBitrate?(console.log("Prefer audio send bitrate: "+t.audioSendBitrate),this.preferBitRate(e,t.audioSendBitrate,"audio")):e},maybeSetAudioReceiveBitRate:function(e,t){return t.audioRecvBitrate?(console.log("Prefer audio receive bitrate: "+t.audioRecvBitrate),this.preferBitRate(e,t.audioRecvBitrate,"audio")):e},maybeSetVideoSendBitRate:function(e,t){return t.videoSendBitrate?(console.log("Prefer video send bitrate: "+t.videoSendBitrate),this.preferBitRate(e,t.videoSendBitrate,"video")):e},maybeSetVideoReceiveBitRate:function(e,t){return t.videoRecvBitrate?(console.log("Prefer video receive bitrate: "+t.videoRecvBitrate),this.preferBitRate(e,t.videoRecvBitrate,"video")):e},preferBitRate:function(e,t,n){var r=e.split("\r\n"),i=this.findLine(r,"m=",n);if(null===i)return console.log("Failed to add bandwidth line to sdp, as no m-line found"),e;var o=this.findLineInRange(r,i+1,-1,"m=");null===o&&(o=r.length);var a=this.findLineInRange(r,i+1,o,"c=");if(null===a)return console.log("Failed to add bandwidth line to sdp, as no c-line found"),e;var s=this.findLineInRange(r,a+1,o,"b=AS");s&&r.splice(s,1);var c="b=AS:"+t;return r.splice(a+1,0,c),e=r.join("\r\n")},maybeSetVideoSendInitialBitRate:function(e,t){var n=t.videoSendInitialBitrate;if(!n)return e;var r=n,i=t.videoSendBitrate;i&&(n>i&&(console.log("Clamping initial bitrate to max bitrate of "+i+" kbps."),n=i,t.videoSendInitialBitrate=n),r=i);var o=e.split("\r\n"),a=this.findLine(o,"m=","video");if(null===a)return console.log("Failed to find video m-line"),e;var s=t.videoRecvCodec;return e=this.setCodecParam(e,s,"x-google-min-bitrate",t.videoSendInitialBitrate.toString()),e=this.setCodecParam(e,s,"x-google-max-bitrate",r.toString())},removePayloadTypeFromMline:function(e,t){e=e.split(" ");for(var n=0;n<e.length;++n)e[n]===t.toString()&&e.splice(n,1);return e.join(" ")},removeCodecByName:function(e,t){var n=this.findLine(e,"a=rtpmap",t);if(null===n)return e;var r=this.getCodecPayloadTypeFromLine(e[n]);e.splice(n,1);var i=this.findLine(e,"m=","video");return null===i?e:(e[i]=this.removePayloadTypeFromMline(e[i],r),e)},removeCodecByPayloadType:function(e,t){var n=this.findLine(e,"a=rtpmap",t.toString());if(null===n)return e;e.splice(n,1);var r=this.findLine(e,"m=","video");return null===r?e:(e[r]=this.removePayloadTypeFromMline(e[r],t),e)},maybeRemoveVideoFec:function(e,t){if("false"!==t.videoFec)return e;var n=e.split("\r\n"),r=this.findLine(n,"a=rtpmap","red");if(null===r)return e;var i=this.getCodecPayloadTypeFromLine(n[r]);if(n=this.removeCodecByPayloadType(n,i),n=this.removeCodecByName(n,"ulpfec"),r=this.findLine(n,"a=fmtp",i.toString()),null===r)return e;var o=this.parseFmtpLine(n[r]),a=o.pt;return null===a?e:(n.splice(r,1),n=this.removeCodecByPayloadType(n,a),n.join("\r\n"))},maybePreferAudioSendCodec:function(e,t){return this.maybePreferCodec(e,"audio","send",t.audioSendCodec)},maybePreferAudioReceiveCodec:function(e,t){return this.maybePreferCodec(e,"audio","receive",t.audioRecvCodec)},maybePreferVideoSendCodec:function(e,t){return this.maybePreferCodec(e,"video","send",t.videoSendCodec)},maybePreferVideoReceiveCodec:function(e,t){return this.maybePreferCodec(e,"video","receive",t.videoRecvCodec)},maybePreferCodec:function(e,t,n,r){var i=t+" "+n+" codec";if(!r)return console.log("No preference on "+i+"."),e;console.log("Prefer "+i+": "+r);var o=e.split("\r\n"),a=this.findLine(o,"m=",t);if(null===a)return e;var s=this.getCodecPayloadType(o,r);return s?o[a]=this.setDefaultCodec(o[a],s):console.error("no prefered codec found for ",r),e=o.join("\r\n")},setCodecParam:function(e,t,n,r){var i=e.split("\r\n"),o=this.findFmtpLine(i,t),a={};if(null===o){var s=this.findLine(i,"a=rtpmap",t);if(null===s)return e;var c=this.getCodecPayloadTypeFromLine(i[s]);a.pt=c.toString(),a.params={},a.params[n]=r,i.splice(s+1,0,this.writeFmtpLine(a))}else a=this.parseFmtpLine(i[o]),a.params[n]=r,i[o]=this.writeFmtpLine(a);return e=i.join("\r\n")},removeCodecParam:function(e,t,n){var r=e.split("\r\n"),i=this.findFmtpLine(r,t);if(null===i)return e;var o=this.parseFmtpLine(r[i]);delete o.params[n];var a=this.writeFmtpLine(o);return null===a?r.splice(i,1):r[i]=a,e=r.join("\r\n")},parseFmtpLine:function(e){var t={},n=e.indexOf(" "),r=e.substring(n+1).split("; "),i=new RegExp("a=fmtp:(\\d+)"),o=e.match(i);if(!o||2!==o.length)return null;t.pt=o[1];for(var a={},s=0;s<r.length;++s){var c=r[s].split("=");2===c.length&&(a[c[0]]=c[1])}return t.params=a,t},writeFmtpLine:function(e){if(!e.hasOwnProperty("pt")||!e.hasOwnProperty("params"))return null;var t=e.pt,n=e.params,r=[],i=0;for(var o in n)r[i]=o+"="+n[o],++i;return 0===i?null:"a=fmtp:"+t.toString()+" "+r.join("; ")},findFmtpLine:function(e,t){var n=this.getCodecPayloadType(e,t);return n?this.findLine(e,"a=fmtp:"+n.toString()):null},findLine:function(e,t,n){return this.findLineInRange(e,0,-1,t,n)},findLineInRange:function(e,t,n,r,i){for(var o=n!==-1?n:e.length,a=t;a<o;++a)if(0===e[a].indexOf(r)&&(!i||e[a].toLowerCase().indexOf(i.toLowerCase())!==-1))return a;return null},getCodecPayloadType:function(e,t){var n=this.findLine(e,"a=rtpmap",t);return n?this.getCodecPayloadTypeFromLine(e[n]):null},getCodecPayloadTypeFromLine:function(e){var t=new RegExp("a=rtpmap:(\\d+) [a-zA-Z0-9-]+\\/\\d+"),n=e.match(t);return n&&2===n.length?n[1]:null},setDefaultCodec:function(e,t){var n=e.split(" "),r=n.slice(0,3);r.push(t);for(var i=3;i<n.length;i++)n[i]!==t&&r.push(n[i]);return r.join(" ")}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(17),s=r(a),c=n(16),d=r(c),u=n(20),l=r(u),p=function(e){function t(n){(0,o["default"])(this,t);var r=(0,s["default"])(this,e.call(this));return r.peer=n.peer,r.mediaStreamTrack=n.mediaStreamTrack,r.interval=5e3,r.init(),r}return(0,d["default"])(t,e),t.prototype.init=function(){this.reset(),this.initStatsResult(),this.initStatsParser(),this.initStatsParserFn()},t.prototype.reset=function(){this.nomore=!1,this.AUDIO_codecs=["opus","isac","ilbc"],this.VIDEO_codecs=["vp9","vp8","h264"],this.SSRC={audio:{send:[],recv:[]},video:{send:[],recv:[]}},this.LOCAL_candidateType=[],this.LOCAL_transport=[],this.LOCAL_ipAddress=[],this.LOCAL_networkType=[],this.REMOTE_candidateType=[],this.REMOTE_transport=[],this.REMOTE_ipAddress=[],this.REMOTE_networkType=[]},t.prototype.initStatsResult=function(){var e=((navigator.connection||{}).type||"unknown").toString().toLowerCase();this.statsResult={encryption:"sha-256",audio:{send:{tracks:[],codecs:[],availableBandwidth:0,streams:0},recv:{tracks:[],codecs:[],availableBandwidth:0,streams:0},bytesSent:0,bytesReceived:0},video:{send:{tracks:[],codecs:[],availableBandwidth:0,streams:0},recv:{tracks:[],codecs:[],availableBandwidth:0,streams:0},bytesSent:0,bytesReceived:0},results:{},connectionType:{systemNetworkType:e,systemIpAddress:"192.168.1.2",local:{candidateType:[],transport:[],ipAddress:[],networkType:[]},remote:{candidateType:[],transport:[],ipAddress:[],networkType:[]}},resolutions:{send:{width:0,height:0},recv:{width:0,height:0}},internal:{audio:{send:{},recv:{}},video:{send:{},recv:{}},candidates:{}},nomore:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){nomore=!0})}},t.prototype.initStatsParser=function(){var e=this;this.statsParser={checkIfOfferer:function(t){"googLibjingleSession"===t.type&&(e.statsResult.isOfferer=t.googInitiator)}}},t.prototype.initStatsParserFn=function(){var e=this.AUDIO_codecs,t=this.VIDEO_codecs,n=this.SSRC,r=this.statsParser,i=this.statsResult,o=this.LOCAL_candidateType,a=this.LOCAL_transport,s=this.LOCAL_ipAddress,c=this.LOCAL_networkType,d=this.REMOTE_candidateType,u=this.REMOTE_transport,l=this.REMOTE_ipAddress,p=this.REMOTE_networkType;r.datachannel=function(e){"datachannel"===e.type&&(i.datachannel={state:e.state})},r.googCertificate=function(e){"googCertificate"===e.type&&(i.encryption=e.googFingerprintAlgorithm)},r.checkAudioTracks=function(t){if(t.googCodecName&&"audio"===t.mediaType&&e.indexOf(t.googCodecName.toLowerCase())!==-1){var n=t.id.split("_").pop();if(i.audio[n].codecs.indexOf(t.googCodecName)===-1&&i.audio[n].codecs.push(t.googCodecName),t.bytesSent){var r=0;if(t.bytesSent){i.internal.audio[n].prevBytesSent||(i.internal.audio[n].prevBytesSent=t.bytesSent);var o=t.bytesSent-i.internal.audio[n].prevBytesSent;i.internal.audio[n].prevBytesSent=t.bytesSent,r=o/1024}i.audio[n].availableBandwidth=r.toFixed(1)}if(t.bytesReceived){var r=0;if(t.bytesReceived){i.internal.audio[n].prevBytesReceived||(i.internal.audio[n].prevBytesReceived=t.bytesReceived);var o=t.bytesReceived-i.internal.audio[n].prevBytesReceived;i.internal.audio[n].prevBytesReceived=t.bytesReceived,r=o/1024}t.availableBandwidth=r.toFixed(1),i.audio[n].availableBandwidth=t.availableBandwidth}i.audio[n].tracks.indexOf(t.googTrackId)===-1&&i.audio[n].tracks.push(t.googTrackId)}},r.checkVideoTracks=function(e){if(e.googCodecName&&"video"===e.mediaType&&t.indexOf(e.googCodecName.toLowerCase())!==-1){var n=e.id.split("_").pop();if(i.video[n].codecs.indexOf(e.googCodecName)===-1&&i.video[n].codecs.push(e.googCodecName),e.bytesSent){var r=0;i.internal.video[n].prevBytesSent||(i.internal.video[n].prevBytesSent=e.bytesSent);var o=e.bytesSent-i.internal.video[n].prevBytesSent;i.internal.video[n].prevBytesSent=e.bytesSent,r=o/1024}if(e.bytesReceived){var r=0;i.internal.video[n].prevBytesReceived||(i.internal.video[n].prevBytesReceived=e.bytesReceived);var o=e.bytesReceived-i.internal.video[n].prevBytesReceived;i.internal.video[n].prevBytesReceived=e.bytesReceived,r=o/1024}e.availableBandwidth=r.toFixed(1),i.video[n].availableBandwidth=e.availableBandwidth,e.googFrameHeightReceived&&e.googFrameWidthReceived&&(i.resolutions[n].width=e.googFrameWidthReceived,i.resolutions[n].height=e.googFrameHeightReceived),e.googFrameHeightSent&&e.googFrameWidthSent&&(i.resolutions[n].width=e.googFrameWidthSent,i.resolutions[n].height=e.googFrameHeightSent),i.video[n].tracks.indexOf(e.googTrackId)===-1&&i.video[n].tracks.push(e.googTrackId)}},r.bweforvideo=function(e){"VideoBwe"===e.type&&(i.video.bandwidth={googActualEncBitrate:e.googActualEncBitrate,googAvailableSendBandwidth:e.googAvailableSendBandwidth,googAvailableReceiveBandwidth:e.googAvailableReceiveBandwidth,googRetransmitBitrate:e.googRetransmitBitrate,googTargetEncBitrate:e.googTargetEncBitrate,googBucketDelay:e.googBucketDelay,googTransmitBitrate:e.googTransmitBitrate})},r.googCandidatePair=function(e){if("googCandidatePair"===e.type&&(i.connectionType.bitsSentPerSecond=8*(e.bytesSent-(i.connectionType.prevBytesSent||0))/1024/2,i.connectionType.bitsReceivedPerSecond=8*(e.bytesReceived-(i.connectionType.prevBytesReceived||0))/1024/2,i.connectionType.bitsSentPerSecond=i.connectionType.bitsSentPerSecond.toFixed(1),i.connectionType.bitsReceivedPerSecond=i.connectionType.bitsReceivedPerSecond.toFixed(1),i.connectionType.prevBytesSent=e.bytesSent,i.connectionType.prevBytesReceived=e.bytesReceived,"true"===e.googActiveConnection)){i.connectionType.local.ipAddress=e.googLocalAddress,i.connectionType.remote.ipAddress=e.googRemoteAddress,i.connectionType.transport=e.googTransportType;var t=i.internal.candidates[e.localCandidateId];t&&t.ipAddress&&(i.connectionType.systemIpAddress=t.ipAddress);var n=i.internal.candidates[e.remoteCandidateId];n&&n.ipAddress&&(i.connectionType.systemIpAddress=n.ipAddress)}},r.localcandidate=function(e){"localcandidate"===e.type&&(e.candidateType&&o.indexOf(e.candidateType)===-1&&o.push(e.candidateType),e.transport&&a.indexOf(e.transport)===-1&&a.push(e.transport),e.ipAddress&&s.indexOf(e.ipAddress+":"+e.portNumber)===-1&&s.push(e.ipAddress+":"+e.portNumber),e.networkType&&c.indexOf(e.networkType)===-1&&c.push(e.networkType),i.internal.candidates[e.id]={candidateType:o,ipAddress:s,portNumber:e.portNumber,networkType:c,priority:e.priority,transport:a,timestamp:e.timestamp,id:e.id,type:e.type},i.connectionType.local.candidateType=o,i.connectionType.local.ipAddress=s,i.connectionType.local.networkType=c,i.connectionType.local.transport=a)},r.remotecandidate=function(e){"remotecandidate"===e.type&&(e.candidateType&&d.indexOf(e.candidateType)===-1&&d.push(e.candidateType),e.transport&&u.indexOf(e.transport)===-1&&u.push(e.transport),e.ipAddress&&l.indexOf(e.ipAddress+":"+e.portNumber)===-1&&l.push(e.ipAddress+":"+e.portNumber),e.networkType&&p.indexOf(e.networkType)===-1&&p.push(e.networkType),i.internal.candidates[e.id]={candidateType:d,ipAddress:l,portNumber:e.portNumber,networkType:p,priority:e.priority,transport:u,timestamp:e.timestamp,id:e.id,type:e.type},i.connectionType.remote.candidateType=d,i.connectionType.remote.ipAddress=l,i.connectionType.remote.networkType=p,i.connectionType.remote.transport=u)},r.dataSentReceived=function(e){!e.googCodecName||"video"!==e.mediaType&&"audio"!==e.mediaType||(e.bytesSent&&(i[e.mediaType].bytesSent=parseInt(e.bytesSent)),e.bytesReceived&&(i[e.mediaType].bytesReceived=parseInt(e.bytesReceived)))},r.ssrc=function(e){if(e.googCodecName&&("video"===e.mediaType||"audio"===e.mediaType)&&"ssrc"===e.type){var t=e.id.split("_").pop();n[e.mediaType][t].indexOf(e.ssrc)===-1&&n[e.mediaType][t].push(e.ssrc),i[e.mediaType][t].streams=n[e.mediaType][t].length}}},t.prototype.start=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.interval;if(this.statsTimer&&clearInterval(this.statsTimer),!e)throw Error("no peer for stats");this.peer=e,this.interval=t,this.statsTimer=setInterval(this.getStats.bind(this),t)},t.prototype.stop=function(){this.statsTimer&&(clearInterval(this.statsTimer),this.statsTimer=null,this.reset())},t.prototype.getStats=function(){var e=this.formatResult.bind(this),t=this.peer,n=this.mediaStreamTrack;"undefined"!=typeof window.InstallTrigger?t.getStats(n,function(t){var n=[];t.forEach(function(e){n.push(e)}),e(n)},e):t.getStats(function(t){var n=[];t.result().forEach(function(e){var t={};e.names().forEach(function(n){t[n]=e.stat(n)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,n.push(t)}),e(n)})},t.prototype.formatResult=function(e){var t=this.peer,n=(this.mediaStreamTrack,this.statsParser),r=this.statsResult;e.forEach(function(e){Object.keys(n).forEach(function(t){"function"==typeof n[t]&&n[t](e)})});try{t.iceConnectionState.search(/failed/gi)!==-1&&(this.nomore=!0)}catch(i){this.nomore=!0}this.nomore===!0&&(r.datachannel&&(r.datachannel.state="close"),r.ended=!0),r.results=e,this.emit("stats",r)},t}(l["default"]);t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(124),o=r(i),a=n(123),s=r(a),c=n(7),d=r(c),u=n(17),l=r(u),p=n(16),f=r(p),h=n(20),m=r(h),v=n(296),g=r(v),y=function(e){function t(){return(0,d["default"])(this,t),(0,l["default"])(this,e.apply(this,arguments))}return(0,f["default"])(t,e),t.prototype.reset=function(){this.timer&&clearInterval(this.timer),this.timer=null,this.interval=0,this.controller=null},t.prototype.start=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.controller,n=e.interval,r=void 0===n?2:n;this.controller=t,this.interval=r,this.timer=setInterval(this.getStats.bind(this),1e3*r)},t.prototype.stop=function(){this.reset()},t.prototype.getStats=function(){function e(){return t.apply(this,arguments)}var t=(0,s["default"])(o["default"].mark(function n(){var e;return o["default"].wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e={},t.next=3,this.getLocalStats();case 3:return e.self=t.sent,t.next=6,this.getRemoteStats();case 6:e.other=t.sent,Object.keys(e.other).map(function(t){e.self=Object.assign(e.self,e.other[t])}),this.emit("stats",e.self);case 9:case"end":return t.stop()}},n,this)}));return e}(),t.prototype.getLocalStats=function(){function e(){return t.apply(this,arguments)}var t=(0,s["default"])(o["default"].mark(function n(){var e;return o["default"].wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.controller,e&&e.rtc){t.next=3;break}return t.abrupt("return",{});case 3:return e.rtc.rtcConnection.interval=this.interval,t.next=6,g["default"].getStats(e.rtc.rtcConnection);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}},n,this)}));return e}(),t.prototype.getRemoteStats=function(){function e(){return t.apply(this,arguments)}var t=(0,s["default"])(o["default"].mark(function n(){var e,t,r,i,a,c,d,u,l=this;return o["default"].wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(this.controller&&this.controller.remoteNode){n.next=2;break}return n.abrupt("return",{});case 2:e={},t=this.controller.remoteNode,r=Object.keys(t).map(function(){var n=(0,s["default"])(o["default"].mark(function r(n){return o["default"].wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!t[n].rtc){r.next=6;break}return t[n].rtc.rtcConnection.interval=l.interval,r.next=4,g["default"].getStats(t[n].rtc.rtcConnection);case 4:return e[n]=r.sent,r.abrupt("return",e[n]);case 6:case"end":return r.stop()}},r,l)}));return function(e){return n.apply(this,arguments)}}()),i=r,a=Array.isArray(i),c=0,i=a?i:i[Symbol.iterator]();case 6:if(!a){n.next=12;break}if(!(c>=i.length)){n.next=9;break}return n.abrupt("break",21);case 9:d=i[c++],n.next=16;break;case 12:if(c=i.next(),!c.done){n.next=15;break}return n.abrupt("break",21);case 15:d=c.value;case 16:return u=d,n.next=19,u;case 19:n.next=6;break;case 21:return n.abrupt("return",e);case 22:case"end":return n.stop()}},n,this)}));return e}(),t}(m["default"]);t["default"]=y,e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0;var n={K:{framesEncoded:1,qpSum:1,audioOutputLevel:1,googDecodingCTN:1,googDecodingNormal:1,googAvailableSendBandwidth:1,googTargetEncBitrate:1,googActualEncBitrate:1,googRetransmitBitrate:1,googTransmitBitrate:1},T:{googCaptureStartNtpTimeMs:1}};t["default"]={getStats:function(e){var t=this;if(e&&!/(failed|closed)/gi.test(e.iceConnectionState))return navigator.mozGetUserMedia?this.getStatsFirefox(e):new Promise(function(n,r){e.getStats(function(r){var i={},o=r.result();o.forEach(function(e){var t={};e.names().forEach(function(n){t[n]=e.stat(n)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,i[t.id]=t}),e.lastStats=e.lastStats||{},i=t.format(e,i),
  n(i)})})},getStatsFirefox:function(e){var t=this;return e.getStats(null).then(function(n){return e.lastStats=e.lastStats||{},n=t.format(e,n),Promise.resolve(n)})},format:function(e,t){return!e||/(failed|closed)/gi.test(e.iceConnectionState)?{}:t=e.uid-e.targetUid===0?this.ssrcLocal(e,t):this.ssrcRemote(e,t)},formatSSRC:function(e,t,n,r){var i=navigator.mozGetUserMedia?"_formatSSRC_F":"_formatSSRC_G";return this[i](e,t,n,r)},_formatSSRC_G:function(e,t,n,r){var i=this,o={};return Object.values(t).map(function(t){if(("recv"!==r||/^ssrc_/gi.test(t.id))&&("send"!==r||/^(bweforvideo|ssrc_)/gi.test(t.id))){t=i.formatData(t);var n=new RegExp("ssrc_(\\d+)_"+r),a=t.id.match(n),s=t.id;if(o[s]=t,a&&a[1]){if("recv"===r&&0===e.uid)return void delete o[s];t.id="ssrc_"+e.uid+"_"+r+"_"+("recv"===r?e.targetUid:0)+"_"+t.mediaType,t=i.computeData(e,t),o[t.id]=t,delete o[s]}}}),o},_formatSSRC_F:function(e,t,n,r){var i=this,o={},a="send"===r?"outbound":"inbound",s=new RegExp("^"+a+"_","i");return Object.values(t).map(function(t){if(s.test(t.id)){var n=t.id;t.id=t.id.replace(/\d+/,e.uid+"_"+r+"_"+("recv"===r?e.targetUid:0)),t=i.computeData(e,t),o[t.id]=t,delete o[n]}}),o},formatData:function(e){return Object.keys(e).map(function(t){n.K[t]&&(e[t]=(e[t]/1024).toFixed(2)),n.T[t]&&(e[t]=(e[t]/1024/1024).toFixed(2))}),e},computeData:function(e,t){var n={peer:e,ssrcKey:t.id,currentItem:t};return t.bytesSent&&(t.bitsSentPerSecond=this.getLastStats(Object.assign({},n,{valueKey:"bytesSent"}))),t.packetsSent&&(t.packetsSentPerSecond=this.getLastStats(Object.assign({},n,{valueKey:"packetsSent"}))),t.bytesReceived&&(t.bitsReceivedPerSecond=this.getLastStats(Object.assign({},n,{valueKey:"bytesReceived"}))),t.packetsReceived&&(t.packetsReceivedPerSecond=this.getLastStats(Object.assign({},n,{valueKey:"packetsReceived"}))),t},ssrcLocal:function(e,t){var n=e.localDescription;return this.formatSSRC(e,t,n.sdp,"send")},ssrcRemote:function(e,t){var n=e.remoteDescription;return this.formatSSRC(e,t,n.sdp,"recv")},getLastStats:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.peer,n=e.ssrcKey,r=e.valueKey,i=e.currentItem,o=null;return o=t.lastStats[n]&&t.lastStats[n][r]?i[r]-t.lastStats[n][r]:i[r],o=/bytes/gi.test(r)?(8*o*1e3/t.interval/1024).toFixed(2):1e3*o/t.interval,t.lastStats[n]=i[r],o}},e.exports=t["default"]},function(e,t,n){"use strict";t.__esModule=!0;var r=n(49);t["default"]={getAccount:function(){return this.baseGetAccount()},getUid:function(){return this.baseGetUid()},isCurrentChannelId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.baseIsCurrentChannelId(e)},notCurrentChannelId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!this.isCurrentChannelId(e)},switchVideoToAudio:function(){var e=this;return this.controller.uploadDataApi("update",{key:"switch_p2p_type"}),this.controller.switchVideoToAudio().then(function(){return e.type=r.constantRtc.NETCALL_TYPE_AUDIO,Promise.resolve()})["catch"](function(e){return Promise.resolve(e)})},switchAudioToVideo:function(){var e=this;return this.controller.uploadDataApi("update",{key:"switch_p2p_type"}),this.controller.switchAudioToVideo().then(function(){return e.type=r.constantRtc.NETCALL_TYPE_VIDEO,Promise.resolve()})["catch"](function(e){return Promise.resolve(e)})},changeRoleToPlayer:function(){return 0===this.imInfo.role?Promise.resolve({role:"player"}):(this.imInfo.role=0,this.controller.switchRole().then(function(){return Promise.resolve({role:"player"})}))},changeRoleToAudience:function(){return 1===this.imInfo.role?Promise.resolve({role:"audience"}):(this.imInfo.role=1,this.controller.switchRole().then(function(){return Promise.resolve({role:"audience"})}))},updateRtmpUrl:function(e){return this.controller.setSessionConfig({rtmpUrl:e}),this.controller.updateRtmpUrl(e),Promise.resolve()},setSessionConfig:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.controller.setSessionConfig(e)},setSessionVideoQuality:function(e){this.controller.setSessionVideoQuality(e)},setSessionVideoFrameRate:function(e){this.controller.setSessionVideoFrameRate(e)},setSessionAudioQuality:function(e){this.controller.setSessionAudioQuality(e)},setCaptureVolume:function(e){return e=void 0===e?1:e/255,this.controller.setCaptureVolume(e)},setPlayVolume:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.constructor===String&&(e=+e),e.constructor===Number&&(e={volume:e}),e.volume=void 0===e.volume?1:e.volume/255,e.volume=e.volume>1?1:e.volume,this.controller.setPlayVolume(e)},destroyMediaStream:function(e){this.controller.destroyMediaStream({uid:e,type:"remote"})},updateRtmpHostVideo:function(e){var t=e.account,n=e.uid;return t&&(n=this.getUidWithAccount(t)),n?this.controller.updateRtmpHostVideo(n):Promise.reject("账号不在房间中，无法进行操作")}},e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0,t["default"]={getDevicesOfType:function(e){return this.controller.getDevicesOfType(e).then(function(e){return{devices:e}})},stopDevice:function(e){return this.controller.stopDevice(e)},startDevice:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.controller.startDevice(e)}},e.exports=t["default"]},function(e,t,n){"use strict";t.__esModule=!0;var r=n(40);t["default"]={startRecordMp4:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.controller.uploadDataApi("update",{key:"record"}),this.controller.startRecordMp4(e)},stopRecordMp4:function(){return this.controller.stopRecord()},startRecordAac:function(){return this.controller.uploadDataApi("update",{key:"audio_record"}),this.controller.startRecordAac()},stopRecordAac:function(){return this.controller.stopRecord()},setVideoViewSize:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.controller.setVideoViewSize(e)},setVideoViewRemoteSize:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.controller.setVideoViewRemoteSize(e)},startLocalStream:function(e){return this.controller.uploadDataApi("update",{key:"display"}),e=r.element.n2node(e),this.controller.startLocalStream(e)},stopLocalStream:function(){return this.controller.stopLocalStream()},startRemoteStream:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.node=r.element.n2node(e.node),e.account&&(e.uid=this.getUidWithAccount(e.account)),this.controller.startRemoteStream(e)},stopRemoteStream:function(e){return this.controller.stopRemoteStream(e)},suspendLocalStream:function(){return this.controller.suspendLocalStream()},resumeLocalStream:function(){return this.controller.resumeLocalStream()},suspendRemoteStream:function(e){return this.controller.suspendRemoteStream(e)},resumeRemoteStream:function(e){return this.controller.resumeRemoteStream(e)},setAudioStart:function(e){return this.controller.setAudioStart(e)},setAudioBlack:function(e){return this.controller.setAudioBlack(e)},setVideoBlack:function(e){return this.controller.setVideoBlack(e)},setVideoShow:function(e){return this.controller.setVideoShow(e)}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(17),s=r(a),c=n(16),d=r(c),u=n(146),l=r(u),p=n(117),f=n(49),h=n(67),m=n(306),v=r(m),g=n(303),y=r(g),S=n(302),b=r(S),C=n(304),_=r(C),T=n(301),w=r(T),R=n(305),E=r(R),O=null,P=function(e){function t(n){(0,o["default"])(this,t);var r=(0,s["default"])(this,e.call(this,n));return r.logger=n.logger||{},r.resetStatus(),r.init(),r}return(0,d["default"])(t,e),t.prototype.resetStatus=function(){this.rtc&&"closed"!==this.rtc.signalingState&&this.rtc.close(),this.stopStats(),this.stopAudioMonitor(),this.destroyLocalMediaStream(),this.destroyRemoteNode(),this._reset(),this.currRmoteOffer=null,this.rtc=null,this.rtcLogined=!1,this.rtcConnected=!1,this.reConnectCount=0,this.remote_SdpOffers=[],this.remoteStreams={},this.remoteNode={},this.currRemoteTrack={},this.deviceVideoStatus=!1,this.deviceAudioStatus=!1,this.monitorRemoteStreamStartTime=null,this.userJoinTimeoutId=null},t.prototype.destroy=function(){this.stopSession(),this.resetStatus(),this.mediaDevices=null,this.rtcRecorder=null,this.stats=null,this.statsNew=null,this.dataStats=null,this.dataRtc=null},t.prototype.init=function(){this.mediaDevices=new p.MDevices,this.mediaDevices.on("deviceStatus",this.onDeviceStatusChange.bind(this)),this.mediaDevices.on("deviceAdd",this.onDeviceAdd.bind(this)),this.mediaDevices.on("deviceRemove",this.onDeviceRemove.bind(this)),this.rtcRecorder=new p.Recorder,this.initStats(),h.RtcUtil.init(this.logger),p.Recorder.init(this.logger),p.MStream.init(this.logger),O||(O=h.RtcSupport.checkVersion())},t.prototype.startSession=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.imInfo=t,this.sessionConfig=Object.assign(this.sessionConfig,t.sessionConfig);var n=f.constantTool.getVideoSessionConfig({quality:this.sessionConfig.videoQuality,frameRate:this.sessionConfig.videoFrameRate});return this.imInfo=Object.assign(this.imInfo,{videoConfig:n}),this._startSession().then(function(t){return e.rtcLogin()}).then(function(t){e.startStats(),e.rtcLogined=!0;var n=e.mediaDevices.getDeviceStatus(),r=e.deviceAudioStatus&&n.hasAudio&&!e.imInfo.role||!1,i=e.deviceVideoStatus&&n.hasVideo&&!e.imInfo.role||!1;console.log("this.deviceAudioStatus",e.deviceAudioStatus),console.log("deviceStatus.hasAudio",n.hasAudio),console.log("this.imInfo.role",e.imInfo.role),(r||i)&&e.initRtc(),e.startAudioMonitor()})["catch"](function(e){return Promise.reject(e)})},t.prototype.stopSession=function(){var e=this;return this.stopStats(),this.rtcLogout(),this._stopSession(),this.stopRecord()["catch"](function(t){return e.logger.warn("webrtc-controller::停止音视频录制相关工作")}),this.resetStatus(),Promise.resolve()},t.prototype.initRtcEvent=function(e){var t=this;e&&(e.on("sessionConnected",function(){t.emit("sessionConnected")}),e.on("getRemoteStream",this.onRemoteStream.bind(this)),e.on("iceCandidate",this.onLocalIceCandidate.bind(this)),e.on("negotiationneeded",this.onNegotiationNeeded.bind(this)),e.on("icestatechange",this.onIceStateChange.bind(this)),this.mediaDevices.getDevices().then(function(e){t.emit("devices",e)}))},t.prototype.rtcLogin=function(){var e=this;return console.log("rtcLogin"),this.sendLocalMessage({isLogin:!0}),new Promise(function(t,n){e.once("LoginSuccess",function(n){e.logger.log("once LoginSuccess-->",n),t()}),e.once("LoginFailed",function(t){e.logger.log("once LoginFailed-->",t),n(t)})})},t.prototype.rtcLogout=function(){var e=Date.now(),t={params:{content:{timestamp:e}}};this.sendMsg("logout",t)},t.prototype.initRtc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return console.log("initRtc"),this.rtc?Promise.resolve():(this.rtc=new v["default"]({imInfo:this.imInfo,logger:this.logger,sessionConfig:this.sessionConfig,controller:this}),this.initRtcEvent(this.rtc),this.uploadDataRtcStart(),this.updateRtcStream(),this.startRtc(e))},t.prototype.updateRtc=function(){var e=0===this.imInfo.role||"p2p"===this.imInfo.sessionMode;return e||this.rtc?this.rtc?(this.updateRtcStream(),this.createOffer({isUpdate:!0})):this.initRtc(!0):Promise.resolve()},t.prototype.startRtc=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.imInfo.sessionMode;return this.createOffer({isUpdate:t}).then(function(){return new Promise(function(t,r){e.once("sessionConnected",function(n){e.logger.log("rtc connect success"),e.rtcConnected=!0,e.setSessionConfig({rtcEndTime:Date.now()}),t(n)}),e.once("rtcConnectError",function(t){e.uploadDataRtcStop(),r(t)}),"p2p"===n&&(e.userJoinTimeoutId=setTimeout(function(){r("user join timeout")},5e4))})})["catch"](function(e){return Promise.reject(e)})},t.prototype.sendMsg=function(e,t){var n={type:e,uid:this.imInfo.uid+"",cid:this.imInfo.cid+""};n=Object.assign(n,t),this.signal&&this.logger.log("webrtc-controller::sendMsg ---> "+e,n),this.signal&&this.signal.send(n)},t.prototype.onSignalMessage=function(e){if(e&&e.cid&&e.uid&&(e.cid=+e.cid,e.uid=+e.uid),e.cid!==this.imInfo.cid)return this.logger.error("webrtc-controller::websocket message not belong to this session");var t=e.type;this["on"+t]&&this["on"+t](e)},t.prototype.hangup=function(){this.stopSession(),null!==this.userJoinTimeoutId&&(clearTimeout(this.userJoinTimeoutId),this.userJoinTimeoutId=null),this.resetStatus()},t.prototype.onSignalTimeout=function(e){this.emit("signalClosed"),this.resetStatus()},t.prototype.onlogin_ack=function(e){this.logger.log("onlogin_ack-->",e);var t=e.params.auth_res-0;return 200!==t?(this.logger.warn("服务器验证不通过, 断开连接"),this.emit("LoginFailed",{code:t,error:"服务器验证不通过, 断开连接"}),void this.stopSession()):(this.logger.log("音视频服务器登录成功",e),void this.emit("LoginSuccess"))},t.prototype.onclient_join=function(e){console.log("onclient_join, ",e),this.emit("userJoined",{uid:e.params.client_id,cid:this.imInfo.cid})},t.prototype._onclient_join=function(e){if(this.remoteNode[e])return this._onclient_update(e,!0);var t=new v["default"]({imInfo:this.imInfo,logger:this.logger,sessionConfig:this.sessionConfig,targetUid:e,controller:this});this.initRtcEvent(t),this.remoteNode[e]={isAudioEnable:!1,isVideoEnable:!1,container:this.info.remoteContainer,rtc:t},this.createOffer({rtc:t})},t.prototype.onclient_update=function(e){console.log("onclient_update, ",e,this.remoteNode[t]);var t=e.params.client_id,n=e.params,r=n.has_video,i=n.has_audio;return this.emit("remoteStreamUpdate",{uid:t,audio:i,video:r}),this.remoteNode[t]?"Firefox"===O.prefix&&O.version-0>=59?this._delayVideoShow(t,r):this._onclient_update(t,r):void(!i&&!r||this.remoteNode[t]||this._onclient_join(t))},t.prototype._onclient_update=function(e,t){if(!this.remoteNode[e])return void this._onclient_join(e);var n=this.remoteNode[e].rtc;n&&(t?this.createOffer({rtc:n}):this.delayVideoShow(e,t))},t.prototype.onclient_logout=function(e){var t=e.params.content.logout_type;t="normal"===t?f.constantRtc.HANGUP_TYPE_NORMAL:f.constantRtc.HANGUP_TYPE_TIMEOUT;var n=e.uid,r=e.cid;this.emit("leaveChannel",{uid:n,cid:r,type:t}),this.remoteNode.hasOwnProperty(n)&&(this.destroyRemoteNode(n),this.removeRemoteUserStream(n),this.rtcRecorder&&this.rtcRecorder.leave({uid:n}))},t.prototype.startAudioMonitor=function(){function e(){var e={},t=0;this.localAudioStream&&(t=this.localAudioStream.getAudioVolume()),e.self={status:t},this.uploadDataRtc("volume",e.self.status);var n=this.remoteNode;for(var r in n){var i=this.info.client.getAccountWithUid(r);t=n[r]&&n[r].remoteAudioStream?n[r].remoteAudioStream.getAudioVolume():0,e[i||r]={status:t}}this.emit("audioVolume",e)}var t=this.audioMonitorTimer;t||(t=this.audioMonitorTimer=setInterval(e.bind(this),500))},t.prototype.stopAudioMonitor=function(){var e=this.audioMonitorTimer;e&&(clearInterval(e),e=this.audioMonitorTimer=null)},t}(l["default"]),k=P.prototype;k=Object.assign(k,y["default"]),k=Object.assign(k,b["default"]),k=Object.assign(k,w["default"]),k=Object.assign(k,_["default"]),k=Object.assign(k,E["default"]),t["default"]=P,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(40),o=n(49),a=n(67),s=n(4),c=r(s),d=null,u="//"+c["default"].roomserver+"/v1/sdk/command/rooms/";t["default"]={switchRole:function(){return this.rtcLogined?(d||(d=a.RtcSupport.checkVersion()),"Firefox"!==d.prefix||"Firefox"===d.prefix&&d.version-0<59?this.updateRtc():(0===this.imInfo.role?(this.enableDevice(o.constantRtc.DEVICE_TYPE_AUDIO_IN),this.enableDevice(o.constantRtc.DEVICE_TYPE_VIDEO)):(this.disableDevice(o.constantRtc.DEVICE_TYPE_AUDIO_IN),this.disableDevice(o.constantRtc.DEVICE_TYPE_VIDEO)),this.rtcConnected?Promise.resolve():(0===this.imInfo.role&&this.updateRtc(),Promise.resolve()))):Promise.resolve()},switchVideoToAudio:function(){return this.rtcLogined?(this.localVideoStream&&this.disableDevice(o.constantRtc.DEVICE_TYPE_VIDEO),Promise.resolve()):Promise.reject("no connection")},switchAudioToVideo:function(){return this.rtcLogined?(this.localVideoStream&&this.enableDevice(o.constantRtc.DEVICE_TYPE_VIDEO),Promise.resolve()):Promise.reject("no connection")},setSessionConfig:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.sessionConfig=Object.assign(this.sessionConfig,e)},setSessionVideoQuality:function(e){void 0!==e&&this.setSessionConfig({videoQuality:e})},setSessionVideoFrameRate:function(e){void 0!==e&&this.setSessionConfig({videoFrameRate:e})},setSessionAudioQuality:function(e){this.setSessionConfig({highAudio:!!e})},startRecordMp4:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.account,n=e.uid;if(t)if(t===this.info.client.getAccount())n=this.imInfo.uid;else if(n=this.info.client.getUidWithAccount(t),!n)return Promise.reject("账号不在房间中，无法进行录制");t=t||this.info.client.getAccount();var r=[];if(n&&n-this.imInfo.uid!==0){var i=this.remoteNode[n];if(!i)return Promise.reject("需要录制的账号不正确");i.remoteAudioStream&&r.push(i.remoteAudioStream.stream),i.remoteVideoStream&&r.push(i.remoteVideoStream.stream)}else this.localAudioStream&&r.push(this.localAudioStream.stream),this.localVideoStream&&r.push(this.localVideoStream.stream);return 0===r.length?Promise.reject("当前没有音视频数据，无法进行录制"):this.rtcRecorder.start(r,{account:t,uid:n})},stopRecord:function(){return this.rtcRecorder.stop()},startRecordAac:function(){var e=this.info.client.getAccount(),t=this.imInfo.uid,n=[];this.localAudioStream&&n.push(this.localAudioStream.stream);var r=this.remoteNode;for(var i in r)r[i].remoteAudioStream&&r[i].remoteAudioStream.stream&&n.push(r[i].remoteAudioStream.stream);return this.rtcRecorder.start(n,{account:e,uid:t,type:"audio"})},updateRtmpUrl:function(){this.sendMsg("update_bypass_url",{params:{content:{bypass_url:this.sessionConfig.rtmpUrl}}})},updateRtmpHostVideo:function(e){if(!e)return Promise.reject("账号不在房间中，无法进行操作");var t=u+this.imInfo.cid,n=this.imInfo.turnToken||this.imInfo.serverMap&&this.imInfo.serverMap.token;return n?(0,i.ajax)({type:"post",url:t,data:{suid:this.imInfo.uid,cid:this.imInfo.cid,uid:+e,cmd:10001},header:{Token:n}}).then(function(e){if(200===e.code)return Promise.resolve();var t=void 0;switch(e.code){case 404:t="房间不存在";break;case 405:t="目标用户不在房间中";break;case 406:t="没有权限";break;case 417:t="请求数据不对";break;case 600:t="服务器内部错误";break;default:t="请求参数不正确"}return Promise.reject(t)}):Promise.reject("token缺失, 请检查")}},e.exports=t["default"]},function(e,t,n){"use strict";t.__esModule=!0;var r=n(117),i=n(49),o=n(67),a=null,s={audio:null,video:null,screen:null,debounceTime:500};t["default"]={getDeviceStatus:function(){return this.mediaDevices.getDeviceStatus()},getDevicesOfType:function(e){return this.mediaDevices.getDevicesOfType(i.constantTool.getDeviceTypeMap(e)).then(function(e){return Promise.resolve(e[0])})},onDeviceStatusChange:function(e){this.logger.log("webrtc-controller::onDeviceStatusChange:",e),this.emit("deviceStatus",e)},onDeviceAdd:function(e){this.logger.log("webrtc-controller::onDeviceAdd:",e),this.emit("deviceAdd",e)},onDeviceRemove:function(e){var t=this;this.logger.log("webrtc-controller::onDeviceRemove:",e),this.emit("deviceRemove",e),(this.localVideoStream||this.localAudioStream)&&e.forEach(function(e){t.localVideoStream&&e.deviceId===t.localVideoStream.constraint.video.deviceId&&(t.localVideoStream.destroy(),t.localVideoStream=null,t.client.devices.hasVideo=!1,t.rtcLogined&&t.updateRtc()),t.localAudioStream&&e.deviceId===t.localAudioStream.constraint.audio.deviceId&&(t.localAudioStream.destroy(),t.localAudioStream=null,t.client.devices.hasAudio=!1)})},checkDeviceStatus:function(e,t){return e===i.constantRtc.DEVICE_TYPE_VIDEO&&this.localVideoStream&&this.localVideoStream.constraint.video.deviceId===t.deviceId?(this.enableDevice(e),Promise.reject("设备已开启，重复操作")):e===i.constantRtc.DEVICE_TYPE_AUDIO_IN&&this.localAudioStream&&this.localAudioStream.audioStream&&this.localAudioStream.constraint.audio.deviceId===t.deviceId?(this.enableDevice(e),Promise.reject("设备已开启，重复操作")):Promise.resolve()},stopDevice:function(e){var t=this;return new Promise(function(n,r){if(e===i.constantRtc.DEVICE_TYPE_VIDEO){if(t.deviceVideoStatus=!1,a||(a=o.RtcSupport.checkVersion()),t.localVideoStream&&("Safari"===a.prefix||"Firefox"===a.prefix&&a.version-0>=59))return t.disableDevice(e).then(n,r);if(t.localVideoStream)return t.localVideoStream.destroy(),t.localVideoStream=null,t.rtcLogined&&t.updateRtc(),n()}else if(e===i.constantRtc.DEVICE_TYPE_AUDIO_IN){if(t.deviceAudioStatus=!1,t.localAudioStream)return t.localAudioStream.stopDevice(),n()}else e===i.constantRtc.DEVICE_TYPE_AUDIO_OUT_LOCAL?t.localAudioStream&&t.localAudioStream.setMuted(!0):e===i.constantRtc.DEVICE_TYPE_AUDIO_OUT_CHAT&&t.setAudioBlack();n()})},destroyDevice:function(e){this.logger.log("webrtc-controller::destroyDevice: 销毁设备",e);var t=e===i.constantRtc.DEVICE_TYPE_AUDIO_IN?"localAudioStream":"localVideoStream";return this[t]&&this[t].destroy(),this[t]=null,Promise.resolve()},disableDevice:function(e){this.logger.log("webrtc-controller::disableDevice: 暂停设备",e);var t=e===i.constantRtc.DEVICE_TYPE_AUDIO_IN?"localAudioStream":"localVideoStream",n=this[t]&&this[t].stream&&this[t].stream.getTracks()||[];return n.forEach(function(e){e.enabled=!1}),Promise.resolve()},enableDevice:function(e){this.logger.log("webrtc-controller::disableDevice: 恢复设备",e);var t=e===i.constantRtc.DEVICE_TYPE_AUDIO_IN?"localAudioStream":"localVideoStream",n=this[t]&&this[t].stream&&this[t].stream.getTracks()||[];return n.forEach(function(e){e.enabled=!0}),Promise.resolve()},startDevice:function(e){var t=this;return new Promise(function(n,r){var o=e.type,a=e.device,s=e.account,c=e.uid;if(o===i.constantRtc.DEVICE_TYPE_VIDEO&&(t.deviceVideoStatus=!0),o===i.constantRtc.DEVICE_TYPE_AUDIO_IN&&(t.deviceAudioStatus=!0),o===i.constantRtc.DEVICE_TYPE_AUDIO_OUT_LOCAL)return t.setAudioStart({uid:-1}),n();if(o===i.constantRtc.DEVICE_TYPE_AUDIO_OUT_CHAT)return t.setAudioStart({account:s,uid:c}),n();var d=Promise.resolve();o!==i.constantRtc.DEVICE_TYPE_DESKTOP_SCREEN&&o!==i.constantRtc.DEVICE_TYPE_DESKTOP_WINDOW&&(a&&a.deviceId||(d=t.getDevicesOfType(o))),d.then(function(e){return a=a||e&&e[0],t.checkDeviceStatus(o,a).then(function(){return o===i.constantRtc.DEVICE_TYPE_VIDEO?t.getStream("Video",a,n,r):o===i.constantRtc.DEVICE_TYPE_AUDIO_IN?t.getStream("Audio",a,n,r):o===i.constantRtc.DEVICE_TYPE_DESKTOP_SCREEN||o===i.constantRtc.DEVICE_TYPE_DESKTOP_WINDOW?t.getStream("Screen",o,n,r):void 0})["catch"](function(e){/重复操作/.test(e)?n():r(e)})}).then(function(e){n(e)})["catch"](function(e){r(e)})})},getStream:function(e,t,n,r){var i="_get"+e+"Stream";return s[e]&&s[e].lockerTimer&&(this.logger.log("webrtc-controller::destroy "+i+" timer"),clearTimeout(s[e].lockerTimer)),this.logger.log("webrtc-controller::create "+i+" timer"),s[e]={},this[i](t,n,r)},_getVideoStream:function(e,t,n){var s=this,c={};if(a||(a=o.RtcSupport.checkVersion()),this.localVideoStream&&("Safari"===a.prefix||"Firefox"===a.prefix&&a.version-0>=59))return this.enableDevice(i.constantRtc.DEVICE_TYPE_VIDEO).then(t,n);this.localVideoStream&&(this.localVideoStream.destroy(),this.localVideoStream=null);var d={};d.deviceId=e.deviceId;var u=i.constantTool.getVideoSessionConfig({quality:this.sessionConfig.videoQuality,frameRate:this.sessionConfig.videoFrameRate});return d=Object.assign(d,u),c.video=d,this.logger.log("webrtc-controller::_getVideoStream:",c),r.MStream.getLocalStream(c).then(function(n){s.localVideoStream=n,s.rtcLogined&&s.updateRtc(),t({device:e,stream:n})})["catch"](function(e){n(e)})},_getAudioStream:function(e,t,n){var i=this,o={};if(this.localAudioStream&&this.localAudioStream.audioStream)return this.enableDevice("audio").then(t);var a=e&&e.deviceId;return o.audio=!a||{deviceId:a},this.logger.log("webrtc-controller::_getAudioStream:",o),r.MStream.getLocalStream(o).then(function(n){i._initAudioStream(o,n),t({device:e,stream:n})})["catch"](function(e){n(e)})},_initAudioStream:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new MediaStream;this.localAudioStream?this.localAudioStream.updateStream(t):(this.localAudioStream=new r.MStream({stream:t,type:"audio",isRemote:!1,constraint:e}),this.rtcLogined&&this.updateRtc())},_getScreenStream:function(e,t,n){var o=this;this.localVideoStream&&(this.localVideoStream.destroy(),this.localVideoStream=null),e=e===i.constantRtc.DEVICE_TYPE_DESKTOP_SCREEN?"screen":"window";var a={audio:!1,video:{mediaSource:e}};return this.logger.log("webrtc-controller::_getScreenStream:",a),r.MStream.getLocalStream(a).then(function(e){o.localVideoStream=e,o.rtcLogined&&o.updateRtc()})["catch"](n)}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(117),o=n(61),a=r(o);t["default"]={destroyMediaStream:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{type:"all"};if("local"!==e.type&&"all"!==e.type||(this.destroyLocalMediaStream(),"local"!==e.type)){if("remote"===e.type)return void this.destroyRemoteMediaStream(e.uid);for(var t in this.remoteNode)this.destroyRemoteMediaStream(t);this.remoteNode={}}},destroyLocalMediaStream:function(){this.localAudioStream&&(this.localAudioStream.destroy(),this.localAudioStream=null),this.localVideoStream&&(this.localVideoStream.destroy(),this.localVideoStream=null)},destroyRemoteMediaStream:function(e){if(e&&this.remoteNode&&this.remoteNode[e]){var t=this.remoteNode[e];t.remoteVideoStream&&t.remoteVideoStream.destroy(),t.remoteAudioStream&&t.remoteAudioStream.destroy(),t.remoteVideoStream=null,t.remoteAudioStream=null,this.remoteNode[e]=null;var n=this.remoteStreams[e];this.switchTrackEvent({stream:n,uid:e,isOn:!1}),i.MStream.destroyMedia(n)}},setCaptureVolume:function(e){(void 0===e||e>1)&&(e=1),this.localAudioStream&&this.localAudioStream.setGain(e)},setPlayVolume:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.option={volume:e.volume},this.localAudioStream&&this.localAudioStream.setPlayVolume(e.volume),this.optionRemoteStream("setPlayVolume",e)},setAudioStart:function(e){var t=e.account,n=e.uid;return console.log("setAudioStart",n),n===-1?void(this.localAudioStream&&this.localAudioStream.show()&&this.localAudioStream.setMuted(!1)):this.optionRemoteStream("setMuted",{account:t,uid:n,isAudio:!0,option:!1})},setAudioBlack:function(e){return this.optionRemoteStream("setMuted",{account:e,isAudio:!0,option:!0})},setVideoBlack:function(e){return this.optionRemoteStream("hide",e)},setVideoShow:function(e){return this.optionRemoteStream("show",e)},setVideoViewSize:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.videoViewSizeOptions=e,this.localVideoStream&&this.localVideoStream.resize(this.videoViewSizeOptions)},setVideoViewRemoteSize:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.option=e,this.optionRemoteStream("resize",e)},startLocalStream:function(e){var t=this;if(this.localVideoStream){if(this.localVideoStream.container=e||this.info.container,!this.localVideoStream.container)return this.logger.error("webrtc-controller::startLocalStream:开启本地视频流失败 -> video容器节点缺失"),Promise.reject("开启本地视频流失败: video容器节点缺失");this.localVideoStream.resize(this.videoViewSizeOptions),this.localVideoStream.show(),this.localVideoStream.on("resize",function(e){t.emit("streamResize",e)}),this.localVideoStream.on("error",function(e){t.emit("error",e)}),this.localVideoStream.isShown()||this.updateRtcStream()}},stopLocalStream:function(){this.localVideoStream&&this.localVideoStream.hide()},startRemoteStream:function(){function e(e){e.container=t&&r||e.container,e.isVideoEnable=!0,e.remoteVideoStream&&(e.remoteVideoStream.resize(e.videoSizeOptions),e.remoteVideoStream.show(e.container,i))}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.uid,r=t.node,i=t.poster,o=void 0;if("p2p"===this.imInfo.sessionMode&&!n&&(n=this.info.client.target.uid,!this.info.remoteContainer&&!r))return Promise.reject("startRemoteStream失败：点对点模式实例化Netcall必须设置remoteContainer与target；或者参数必须包含account，node");if(o=this.remoteNode[n],n&&!o)return Promise.reject("未收到对应账号的音视频流信息，无法播放");if(r=r||this.info.remoteContainer,o)return o.container=t&&r||o.container,o.container?(e(o),Promise.resolve(o.remoteVideoStream.node)):Promise.reject(n+" 开启显示远端视频画面失败: 请传递video容器");var a=this.remoteNode;for(var s in a){if(a[s].container=t&&r||a[s].container,!a[s].container)return Promise.reject(n+" 开启显示远端视频画面失败: 请传递video容器");e(a[s])}return Promise.resolve()},stopRemoteStream:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.optionRemoteStream("hide",e)},suspendLocalStream:function(){return this.localVideoStream?(this.localVideoStream.pause(),Promise.resolve()):Promise.reject("本地没有音视频流，无法进行操作")},resumeLocalStream:function(){return this.localVideoStream?(this.localVideoStream.resume(),Promise.resolve()):Promise.reject("本地没有音视频流，无法进行操作")},suspendRemoteStream:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.optionRemoteStream("pause",e)},resumeRemoteStream:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.optionRemoteStream("resume",e)},optionRemoteStream:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.constructor===String&&(t={account:t}),t.fn=e;var n=t,r=n.account;return r&&r.constructor===Object&&(t=Object.assign(t,r),t.account.constructor===Object&&delete t.account),t.uid||a["default"].CURRENT.SDK_TYPE!==a["default"].SDK_TYPE.NRTC||(t.uid=t.account,delete t.account),this.doOptionRemoteStream(t)},doOptionRemoteStream:function(){function e(e){return o?(e.remoteAudioStream&&e.remoteAudioStream[n]&&e.remoteAudioStream[n](a),void(e.isAudioEnable=!0)):("resize"===n&&(e.videoSizeOptions=a||this.videoViewRemoteSizeOptions),e.remoteVideoStream&&e.remoteVideoStream[n]&&e.remoteVideoStream[n](a),void(e.isVideoEnable="hide"!==n))}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.fn,r=t.uid,i=t.account,o=t.isAudio,a=t.option,s=void 0;if(o=o||/(setPlayVolume|setGain)/.test(n),"p2p"!==this.imInfo.sessionMode||r||(r=this.info.client.target.uid),!r&&i&&(r=this.info.client.getUidWithAccount(i),!r))return Promise.reject("目标账号不正确或者未在当前会话中");if(r)return s=this.remoteNode[r],s&&e(s),Promise.resolve();s=this.remoteNode;for(var c in s)s[c]&&e(s[c]);return Promise.resolve()},addStream:function(e){!e||!this.localAudioStream}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(15),o=r(i),a=n(67),s=n(117),c=n(4),d=c.info.nrtcSdkVersion,u=null,l=3;t["default"]={destroyRemoteNode:function(e){if(e)return this.destroyRemoteRtc(e),void this.destroyRemoteMediaStream(e);var t=this.remoteNode;for(var n in t)this.destroyRemoteRtc(n),this.destroyRemoteMediaStream(n)},destroyRemoteRtc:function(e){if(e&&this.remoteNode&&this.remoteNode[e]){var t=this.remoteNode[e];t.rtc&&t.rtc.close()}},createOffer:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isUpdate,r=void 0!==n&&n,i=t.rtc,o=void 0===i?this.rtc:i;return o.createOffer().then(function(e){return o.setLocalDescription(e,r)}).then(function(t){return e.sendOffer({offer:t,isUpdate:r,targetUid:o.targetUid}),Promise.resolve()})},sendOffer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.targetUid===this.imInfo.uid?this.sendLocalMessage(e):this.sendRemoteMessage(e)},sendLocalMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.offer,n=e.isUpdate,r=e.isLogin,i=void 0!==r&&r,o=this.imInfo,a=this.imInfo.videoConfig,s=this.sessionConfig||{},c=i?"client_login":n?"sdp_update":"sdp_offer",u=this.mediaDevices.getDeviceStatus(),l={session_mode:o.sessionMode||"p2p",record:{support_video_record:s.recordVideo||!1,
  support_audio_record:s.recordAudio||!1},bypass_rtmp:{is_host:!!s.rtmpUrl,support_bypass_rtmp:s.liveEnable||!1,support_bypass_rtmp_record:s.rtmpRecord||!1,bypass_rtmp_url:s.rtmpUrl||"",participant_mode:"M-"+s.splitMode,layout:s.layout||""},params:{version:+d,token:o.token||o.cid+"",user_type:o.token?3:2,user_token_type:0,content:i?"":t,streamSetting:{video:{width:a.width,height:a.height,frameRate:s.liveEnable&&a.frameRate>15?15:a.frameRate}},dst_id:this.imInfo.uid,is_multi_peerconnection:!0},hasAudio:!i&&(this.deviceAudioStatus&&u.hasAudio&&!this.imInfo.role||!1),hasVideo:!i&&(this.deviceVideoStatus&&u.hasVideo&&!this.imInfo.role||!1)};this.sendMsg(c,l)},sendRemoteMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.offer,n=e.targetUid,r=this.imInfo,i="sdp_offer",o={session_mode:r.sessionMode||"p2p",params:{token:r.token||r.cid+"",user_type:r.token?3:2,user_token_type:0,content:t,version:+d,dst_id:n,is_multi_peerconnection:!0}};this.sendMsg(i,o)},sendAnswer:function(e,t){var n=this.imInfo.videoConfig,r={params:{content:e,streamSetting:{video:n}}};t&&(r.params.dst_id=t),this.sendMsg("sdp_answer",r)},onsdp_answer:function(e){this.logger.log("webrtc-controller::onSdp_answer:uid -> ",e);var t=e.params.auth_res-0,n=e.params.dst_id||this.imInfo.uid;if(200!==t)return this.logger.error("webrtc-controller::onSdp_answer:服务器验证不通过, 断开连接"),this.emit("signalClosed",{code:t,error:"服务器验证不通过, 断开连接"}),void this.stopSession();var r=n-this.imInfo.uid===0?this.rtc:this.remoteNode[n].rtc;r&&r.setRemoteDescription(e.params.content,"answer")},onice_answer:function(e){var t=e.params.content,n=e.params.dst_id||this.imInfo.uid;"object"!==("undefined"==typeof t?"undefined":(0,o["default"])(t))&&(t={candidate:t});var r=n-this.imInfo.uid===0?this.rtc:this.remoteNode[n].rtc;r&&r.addRemoteIceCandidate(t)},monitorRemoteStream:function(e){if(this.remoteVideoStream||this.remoteAudioStream){if(!e.ssrc.remote||!e.ssrc.remote.total)return;var t=e.ssrc.remote.total;if(t.bytesReceivedRate>0||!this.monitorRemoteStreamStartTime)this.monitorRemoteStreamStartTime=Date.now();else{var n=Date.now();n-this.monitorRemoteStreamStartTime>1e4&&(this.logger.warn("webrtc-controller::monitorRemoteStream:10秒内未收到音视频数据"),this.emit("remoteStreamNoData"),this.monitorRemoteStreamStartTime=null)}}else this.monitorRemoteStreamStartTime=null},onRemoteStream:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.uid,n=e.stream,r=e.track;return window.myRemoteStreams=this.remoteStreams,window.myRemoteNode=this.remoteNode,this.logger.log("webrtc-controller::onRemoteStream:get remote stream",e),this.remoteStreams[t]=n,t?void this.doRemoteStream(n,t,r):this.logger.warn("webrtc-controller::onRemoteStream:无法找到远程流对应的uid!!,先暂存",n)},composeTrack:function(e,t,n,r){if(e!==this.imInfo.uid){var i=this.remoteNode[e],o=new MediaStream,a="audio"===n?"remoteAudioStream":"remoteVideoStream";o.addTrack(t),i[a]?i[a].updateStream(o):i[a]=new s.MStream({uid:e,stream:o,type:n,isRemote:!0,container:i.container}),this.logger.log("webrtc::composeTrack ",e,n,t.id,t.readyState),"audio"===n&&i.isAudioEnable&&i[a].show(),"video"===n&&this.delayVideoShow(e)}},delayVideoShow:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];setTimeout(function(){t._delayVideoShow(e,n)},100)},_delayVideoShow:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e&&e!==this.imInfo.uid){var n=this.remoteNode[e],r=n.remoteVideoStream;if(n&&r){if(console.log("_delayVideoShow",e,t),u||(u=a.RtcSupport.checkVersion()),"Firefox"!==u.prefix){var i={};n.isVideoEnable&&t&&(i=this.checkRemoteTrack(e,n.rtc.sdpAnswer.sdp)),t=i.video}var o=n.isVideoEnable&&t?"show":"hide";r[o]&&r[o](),"show"===o&&r.resize(n.videoSizeOptions||this.videoViewRemoteSizeOptions),this.logger.log("webrtc-controller::delayVideoShow: "+e+" video "+o)}}},switchTrackEvent:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.stream,r=t.uid,i=t.isOn,o=void 0===i||i;if(n&&r){if(!o)return n.onaddtrack=null,n.onremovetrack=null,this.logger.log("webrtc-controller::remove trackevent: onaddtrack",n.id),void this.logger.log("webrtc-controller::remove trackevent: onremovetrack",n.id);n.onaddtrack||(this.logger.log("webrtc-controller::add trackevent onaddtrack",n.id),n.onaddtrack=function(t){e.emit("addtrack",t);var i=t.track,o=i.kind;if(e.logger.log("webrtc-controller::on add track:",n.id,o,i.id,i.readyState),e.composeTrack(r,i,o),e.emit("remoteTrack",{uid:r,track:i}),"video"===o){var a=e.remoteNode[r].rtc,s=a.rtcConnection&&a.rtcConnection.remoteDescription.sdp;e.checkRemoteTrack(r,s),e.delayVideoShow(r)}}),n.onremovetrack||(this.logger.log("webrtc-controller::add trackevent onremovetrack",n.id),n.onremovetrack=function(t){var i=t.track,o=i.kind,a=e.remoteNode[r];a&&(e.logger.warn("webrtc-controller::on remove track:",n.id,o,i.id,i.readyState),e.emit("removetrack",t),"video"===o&&a.remoteVideoStream&&a.remoteVideoStream.hide())})}},doRemoteStream:function(e,t,n){/Firefox/gi.test(navigator.userAgent)?this.doRemoteStreamFirefox(e,t,n):this.doRemoteStreamChrome(e,t,n)},doRemoteStreamChrome:function(e,t){var n=this;this.logger.log("webrtc-controller::get "+t+" stream, track num: "+e.getTracks().length,e),e&&e.getTracks().forEach(function(e){n.logger.log("   > track id:",e.kind+":"+e.id,e)});var r=e.getAudioTracks()[0],i=e.getVideoTracks()[0];r&&this.composeTrack(t,r,"audio",e),i&&this.composeTrack(t,i,"video",e),this.switchTrackEvent({stream:e,uid:t}),r&&this.emit("remoteTrack",{uid:t,track:r}),i&&this.emit("remoteTrack",{uid:t,track:i})},doRemoteStreamFirefox:function(e,t,n){var r=this.remoteNode[t];if(r&&r.rtc){this.logger.log("webrtc-controller::get "+t+" track: ",n&&n.id,n),u||(u=a.RtcSupport.checkVersion());n&&(this.composeTrack(t,n,n.kind,e),this.emit("remoteTrack",{uid:t,track:n}))}},onLocalIceCandidate:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger.log("webrtc-controller::onLocalIceCandidate",e);var t=e.uid,n=e.ice;if(!/\d tcp \d/gi.test(n.candidate)){var r={params:{content:n,dst_id:t}};this.sendMsg("ice_offer",r)}},onNegotiationNeeded:function(e){this.rtcConnected&&this.logger.log("webrtc-controller::onNegotiationNeeded",e.target)},onIceStateChange:function(e){var t=e.rtc,n=e.state,r=t.targetUid;if(this.logger.log("webrtc-controller::"+r+" ice connection state change to: "+n),"connected"===n&&r===this.imInfo.uid&&this.emit("sessionConnected"),"failed"===n){if(this.logger.error("webrtc-controller::"+r+" ice failed"),r-this.imInfo.uid===0)return void this.onLocalIceFail();this.onRemoteFail(r)}},onLocalIceFail:function(){var e=this;return l?(this.stopSession(),void this.emit("signalClosed")):(this.reConnectCount++,this.logger.log("webrtc-controller::3s后尝试第"+this.reConnectCount+"次重连服务器"),void setTimeout(function(){e.logger.log("webrtc-controller::假的重连")},3e3))},onRemoteFail:function(e){this.emit("remoteSignalClosed",e),this.remoteNode.hasOwnProperty(e)&&(this.destroyRemoteNode(e),this.removeRemoteUserStream(e),this.remoteNode[e]=null,delete this.remoteNode[e],this.rtcRecorder&&this.rtcRecorder.leave({uid:e}))},updateRtcStream:function(){var e=0===this.imInfo.role||"p2p"===this.imInfo.sessionMode;this.logger.log("webrtc-controller::updateRtcStream:role -> ",e?"player":"audience");var t=[];if(e){var n=this.localAudioStream,r=this.localVideoStream;n&&n.stream&&t.push(n.stream),r&&r.stream&&t.push(r.stream)}this.rtc&&this.rtc.updateStream(t)},removeRemoteUserStream:function(e){this.logger.log("webrtc-controller::removeRemoteUserStream:uid -> ",e),delete this.remoteNode[e]},checkRemoteTrack:function(e,t){var n=this.remoteNode[e];if(!n)return{};var r=n.remoteAudioStream&&n.remoteAudioStream.audioStream,i=n.remoteVideoStream&&n.remoteVideoStream.stream;if(!r&&!i||!n.rtc)return{};var o=n.rtc.checkMediaStatus({audio:r,video:i,sdp:t,uid:e});return this.logger.log("webrtc-controller::checkRemoteTrack:uid -> ",e,o),o.video||n.remoteVideoStream&&n.remoteVideoStream.hide(),o}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(61),o=r(i),a=n(49),s=n(67),c=n(152);t["default"]={stopStats:function(){this.stats&&this.stats.stop(),this.statsNew&&this.statsNew.stop(),this.dataRtc&&this.dataRtc.stop(),this.dataStats&&this.dataStats.stop()},initStats:function(){var e=this;this.stats=new s.RtcStats({controller:this,interval:2e3}),this.stats.on("stats",function(t){e.monitorRemoteStream(t),e.uploadDataRtc(t)}),this.statsNew=new s.RtcStatsNew({controller:this,interval:1e3}),this.statsNew.on("stats",function(t){e.uploadDataRtcNew(t)}),this.dataRtc=(0,c.DataRtc)({appkey:this.info.appKey}),this.dataStats=(0,c.DataStats)({appkey:this.info.appKey})},startStats:function(){this.statsNew.start({controller:this}),this.uploadDataStatsStart()},uploadDataRtcStart:function(){this.info.appKey&&o["default"].STATS_FUN[o["default"].CURRENT.SDK_TYPE]&&this.dataRtc&&this.dataRtc.start({info:this.info,controller:this,imInfo:this.imInfo,sessionConfig:this.sessionConfig,videoConfig:this.imInfo.videoConfig,uid:this.imInfo.uid})},uploadDataRtcStop:function(){o["default"].STATS_RTC[o["default"].CURRENT.SDK_TYPE]&&this.dataRtc&&this.dataRtc.stop()},uploadDataRtcOnce:function(e){if(o["default"].STATS_RTC[o["default"].CURRENT.SDK_TYPE]&&this.dataRtc){var t=a.constantTool.getVideoSessionConfig({quality:this.sessionConfig.videoQuality,frameRate:this.sessionConfig.videoFrameRate});this.dataRtc.updateOnce({info:this.info,imInfo:e,sessionConfig:this.sessionConfig,videoConfig:t})}},uploadDataRtc:function(e,t){if(o["default"].STATS_RTC[o["default"].CURRENT.SDK_TYPE]&&this.info.appKey&&this.dataRtc)return"volume"===e?void this.dataRtc.updateLocalVolumn(t):void this.dataRtc.update(e,t)},uploadDataStatsStart:function(){o["default"].STATS_RTC[o["default"].CURRENT.SDK_TYPE]&&this.dataStats&&this.dataStats.start({info:this.info,cid:this.imInfo.cid,uid:this.imInfo.uid})},uploadDataRtcNewStop:function(){o["default"].STATS_RTC[o["default"].CURRENT.SDK_TYPE]&&this.dataStats&&this.dataStats.stop()},uploadDataRtcNew:function(e){o["default"].STATS_RTC[o["default"].CURRENT.SDK_TYPE]&&this.dataStats&&this.dataStats.update(e)}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(17),s=r(a),c=n(16),d=r(c),u=n(67);n(332);var l=n(20),p=function(e){function t(n){(0,o["default"])(this,t);var r=(0,s["default"])(this,e.call(this));return r.logger=n.logger,r.imInfo=n.imInfo,r.sessionConfig=n.sessionConfig,r.controller=n.controller,r.targetUid=n.targetUid||r.imInfo.uid,r.init(),r.isProgress=!1,r}return(0,d["default"])(t,e),t}(l);t["default"]=p;var f=p.prototype;f.resetStatus=function(){this.sdpOffer=null,this.sdpAnswer=null,this.iceOffer=[],this.iceAnswer=[],this.offerCount=0},f.setProgress=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isProgress=e,e===!1&&"completed"===this.rtcConnection.iceConnectionState&&this.emit("ready")},f.init=function(){var e=this;if(this.resetStatus(),!this.rtcConnection){var t=/Firefox/gi.test(navigator.userAgent),n={iceServers:[{url:"stun:turn.ideasip.com"}]},r=this.rtcConnection=new RTCPeerConnection(n);r.uid=this.imInfo.uid,r.targetUid=this.targetUid,r.onicecandidate=this.onIceCandidate.bind(this),r.onnegotiationneeded=this.onNegotiationneeded.bind(this),r.oniceconnectionstatechange=this.onIceStateChange.bind(this),t?r.ontrack=this.onRemoteTrack.bind(this):(r.onaddstream=this.onRemoteStream.bind(this),r.onremovestream=function(t){e.logger.warn("webrtc-rtc::",e.targetUid,"on remove stream:",t.stream)}),window.myRtc=r}},f.doSendIce=function(){if(this.sdpAnswer&&!this.iceCompleted&&0!==this.iceOffer.length){var e=this.iceOffer.shift();this.emit("iceCandidate",{uid:this.targetUid,ice:e}),this.doSendIce()}},f.onIceCandidate=function(e){if(e.candidate){if(/ tcp /gi.test(e.candidate.candidate))return;return this.logger.log("webrtc-rtc::",this.targetUid,"gather candidate",e.candidate.candidate),this.iceOffer.push(e.candidate),void this.offerCount++}this.logger.log("webrtc-rtc::",this.targetUid,"onicecandidate end"),this.doSendIce()},f.onIceStateChange=function(){if(this.rtcConnection){var e=this.rtcConnection.iceConnectionState;"connected"===e&&this.iceCompleted&&this.setProgress(!1),this.emit("icestatechange",{rtc:this,state:this.rtcConnection.iceConnectionState})}},f.onNegotiationneeded=function(e){this.emit("negotiationneeded",e)},f.getReceivers=function(){return this.rtcConnection.getReceivers()},f.getRemoteStreams=function(){return this.rtcConnection.getRemoteStreams()},f.onRemoteStream=function(e){if(this.targetUid!==this.imInfo.uid)return this.logger.log("webrtc-rtc::",this.targetUid,"on remote stream",e),!e.stream||e.stream&&"default"===e.stream.id?this.logger.log("webrtc-rtc::remote stream is default stream, do nothing"):void this.emit("getRemoteStream",{uid:this.targetUid,stream:e.stream})},f.onRemoteTrack=function(e){if(this.targetUid!==this.imInfo.uid){var t=e.streams[0];t&&this.emit("getRemoteStream",{uid:this.targetUid,stream:t,track:e.track})}},f.getIceConnectionState=function(){if(this.rtcConnection)return this.rtcConnection.iceConnectionState},f.checkNegotiation=function(){return!(0===this.oldTracks&&0===this.newTracks)},f.updateStream=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];u.RtcUtil.updateMediaStream({peer:this.rtcConnection,currStream:this.currStream,streams:t}).then(function(t){e.currStream||(e.currStream=t)})},f.removeTrack=function(e){u.RtcUtil.removeTrack({peer:this.rtcConnection,currStream:this.currStream,tracks:e})},f.createAnswer=function(e){var t=this;return this.setProgress(!0),this.rtcConnection.createAnswer().then(function(e){return e.sdp=u.SdpUtil.maybePreferVideoReceiveCodec(e.sdp,{videoRecvCodec:"H264"}),e=u.RtcUtil.formatSdp({offerOrAnswer:e,uid:t.imInfo.uid,cid:t.imInfo.cid,stream:t.currStream,highAudio:t.sessionConfig.highAudio,stero:t.sessionConfig.stero,targetUid:t.targetUid})})["catch"](function(e){t.logger.error("webrtc-rtc::",e)})},f.createOffer=function(){var e=this;return this.setProgress(!0),u.RtcUtil.createOffer(this.rtcConnection).then(function(t){return e.logger.log("\r\nwebrtc-rtc::","---------------netease: activity start----------------\r\n"),e.resetStatus(),t.sdp=u.SdpUtil.maybePreferVideoReceiveCodec(t.sdp,{videoRecvCodec:"H264"}),e.logger.log("webrtc-rtc::this.currentStream",e.currStream&&e.currStream.getTracks()),t=u.RtcUtil.formatSdp({offerOrAnswer:t,uid:e.imInfo.uid,cid:e.imInfo.cid,stream:e.currStream,highAudio:e.sessionConfig.highAudio,stero:e.sessionConfig.stero,targetUid:e.targetUid}),Promise.resolve(t)})["catch"](function(t){return e.logger.error("webrtc-rtc::createOffer",t),Promise.reject(t)})},f.getLocalSdp=function(){return this.rtcConnection.localDescription},f.getRemoteSdp=function(){return this.rtcConnection.remoteDescription},f.checkMediaStatus=function(e,t,n){return u.RtcUtil.checkMediaStatus(e,t,n)},f.logSdp=function(){this.rtcConnection.remoteDescription&&console.log("webrtc-rtc::remoteDescription after set",this.rtcConnection.remoteDescription.sdp),this.rtcConnection.currentRemoteDescription&&console.log("webrtc-rtc::currentRemoteDescription after set",this.rtcConnection.currentRemoteDescription.sdp)},f.setRemoteDescription=function(e,t){var n=this;"offer"===e.type&&this.logger.log("\r\nwebrtc-rtc::","---------------netease: activity start----------------\r\n"),this.setProgress("offer"===e.type),this.logger.log("webrtc-rtc::"+this.targetUid+" get remote sdp "+t+" --> "+e.type+"\n",e.sdp);var r={sdp:e.sdp,type:e.type};if("offer"===e.type&&!this.sdpAnswer)return Promise.reject();r.sdp=u.SdpUtil.maybePreferVideoSendCodec(r.sdp,{videoRecvCodec:"H264"}),r.sdp=u.RtcUtil.formatSdpRemote(r.sdp,this.sdpOffer),u.RtcUtil.parse(r.sdp),this.sdpAnswer="answer"===e.type?r:null;var i=this.rtcConnection;return i.setRemoteDescription(r).then(function(){if("answer"===e.type){if(n.iceCompleted)return void n.emit("iceCompleted");n.doSendIce()}return Promise.resolve()})["catch"](function(e){return console.error("webrtc-rtc::",i.uid," setRemoteDescription error: ",e),Promise.reject(e)})},f.setLocalDescription=function(e,t){var n=this;return this.sdpOffer=e,this.logger.log("webrtc-rtc::"+this.targetUid+" set local sdp "+e.type+"\n",e.sdp),this.rtcConnection.setLocalDescription(e).then(function(){return e.sdp=u.RtcUtil.setMediaBitrates({sdp:e.sdp}),"answer"===e.type?(n.sdpAnswer=e,n.iceCompleted&&n.emit("iceCompleted"),n.setProgress(!1)):n.sdpAnswer=null,Promise.resolve(e)})["catch"](function(t){return n.logger.warn(t),Promise.resolve(e)})},f.addRemoteIceCandidate=function(e){var t=this;this.logger.log("webrtc-rtc::"+this.targetUid+" set remote ICE ",e),this.rtcConnection.addIceCandidate(new RTCIceCandidate(e)).then(function(){t.iceAnswer.push(e),t.iceAnswer.length===t.offerCount&&(t.iceCompleted=!0,t.iceAnswer=[],t.offerCount=0,t.emit("iceCompleted"))})["catch"](function(e){t.logger.warn(e)})},f.close=function(){this.logger.log("webrtc-rtc::close rtc ",this.targetUid,this.rtcConnection),this.rtcConnection&&this.rtcConnection.close(),this.rtcConnection=null},e.exports=t["default"]},,,,function(e,t){"use strict";t.__esModule=!0,t["default"]={pipe:function(){var e=[].concat(Array.prototype.slice.call(arguments));return this._pipe(1===e.length?e[0]:e)},_pipe:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments[1],r=t.shift(),i=n&&n.constructor===Promise?n:Promise.resolve(n);return i.then(function(){return 0===t.length?e._pipeLast(r,n):e._pipeLast(r,n).then(function(n){return e._pipe(t,n)})})},_pipeLast:function(e,t){if(!e||e.constructor!==Function&&e.constructor!==Promise)return Promise.resolve(e);if(e.constructor===Promise)return e;if(e.constructor===Function){var n=e(t);return n&&n.constructor===Promise?n:Promise.resolve(n)}return Promise.resolve(e)}},e.exports=t["default"]},function(e,t,n){e.exports={"default":n(312),__esModule:!0}},function(e,t,n){n(70),n(71),n(72),n(323),n(324),n(325),e.exports=n(11).Promise},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(45),i=n(317),o=n(316),a=n(14),s=n(69),c=n(322),d={},u={},t=e.exports=function(e,t,n,l,p){var f,h,m,v,g=p?function(){return e}:c(e),y=r(n,l,t?2:1),S=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(o(g)){for(f=s(e.length);f>S;S++)if(v=t?y(a(h=e[S])[0],h[1]):y(e[S]),v===d||v===u)return v}else for(m=g.call(e);!(h=m.next()).done;)if(v=i(m,y,h.value,t),v===d||v===u)return v};t.BREAK=d,t.RETURN=u},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var r=n(26),i=n(3)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||o[i]===e)}},function(e,t,n){var r=n(14);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(o){var a=e["return"];throw void 0!==a&&r(a.call(e)),o}}},function(e,t,n){var r=n(3)("iterator"),i=!1;try{var o=[7][r]();o["return"]=function(){i=!0},Array.from(o,function(){throw 2})}catch(a){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:n=!0}},o[r]=function(){return a},e(o)}catch(s){}return n}},function(e,t,n){var r=n(2),i=n(190).set,o=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,c="process"==n(41)(a);e.exports=function(){var e,t,n,d=function(){var r,i;for(c&&(r=a.domain)&&r.exit();e;){i=e.fn,e=e.next;try{i()}catch(o){throw e?n():t=void 0,o}}t=void 0,r&&r.enter()};if(c)n=function(){a.nextTick(d)};else if(!o||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var u=s.resolve();n=function(){u.then(d)}}else n=function(){i.call(r,d)};else{var l=!0,p=document.createTextNode("");new o(d).observe(p,{characterData:!0}),n=function(){p.data=l=!l}}return function(r){var i={fn:r,next:void 0};t&&(t.next=i),e||(e=i,n()),t=i}}},function(e,t,n){var r=n(9);e.exports=function(e,t,n){for(var i in t)n&&e[i]?e[i]=t[i]:r(e,i,t[i]);return e}},function(e,t,n){"use strict";var r=n(2),i=n(11),o=n(10),a=n(8),s=n(3)("species");e.exports=function(e){var t="function"==typeof i[e]?i[e]:r[e];a&&t&&!t[s]&&o.f(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(186),i=n(3)("iterator"),o=n(26);e.exports=n(11).getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){"use strict";var r,i,o,a,s=n(29),c=n(2),d=n(45),u=n(186),l=n(18),p=n(12),f=n(56),h=n(313),m=n(314),v=n(189),g=n(190).set,y=n(319)(),S=n(150),b=n(187),C=n(188),_="Promise",T=c.TypeError,w=c.process,R=c[_],E="process"==u(w),O=function(){},P=i=S.f,k=!!function(){try{var e=R.resolve(1),t=(e.constructor={})[n(3)("species")]=function(e){e(O,O)};return(E||"function"==typeof PromiseRejectionEvent)&&e.then(O)instanceof t}catch(r){}}(),A=function(e){var t;return!(!p(e)||"function"!=typeof(t=e.then))&&t},I=function(e,t){if(!e._n){e._n=!0;var n=e._c;y(function(){for(var r=e._v,i=1==e._s,o=0,a=function(t){var n,o,a=i?t.ok:t.fail,s=t.resolve,c=t.reject,d=t.domain;try{a?(i||(2==e._h&&D(e),e._h=1),a===!0?n=r:(d&&d.enter(),n=a(r),d&&d.exit()),n===t.promise?c(T("Promise-chain cycle")):(o=A(n))?o.call(n,s,c):s(n)):c(r)}catch(u){c(u)}};n.length>o;)a(n[o++]);e._c=[],e._n=!1,t&&!e._h&&M(e)})}},M=function(e){g.call(c,function(){var t,n,r,i=e._v,o=x(e);if(o&&(t=b(function(){E?w.emit("unhandledRejection",i,e):(n=c.onunhandledrejection)?n({promise:e,reason:i}):(r=c.console)&&r.error&&r.error("Unhandled promise rejection",i)}),e._h=E||x(e)?2:1),e._a=void 0,o&&t.e)throw t.v})},x=function(e){return 1!==e._h&&0===(e._a||e._c).length},D=function(e){g.call(c,function(){var t;E?w.emit("rejectionHandled",e):(t=c.onrejectionhandled)&&t({promise:e,reason:e._v})})},L=function(e){var t=this;t._d||(t._d=!0,t=t._w||t,t._v=e,t._s=2,t._a||(t._a=t._c.slice()),I(t,!0))},j=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw T("Promise can't be resolved itself");(t=A(e))?y(function(){var r={_w:n,_d:!1};try{t.call(e,d(j,r,1),d(L,r,1))}catch(i){L.call(r,i)}}):(n._v=e,n._s=1,I(n,!1))}catch(r){L.call({_w:n,_d:!1},r)}}};k||(R=function(e){h(this,R,_,"_h"),f(e),r.call(this);try{e(d(j,this,1),d(L,this,1))}catch(t){L.call(this,t)}},r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},r.prototype=n(320)(R.prototype,{then:function(e,t){var n=P(v(this,R));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=E?w.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&I(this,!1),n.promise},"catch":function(e){return this.then(void 0,e)}}),o=function(){var e=new r;this.promise=e,this.resolve=d(j,e,1),this.reject=d(L,e,1)},S.f=P=function(e){return e===R||e===a?new o(e):i(e)}),l(l.G+l.W+l.F*!k,{Promise:R}),n(30)(R,_),n(321)(_),a=n(11)[_],l(l.S+l.F*!k,_,{reject:function(e){var t=P(this),n=t.reject;return n(e),t.promise}}),l(l.S+l.F*(s||!k),_,{resolve:function(e){return C(s&&this===a?R:this,e)}}),l(l.S+l.F*!(k&&n(318)(function(e){R.all(e)["catch"](O)})),_,{all:function(e){var t=this,n=P(t),r=n.resolve,i=n.reject,o=b(function(){var n=[],o=0,a=1;m(e,!1,function(e){var s=o++,c=!1;n.push(void 0),a++,t.resolve(e).then(function(e){c||(c=!0,n[s]=e,--a||r(n))},i)}),--a||r(n)});return o.e&&i(o.v),n.promise},race:function(e){var t=this,n=P(t),r=n.reject,i=b(function(){m(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},function(e,t,n){"use strict";var r=n(18),i=n(11),o=n(2),a=n(189),s=n(188);r(r.P+r.R,"Promise",{"finally":function(e){var t=a(this,i.Promise||o.Promise),n="function"==typeof e;return this.then(n?function(n){return s(t,e()).then(function(){return n})}:e,n?function(n){return s(t,e()).then(function(){throw n})}:e)}})},function(e,t,n){"use strict";var r=n(18),i=n(150),o=n(187);r(r.S,"Promise",{"try":function(e){var t=i.f(this),n=o(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(327),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(a){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,a=Object.create(o.prototype),s=new f(r||[]);return a._invoke=d(e,n,s),a}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(r){return{type:"throw",arg:r}}}function i(){}function o(){}function a(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,i,o,a){var s=r(e[n],e,i);if("throw"!==s.type){var c=s.arg,d=c.value;return d&&"object"==typeof d&&y.call(d,"__await")?Promise.resolve(d.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(d).then(function(e){c.value=e,o(c)},a)}a(s.arg)}function n(e,n){function r(){return new Promise(function(r,i){t(e,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function d(e,t,n){var i=R;return function(o,a){if(i===O)throw new Error("Generator is already running");if(i===P){if("throw"===o)throw a;return m()}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=u(s,n);if(c){if(c===k)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===R)throw i=P,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=O;var d=r(e,t,n);if("normal"===d.type){if(i=n.done?P:E,d.arg===k)continue;return{value:d.arg,done:n.done}}"throw"===d.type&&(i=P,n.method="throw",n.arg=d.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,"throw"===t.method){if(e.iterator["return"]&&(t.method="return",t.arg=v,u(e,t),"throw"===t.method))return k;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var i=r(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,k;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=v),t.delegate=null,k):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,k)}function l(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function p(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(l,this),this.reset(!0)}function h(e){if(e){var t=e[b];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function i(){for(;++n<e.length;)if(y.call(e,n))return i.value=e[n],i.done=!1,i;return i.value=v,i.done=!0,i};return r.next=r}}return{next:m}}function m(){return{value:v,done:!0}}var v,g=Object.prototype,y=g.hasOwnProperty,S="function"==typeof Symbol?Symbol:{},b=S.iterator||"@@iterator",C=S.asyncIterator||"@@asyncIterator",_=S.toStringTag||"@@toStringTag",T="object"==typeof e,w=t.regeneratorRuntime;if(w)return void(T&&(e.exports=w));w=t.regeneratorRuntime=T?e.exports:{},w.wrap=n;var R="suspendedStart",E="suspendedYield",O="executing",P="completed",k={},A={};A[b]=function(){return this};var I=Object.getPrototypeOf,M=I&&I(I(h([])));M&&M!==g&&y.call(M,b)&&(A=M);var x=a.prototype=i.prototype=Object.create(A);o.prototype=x.constructor=a,a.constructor=o,a[_]=o.displayName="GeneratorFunction",w.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},w.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,_ in e||(e[_]="GeneratorFunction")),e.prototype=Object.create(x),e},w.awrap=function(e){return{__await:e}},s(c.prototype),c.prototype[C]=function(){return this},w.AsyncIterator=c,w.async=function(e,t,r,i){var o=new c(n(e,t,r,i));return w.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},s(x),x[_]="Generator",x[b]=function(){return this},x.toString=function(){return"[object Generator]"},w.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},w.values=h,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(p),!e)for(var t in this)"t"===t.charAt(0)&&y.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=v),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=y.call(i,"catchLoc"),s=y.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,k):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),k},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),p(n),k}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;p(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:h(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=v),k}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";function r(e,t,n,r,i){var o=d.writeRtpDescription(e.kind,t);if(o+=d.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=d.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":i||"active"),o+="a=mid:"+e.mid+"\r\n",o+=e.rtpSender&&e.rtpReceiver?"a=sendrecv\r\n":e.rtpSender?"a=sendonly\r\n":e.rtpReceiver?"a=recvonly\r\n":"a=inactive\r\n",e.rtpSender){var a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var s="msid:"+(r?r.id:"-")+" "+a+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+d.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+d.localCName+"\r\n"),o}function i(e,t){var n=!1;return e=JSON.parse(JSON.stringify(e)),e.filter(function(e){
  if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter(function(e){var r=0===e.indexOf("turn:")&&e.indexOf("transport=udp")!==-1&&e.indexOf("turn:[")===-1&&!n;return r?(n=!0,!0):0===e.indexOf("stun:")&&t>=14393&&e.indexOf("?transport=udp")===-1}),delete e.url,e.urls=i?r[0]:r,!!r.length}})}function o(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]},i=function(e,t,n,i){var o=r(e.parameters.apt,n),a=r(t.parameters.apt,i);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach(function(r){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(r.name.toLowerCase()===a.name.toLowerCase()&&r.clockRate===a.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&a.parameters.apt&&!i(r,a,e.codecs,t.codecs))continue;a=JSON.parse(JSON.stringify(a)),a.numChannels=Math.min(r.numChannels,a.numChannels),n.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter(function(e){for(var t=0;t<r.rtcpFeedback.length;t++)if(r.rtcpFeedback[t].type===e.type&&r.rtcpFeedback[t].parameter===e.parameter)return!0;return!1});break}}}),e.headerExtensions.forEach(function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}}),n}function a(e,t,n){return{offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(n)!==-1}function s(e,t){var n=e.getRemoteCandidates().find(function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type});return n||e.addRemoteCandidate(t),!n}function c(e,t){var n=new Error(t);return n.name=e,n.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],n}var d=n(197);e.exports=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function u(t,n){n.removeTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}function l(t,n,r,i){var o=new Event("track");o.track=n,o.receiver=r,o.transceiver={receiver:r},o.streams=i,e.setTimeout(function(){t._dispatchEvent("track",o)})}var p=function(n){var r=this,o=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){r[e]=o[e].bind(o)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this.localDescription=null,this.remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw c("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=i(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=d.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};p.prototype.onicecandidate=null,p.prototype.onaddstream=null,p.prototype.ontrack=null,p.prototype.onremovestream=null,p.prototype.onsignalingstatechange=null,p.prototype.oniceconnectionstatechange=null,p.prototype.onconnectionstatechange=null,p.prototype.onicegatheringstatechange=null,p.prototype.onnegotiationneeded=null,p.prototype.ondatachannel=null,p.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},p.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},p.prototype.getConfiguration=function(){return this._config},p.prototype.getLocalStreams=function(){return this.localStreams},p.prototype.getRemoteStreams=function(){return this.remoteStreams},p.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 i=this._createIceAndDtlsTransports();r.iceTransport=i.iceTransport,r.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(r),r},p.prototype.addTrack=function(t,n){if(this._isClosed)throw c("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r=this.transceivers.find(function(e){return e.track===t});if(r)throw c("InvalidAccessError","Track already exists.");for(var i,o=0;o<this.transceivers.length;o++)this.transceivers[o].track||this.transceivers[o].kind!==t.kind||(i=this.transceivers[o]);return i||(i=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),this.localStreams.indexOf(n)===-1&&this.localStreams.push(n),i.track=t,i.stream=n,i.rtpSender=new e.RTCRtpSender(t,i.dtlsTransport),i.rtpSender},p.prototype.addStream=function(e){var n=this;if(t>=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)})}},p.prototype.removeTrack=function(t){if(this._isClosed)throw c("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 c("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null;var i=this.transceivers.map(function(e){return e.stream});i.indexOf(r)===-1&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},p.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)})},p.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},p.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},p.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 i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"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;i.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},p.prototype._gather=function(t,n){var r=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:n};var a=e.candidate,s=!a||0===Object.keys(a).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),a.component=1,a.ufrag=i.getLocalParameters().usernameFragment;var c=d.writeCandidate(a);o.candidate=Object.assign(o.candidate,d.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var u=d.getMediaSections(r.localDescription.sdp);s?u[o.candidate.sdpMLineIndex]+="a=end-of-candidates\r\n":u[o.candidate.sdpMLineIndex]+="a="+o.candidate.candidate+"\r\n",r.localDescription.sdp=d.getDescription(r.localDescription.sdp)+u.join("");var l=r.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),s||r._dispatchEvent("icecandidate",o),l&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout(function(){o.forEach(function(e){i.onlocalcandidate(e)})},0)}},p.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}},p.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)},p.prototype._transceive=function(e,n,r){var i=o(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:d.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),r&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach(function(e){delete e.rtx}),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},p.prototype.setLocalDescription=function(e){var t=this;if(["offer","answer"].indexOf(e.type)===-1)return Promise.reject(c("TypeError",'Unsupported type "'+e.type+'"'));if(!a("setLocalDescription",e.type,t.signalingState)||t._isClosed)return Promise.reject(c("InvalidStateError","Can not set local "+e.type+" in state "+t.signalingState));var n,r;if("offer"===e.type)n=d.splitSections(e.sdp),r=n.shift(),n.forEach(function(e,n){var r=d.parseRtpParameters(e);t.transceivers[n].localCapabilities=r}),t.transceivers.forEach(function(e,n){t._gather(e.mid,n)});else if("answer"===e.type){n=d.splitSections(t.remoteDescription.sdp),r=n.shift();var i=d.matchPrefix(r,"a=ice-lite").length>0;n.forEach(function(e,n){var a=t.transceivers[n],s=a.iceGatherer,c=a.iceTransport,u=a.dtlsTransport,l=a.localCapabilities,p=a.remoteCapabilities,f=d.isRejected(e)&&0===d.matchPrefix(e,"a=bundle-only").length;if(!f&&!a.rejected){var h=d.getIceParameters(e,r),m=d.getDtlsParameters(e,r);i&&(m.role="server"),t.usingBundle&&0!==n||(t._gather(a.mid,n),"new"===c.state&&c.start(s,h,i?"controlling":"controlled"),"new"===u.state&&u.start(m));var v=o(l,p);t._transceive(a,v.codecs.length>0,!1)}})}return t.localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?t._updateSignalingState("have-local-offer"):t._updateSignalingState("stable"),Promise.resolve()},p.prototype.setRemoteDescription=function(r){var i=this;if(["offer","answer"].indexOf(r.type)===-1)return Promise.reject(c("TypeError",'Unsupported type "'+r.type+'"'));if(!a("setRemoteDescription",r.type,i.signalingState)||i._isClosed)return Promise.reject(c("InvalidStateError","Can not set remote "+r.type+" in state "+i.signalingState));var o={};i.remoteStreams.forEach(function(e){o[e.id]=e});var p=[],f=d.splitSections(r.sdp),h=f.shift(),m=d.matchPrefix(h,"a=ice-lite").length>0,v=d.matchPrefix(h,"a=group:BUNDLE ").length>0;i.usingBundle=v;var g=d.matchPrefix(h,"a=ice-options:")[0];return g?i.canTrickleIceCandidates=g.substr(14).split(" ").indexOf("trickle")>=0:i.canTrickleIceCandidates=!1,f.forEach(function(a,c){var l=d.splitLines(a),f=d.getKind(a),g=d.isRejected(a)&&0===d.matchPrefix(a,"a=bundle-only").length,y=l[0].substr(2).split(" ")[2],S=d.getDirection(a,h),b=d.parseMsid(a),C=d.getMid(a)||d.generateIdentifier();if("application"===f&&"DTLS/SCTP"===y||g)return void(i.transceivers[c]={mid:C,kind:f,rejected:!0});!g&&i.transceivers[c]&&i.transceivers[c].rejected&&(i.transceivers[c]=i._createTransceiver(f,!0));var _,T,w,R,E,O,P,k,A,I,M,x=d.parseRtpParameters(a);g||(I=d.getIceParameters(a,h),M=d.getDtlsParameters(a,h),M.role="client"),P=d.parseRtpEncodingParameters(a);var D=d.parseRtcpParameters(a),L=d.matchPrefix(a,"a=end-of-candidates",h).length>0,j=d.matchPrefix(a,"a=candidate:").map(function(e){return d.parseCandidate(e)}).filter(function(e){return 1===e.component});if(("offer"===r.type||"answer"===r.type)&&!g&&v&&c>0&&i.transceivers[c]&&(i._disposeIceAndDtlsTransports(c),i.transceivers[c].iceGatherer=i.transceivers[0].iceGatherer,i.transceivers[c].iceTransport=i.transceivers[0].iceTransport,i.transceivers[c].dtlsTransport=i.transceivers[0].dtlsTransport,i.transceivers[c].rtpSender&&i.transceivers[c].rtpSender.setTransport(i.transceivers[0].dtlsTransport),i.transceivers[c].rtpReceiver&&i.transceivers[c].rtpReceiver.setTransport(i.transceivers[0].dtlsTransport)),"offer"!==r.type||g)"answer"!==r.type||g||(_=i.transceivers[c],T=_.iceGatherer,w=_.iceTransport,R=_.dtlsTransport,E=_.rtpReceiver,O=_.sendEncodingParameters,k=_.localCapabilities,i.transceivers[c].recvEncodingParameters=P,i.transceivers[c].remoteCapabilities=x,i.transceivers[c].rtcpParameters=D,j.length&&"new"===w.state&&(!m&&!L||v&&0!==c?j.forEach(function(e){s(_.iceTransport,e)}):w.setRemoteCandidates(j)),v&&0!==c||("new"===w.state&&w.start(T,I,"controlling"),"new"===R.state&&R.start(M)),i._transceive(_,"sendrecv"===S||"recvonly"===S,"sendrecv"===S||"sendonly"===S),!E||"sendrecv"!==S&&"sendonly"!==S?delete _.rtpReceiver:(A=E.track,b?(o[b.stream]||(o[b.stream]=new e.MediaStream),n(A,o[b.stream]),p.push([A,E,o[b.stream]])):(o["default"]||(o["default"]=new e.MediaStream),n(A,o["default"]),p.push([A,E,o["default"]]))));else{_=i.transceivers[c]||i._createTransceiver(f),_.mid=C,_.iceGatherer||(_.iceGatherer=i._createIceGatherer(c,v)),j.length&&"new"===_.iceTransport.state&&(!L||v&&0!==c?j.forEach(function(e){s(_.iceTransport,e)}):_.iceTransport.setRemoteCandidates(j)),k=e.RTCRtpReceiver.getCapabilities(f),t<15019&&(k.codecs=k.codecs.filter(function(e){return"rtx"!==e.name})),O=_.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var N=!1;if("sendrecv"===S||"sendonly"===S){if(N=!_.rtpReceiver,E=_.rtpReceiver||new e.RTCRtpReceiver(_.dtlsTransport,f),N){var U;A=E.track,b&&"-"===b.stream||(b?(o[b.stream]||(o[b.stream]=new e.MediaStream,Object.defineProperty(o[b.stream],"id",{get:function(){return b.stream}})),Object.defineProperty(A,"id",{get:function(){return b.track}}),U=o[b.stream]):(o["default"]||(o["default"]=new e.MediaStream),U=o["default"])),U&&(n(A,U),_.associatedRemoteMediaStreams.push(U)),p.push([A,E,U])}}else _.rtpReceiver&&_.rtpReceiver.track&&(_.associatedRemoteMediaStreams.forEach(function(e){var t=e.getTracks().find(function(e){return e.id===_.rtpReceiver.track.id});t&&u(t,e)}),_.associatedRemoteMediaStreams=[]);_.localCapabilities=k,_.remoteCapabilities=x,_.rtpReceiver=E,_.rtcpParameters=D,_.sendEncodingParameters=O,_.recvEncodingParameters=P,i._transceive(i.transceivers[c],!1,N)}}),void 0===i._dtlsRole&&(i._dtlsRole="offer"===r.type?"active":"passive"),i.remoteDescription={type:r.type,sdp:r.sdp},"offer"===r.type?i._updateSignalingState("have-remote-offer"):i._updateSignalingState("stable"),Object.keys(o).forEach(function(t){var n=o[t];if(n.getTracks().length){if(i.remoteStreams.indexOf(n)===-1){i.remoteStreams.push(n);var r=new Event("addstream");r.stream=n,e.setTimeout(function(){i._dispatchEvent("addstream",r)})}p.forEach(function(e){var t=e[0],r=e[1];n.id===e[2].id&&l(i,t,r,[n])})}}),p.forEach(function(e){e[2]||l(i,e[0],e[1],[])}),e.setTimeout(function(){i&&i.transceivers&&i.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()},p.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")},p.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},p.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&this.needNegotiation!==!0&&(this.needNegotiation=!0,e.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}},0))},p.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){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)}},p.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){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)}},p.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(c("InvalidStateError","Can not call createOffer after close"));var i=n.transceivers.filter(function(e){return"audio"===e.kind}).length,o=n.transceivers.filter(function(e){return"video"===e.kind}).length,a=arguments[0];if(a){if(a.mandatory||a.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==a.offerToReceiveAudio&&(i=a.offerToReceiveAudio===!0?1:a.offerToReceiveAudio===!1?0:a.offerToReceiveAudio),void 0!==a.offerToReceiveVideo&&(o=a.offerToReceiveVideo===!0?1:a.offerToReceiveVideo===!1?0:a.offerToReceiveVideo)}for(n.transceivers.forEach(function(e){"audio"===e.kind?(i--,i<0&&(e.wantReceive=!1)):"video"===e.kind&&(o--,o<0&&(e.wantReceive=!1))});i>0||o>0;)i>0&&(n._createTransceiver("audio"),i--),o>0&&(n._createTransceiver("video"),o--);var s=d.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach(function(r,i){var o=r.track,a=r.kind,s=r.mid||d.generateIdentifier();r.mid=s,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.usingBundle));var c=e.RTCRtpSender.getCapabilities(a);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"),r.remoteCapabilities&&r.remoteCapabilities.codecs&&r.remoteCapabilities.codecs.forEach(function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)})}),c.headerExtensions.forEach(function(e){var t=r.remoteCapabilities&&r.remoteCapabilities.headerExtensions||[];t.forEach(function(t){e.uri===t.uri&&(e.id=t.id)})});var u=r.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,a)),r.localCapabilities=c,r.sendEncodingParameters=u}),"max-compat"!==n._config.bundlePolicy&&(s+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),s+="a=ice-options:trickle\r\n",n.transceivers.forEach(function(e,t){s+=r(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),s+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,s+="a="+d.writeCandidate(e)+"\r\n"}),"completed"===e.iceGatherer.state&&(s+="a=end-of-candidates\r\n"))});var u=new e.RTCSessionDescription({type:"offer",sdp:s});return Promise.resolve(u)},p.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(c("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(c("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var i=d.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(i+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n");var a=d.getMediaSections(n.remoteDescription.sdp).length;n.transceivers.forEach(function(e,s){if(!(s+1>a)){if(e.rejected)return"application"===e.kind?i+="m=application 0 DTLS/SCTP 5000\r\n":"audio"===e.kind?i+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(i+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(i+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");if(e.stream){var c;"audio"===e.kind?c=e.stream.getAudioTracks()[0]:"video"===e.kind&&(c=e.stream.getVideoTracks()[0]),c&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1})}var d=o(e.localCapabilities,e.remoteCapabilities),u=d.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length;!u&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,i+=r(e,d,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(i+="a=rtcp-rsize\r\n")}});var s=new e.RTCSessionDescription({type:"answer",sdp:i});return Promise.resolve(s)},p.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(r,i){if(!n.remoteDescription)return i(c("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var a=0;a<n.transceivers.length;a++)if(n.transceivers[a].mid===e.sdpMid){o=a;break}var u=n.transceivers[o];if(!u)return i(c("OperationError","Can not add ICE candidate"));if(u.rejected)return r();var l=Object.keys(e.candidate).length>0?d.parseCandidate(e.candidate):{};if("tcp"===l.protocol&&(0===l.port||9===l.port))return r();if(l.component&&1!==l.component)return r();if((0===o||o>0&&u.iceTransport!==n.transceivers[0].iceTransport)&&!s(u.iceTransport,l))return i(c("OperationError","Can not add ICE candidate"));var p=e.candidate.trim();0===p.indexOf("a=")&&(p=p.substr(2)),t=d.getMediaSections(n.remoteDescription.sdp),t[o]+="a="+(l.type?p:"end-of-candidates")+"\r\n",n.remoteDescription.sdp=d.getDescription(n.remoteDescription.sdp)+t.join("")}else for(var f=0;f<n.transceivers.length&&(n.transceivers[f].rejected||(n.transceivers[f].iceTransport.addRemoteCandidate({}),t=d.getMediaSections(n.remoteDescription.sdp),t[f]+="a=end-of-candidates\r\n",n.remoteDescription.sdp=d.getDescription(n.remoteDescription.sdp)+t.join(""),!n.usingBundle));f++);r()})},p.prototype.getStats=function(){var e=[];this.transceivers.forEach(function(t){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(n){t[n]&&e.push(t[n].getStats())})});var t=function(e){return{inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};return new Promise(function(n){var r=new Map;Promise.all(e).then(function(e){e.forEach(function(e){Object.keys(e).forEach(function(n){e[n].type=t(e[n]),r.set(n,e[n])})}),n(r)})})};var f=["createOffer","createAnswer"];return f.forEach(function(e){var t=p.prototype[e];p.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then(function(t){"function"==typeof e[0]&&e[0].apply(null,[t])},function(t){"function"==typeof e[1]&&e[1].apply(null,[t])}):t.apply(this,arguments)}}),f=["setLocalDescription","setRemoteDescription","addIceCandidate"],f.forEach(function(e){var t=p.prototype[e];p.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)},function(t){"function"==typeof e[2]&&e[2].apply(null,[t])}):t.apply(this,arguments)}}),["getStats"].forEach(function(e){var t=p.prototype[e];p.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)}):t.apply(this,arguments)}}),p}},function(e,t,n){var r=n(330),i=n(331);t.write=i,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,n){var r=function(e){return String(Number(e))===e?Number(e):e},i=function(e,t,n,i){if(i&&!n)t[i]=r(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(t[n[o]]=r(e[o+1]))},o=function(e,t,n){var r=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:r&&!t[e.name]&&(t[e.name]={});var o=e.push?{}:r?t[e.name]:t;i(n.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},a=n(196),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},n=[],r=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach(function(e){var t=e[0],i=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),r=n[n.length-1]);for(var s=0;s<(a[t]||[]).length;s+=1){var c=a[t][s];if(c.reg.test(i))return o(c,r,i)}}),t.media=n,t};var c=function(e,t){var n=t.split(/=(.+)/,2);return 2===n.length&&(e[n[0]]=r(n[1])),e};t.parseParams=function(e){return e.split(/\;\s?/).reduce(c,{})},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),i=0;i<n.length;i+=3)t.push({component:n[i],ip:n[i+1],port:n[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(c,{})})},t.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var t,n=!1;return"~"!==e[0]?t=r(e):(t=r(e.substring(1,e.length)),n=!0),{scid:t,paused:n}})})}},function(e,t,n){var r=n(196),i=/%[sdv%]/g,o=function(e){var t=1,n=arguments,r=n.length;return e.replace(i,function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}})},a=function(e,t,n){var r=t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format,i=[e+"="+r];if(t.names)for(var a=0;a<t.names.length;a+=1){var s=t.names[a];t.name?i.push(n[t.name][s]):i.push(n[t.names[a]])}else i.push(n[t.name]);return o.apply(null,i)},s=["v","o","s","i","u","e","p","c","b","t","r","z","a"],c=["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||s,i=t.innerOrder||c,o=[];return n.forEach(function(t){r[t].forEach(function(n){n.name in e&&null!=e[n.name]?o.push(a(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach(function(e){o.push(a(t,n,e))})})}),e.media.forEach(function(e){o.push(a("m",r.m[0],e)),i.forEach(function(t){r[t].forEach(function(n){n.name in e&&null!=e[n.name]?o.push(a(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach(function(e){o.push(a(t,n,e))})})})}),o.join("\r\n")+"\r\n"}},function(e,t,n){(function(t){"use strict";var r=n(333);e.exports=r({window:t.window})}).call(t,function(){return this}())},function(e,t,n){"use strict";var r=n(73);e.exports=function(e,t){var i=e&&e.window,o={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0};for(var a in t)hasOwnProperty.call(t,a)&&(o[a]=t[a]);var s=r.log,c=r.detectBrowser(i),d={browserDetails:c,extractVersion:r.extractVersion,disableLog:r.disableLog,disableWarnings:r.disableWarnings},u=n(334)||null,l=n(337)||null,p=n(339)||null,f=n(341)||null,h=n(336)||null;switch(c.browser){case"chrome":if(!u||!u.shimPeerConnection||!o.shimChrome)return s("Chrome shim is not included in this adapter release."),d;s("adapter.js shimming chrome."),d.browserShim=u,h.shimCreateObjectURL(i),u.shimGetUserMedia(i),u.shimMediaStream(i),u.shimSourceObject(i),u.shimPeerConnection(i),u.shimOnTrack(i),u.shimAddTrackRemoveTrack(i),u.shimGetSendersWithDtmf(i),h.shimRTCIceCandidate(i);break;case"firefox":if(!p||!p.shimPeerConnection||!o.shimFirefox)return s("Firefox shim is not included in this adapter release."),d;s("adapter.js shimming firefox."),d.browserShim=p,h.shimCreateObjectURL(i),p.shimGetUserMedia(i),p.shimSourceObject(i),p.shimPeerConnection(i),p.shimOnTrack(i),p.shimRemoveStream(i),h.shimRTCIceCandidate(i);break;case"edge":if(!l||!l.shimPeerConnection||!o.shimEdge)return s("MS edge shim is not included in this adapter release."),d;s("adapter.js shimming edge."),d.browserShim=l,h.shimCreateObjectURL(i),l.shimGetUserMedia(i),l.shimPeerConnection(i),l.shimReplaceTrack(i);break;case"safari":if(!f||!o.shimSafari)return s("Safari shim is not included in this adapter release."),d;s("adapter.js shimming safari."),d.browserShim=f,h.shimCreateObjectURL(i),f.shimRTCIceServerUrls(i),f.shimCallbacksAPI(i),f.shimLocalStreamsAPI(i),f.shimRemoteStreamsAPI(i),f.shimTrackEventTransceiver(i),f.shimGetUserMedia(i),f.shimCreateOfferLegacy(i),h.shimRTCIceCandidate(i);break;default:s("Unsupported browser!")}return d}},function(e,t,n){"use strict";var r=n(73),i=r.log,o={shimMediaStream:function(e){e.MediaStream=e.MediaStream||e.webkitMediaStream},shimOnTrack:function(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e);
  }});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var n=this;return n._ontrackpoly||(n._ontrackpoly=function(t){t.stream.addEventListener("addtrack",function(r){var i;i=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find(function(e){return e.track&&e.track.id===r.track.id}):{track:r.track};var o=new Event("track");o.track=r.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],n.dispatchEvent(o)}),t.stream.getTracks().forEach(function(r){var i;i=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find(function(e){return e.track&&e.track.id===r.id}):{track:r};var o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],n.dispatchEvent(o)})},n.addEventListener("addstream",n._ontrackpoly)),t.apply(n,arguments)}}},shimGetSendersWithDtmf:function(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var i=this,o=n.apply(i,arguments);return o||(o=t(i,e),i._senders.push(o)),o};var r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;r.apply(t,arguments);var n=t._senders.indexOf(e);n!==-1&&t._senders.splice(n,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;n._senders=n._senders||[],i.apply(n,[e]),e.getTracks().forEach(function(e){n._senders.push(t(n,e))})};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;t._senders=t._senders||[],o.apply(t,[e]),e.getTracks().forEach(function(e){var n=t._senders.find(function(t){return t.track===e});n&&t._senders.splice(t._senders.indexOf(n),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(e,[]);return t.forEach(function(t){t._pc=e}),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}},shimSourceObject:function(e){var t=e&&e.URL;"object"==typeof 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;return 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)}),void e.addEventListener("removetrack",function(){n.src&&t.revokeObjectURL(n.src),n.src=t.createObjectURL(e)})):void(this.src="")}}))},shimAddTrackRemoveTrack:function(e){function t(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(t){var r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function n(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(t){var r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}var i=r.detectBrowser(e);if(!(e.RTCPeerConnection.prototype.addTrack&&i.version>=64)){var o=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=o.apply(this);return e._reverseStreams=e._reverseStreams||{},t.map(function(t){return e._reverseStreams[t.id]})};var a=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){var t=n.getSenders().find(function(t){return t.track===e});if(t)throw new DOMException("Track already exists.","InvalidAccessError")}),!n._reverseStreams[t.id]){var r=new e.MediaStream(t.getTracks());n._streams[t.id]=r,n._reverseStreams[r.id]=t,t=r}a.apply(n,[t])};var s=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;t._streams=t._streams||{},t._reverseStreams=t._reverseStreams||{},s.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 i=[].slice.call(arguments,1);if(1!==i.length||!i[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");var o=r.getSenders().find(function(e){return e.track===t});if(o)throw new DOMException("Track already exists.","InvalidAccessError");r._streams=r._streams||{},r._reverseStreams=r._reverseStreams||{};var a=r._streams[n.id];if(a)a.addTrack(t),Promise.resolve().then(function(){r.dispatchEvent(new Event("negotiationneeded"))});else{var s=new e.MediaStream([t]);r._streams[n.id]=s,r._reverseStreams[s.id]=n,r.addStream(s)}return r.getSenders().find(function(e){return e.track===t})},["createOffer","createAnswer"].forEach(function(n){var r=e.RTCPeerConnection.prototype[n];e.RTCPeerConnection.prototype[n]=function(){var e=this,n=arguments,i=arguments.length&&"function"==typeof arguments[0];return i?r.apply(e,[function(r){var i=t(e,r);n[0].apply(null,[i])},function(e){n[1]&&n[1].apply(null,e)},arguments[2]]):r.apply(e,arguments).then(function(n){return t(e,n)})}});var c=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this;return arguments.length&&arguments[0].type?(arguments[0]=n(e,arguments[0]),c.apply(e,arguments)):c.apply(e,arguments)};var d=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=this,n=d.get.apply(this);return""===n.type?n:t(e,n)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;if("closed"===t.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");var n=e._pc===t;if(!n)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");t._streams=t._streams||{};var r;Object.keys(t._streams).forEach(function(n){var i=t._streams[n].getTracks().find(function(t){return e.track===t});i&&(r=t._streams[n])}),r&&(1===r.getTracks().length?t.removeStream(t._reverseStreams[r.id]):r.removeTrack(e.track),t.dispatchEvent(new Event("negotiationneeded")))}}},shimPeerConnection:function(e){var t=r.detectBrowser(e);if(e.RTCPeerConnection){var n=e.RTCPeerConnection;e.RTCPeerConnection=function(e,t){if(e&&e.iceServers){for(var i=[],o=0;o<e.iceServers.length;o++){var a=e.iceServers[o];!a.hasOwnProperty("urls")&&a.hasOwnProperty("url")?(r.deprecated("RTCIceServer.url","RTCIceServer.urls"),a=JSON.parse(JSON.stringify(a)),a.urls=a.url,i.push(a)):i.push(e.iceServers[o])}e.iceServers=i}return new n(e,t)},e.RTCPeerConnection.prototype=n.prototype,Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return n.generateCertificate}})}else 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}});var o=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(e,t,n){var r=this,i=arguments;if(arguments.length>0&&"function"==typeof e)return o.apply(this,arguments);if(0===o.length&&(0===arguments.length||"function"!=typeof arguments[0]))return o.apply(this,[]);var a=function(e){var t={},n=e.result();return n.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){var c=function(e){i[1](s(a(e)))};return o.apply(this,[c,arguments[0]])}return new Promise(function(e,t){o.apply(r,[function(t){e(s(a(t)))},t])}).then(t,n)},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,i){n.apply(t,[e[0],r,i])});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"==typeof arguments[0]){var t=1===arguments.length?arguments[0]:void 0;return new Promise(function(r,i){n.apply(e,[r,i,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())}}};e.exports={shimMediaStream:o.shimMediaStream,shimOnTrack:o.shimOnTrack,shimAddTrackRemoveTrack:o.shimAddTrackRemoveTrack,shimGetSendersWithDtmf:o.shimGetSendersWithDtmf,shimSourceObject:o.shimSourceObject,shimPeerConnection:o.shimPeerConnection,shimGetUserMedia:n(335)}},function(e,t,n){"use strict";var r=n(73),i=r.log;e.exports=function(e){var t=r.detectBrowser(e),n=e&&e.navigator,o=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var o={};"number"==typeof r.ideal?(o[i("min",n)]=r.ideal,t.optional.push(o),o={},o[i("max",n)]=r.ideal,t.optional.push(o)):(o[i("",n)]=r.ideal,t.optional.push(o))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},a=function(e,r){if(t.version>=61)return r(e);if(e=JSON.parse(JSON.stringify(e)),e&&"object"==typeof e.audio){var a=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),a(e.audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=o(e.audio)}if(e&&"object"==typeof e.video){var s=e.video.facingMode;s=s&&("object"==typeof s?s:{ideal:s});var c=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||c)){delete e.video.facingMode;var d;if("environment"===s.exact||"environment"===s.ideal?d=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(d=["front"]),d)return n.mediaDevices.enumerateDevices().then(function(t){t=t.filter(function(e){return"videoinput"===e.kind});var n=t.find(function(e){return d.some(function(t){return e.label.toLowerCase().indexOf(t)!==-1})});return!n&&t.length&&d.indexOf("back")!==-1&&(n=t[t.length-1]),n&&(e.video.deviceId=s.exact?{exact:n.deviceId}:{ideal:n.deviceId}),e.video=o(e.video),i("chrome: "+JSON.stringify(e)),r(e)})}e.video=o(e.video)}return i("chrome: "+JSON.stringify(e)),r(e)},s=function(e){return{name:{PermissionDeniedError:"NotAllowedError",InvalidStateError:"NotReadableError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotReadableError",MediaDeviceKillSwitchOn:"NotReadableError"}[e.name]||e.name,message:e.message,constraint:e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},c=function(e,t,r){a(e,function(e){n.webkitGetUserMedia(e,t,function(e){r&&r(s(e))})})};n.getUserMedia=c;var d=function(e){return new Promise(function(t,r){n.getUserMedia(e,t,r)})};if(n.mediaDevices||(n.mediaDevices={getUserMedia:d,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 u=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return a(e,function(e){return u(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(s(e))})})}}else n.mediaDevices.getUserMedia=function(e){return d(e)};"undefined"==typeof n.mediaDevices.addEventListener&&(n.mediaDevices.addEventListener=function(){i("Dummy mediaDevices.addEventListener called.")}),"undefined"==typeof n.mediaDevices.removeEventListener&&(n.mediaDevices.removeEventListener=function(){i("Dummy mediaDevices.removeEventListener called.")})}},function(e,t,n){"use strict";function r(e,t,n){if(e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);var o=function(e){r(n(e))};return this._eventMap=this._eventMap||{},this._eventMap[r]=o,i.apply(this,[e,o])};var o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[n])return o.apply(this,arguments);var r=this._eventMap[n];return delete this._eventMap[n],o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)}})}}var i=n(197),o=n(73);e.exports={shimRTCIceCandidate:function(e){if(!(e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){"object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&(e=JSON.parse(JSON.stringify(e)),e.candidate=e.candidate.substr(2));var n=new t(e),r=i.parseCandidate(e.candidate),o=Object.assign(n,r);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o},r(e,"icecandidate",function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t})}},shimCreateObjectURL:function(e){var t=e&&e.URL;if("object"==typeof e&&e.HTMLMediaElement&&"srcObject"in e.HTMLMediaElement.prototype&&t.createObjectURL&&t.revokeObjectURL){var n=t.createObjectURL.bind(t),r=t.revokeObjectURL.bind(t),i=new Map,a=0;t.createObjectURL=function(e){if("getTracks"in e){var t="polyblob:"+ ++a;return i.set(t,e),o.deprecated("URL.createObjectURL(stream)","elem.srcObject = stream"),t}return n(e)},t.revokeObjectURL=function(e){r(e),i["delete"](e)};var s=Object.getOwnPropertyDescriptor(e.HTMLMediaElement.prototype,"src");Object.defineProperty(e.HTMLMediaElement.prototype,"src",{get:function(){return s.get.apply(this)},set:function(e){return this.srcObject=i.get(e)||null,s.set.apply(this,[e])}});var c=e.HTMLMediaElement.prototype.setAttribute;e.HTMLMediaElement.prototype.setAttribute=function(){return 2===arguments.length&&"src"===(""+arguments[0]).toLowerCase()&&(this.srcObject=i.get(arguments[1])||null),c.apply(this,arguments)}}}}},function(e,t,n){"use strict";var r=n(73),i=n(328);e.exports={shimGetUserMedia:n(338),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.RTCPeerConnection=i(e,t.version)},shimReplaceTrack:function(e){!e.RTCRtpSender||"replaceTrack"in e.RTCRtpSender.prototype||(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}}},function(e,t){"use strict";e.exports=function(e){var t=e&&e.navigator,n=function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}},r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e)["catch"](function(e){return Promise.reject(n(e))})}}},function(e,t,n){"use strict";var r=n(73),i={shimOnTrack:function(e){"object"!=typeof e||!e.RTCPeerConnection||"ontrack"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&(this.removeEventListener("track",this._ontrack),this.removeEventListener("addstream",this._ontrackpoly)),this.addEventListener("track",this._ontrack=e),this.addEventListener("addstream",this._ontrackpoly=function(e){e.stream.getTracks().forEach(function(t){var n=new Event("track");n.track=t,n.receiver={track:t},n.transceiver={receiver:n.receiver},n.streams=[e.stream],this.dispatchEvent(n)}.bind(this))}.bind(this))}}),"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},shimSourceObject:function(e){"object"==typeof e&&(!e.HTMLMediaElement||"srcObject"in e.HTMLMediaElement.prototype||Object.defineProperty(e.HTMLMediaElement.prototype,"srcObject",{get:function(){return this.mozSrcObject},set:function(e){this.mozSrcObject=e}}))},shimPeerConnection:function(e){var t=r.detectBrowser(e);if("object"==typeof e&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){e.RTCPeerConnection||(e.RTCPeerConnection=function(n,r){if(t.version<38&&n&&n.iceServers){for(var i=[],o=0;o<n.iceServers.length;o++){var a=n.iceServers[o];if(a.hasOwnProperty("urls"))for(var s=0;s<a.urls.length;s++){var c={url:a.urls[s]};0===a.urls[s].indexOf("turn")&&(c.username=a.username,c.credential=a.credential),i.push(c)}else i.push(n.iceServers[o])}n.iceServers=i}return new e.mozRTCPeerConnection(n,r)},e.RTCPeerConnection.prototype=e.mozRTCPeerConnection.prototype,e.mozRTCPeerConnection.generateCertificate&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return e.mozRTCPeerConnection.generateCertificate}}),e.RTCSessionDescription=e.mozRTCSessionDescription,e.RTCIceCandidate=e.mozRTCIceCandidate),["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 n=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())};var i=function(e){var t=new Map;return Object.keys(e).forEach(function(n){t.set(n,e[n]),t[n]=e[n]}),t},o={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},a=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(e,n,r){return a.apply(this,[e||null]).then(function(e){if(t.version<48&&(e=i(e)),t.version<53&&!n)try{e.forEach(function(e){e.type=o[e.type]||e.type})}catch(r){if("TypeError"!==r.name)throw r;e.forEach(function(t,n){e.set(n,Object.assign({},t,{type:o[t.type]||t.type}))})}return e}).then(n,r)}}},shimRemoveStream:function(e){!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;r.deprecated("removeStream","removeTrack"),this.getSenders().forEach(function(n){n.track&&e.getTracks().indexOf(n.track)!==-1&&t.removeTrack(n)})})}};e.exports={shimOnTrack:i.shimOnTrack,shimSourceObject:i.shimSourceObject,shimPeerConnection:i.shimPeerConnection,shimRemoveStream:i.shimRemoveStream,shimGetUserMedia:n(340)}},function(e,t,n){"use strict";var r=n(73),i=r.log;e.exports=function(e){var t=r.detectBrowser(e),n=e&&e.navigator,o=e&&e.MediaStreamTrack,a=function(e){return{name:{InternalError:"NotReadableError",NotSupportedError:"TypeError",PermissionDeniedError:"NotAllowedError",SecurityError:"NotAllowedError"}[e.name]||e.name,message:{"The operation is insecure.":"The request is not allowed by the user agent or the platform in the current context."}[e.message]||e.message,constraint:e.constraint,toString:function(){return this.name+(this.message&&": ")+this.message}}},s=function(e,r,o){var s=function(e){if("object"!=typeof e||e.require)return e;var t=[];return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r=e[n]="object"==typeof e[n]?e[n]:{ideal:e[n]};if(void 0===r.min&&void 0===r.max&&void 0===r.exact||t.push(n),void 0!==r.exact&&("number"==typeof r.exact?r.min=r.max=r.exact:e[n]=r.exact,delete r.exact),void 0!==r.ideal){e.advanced=e.advanced||[];var i={};"number"==typeof r.ideal?i[n]={min:r.ideal,max:r.ideal}:i[n]=r.ideal,e.advanced.push(i),delete r.ideal,Object.keys(r).length||delete e[n]}}}),t.length&&(e.require=t),e};return e=JSON.parse(JSON.stringify(e)),t.version<38&&(i("spec: "+JSON.stringify(e)),e.audio&&(e.audio=s(e.audio)),e.video&&(e.video=s(e.video)),i("ff37: "+JSON.stringify(e))),n.mozGetUserMedia(e,r,function(e){o(a(e))})},c=function(e){return new Promise(function(t,n){s(e,t,n)})};if(n.mediaDevices||(n.mediaDevices={getUserMedia:c,addEventListener:function(){},removeEventListener:function(){}}),n.mediaDevices.enumerateDevices=n.mediaDevices.enumerateDevices||function(){return new Promise(function(e){var t=[{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}];e(t)})},t.version<41){var d=n.mediaDevices.enumerateDevices.bind(n.mediaDevices);n.mediaDevices.enumerateDevices=function(){return d().then(void 0,function(e){if("NotFoundError"===e.name)return[];throw e})}}if(t.version<49){var u=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return u(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("The object can not be found here.","NotFoundError");return t},function(e){return Promise.reject(a(e))})}}if(!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var l=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},p=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(e){return"object"==typeof e&&"object"==typeof e.audio&&(e=JSON.parse(JSON.stringify(e)),l(e.audio,"autoGainControl","mozAutoGainControl"),l(e.audio,"noiseSuppression","mozNoiseSuppression")),p(e)},o&&o.prototype.getSettings){var f=o.prototype.getSettings;o.prototype.getSettings=function(){var e=f.apply(this,arguments);return l(e,"mozAutoGainControl","autoGainControl"),l(e,"mozNoiseSuppression","noiseSuppression"),e}}if(o&&o.prototype.applyConstraints){var h=o.prototype.applyConstraints;o.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==typeof e&&(e=JSON.parse(JSON.stringify(e)),l(e,"autoGainControl","mozAutoGainControl"),l(e,"noiseSuppression","mozNoiseSuppression")),h.apply(this,[e])}}}n.getUserMedia=function(e,i,o){return t.version<44?s(e,i,o):(r.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),void n.mediaDevices.getUserMedia(e).then(i,o))}}},function(e,t,n){"use strict";var r=n(73),i={shimLocalStreamsAPI:function(e){if("object"==typeof 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=[]),this._localStreams.indexOf(e)===-1&&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?this._localStreams.indexOf(n)===-1&&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(t!==-1){this._localStreams.splice(t,1);var n=this,r=e.getTracks();this.getSenders().forEach(function(e){r.indexOf(e.track)!==-1&&n.removeTrack(e)})}})}},shimRemoteStreamsAPI:function(e){"object"==typeof 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.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){var t=e.streams[0];if(this._remoteStreams||(this._remoteStreams=[]),!(this._remoteStreams.indexOf(t)>=0)){this._remoteStreams.push(t);var n=new Event("addstream");n.stream=e.streams[0],this.dispatchEvent(n)}}.bind(this))}}))},shimCallbacksAPI:function(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};var s=function(e,t,n){var r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){var r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){var r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}},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 i=[],o=0;o<e.iceServers.length;o++){var a=e.iceServers[o];!a.hasOwnProperty("urls")&&a.hasOwnProperty("url")?(r.deprecated("RTCIceServer.url","RTCIceServer.urls"),a=JSON.parse(JSON.stringify(a)),a.urls=a.url,delete a.url,i.push(a)):i.push(e.iceServers[o])}e.iceServers=i}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in e.RTCPeerConnection&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})},shimTrackEventTransceiver:function(e){"object"==typeof e&&e.RTCPeerConnection&&"receiver"in e.RTCTrackEvent.prototype&&!e.RTCTransceiver&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},shimCreateOfferLegacy:function(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){var n=this;if(e){var r=n.getTransceivers().find(function(e){return e.sender.track&&"audio"===e.sender.track.kind});e.offerToReceiveAudio===!1&&r?"sendrecv"===r.direction?r.setDirection("sendonly"):"recvonly"===r.direction&&r.setDirection("inactive"):e.offerToReceiveAudio!==!0||r||n.addTransceiver("audio");var i=n.getTransceivers().find(function(e){return e.sender.track&&"video"===e.sender.track.kind});e.offerToReceiveVideo===!1&&i?"sendrecv"===i.direction?i.setDirection("sendonly"):"recvonly"===i.direction&&i.setDirection("inactive"):e.offerToReceiveVideo!==!0||i||n.addTransceiver("video")}return t.apply(n,arguments)}}};e.exports={shimCallbacksAPI:i.shimCallbacksAPI,shimLocalStreamsAPI:i.shimLocalStreamsAPI,shimRemoteStreamsAPI:i.shimRemoteStreamsAPI,shimGetUserMedia:i.shimGetUserMedia,shimRTCIceServerUrls:i.shimRTCIceServerUrls,shimTrackEventTransceiver:i.shimTrackEventTransceiver,shimCreateOfferLegacy:i.shimCreateOfferLegacy}},,,,,,,,,,,,,,,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(7),o=r(i),a=n(17),s=r(a),c=n(16),d=r(c),u=n(61),l=r(u),p=n(49),f=n(145),h=r(f),m=n(300),v=r(m),g=n(299),y=r(g),S=n(298),b=r(S),C=n(297),_=r(C),T=n(360),w=r(T);l["default"].CURRENT.SDK_TYPE=l["default"].SDK_TYPE.WEBRTC;var R=function(e){function t(n){(0,o["default"])(this,t);var r=(0,s["default"])(this,e.call(this,n));return r.initWR(),r}return(0,d["default"])(t,e),t.prototype.initWR=function(){this.nim||this.logger.error("webrtc-client::initWR: 请传入nim实例"),this.initProtocol(),this.initController(),
  this.devices={hasAudio:!1,hasVideo:!1}},t.prototype.destroy=function(){var e=this;this.controller.destroy(),this.resetStatus(),this.nim=null,this.controller=null,Object.keys(this).map(function(t){e[t]=null,delete e[t]})},t.prototype.resetWhenHangup=function(){this.controller.stopSession(),this.resetStatus()},t.prototype.initSignal=function(){return Promise.resolve()},t.prototype.initProtocol=function(){var e=this.nim;e.on("beCalled",this.onBeCalled.bind(this)),e.on("notifyCalleeAck",this.onCalleeAck.bind(this)),e.on("notifyHangup",this.onHangup.bind(this)),e.on("netcallControl",this.onControl.bind(this)),e.on("notifyCalleeAckSync",this.onCalleeAckSync.bind(this)),e.on("notifyJoin",this.onNotifyJoin.bind(this))},t.prototype.initController=function(){var e=this;window.myContrl=this.controller=new v["default"]({appKey:this.nim&&this.nim.options.appKey,logger:this.logger,container:this.container,remoteContainer:this.remoteContainer,client:this}),this.controller.on("sessionConnected",function(t){e.emit("sessionConnected",t)}),this.controller.on("signalClosed",function(t){e.emit("signalClosed",t)}),this.controller.on("userJoined",this.onUserJoin.bind(this)),this.controller.on("deviceStatus",function(t){e.emit("deviceStatus",t)}),this.controller.on("deviceAdd",function(t){e.emit("deviceAdd",t)}),this.controller.on("deviceRemove",function(t){e.emit("deviceRemove",t)}),this.controller.on("devices",function(t){e.emit("devices",t)}),this.controller.on("statistics",function(t){e.emit("statistics",t)}),this.controller.on("signalClosed",function(t){e.emit("signalClosed",t)}),this.controller.on("remoteSignalClosed",function(t){e.emit("remoteSignalClosed",{uid:t,account:e.getAccountWithUid(t)})}),this.controller.on("leaveChannel",this.onUserLeft.bind(this)),this.controller.on("remoteTrack",function(t){e.emit("remoteTrack",{uid:t.uid,track:t.track,type:t.track.kind,account:e.getAccountWithUid(t.uid)})}),this.controller.on("remoteStreamUpdate",function(t){t.account=e.getAccountWithUid(t.uid),e.emit("remoteStreamUpdate",t)}),this.controller.on("audioVolume",function(t){e.emit("audioVolume",t)})},t.prototype.call=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.calling)return Promise.reject({type:"statusNotMatch",error:"呼叫失败: 当前正在通话中"});var t=e.account,n=e.type,r=e.pushConfig,i=e.sessionConfig;if(this.calling=!0,this.isCaller=!0,this.callee=t,this.target.account=t,this.setSessionConfig(i),this.setSessionConfig({signalStartTime:Date.now()}),this.controller.uploadDataApi("update",{key:"p2p"}),i.highAudio&&this.controller.uploadDataApi("update",{key:"hd_audio"}),void 0!==i.videoFrameRate&&this.controller.uploadDataApi("update",{key:"fps",ext:0===+i.videoFrameRate?0:+i.videoFrameRate+1}),void 0!==i.videoQuality){var o=+i.videoQuality;o===p.constantRtc.CHAT_VIDEO_QUALITY_540P?o=p.constantRtc.CHAT_VIDEO_QUALITY_720P:o===p.constantRtc.CHAT_VIDEO_QUALITY_720P&&(o=p.constantRtc.CHAT_VIDEO_QUALITY_540P),this.controller.uploadDataApi("update",{key:"video_quality",ext:o||0})}return this.initNetcall({type:n,pushConfig:r})},t.prototype.initNetcall=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.type,r=t.pushConfig;return this.type=n,this.setSessionConfig({signalStartTime:Date.now()}),this.nim.initNetcall({type:n,accounts:[this.callee],pushConfig:r,webrtcEnable:!0}).then(function(t){e.signalInited=!0,e.sessionMode="p2p",e.logger.log("webrtc-client::initNetcall:",t),e.callerInfo=t,e.channelId=t.channelId,e.imInfo=e.callerInfo,e.imInfo.sessionMode=e.sessionMode,e.imInfo.role=0})["catch"](function(t){return e.setSessionConfig({signalEndTime:Date.now()}),e.controller.uploadDataRtcOnce({code:t.code}),e.resetWhenHangup(),Promise.reject(t)})},t.prototype.response=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.sessionConfig,n=void 0===t?{}:t;if(this.controller.uploadDataApi("update",{key:"p2p"}),n.highAudio&&this.controller.uploadDataApi("update",{key:"hd_audio"}),void 0!==n.videoFrameRate&&this.controller.uploadDataApi("update",{key:"fps",ext:0===+n.videoFrameRate?0:+n.videoFrameRate+1}),void 0!==n.videoQuality){var r=+n.videoQuality;r===p.constantRtc.CHAT_VIDEO_QUALITY_540P?r=p.constantRtc.CHAT_VIDEO_QUALITY_720P:r===p.constantRtc.CHAT_VIDEO_QUALITY_720P&&(r=p.constantRtc.CHAT_VIDEO_QUALITY_540P),this.controller.uploadDataApi("update",{key:"video_quality",ext:r||0})}return e.fn="calleeAck",this.baseResponse(e)},t.prototype.control=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.fn="netcallControl",this.baseControl(e)},t.prototype.hangup=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.fn="hangup",e.recordType="cancelNetcallBeforeAccept",this.baseHangup(e)},t.prototype.onBeCalled=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.signalInited=!0,this.channelId=e.channelId,this.beCalledInfo=e,this.logger.log("beCalling",e),this.emit("beCalling",e)},t.prototype.setNetcallSession=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.calling?Promise.reject({type:"statusNotMatch",error:"开启会话失败: 当前正在通话中"}):(this.signalInited=!0,this.calling=!0,this.channelId=e.channelId,this.type=e.netcallType,this.imInfo=e,this.imInfo.serverAddrs=e.rtcServerMap,this.imInfo.rtcUrls=e.rtcServerMap,this.beCalledInfo=this.imInfo,this.imInfo.sessionConfig&&this.setSessionConfig(this.imInfo.sessionConfig),this.parseAccountUidMap(e.accountUidMap),Promise.resolve())},t.prototype.startSession=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.wssArr&&(this.imInfo.serverAddrs=e.wssArr.constructor===Array?e.wssArr:[e.wssArr]),this.baseStartSession(),this.controller.uploadDataApi("start",{uid:this.imInfo.uid}),this.controller.startSession(this.imInfo)},t.prototype.startRtc=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.startSession(e)},t.prototype.stopSession=function(){return this.controller.stopSession()},t}(h["default"]),E=R.prototype;E=Object.assign(E,y["default"]),E=Object.assign(E,b["default"]),E=Object.assign(E,_["default"]),E=Object.assign(E,w["default"]),t["default"]=R,e.exports=t["default"]},,function(e,t,n){"use strict";t.__esModule=!0;var r=n(49),i=n(40);t["default"]={createChannel:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i.tool.verifyOptions(t,"channelName"),t.custom=t.custom||"",t.webrtcEnable=!0,this.controller.uploadDataApi("update",{key:"meeting"}),this.setSessionConfig({signalStartTime:Date.now()}),this.baseCreateChannel("createChannel",t).then(function(e){return Promise.resolve(e)})["catch"](function(t){return e.setSessionConfig({signalEndTime:Date.now()}),e.controller.uploadDataRtcOnce({code:t.code}),Promise.reject(t)})},joinChannel:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.signalInited)return Promise.reject("已经加入房间");i.tool.verifyOptions(t,"channelName type");var n=t.sessionConfig,o=void 0===n?{}:n;if(o.liveEnable=t.liveEnable||o.liveEnable,i.tool.merge(this,{sessionConfig:o}),this.setSessionConfig(o),this.setSessionConfig({signalStartTime:Date.now()}),this.controller.uploadDataApi("update",{key:"meeting"}),t.liveEnable&&this.controller.uploadDataApi("update",{key:"bypass",ext:void 0!==o.splitMode?+o.splitMode+1:0}),o.highAudio&&this.controller.uploadDataApi("update",{key:"hd_audio"}),void 0!==o.videoFrameRate&&this.controller.uploadDataApi("update",{key:"fps",ext:0===+o.videoFrameRate?0:+o.videoFrameRate+1}),void 0!==o.videoQuality){var a=+o.videoQuality;a===r.constantRtc.CHAT_VIDEO_QUALITY_540P?a=r.constantRtc.CHAT_VIDEO_QUALITY_720P:a===r.constantRtc.CHAT_VIDEO_QUALITY_720P&&(a=r.constantRtc.CHAT_VIDEO_QUALITY_540P),this.controller.uploadDataApi("update",{key:"video_quality",ext:a||0})}return this.baseJoinChannel("joinChannel",{channelName:t.channelName,liveEnable:t.liveEnable}).then(function(n){return console.log("joinChannel",n),e.type=n.type=t.type,n.account=e.nim.account,e.imInfo=n,e.imInfo.role=void 0===t.role?0:t.role,e.channelId=n.channelId,e.controller.uploadDataApi("start",{uid:n.uid}),Promise.resolve({uid:n.uid,account:e.nim.account,type:n.type,custom:n.custom})})["catch"](function(t){return e.controller.uploadDataRtcOnce({code:t.code}),Promise.reject(t)})},leaveChannel:function(){return this.signalInited&&this.sessionMode?"meeting"!==this.sessionMode?Promise.reject({code:"not in a meeting"}):(this.controller.uploadDataApi("send"),this.controller.hangup(),this.resetStatus(),Promise.resolve()):Promise.reject({code:"noConnection"})}},e.exports=t["default"]}])});