(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["vendors~business~home"],{

/***/ "./node_modules/dayjs/locale/zh-cn.js":
/*!********************************************!*\
  !*** ./node_modules/dayjs/locale/zh-cn.js ***!
  \********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

!function(e,_){ true?module.exports=_(__webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js")):undefined}(this,(function(e){"use strict";function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=_(e),d={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(e,_){return"W"===_?e+"周":e+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(e,_){var t=100*e+_;return t<600?"凌晨":t<900?"早上":t<1100?"上午":t<1300?"中午":t<1800?"下午":"晚上"}};return t.default.locale(d,null,!0),d}));

/***/ }),

/***/ "./node_modules/dayjs/plugin/weekday.js":
/*!**********************************************!*\
  !*** ./node_modules/dayjs/plugin/weekday.js ***!
  \**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

!function(e,t){ true?module.exports=t():undefined}(this,(function(){"use strict";return function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,i=this.$W,n=(i<t?i+7:i)-t;return this.$utils().u(e)?n:this.subtract(n,"day").add(e,"day")}}}));

/***/ }),

/***/ "./node_modules/nanoid/index.browser.js":
/*!**********************************************!*\
  !*** ./node_modules/nanoid/index.browser.js ***!
  \**********************************************/
/*! exports provided: urlAlphabet, random, customRandom, customAlphabet, nanoid */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return random; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "customRandom", function() { return customRandom; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "customAlphabet", function() { return customAlphabet; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nanoid", function() { return nanoid; });
/* harmony import */ var _url_alphabet_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./url-alphabet/index.js */ "./node_modules/nanoid/url-alphabet/index.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "urlAlphabet", function() { return _url_alphabet_index_js__WEBPACK_IMPORTED_MODULE_0__["urlAlphabet"]; });


let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))
let customRandom = (alphabet, defaultSize, getRandom) => {
  let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
  let step = -~((1.6 * mask * defaultSize) / alphabet.length)
  return (size = defaultSize) => {
    let id = ''
    while (true) {
      let bytes = getRandom(step)
      let j = step
      while (j--) {
        id += alphabet[bytes[j] & mask] || ''
        if (id.length === size) return id
      }
    }
  }
}
let customAlphabet = (alphabet, size = 21) =>
  customRandom(alphabet, size, random)
let nanoid = (size = 21) =>
  crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
    byte &= 63
    if (byte < 36) {
      id += byte.toString(36)
    } else if (byte < 62) {
      id += (byte - 26).toString(36).toUpperCase()
    } else if (byte > 62) {
      id += '-'
    } else {
      id += '_'
    }
    return id
  }, '')


/***/ }),

/***/ "./node_modules/nanoid/url-alphabet/index.js":
/*!***************************************************!*\
  !*** ./node_modules/nanoid/url-alphabet/index.js ***!
  \***************************************************/
/*! exports provided: urlAlphabet */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "urlAlphabet", function() { return urlAlphabet; });
const urlAlphabet =
  'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'


/***/ }),

/***/ "./node_modules/screenfull/index.js":
/*!******************************************!*\
  !*** ./node_modules/screenfull/index.js ***!
  \******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* eslint-disable promise/prefer-await-to-then */

const methodMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
// New WebKit
['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],
// Old WebKit
['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
const nativeAPI = (() => {
  if (typeof document === 'undefined') {
    return false;
  }
  const unprefixedMethods = methodMap[0];
  const returnValue = {};
  for (const methodList of methodMap) {
    const exitFullscreenMethod = methodList === null || methodList === void 0 ? void 0 : methodList[1];
    if (exitFullscreenMethod in document) {
      for (const [index, method] of methodList.entries()) {
        returnValue[unprefixedMethods[index]] = method;
      }
      return returnValue;
    }
  }
  return false;
})();
const eventNameMap = {
  change: nativeAPI.fullscreenchange,
  error: nativeAPI.fullscreenerror
};

// eslint-disable-next-line import/no-mutable-exports
let screenfull = {
  // eslint-disable-next-line default-param-last
  request(element = document.documentElement, options) {
    return new Promise((resolve, reject) => {
      const onFullScreenEntered = () => {
        screenfull.off('change', onFullScreenEntered);
        resolve();
      };
      screenfull.on('change', onFullScreenEntered);
      const returnPromise = element[nativeAPI.requestFullscreen](options);
      if (returnPromise instanceof Promise) {
        returnPromise.then(onFullScreenEntered).catch(reject);
      }
    });
  },
  exit() {
    return new Promise((resolve, reject) => {
      if (!screenfull.isFullscreen) {
        resolve();
        return;
      }
      const onFullScreenExit = () => {
        screenfull.off('change', onFullScreenExit);
        resolve();
      };
      screenfull.on('change', onFullScreenExit);
      const returnPromise = document[nativeAPI.exitFullscreen]();
      if (returnPromise instanceof Promise) {
        returnPromise.then(onFullScreenExit).catch(reject);
      }
    });
  },
  toggle(element, options) {
    return screenfull.isFullscreen ? screenfull.exit() : screenfull.request(element, options);
  },
  onchange(callback) {
    screenfull.on('change', callback);
  },
  onerror(callback) {
    screenfull.on('error', callback);
  },
  on(event, callback) {
    const eventName = eventNameMap[event];
    if (eventName) {
      document.addEventListener(eventName, callback, false);
    }
  },
  off(event, callback) {
    const eventName = eventNameMap[event];
    if (eventName) {
      document.removeEventListener(eventName, callback, false);
    }
  },
  raw: nativeAPI
};
Object.defineProperties(screenfull, {
  isFullscreen: {
    get: () => Boolean(document[nativeAPI.fullscreenElement])
  },
  element: {
    enumerable: true,
    get: () => {
      var _document$nativeAPI$f;
      return (_document$nativeAPI$f = document[nativeAPI.fullscreenElement]) !== null && _document$nativeAPI$f !== void 0 ? _document$nativeAPI$f : undefined;
    }
  },
  isEnabled: {
    enumerable: true,
    // Coerce to boolean in case of old WebKit.
    get: () => Boolean(document[nativeAPI.fullscreenEnabled])
  }
});
if (!nativeAPI) {
  screenfull = {
    isEnabled: false
  };
}
/* harmony default export */ __webpack_exports__["default"] = (screenfull);

/***/ }),

/***/ "./node_modules/trtc-js-sdk/trtc.js":
/*!******************************************!*\
  !*** ./node_modules/trtc-js-sdk/trtc.js ***!
  \******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(global) {!function(e,t){ true?module.exports=t():undefined}(this,(function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){u(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(){n=function(){return e};var e={},t=Object.prototype,i=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(R){c=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var r=t&&t.prototype instanceof h?t:h,a=Object.create(r.prototype),o=new T(i||[]);return a._invoke=function(e,t,n){var i="suspendedStart";return function(r,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw a;return E()}for(n.method=r,n.arg=a;;){var o=n.delegate;if(o){var s=b(o,n);if(s){if(s===l)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var c=d(e,t,n);if("normal"===c.type){if(i=n.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i="completed",n.method="throw",n.arg=c.arg)}}}(e,n,o),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(R){return{type:"throw",arg:R}}}e.wrap=u;var l={};function h(){}function p(){}function f(){}var m={};c(m,a,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(w([])));v&&v!==t&&i.call(v,a)&&(m=v);var g=f.prototype=h.prototype=Object.create(m);function y(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(r,a,o,s){var c=d(e[r],e,a);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==typeof l&&i.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(l).then((function(e){u.value=e,o(u)}),(function(e){return n("throw",e,o,s)}))}s(c.arg)}var r;this._invoke=function(e,i){function a(){return new t((function(t,r){n(e,i,t,r)}))}return r=r?r.then(a,a):a()}}function b(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var i=d(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var r=i.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function k(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 I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function w(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(i.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:E}}function E(){return{value:void 0,done:!0}}return p.prototype=f,c(g,"constructor",f),c(f,"constructor",p),p.displayName=c(f,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},y(S.prototype),c(S.prototype,o,(function(){return this})),e.AsyncIterator=S,e.async=function(t,n,i,r,a){void 0===a&&(a=Promise);var o=new S(u(t,n,i,r),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},y(g),c(g,s,"Generator"),c(g,a,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=w,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return o.type="throw",o.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.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&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,l):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),l},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),I(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;I(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function r(e,t,n,i,r,a,o){try{var s=e[a](o),c=s.value}catch(u){return void n(u)}s.done?t(c):Promise.resolve(c).then(i,r)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,c,"next",e)}function c(e){r(o,i,a,s,c,"throw",e)}s(void 0)}))}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function c(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function f(e,t,n){return f=p()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&h(r,n.prototype),r},f.apply(null,arguments)}function m(e){var t="function"==typeof Map?new Map:void 0;return m=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return f(e,arguments,l(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),h(i,e)},m(e)}function _(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function v(e){var t=p();return function(){var n,i=l(e);if(t){var r=l(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return _(this,n)}}function g(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}function y(){return y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=g(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},y.apply(this,arguments)}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var i,r,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(c){s=!0,r=c}finally{try{o||null==n.return||n.return()}finally{if(s)throw r}}return a}(e,t)||k(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){return function(e){if(Array.isArray(e))return I(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||k(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){if(e){if("string"==typeof e)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(e,t):void 0}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function T(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=k(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function w(e,t,n,i,r){var a={};return Object.keys(i).forEach((function(e){a[e]=i[e]})),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce((function(n,i){return i(e,t,n)||n}),a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}var E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},R=function(e){return e&&e.Math==Math&&e},C=R("object"==typeof globalThis&&globalThis)||R("object"==typeof window&&window)||R("object"==typeof self&&self)||R("object"==typeof E&&E)||function(){return this}()||Function("return this")(),A={},x=function(e){try{return!!e()}catch(t){return!0}},P=!x((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),D=!x((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),O=D,M=Function.prototype.call,N=O?M.bind(M):function(){return M.apply(M,arguments)},L={},U={}.propertyIsEnumerable,V=Object.getOwnPropertyDescriptor,j=V&&!U.call({1:2},1);L.f=j?function(e){var t=V(this,e);return!!t&&t.enumerable}:U;var F,B,H=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},W=D,G=Function.prototype,z=G.call,J=W&&G.bind.bind(z,z),q=function(e){return W?J(e):function(){return z.apply(e,arguments)}},K=q,Q=K({}.toString),X=K("".slice),Y=function(e){return X(Q(e),8,-1)},$=Y,Z=q,ee=function(e){if("Function"===$(e))return Z(e)},te=x,ne=Y,ie=Object,re=ee("".split),ae=te((function(){return!ie("z").propertyIsEnumerable(0)}))?function(e){return"String"==ne(e)?re(e,""):ie(e)}:ie,oe=function(e){return null==e},se=oe,ce=TypeError,ue=function(e){if(se(e))throw ce("Can't call method on "+e);return e},de=ae,le=ue,he=function(e){return de(le(e))},pe="object"==typeof document&&document.all,fe={all:pe,IS_HTMLDDA:void 0===pe&&void 0!==pe},me=fe.all,_e=fe.IS_HTMLDDA?function(e){return"function"==typeof e||e===me}:function(e){return"function"==typeof e},ve=_e,ge=fe.all,ye=fe.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:ve(e)||e===ge}:function(e){return"object"==typeof e?null!==e:ve(e)},Se=C,be=_e,ke=function(e){return be(e)?e:void 0},Ie=function(e,t){return arguments.length<2?ke(Se[e]):Se[e]&&Se[e][t]},Te=ee({}.isPrototypeOf),we=Ie("navigator","userAgent")||"",Ee=C,Re=we,Ce=Ee.process,Ae=Ee.Deno,xe=Ce&&Ce.versions||Ae&&Ae.version,Pe=xe&&xe.v8;Pe&&(B=(F=Pe.split("."))[0]>0&&F[0]<4?1:+(F[0]+F[1])),!B&&Re&&(!(F=Re.match(/Edge\/(\d+)/))||F[1]>=74)&&(F=Re.match(/Chrome\/(\d+)/))&&(B=+F[1]);var De=B,Oe=De,Me=x,Ne=!!Object.getOwnPropertySymbols&&!Me((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Oe&&Oe<41})),Le=Ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ue=Ie,Ve=_e,je=Te,Fe=Object,Be=Le?function(e){return"symbol"==typeof e}:function(e){var t=Ue("Symbol");return Ve(t)&&je(t.prototype,Fe(e))},He=String,We=function(e){try{return He(e)}catch(t){return"Object"}},Ge=_e,ze=We,Je=TypeError,qe=function(e){if(Ge(e))return e;throw Je(ze(e)+" is not a function")},Ke=qe,Qe=oe,Xe=function(e,t){var n=e[t];return Qe(n)?void 0:Ke(n)},Ye=N,$e=_e,Ze=ye,et=TypeError,tt={exports:{}},nt=C,it=Object.defineProperty,rt=function(e,t){try{it(nt,e,{value:t,configurable:!0,writable:!0})}catch(n){nt[e]=t}return t},at=rt,ot="__core-js_shared__",st=C[ot]||at(ot,{}),ct=st;(tt.exports=function(e,t){return ct[e]||(ct[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.25.5",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.25.5/LICENSE",source:"https://github.com/zloirock/core-js"});var ut=ue,dt=Object,lt=function(e){return dt(ut(e))},ht=lt,pt=ee({}.hasOwnProperty),ft=Object.hasOwn||function(e,t){return pt(ht(e),t)},mt=ee,_t=0,vt=Math.random(),gt=mt(1..toString),yt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+gt(++_t+vt,36)},St=C,bt=tt.exports,kt=ft,It=yt,Tt=Ne,wt=Le,Et=bt("wks"),Rt=St.Symbol,Ct=Rt&&Rt.for,At=wt?Rt:Rt&&Rt.withoutSetter||It,xt=function(e){if(!kt(Et,e)||!Tt&&"string"!=typeof Et[e]){var t="Symbol."+e;Tt&&kt(Rt,e)?Et[e]=Rt[e]:Et[e]=wt&&Ct?Ct(t):At(t)}return Et[e]},Pt=N,Dt=ye,Ot=Be,Mt=Xe,Nt=function(e,t){var n,i;if("string"===t&&$e(n=e.toString)&&!Ze(i=Ye(n,e)))return i;if($e(n=e.valueOf)&&!Ze(i=Ye(n,e)))return i;if("string"!==t&&$e(n=e.toString)&&!Ze(i=Ye(n,e)))return i;throw et("Can't convert object to primitive value")},Lt=TypeError,Ut=xt("toPrimitive"),Vt=function(e,t){if(!Dt(e)||Ot(e))return e;var n,i=Mt(e,Ut);if(i){if(void 0===t&&(t="default"),n=Pt(i,e,t),!Dt(n)||Ot(n))return n;throw Lt("Can't convert object to primitive value")}return void 0===t&&(t="number"),Nt(e,t)},jt=Vt,Ft=Be,Bt=function(e){var t=jt(e,"string");return Ft(t)?t:t+""},Ht=ye,Wt=C.document,Gt=Ht(Wt)&&Ht(Wt.createElement),zt=function(e){return Gt?Wt.createElement(e):{}},Jt=zt,qt=!P&&!x((function(){return 7!=Object.defineProperty(Jt("div"),"a",{get:function(){return 7}}).a})),Kt=P,Qt=N,Xt=L,Yt=H,$t=he,Zt=Bt,en=ft,tn=qt,nn=Object.getOwnPropertyDescriptor;A.f=Kt?nn:function(e,t){if(e=$t(e),t=Zt(t),tn)try{return nn(e,t)}catch(n){}if(en(e,t))return Yt(!Qt(Xt.f,e,t),e[t])};var rn={},an=P&&x((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),on=ye,sn=String,cn=TypeError,un=function(e){if(on(e))return e;throw cn(sn(e)+" is not an object")},dn=P,ln=qt,hn=an,pn=un,fn=Bt,mn=TypeError,_n=Object.defineProperty,vn=Object.getOwnPropertyDescriptor,gn="enumerable",yn="configurable",Sn="writable";rn.f=dn?hn?function(e,t,n){if(pn(e),t=fn(t),pn(n),"function"==typeof e&&"prototype"===t&&"value"in n&&Sn in n&&!n.writable){var i=vn(e,t);i&&i.writable&&(e[t]=n.value,n={configurable:yn in n?n.configurable:i.configurable,enumerable:gn in n?n.enumerable:i.enumerable,writable:!1})}return _n(e,t,n)}:_n:function(e,t,n){if(pn(e),t=fn(t),pn(n),ln)try{return _n(e,t,n)}catch(i){}if("get"in n||"set"in n)throw mn("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var bn=rn,kn=H,In=P?function(e,t,n){return bn.f(e,t,kn(1,n))}:function(e,t,n){return e[t]=n,e},Tn={exports:{}},wn=P,En=ft,Rn=Function.prototype,Cn=wn&&Object.getOwnPropertyDescriptor,An=En(Rn,"name"),xn={EXISTS:An,PROPER:An&&"something"===function(){}.name,CONFIGURABLE:An&&(!wn||wn&&Cn(Rn,"name").configurable)},Pn=_e,Dn=st,On=ee(Function.toString);Pn(Dn.inspectSource)||(Dn.inspectSource=function(e){return On(e)});var Mn,Nn,Ln,Un=Dn.inspectSource,Vn=_e,jn=C.WeakMap,Fn=Vn(jn)&&/native code/.test(String(jn)),Bn=tt.exports,Hn=yt,Wn=Bn("keys"),Gn=function(e){return Wn[e]||(Wn[e]=Hn(e))},zn={},Jn=Fn,qn=C,Kn=ye,Qn=In,Xn=ft,Yn=st,$n=Gn,Zn=zn,ei="Object already initialized",ti=qn.TypeError,ni=qn.WeakMap;if(Jn||Yn.state){var ii=Yn.state||(Yn.state=new ni);ii.get=ii.get,ii.has=ii.has,ii.set=ii.set,Mn=function(e,t){if(ii.has(e))throw ti(ei);return t.facade=e,ii.set(e,t),t},Nn=function(e){return ii.get(e)||{}},Ln=function(e){return ii.has(e)}}else{var ri=$n("state");Zn[ri]=!0,Mn=function(e,t){if(Xn(e,ri))throw ti(ei);return t.facade=e,Qn(e,ri,t),t},Nn=function(e){return Xn(e,ri)?e[ri]:{}},Ln=function(e){return Xn(e,ri)}}var ai={set:Mn,get:Nn,has:Ln,enforce:function(e){return Ln(e)?Nn(e):Mn(e,{})},getterFor:function(e){return function(t){var n;if(!Kn(t)||(n=Nn(t)).type!==e)throw ti("Incompatible receiver, "+e+" required");return n}}},oi=x,si=_e,ci=ft,ui=P,di=xn.CONFIGURABLE,li=Un,hi=ai.enforce,pi=ai.get,fi=Object.defineProperty,mi=ui&&!oi((function(){return 8!==fi((function(){}),"length",{value:8}).length})),_i=String(String).split("String"),vi=Tn.exports=function(e,t,n){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!ci(e,"name")||di&&e.name!==t)&&(ui?fi(e,"name",{value:t,configurable:!0}):e.name=t),mi&&n&&ci(n,"arity")&&e.length!==n.arity&&fi(e,"length",{value:n.arity});try{n&&ci(n,"constructor")&&n.constructor?ui&&fi(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(r){}var i=hi(e);return ci(i,"source")||(i.source=_i.join("string"==typeof t?t:"")),e};Function.prototype.toString=vi((function(){return si(this)&&pi(this).source||li(this)}),"toString");var gi=_e,yi=rn,Si=Tn.exports,bi=rt,ki=function(e,t,n,i){i||(i={});var r=i.enumerable,a=void 0!==i.name?i.name:t;if(gi(n)&&Si(n,a,i),i.global)r?e[t]=n:bi(t,n);else{try{i.unsafe?e[t]&&(r=!0):delete e[t]}catch(o){}r?e[t]=n:yi.f(e,t,{value:n,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return e},Ii={},Ti=Math.ceil,wi=Math.floor,Ei=Math.trunc||function(e){var t=+e;return(t>0?wi:Ti)(t)},Ri=function(e){var t=+e;return t!=t||0===t?0:Ei(t)},Ci=Ri,Ai=Math.max,xi=Math.min,Pi=function(e,t){var n=Ci(e);return n<0?Ai(n+t,0):xi(n,t)},Di=Ri,Oi=Math.min,Mi=function(e){return e>0?Oi(Di(e),9007199254740991):0},Ni=Mi,Li=function(e){return Ni(e.length)},Ui=he,Vi=Pi,ji=Li,Fi=function(e){return function(t,n,i){var r,a=Ui(t),o=ji(a),s=Vi(i,o);if(e&&n!=n){for(;o>s;)if((r=a[s++])!=r)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===n)return e||s||0;return!e&&-1}},Bi={includes:Fi(!0),indexOf:Fi(!1)},Hi=ft,Wi=he,Gi=Bi.indexOf,zi=zn,Ji=ee([].push),qi=function(e,t){var n,i=Wi(e),r=0,a=[];for(n in i)!Hi(zi,n)&&Hi(i,n)&&Ji(a,n);for(;t.length>r;)Hi(i,n=t[r++])&&(~Gi(a,n)||Ji(a,n));return a},Ki=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Qi=qi,Xi=Ki.concat("length","prototype");Ii.f=Object.getOwnPropertyNames||function(e){return Qi(e,Xi)};var Yi={};Yi.f=Object.getOwnPropertySymbols;var $i=Ie,Zi=Ii,er=Yi,tr=un,nr=ee([].concat),ir=$i("Reflect","ownKeys")||function(e){var t=Zi.f(tr(e)),n=er.f;return n?nr(t,n(e)):t},rr=ft,ar=ir,or=A,sr=rn,cr=x,ur=_e,dr=/#|\.prototype\./,lr=function(e,t){var n=pr[hr(e)];return n==mr||n!=fr&&(ur(t)?cr(t):!!t)},hr=lr.normalize=function(e){return String(e).replace(dr,".").toLowerCase()},pr=lr.data={},fr=lr.NATIVE="N",mr=lr.POLYFILL="P",_r=lr,vr=C,gr=A.f,yr=In,Sr=ki,br=rt,kr=function(e,t,n){for(var i=ar(t),r=sr.f,a=or.f,o=0;o<i.length;o++){var s=i[o];rr(e,s)||n&&rr(n,s)||r(e,s,a(t,s))}},Ir=_r,Tr=function(e,t){var n,i,r,a,o,s=e.target,c=e.global,u=e.stat;if(n=c?vr:u?vr[s]||br(s,{}):(vr[s]||{}).prototype)for(i in t){if(a=t[i],r=e.dontCallGetSet?(o=gr(n,i))&&o.value:n[i],!Ir(c?i:s+(u?".":"#")+i,e.forced)&&void 0!==r){if(typeof a==typeof r)continue;kr(a,r)}(e.sham||r&&r.sham)&&yr(a,"sham",!0),Sr(n,i,a,e)}},wr=Tr,Er=x,Rr=he,Cr=A.f,Ar=P,xr=Er((function(){Cr(1)}));function Pr(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}wr({target:"Object",stat:!0,forced:!Ar||xr,sham:!Ar},{getOwnPropertyDescriptor:function(e,t){return Cr(Rr(e),t)}});!function(e,t){e.exports=function(){function e(t,n,i){function r(o,s){if(!n[o]){if(!t[o]){if(!s&&Pr)return Pr(o);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[o]={exports:{}};t[o][0].call(u.exports,(function(e){return r(t[o][1][e]||e)}),u,u.exports,e,t,n,i)}return n[o].exports}for(var a=Pr,o=0;o<i.length;o++)r(i[o]);return r}return e}()({1:[function(e,t,n){var i=(0,e("./adapter_factory.js").adapterFactory)({window:"undefined"==typeof window?void 0:window});t.exports=i},{"./adapter_factory.js":2}],2:[function(e,t,n){function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.adapterFactory=h;var r=l(e("./utils")),a=l(e("./chrome/chrome_shim")),o=l(e("./firefox/firefox_shim")),s=l(e("./safari/safari_shim")),c=l(e("./common_shim")),u=l(e("sdp"));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function l(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function h(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).window,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=r.log,i=r.detectBrowser(e),d={browserDetails:i,commonShim:c,extractVersion:r.extractVersion,disableLog:r.disableLog,disableWarnings:r.disableWarnings,sdp:u};switch(i.browser){case"chrome":if(!a||!a.shimPeerConnection||!t.shimChrome)return n("Chrome shim is not included in this adapter release."),d;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),d;n("adapter.js shimming chrome."),d.browserShim=a,c.shimAddIceCandidateNullOrEmpty(e,i),c.shimParameterlessSetLocalDescription(e,i),a.shimGetUserMedia(e,i),a.shimMediaStream(e,i),a.shimPeerConnection(e,i),a.shimOnTrack(e,i),a.shimAddTrackRemoveTrack(e,i),a.shimGetSendersWithDtmf(e,i),a.shimGetStats(e,i),a.shimSenderReceiverGetStats(e,i),a.fixNegotiationNeeded(e,i),c.shimRTCIceCandidate(e,i),c.shimRTCIceCandidateRelayProtocol(e,i),c.shimConnectionState(e,i),c.shimMaxMessageSize(e,i),c.shimSendThrowTypeError(e,i),c.removeExtmapAllowMixed(e,i);break;case"firefox":if(!o||!o.shimPeerConnection||!t.shimFirefox)return n("Firefox shim is not included in this adapter release."),d;n("adapter.js shimming firefox."),d.browserShim=o,c.shimAddIceCandidateNullOrEmpty(e,i),c.shimParameterlessSetLocalDescription(e,i),o.shimGetUserMedia(e,i),o.shimPeerConnection(e,i),o.shimOnTrack(e,i),o.shimRemoveStream(e,i),o.shimSenderGetStats(e,i),o.shimReceiverGetStats(e,i),o.shimRTCDataChannel(e,i),o.shimAddTransceiver(e,i),o.shimGetParameters(e,i),o.shimCreateOffer(e,i),o.shimCreateAnswer(e,i),c.shimRTCIceCandidate(e,i),c.shimConnectionState(e,i),c.shimMaxMessageSize(e,i),c.shimSendThrowTypeError(e,i);break;case"safari":if(!s||!t.shimSafari)return n("Safari shim is not included in this adapter release."),d;n("adapter.js shimming safari."),d.browserShim=s,c.shimAddIceCandidateNullOrEmpty(e,i),c.shimParameterlessSetLocalDescription(e,i),s.shimRTCIceServerUrls(e,i),s.shimCreateOfferLegacy(e,i),s.shimCallbacksAPI(e,i),s.shimLocalStreamsAPI(e,i),s.shimRemoteStreamsAPI(e,i),s.shimTrackEventTransceiver(e,i),s.shimGetUserMedia(e,i),s.shimAudioContext(e,i),c.shimRTCIceCandidate(e,i),c.shimRTCIceCandidateRelayProtocol(e,i),c.shimMaxMessageSize(e,i),c.shimSendThrowTypeError(e,i),c.removeExtmapAllowMixed(e,i);break;default:n("Unsupported browser!")}return d}},{"./chrome/chrome_shim":3,"./common_shim":6,"./firefox/firefox_shim":7,"./safari/safari_shim":10,"./utils":11,sdp:12}],3:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.fixNegotiationNeeded=S,n.shimAddTrackRemoveTrack=g,n.shimAddTrackRemoveTrackWithNative=v,Object.defineProperty(n,"shimGetDisplayMedia",{enumerable:!0,get:function(){return a.shimGetDisplayMedia}}),n.shimGetSendersWithDtmf=f,n.shimGetStats=m,Object.defineProperty(n,"shimGetUserMedia",{enumerable:!0,get:function(){return r.shimGetUserMedia}}),n.shimMediaStream=h,n.shimOnTrack=p,n.shimPeerConnection=y,n.shimSenderReceiverGetStats=_;var i=s(e("../utils.js")),r=e("./getusermedia"),a=e("./getdisplaymedia");function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function s(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==l(e)&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=r?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(i,a,s):i[a]=e[a]}return i.default=e,n&&n.set(e,i),i}function c(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){var t=d(e,"string");return"symbol"===l(t)?t:String(t)}function d(e,t){if("object"!==l(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==l(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function h(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function p(e){if("object"===l(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)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var n=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(i){var r;r=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find((function(e){return e.track&&e.track.id===i.track.id})):{track:i.track};var a=new Event("track");a.track=i.track,a.receiver=r,a.transceiver={receiver:r},a.streams=[t.stream],n.dispatchEvent(a)})),t.stream.getTracks().forEach((function(i){var r;r=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find((function(e){return e.track&&e.track.id===i.id})):{track:i};var a=new Event("track");a.track=i,a.receiver=r,a.transceiver={receiver:r},a.streams=[t.stream],n.dispatchEvent(a)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else i.wrapPeerConnectionEvent(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function f(e){if("object"===l(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,i){var r=n.apply(this,arguments);return r||(r=t(this,e),this._senders.push(r)),r};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((function(e){n._senders.push(t(n,e))}))};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],a.apply(this,[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"===l(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var o=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=o.apply(this,[]);return t.forEach((function(t){return 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}})}}function m(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,n=Array.prototype.slice.call(arguments),i=n[0],r=n[1],a=n[2];if(arguments.length>0&&"function"==typeof i)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof i))return t.apply(this,[]);var o=function(e){var t={};return e.result().forEach((function(e){var n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){n[t]=e.stat(t)})),t[n.id]=n})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){r(s(o(e)))};return t.apply(this,[c,i])}return new Promise((function(n,i){t.apply(e,[function(e){n(s(o(e)))},i])})).then(r,a)}}}function _(e){if("object"===l(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,n=t.apply(this,[]);return n.forEach((function(t){return t._pc=e})),n});var n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return i.filterStats(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var r=e.RTCPeerConnection.prototype.getReceivers;r&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),i.wrapPeerConnectionEvent(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return i.filterStats(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var a=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,n,i,r=arguments[0];return this.getSenders().forEach((function(e){e.track===r&&(t?i=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===r&&(n?i=!0:n=e),e.track===r})),i||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return a.apply(this,arguments)}}}}function v(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(i)&&this._shimmedLocalStreams[n.id].push(i):this._shimmedLocalStreams[n.id]=[n,i],i};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var i=this.getSenders();n.apply(this,arguments);var r=this.getSenders().filter((function(e){return-1===i.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(r)};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};var r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(n){var i=t._shimmedLocalStreams[n].indexOf(e);-1!==i&&t._shimmedLocalStreams[n].splice(i,1),1===t._shimmedLocalStreams[n].length&&delete t._shimmedLocalStreams[n]})),r.apply(this,arguments)}}function g(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return v(e);var n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=n.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var n=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(n.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}i.apply(this,[t])};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){var i=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single  stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((function(e){return e.track===t})))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[n.id];if(a)a.addTrack(t),Promise.resolve().then((function(){i.dispatchEvent(new Event("negotiationneeded"))}));else{var o=new e.MediaStream([t]);this._streams[n.id]=o,this._reverseStreams[o.id]=n,this.addStream(o)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var n=e.RTCPeerConnection.prototype[t],i=c({},t,(function(){var e=this,t=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[function(n){var i=s(e,n);t[0].apply(null,[i])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=i[t]}));var a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=u(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};var o=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=o.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(i){n._streams[i].getTracks().find((function(t){return e.track===t}))&&(t=n._streams[i])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var i=e._reverseStreams[t],r=e._streams[i.id];n=n.replace(new RegExp(r.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:n})}function u(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var i=e._reverseStreams[t],r=e._streams[i.id];n=n.replace(new RegExp(i.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:n})}}function y(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var n=e.RTCPeerConnection.prototype[t],i=c({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=i[t]}))}function S(e,t){i.wrapPeerConnectionEvent(e,"negotiationneeded",(function(e){var n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e}))}},{"../utils.js":11,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(e,t,n){function i(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then((function(t){var i=n.video&&n.video.width,r=n.video&&n.video.height,a=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:a||3}},i&&(n.video.mandatory.maxWidth=i),r&&(n.video.mandatory.maxHeight=r),e.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}Object.defineProperty(n,"__esModule",{value:!0}),n.shimGetDisplayMedia=i},{}],5:[function(e,t,n){function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function r(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var c=o?Object.getOwnPropertyDescriptor(e,s):null;c&&(c.get||c.set)?Object.defineProperty(r,s,c):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.shimGetUserMedia=s;var o=r(e("../utils.js")).log;function s(e,t){var n=e&&e.navigator;if(n.mediaDevices){var i=function(e){if("object"!==a(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var i="object"===a(e[n])?e[n]:{ideal:e[n]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);var r=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];var o={};"number"==typeof i.ideal?(o[r("min",n)]=i.ideal,t.optional.push(o),(o={})[r("max",n)]=i.ideal,t.optional.push(o)):(o[r("",n)]=i.ideal,t.optional.push(o))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[r("",n)]=i.exact):["min","max"].forEach((function(e){void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[r(e,n)]=i[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},r=function(e,r){if(t.version>=61)return r(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===a(e.audio)){var s=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};s((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),s(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"===a(e.video)){var c=e.video.facingMode;c=c&&("object"===a(c)?c:{ideal:c});var u,d=t.version<66;if(c&&("user"===c.exact||"environment"===c.exact||"user"===c.ideal||"environment"===c.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||d)&&(delete e.video.facingMode,"environment"===c.exact||"environment"===c.ideal?u=["back","rear"]:"user"!==c.exact&&"user"!==c.ideal||(u=["front"]),u))return n.mediaDevices.enumerateDevices().then((function(t){var n=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return u.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!n&&t.length&&u.includes("back")&&(n=t[t.length-1]),n&&(e.video.deviceId=c.exact?{exact:n.deviceId}:{ideal:n.deviceId}),e.video=i(e.video),o("chrome: "+JSON.stringify(e)),r(e)}));e.video=i(e.video)}return o("chrome: "+JSON.stringify(e)),r(e)},s=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},c=function(e,t,i){r(e,(function(e){n.webkitGetUserMedia(e,t,(function(e){i&&i(s(e))}))}))};if(n.getUserMedia=c.bind(n),n.mediaDevices.getUserMedia){var u=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return r(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))}))}))}}}}},{"../utils.js":11}],6:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.removeExtmapAllowMixed=f,n.shimAddIceCandidateNullOrEmpty=m,n.shimConnectionState=p,n.shimMaxMessageSize=l,n.shimParameterlessSetLocalDescription=_,n.shimRTCIceCandidate=u,n.shimRTCIceCandidateRelayProtocol=d,n.shimSendThrowTypeError=h;var i=s(e("sdp")),r=o(e("./utils"));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}function o(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==c(e)&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=r?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(i,o,s):i[o]=e[o]}return i.default=e,n&&n.set(e,i),i}function s(e){return e&&e.__esModule?e:{default:e}}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function u(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===c(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){var n=new t(e),r=i.default.parseCandidate(e.candidate);for(var a in r)a in n||Object.defineProperty(n,a,{value:r[a]});return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,r.wrapPeerConnectionEvent(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function d(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||r.wrapPeerConnectionEvent(e,"icecandidate",(function(e){if(e.candidate){var t=i.default.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function l(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var n=function(e){if(!e||!e.sdp)return!1;var t=i.default.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=i.default.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},r=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var n=parseInt(t[1],10);return n!=n?-1:n},a=function(e){var n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n},o=function(e,n){var r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);var a=i.default.matchPrefix(e.sdp,"a=max-message-size:");return a.length>0?r=parseInt(a[0].substring(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76&&"plan-b"===this.getConfiguration().sdpSemantics&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0}),n(arguments[0])){var e,i=r(arguments[0]),c=a(i),u=o(arguments[0],i);e=0===c&&0===u?Number.POSITIVE_INFINITY:0===c||0===u?Math.max(c,u):Math.min(c,u);var d={};Object.defineProperty(d,"maxMessageSize",{get:function(){return e}}),this._sctp=d}return s.apply(this,arguments)}}}function h(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return n(e,this),e},r.wrapPeerConnectionEvent(e,"datachannel",(function(e){return n(e.channel,e.target),e}))}function n(e,t){var n=e.send;e.send=function(){var i=arguments[0],r=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&r>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}}function p(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}}function f(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var i=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:i}):t.sdp=i}return n.apply(this,arguments)}}}function m(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function _(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==c(t)||t.type&&t.sdp)return n.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}return t.sdp||"offer"!==t.type&&"answer"!==t.type?n.apply(this,[t]):("offer"===t.type?this.createOffer:this.createAnswer).apply(this).then((function(t){return n.apply(e,[t])}))})}}},{"./utils":11,sdp:12}],7:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.shimAddTransceiver=T,n.shimCreateAnswer=R,n.shimCreateOffer=E,Object.defineProperty(n,"shimGetDisplayMedia",{enumerable:!0,get:function(){return a.shimGetDisplayMedia}}),n.shimGetParameters=w,Object.defineProperty(n,"shimGetUserMedia",{enumerable:!0,get:function(){return r.shimGetUserMedia}}),n.shimOnTrack=g,n.shimPeerConnection=y,n.shimRTCDataChannel=I,n.shimReceiverGetStats=b,n.shimRemoveStream=k,n.shimSenderGetStats=S;var i=s(e("../utils")),r=e("./getusermedia"),a=e("./getdisplaymedia");function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function s(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==v(e)&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=r?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(i,a,s):i[a]=e[a]}return i.default=e,n&&n.set(e,i),i}function c(e){return h(e)||l(e)||d(e)||u()}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function l(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function h(e){if(Array.isArray(e))return p(e)}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function f(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){var t=_(e,"string");return"symbol"===v(t)?t:String(t)}function _(e,t){if("object"!==v(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==v(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function g(e){"object"===v(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}}})}function y(e,t){if("object"===v(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var n=e.RTCPeerConnection.prototype[t],i=f({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=i[t]}));var n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),r=e[0],a=e[1],o=e[2];return i.apply(this,[r||null]).then((function(e){if(t.version<53&&!a)try{e.forEach((function(e){e.type=n[e.type]||e.type}))}catch(i){if("TypeError"!==i.name)throw i;e.forEach((function(t,i){e.set(i,Object.assign({},t,{type:n[t.type]||t.type}))}))}return e})).then(a,o)}}}function S(e){if("object"===v(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,n=t.apply(this,[]);return n.forEach((function(t){return t._pc=e})),n});var n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function b(e){if("object"===v(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,n=t.apply(this,[]);return n.forEach((function(t){return t._pc=e})),n}),i.wrapPeerConnectionEvent(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function k(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;i.deprecated("removeStream","removeTrack"),this.getSenders().forEach((function(n){n.track&&e.getTracks().includes(n.track)&&t.removeTrack(n)}))})}function I(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function T(e){if("object"===v(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var n=(e=c(e)).length>0;n&&e.forEach((function(e){if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var i=t.apply(this,arguments);if(n){var r=i.sender,a=r.getParameters();(!("encodings"in a)||1===a.encodings.length&&0===Object.keys(a.encodings[0]).length)&&(a.encodings=e,r.sendEncodings=e,this.setParametersPromises.push(r.setParameters(a).then((function(){delete r.sendEncodings})).catch((function(){delete r.sendEncodings}))))}return i})}}function w(e){if("object"===v(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function E(e){if("object"===v(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,n=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(n,e)})).finally((function(){n.setParametersPromises=[]})):t.apply(this,arguments)}}}function R(e){if("object"===v(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,n=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(n,e)})).finally((function(){n.setParametersPromises=[]})):t.apply(this,arguments)}}}},{"../utils":11,"./getdisplaymedia":8,"./getusermedia":9}],8:[function(e,t,n){function i(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){var i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}Object.defineProperty(n,"__esModule",{value:!0}),n.shimGetDisplayMedia=i},{}],9:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.shimGetUserMedia=s;var i=a(e("../utils"));function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(r=function(e){return e?n:t})(e)}function a(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==o(e)&&"function"!=typeof e)return{default:e};var n=r(t);if(n&&n.has(e))return n.get(e);var i={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var c=a?Object.getOwnPropertyDescriptor(e,s):null;c&&(c.get||c.set)?Object.defineProperty(i,s,c):i[s]=e[s]}return i.default=e,n&&n.set(e,i),i}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){var n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){i.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var a=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(e){return"object"===o(e)&&"object"===o(e.audio)&&(e=JSON.parse(JSON.stringify(e)),a(e.audio,"autoGainControl","mozAutoGainControl"),a(e.audio,"noiseSuppression","mozNoiseSuppression")),s(e)},r&&r.prototype.getSettings){var c=r.prototype.getSettings;r.prototype.getSettings=function(){var e=c.apply(this,arguments);return a(e,"mozAutoGainControl","autoGainControl"),a(e,"mozNoiseSuppression","noiseSuppression"),e}}if(r&&r.prototype.applyConstraints){var u=r.prototype.applyConstraints;r.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===o(e)&&(e=JSON.parse(JSON.stringify(e)),a(e,"autoGainControl","mozAutoGainControl"),a(e,"noiseSuppression","mozNoiseSuppression")),u.apply(this,[e])}}}}},{"../utils":11}],10:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.shimAudioContext=p,n.shimCallbacksAPI=s,n.shimConstraints=u,n.shimCreateOfferLegacy=h,n.shimGetUserMedia=c,n.shimLocalStreamsAPI=shimLocalStreamsAPI,n.shimRTCIceServerUrls=d,n.shimRemoteStreamsAPI=shimRemoteStreamsAPI,n.shimTrackEventTransceiver=l;var i=a(e("../utils"));function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(r=function(e){return e?n:t})(e)}function a(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==o(e)&&"function"!=typeof e)return{default:e};var n=r(t);if(n&&n.has(e))return n.get(e);var i={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var c=a?Object.getOwnPropertyDescriptor(e,s):null;c&&(c.get||c.set)?Object.defineProperty(i,s,c):i[s]=e[s]}return i.default=e,n&&n.set(e,i),i}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function shimLocalStreamsAPI(e){if("object"===o(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(i){return t.call(n,i,e)})),e.getVideoTracks().forEach((function(i){return t.call(n,i,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var n=this,i=arguments.length,r=new Array(i>1?i-1:0),a=1;a<i;a++)r[a-1]=arguments[a];return r&&r.forEach((function(e){n._localStreams?n._localStreams.includes(e)||n._localStreams.push(e):n._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var n=this._localStreams.indexOf(e);if(-1!==n){this._localStreams.splice(n,1);var i=e.getTracks();this.getSenders().forEach((function(e){i.includes(e.track)&&t.removeTrack(e)}))}})}}function shimRemoteStreamsAPI(e){if("object"===o(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){var t=this;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){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}}function s(e){if("object"===o(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,n=t.createOffer,i=t.createAnswer,r=t.setLocalDescription,a=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],r=n.apply(this,[i]);return t?(r.then(e,t),Promise.resolve()):r},t.createAnswer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],r=i.apply(this,[n]);return t?(r.then(e,t),Promise.resolve()):r};var c=function(e,t,n){var i=r.apply(this,[e]);return n?(i.then(t,n),Promise.resolve()):i};t.setLocalDescription=c,c=function(e,t,n){var i=a.apply(this,[e]);return n?(i.then(t,n),Promise.resolve()):i},t.setRemoteDescription=c,c=function(e,t,n){var i=s.apply(this,[e]);return n?(i.then(t,n),Promise.resolve()):i},t.addIceCandidate=c}}function c(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var n=t.mediaDevices,i=n.getUserMedia.bind(n);t.mediaDevices.getUserMedia=function(e){return i(u(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,i){t.mediaDevices.getUserMedia(e).then(n,i)}.bind(t))}function u(e){return e&&void 0!==e.video?Object.assign({},e,{video:i.compactObject(e.video)}):e}function d(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){for(var r=[],a=0;a<e.iceServers.length;a++){var o=e.iceServers[a];void 0===o.urls&&o.url?(i.deprecated("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,r.push(o)):r.push(e.iceServers[a])}e.iceServers=r}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function l(e){"object"===o(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}}})}function h(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var n=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveAudio||n||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var i=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveVideo||i||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function p(e){"object"!==o(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}},{"../utils":11}],11:[function(e,t,n){function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){var t=a(e,"string");return"symbol"===o(t)?t:String(t)}function a(e,t){if("object"!==o(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==o(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.compactObject=v,n.deprecated=f,n.detectBrowser=m,n.disableLog=l,n.disableWarnings=h,n.extractVersion=u,n.filterStats=y,n.log=p,n.walkStats=g,n.wrapPeerConnectionEvent=d;var s=!0,c=!0;function u(e,t,n){var i=e.match(t);return i&&i.length>=n&&parseInt(i[n],10)}function d(e,t,n){if(e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype,r=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return r.apply(this,arguments);var a=function(e){var t=n(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,a),r.apply(this,[e,a])};var a=i.removeEventListener;i.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return a.apply(this,arguments);if(!this._eventMap[t].has(n))return a.apply(this,arguments);var i=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,a.apply(this,[e,i])},Object.defineProperty(i,"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)},enumerable:!0,configurable:!0})}}function l(e){return"boolean"!=typeof e?new Error("Argument type: "+o(e)+". Please use a boolean."):(s=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function h(e){return"boolean"!=typeof e?new Error("Argument type: "+o(e)+". Please use a boolean."):(c=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function p(){if("object"===("undefined"==typeof window?"undefined":o(window))){if(s)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function f(e,t){c&&console.warn(e+" is deprecated, please use "+t+" instead.")}function m(e){var t={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;var n=e.navigator;if(n.mozGetUserMedia)t.browser="firefox",t.version=u(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=u(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=u(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function _(e){return"[object Object]"===Object.prototype.toString.call(e)}function v(e){return _(e)?Object.keys(e).reduce((function(t,n){var r=_(e[n]),a=r?v(e[n]):e[n],o=r&&!Object.keys(a).length;return void 0===a||o?t:Object.assign(t,i({},n,a))}),{}):e}function g(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach((function(i){i.endsWith("Id")?g(e,e.get(t[i]),n):i.endsWith("Ids")&&t[i].forEach((function(t){g(e,e.get(t),n)}))})))}function y(e,t,n){var i=n?"outbound-rtp":"inbound-rtp",r=new Map;if(null===t)return r;var a=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&a.push(e)})),a.forEach((function(t){e.forEach((function(n){n.type===i&&n.trackId===t.id&&g(e,n,r)}))})),r}},{}],12:[function(e,t,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},r.splitSections=function(e){return e.split("\nm=").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){for(var t=void 0,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":n.relatedAddress=t[i+1];break;case"rport":n.relatedPort=parseInt(t[i+1],10);break;case"tcptype":n.tcpType=t[i+1];break;case"ufrag":n.ufrag=t[i+1],n.usernameFragment=t[i+1];break;default:void 0===n[t[i]]&&(n[t[i]]=t[i+1])}return n},r.writeCandidate=function(e){var t=[];t.push(e.foundation);var n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var i=e.type;return t.push("typ"),t.push(i),"host"!==i&&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.substring(14).split(" ")},r.parseRtpMap=function(e){var t=e.substring(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},r.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},r.parseExtmap=function(e){var t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},r.parseFmtp=function(e){for(var t={},n=void 0,i=e.substring(e.indexOf(" ")+1).split(";"),r=0;r<i.length;r++)t[(n=i[r].trim().split("="))[0].trim()]=n[1];return t},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 i=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+n+" "+i.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){var t=e.substring(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.substring(7,t),10)},i=e.indexOf(":",t);return i>-1?(n.attribute=e.substring(t+1,i),n.value=e.substring(i+1)):n.attribute=e.substring(t+1),n},r.parseSsrcGroup=function(e){var t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},r.getMid=function(e){var t=r.matchPrefix(e,"a=mid:")[0];if(t)return t.substring(6)},r.parseFingerprint=function(e){var t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},r.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:r.matchPrefix(e+t,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),n},r.parseCryptoLine=function(e){var t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},r.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===i(e.keyParams)?r.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},r.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},r.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},r.getCryptoParameters=function(e,t){return r.matchPrefix(e+t,"a=crypto:").map(r.parseCryptoLine)},r.getIceParameters=function(e,t){var n=r.matchPrefix(e+t,"a=ice-ufrag:")[0],i=r.matchPrefix(e+t,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substring(12),password:i.substring(10)}:null},r.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},r.parseRtpParameters=function(e){var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=r.splitLines(e)[0].split(" ");t.profile=n[2];for(var i=3;i<n.length;i++){var a=n[i],o=r.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(o){var s=r.parseRtpMap(o),c=r.matchPrefix(e,"a=fmtp:"+a+" ");switch(s.parameters=c.length?r.parseFmtp(c[0]):{},s.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(r.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}r.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(r.parseExtmap(e))}));var u=r.matchPrefix(e,"a=rtcp-fb:* ").map(r.parseRtcpFb);return t.codecs.forEach((function(e){u.forEach((function(t){e.rtcpFeedback.find((function(e){return e.type===t.type&&e.parameter===t.parameter}))||e.rtcpFeedback.push(t)}))})),t},r.writeRtpDescription=function(e,t){var n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" "+(t.profile||"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"),t.headerExtensions&&t.headerExtensions.forEach((function(e){n+=r.writeExtmap(e)})),n},r.parseRtpEncodingParameters=function(e){var t=[],n=r.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),o=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),s=o.length>0&&o[0].ssrc,c=void 0,u=r.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substring(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===s&&(c=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var n={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};s&&c&&(n.rtx={ssrc:c}),t.push(n),i&&((n=JSON.parse(JSON.stringify(n))).fec={ssrc:s,mechanism:a?"red+ulpfec":"red"},t.push(n))}})),0===t.length&&s&&t.push({ssrc:s});var d=r.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,t.forEach((function(e){e.maxBitrate=d}))),t},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 a=r.matchPrefix(e,"a=rtcp-mux");return t.mux=a.length>0,t},r.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},r.parseMsid=function(e){var t=void 0,n=r.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(t=n[0].substring(7).split(" "))[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?{stream:(t=i[0].value.split(" "))[0],track:t[1]}:void 0},r.parseSctpDescription=function(e){var t=r.parseMLine(e),n=r.matchPrefix(e,"a=max-message-size:"),i=void 0;n.length>0&&(i=parseInt(n[0].substring(19),10)),isNaN(i)&&(i=65536);var a=r.matchPrefix(e,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substring(12),10),protocol:t.fmt,maxMessageSize:i};var o=r.matchPrefix(e,"a=sctpmap:");if(o.length>0){var s=o[0].substring(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:i}}},r.writeSctpDescription=function(e,t){var n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},r.generateSessionId=function(){return Math.random().toString().substr(2,22)},r.writeSessionBoilerplate=function(e,t,n){var i=void 0!==t?t:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||r.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},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].substring(2)}return t?r.getDirection(t):"sendrecv"},r.getKind=function(e){return r.splitLines(e)[0].split(" ")[0].substring(2)},r.isRejected=function(e){return"0"===e.split(" ",2)[1]},r.parseMLine=function(e){var t=r.splitLines(e)[0].substring(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},r.parseOLine=function(e){var t=r.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},r.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=r.splitLines(e),n=0;n<t.length;n++)if(t[n].length<2||"="!==t[n].charAt(1))return!1;return!0},"object"===(void 0===t?"undefined":i(t))&&(t.exports=r)},{}]},{},[1])(1)}({exports:{}});var Dr="4.15.19",Or={},Mr=qi,Nr=Ki,Lr=Object.keys||function(e){return Mr(e,Nr)},Ur=P,Vr=an,jr=rn,Fr=un,Br=he,Hr=Lr;Or.f=Ur&&!Vr?Object.defineProperties:function(e,t){Fr(e);for(var n,i=Br(t),r=Hr(t),a=r.length,o=0;a>o;)jr.f(e,n=r[o++],i[n]);return e};var Wr,Gr=Ie("document","documentElement"),zr=un,Jr=Or,qr=Ki,Kr=zn,Qr=Gr,Xr=zt,Yr=Gn("IE_PROTO"),$r=function(){},Zr=function(e){return"<script>"+e+"</"+"script>"},ea=function(e){e.write(Zr("")),e.close();var t=e.parentWindow.Object;return e=null,t},ta=function(){try{Wr=new ActiveXObject("htmlfile")}catch(i){}var e,t;ta="undefined"!=typeof document?document.domain&&Wr?ea(Wr):((t=Xr("iframe")).style.display="none",Qr.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Zr("document.F=Object")),e.close(),e.F):ea(Wr);for(var n=qr.length;n--;)delete ta.prototype[qr[n]];return ta()};Kr[Yr]=!0;var na=Object.create||function(e,t){var n;return null!==e?($r.prototype=zr(e),n=new $r,$r.prototype=null,n[Yr]=e):n=ta(),void 0===t?n:Jr.f(n,t)},ia=xt,ra=na,aa=rn.f,oa=ia("unscopables"),sa=Array.prototype;null==sa[oa]&&aa(sa,oa,{configurable:!0,value:ra(null)});var ca,ua,da,la=function(e){sa[oa][e]=!0},ha={},pa=!x((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),fa=ft,ma=_e,_a=lt,va=pa,ga=Gn("IE_PROTO"),ya=Object,Sa=ya.prototype,ba=va?ya.getPrototypeOf:function(e){var t=_a(e);if(fa(t,ga))return t[ga];var n=t.constructor;return ma(n)&&t instanceof n?n.prototype:t instanceof ya?Sa:null},ka=x,Ia=_e,Ta=ye,wa=ba,Ea=ki,Ra=xt("iterator"),Ca=!1;[].keys&&("next"in(da=[].keys())?(ua=wa(wa(da)))!==Object.prototype&&(ca=ua):Ca=!0);var Aa=!Ta(ca)||ka((function(){var e={};return ca[Ra].call(e)!==e}));Aa&&(ca={}),Ia(ca[Ra])||Ea(ca,Ra,(function(){return this}));var xa={IteratorPrototype:ca,BUGGY_SAFARI_ITERATORS:Ca},Pa=rn.f,Da=ft,Oa=xt("toStringTag"),Ma=function(e,t,n){e&&!n&&(e=e.prototype),e&&!Da(e,Oa)&&Pa(e,Oa,{configurable:!0,value:t})},Na=xa.IteratorPrototype,La=na,Ua=H,Va=Ma,ja=ha,Fa=function(){return this},Ba=function(e,t,n,i){var r=t+" Iterator";return e.prototype=La(Na,{next:Ua(+!i,n)}),Va(e,r,!1),ja[r]=Fa,e},Ha=_e,Wa=String,Ga=TypeError,za=ee,Ja=un,qa=function(e){if("object"==typeof e||Ha(e))return e;throw Ga("Can't set "+Wa(e)+" as a prototype")},Ka=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=za(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),t=n instanceof Array}catch(i){}return function(n,i){return Ja(n),qa(i),t?e(n,i):n.__proto__=i,n}}():void 0),Qa=Tr,Xa=N,Ya=_e,$a=Ba,Za=ba,eo=Ka,to=Ma,no=In,io=ki,ro=ha,ao=xn.PROPER,oo=xn.CONFIGURABLE,so=xa.IteratorPrototype,co=xa.BUGGY_SAFARI_ITERATORS,uo=xt("iterator"),lo="keys",ho="values",po="entries",fo=function(){return this},mo=function(e,t,n,i,r,a,o){$a(n,t,i);var s,c,u,d=function(e){if(e===r&&m)return m;if(!co&&e in p)return p[e];switch(e){case lo:case ho:case po:return function(){return new n(this,e)}}return function(){return new n(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[uo]||p["@@iterator"]||r&&p[r],m=!co&&f||d(r),_="Array"==t&&p.entries||f;if(_&&(s=Za(_.call(new e)))!==Object.prototype&&s.next&&(Za(s)!==so&&(eo?eo(s,so):Ya(s[uo])||io(s,uo,fo)),to(s,l,!0)),ao&&r==ho&&f&&f.name!==ho&&(oo?no(p,"name",ho):(h=!0,m=function(){return Xa(f,this)})),r)if(c={values:d(ho),keys:a?m:d(lo),entries:d(po)},o)for(u in c)(co||h||!(u in p))&&io(p,u,c[u]);else Qa({target:t,proto:!0,forced:co||h},c);return p[uo]!==m&&io(p,uo,m,{name:r}),ro[t]=m,c},_o=function(e,t){return{value:e,done:t}},vo=he,go=la,yo=ha,So=ai,bo=rn.f,ko=mo,Io=_o,To=P,wo="Array Iterator",Eo=So.set,Ro=So.getterFor(wo),Co=ko(Array,"Array",(function(e,t){Eo(this,{type:wo,target:vo(e),index:0,kind:t})}),(function(){var e=Ro(this),t=e.target,n=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,Io(void 0,!0)):Io("keys"==n?i:"values"==n?t[i]:[i,t[i]],!1)}),"values"),Ao=yo.Arguments=yo.Array;if(go("keys"),go("values"),go("entries"),To&&"values"!==Ao.name)try{bo(Ao,"name",{value:"values"})}catch(Yq){}var xo={};xo[xt("toStringTag")]="z";var Po="[object z]"===String(xo),Do=Po,Oo=_e,Mo=Y,No=xt("toStringTag"),Lo=Object,Uo="Arguments"==Mo(function(){return arguments}()),Vo=Do?Mo:function(e){var t,n,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(Yq){}}(t=Lo(e),No))?n:Uo?Mo(t):"Object"==(i=Mo(t))&&Oo(t.callee)?"Arguments":i},jo=Vo,Fo=Po?{}.toString:function(){return"[object "+jo(this)+"]"};Po||ki(Object.prototype,"toString",Fo,{unsafe:!0});var Bo={exports:{}},Ho={},Wo=Bt,Go=rn,zo=H,Jo=function(e,t,n){var i=Wo(t);i in e?Go.f(e,i,zo(0,n)):e[i]=n},qo=Pi,Ko=Li,Qo=Jo,Xo=Array,Yo=Math.max,$o=function(e,t,n){for(var i=Ko(e),r=qo(t,i),a=qo(void 0===n?i:n,i),o=Xo(Yo(a-r,0)),s=0;r<a;r++,s++)Qo(o,s,e[r]);return o.length=s,o},Zo=Y,es=he,ts=Ii.f,ns=$o,is="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Ho.f=function(e){return is&&"Window"==Zo(e)?function(e){try{return ts(e)}catch(Yq){return ns(is)}}(e):ts(es(e))};var rs=x((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),as=x,os=ye,ss=Y,cs=rs,us=Object.isExtensible,ds=as((function(){us(1)}))||cs?function(e){return!!os(e)&&((!cs||"ArrayBuffer"!=ss(e))&&(!us||us(e)))}:us,ls=!x((function(){return Object.isExtensible(Object.preventExtensions({}))})),hs=Tr,ps=ee,fs=zn,ms=ye,_s=ft,vs=rn.f,gs=Ii,ys=Ho,Ss=ds,bs=ls,ks=!1,Is=yt("meta"),Ts=0,ws=function(e){vs(e,Is,{value:{objectID:"O"+Ts++,weakData:{}}})},Es=Bo.exports={enable:function(){Es.enable=function(){},ks=!0;var e=gs.f,t=ps([].splice),n={};n[Is]=1,e(n).length&&(gs.f=function(n){for(var i=e(n),r=0,a=i.length;r<a;r++)if(i[r]===Is){t(i,r,1);break}return i},hs({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:ys.f}))},fastKey:function(e,t){if(!ms(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!_s(e,Is)){if(!Ss(e))return"F";if(!t)return"E";ws(e)}return e[Is].objectID},getWeakData:function(e,t){if(!_s(e,Is)){if(!Ss(e))return!0;if(!t)return!1;ws(e)}return e[Is].weakData},onFreeze:function(e){return bs&&ks&&Ss(e)&&!_s(e,Is)&&ws(e),e}};fs[Is]=!0;var Rs=qe,Cs=D,As=ee(ee.bind),xs=function(e,t){return Rs(e),void 0===t?e:Cs?As(e,t):function(){return e.apply(t,arguments)}},Ps=ha,Ds=xt("iterator"),Os=Array.prototype,Ms=function(e){return void 0!==e&&(Ps.Array===e||Os[Ds]===e)},Ns=Vo,Ls=Xe,Us=oe,Vs=ha,js=xt("iterator"),Fs=function(e){if(!Us(e))return Ls(e,js)||Ls(e,"@@iterator")||Vs[Ns(e)]},Bs=N,Hs=qe,Ws=un,Gs=We,zs=Fs,Js=TypeError,qs=function(e,t){var n=arguments.length<2?zs(e):t;if(Hs(n))return Ws(Bs(n,e));throw Js(Gs(e)+" is not iterable")},Ks=N,Qs=un,Xs=Xe,Ys=function(e,t,n){var i,r;Qs(e);try{if(!(i=Xs(e,"return"))){if("throw"===t)throw n;return n}i=Ks(i,e)}catch(Yq){r=!0,i=Yq}if("throw"===t)throw n;if(r)throw i;return Qs(i),n},$s=xs,Zs=N,ec=un,tc=We,nc=Ms,ic=Li,rc=Te,ac=qs,oc=Fs,sc=Ys,cc=TypeError,uc=function(e,t){this.stopped=e,this.result=t},dc=uc.prototype,lc=function(e,t,n){var i,r,a,o,s,c,u,d=n&&n.that,l=!(!n||!n.AS_ENTRIES),h=!(!n||!n.IS_RECORD),p=!(!n||!n.IS_ITERATOR),f=!(!n||!n.INTERRUPTED),m=$s(t,d),_=function(e){return i&&sc(i,"normal",e),new uc(!0,e)},v=function(e){return l?(ec(e),f?m(e[0],e[1],_):m(e[0],e[1])):f?m(e,_):m(e)};if(h)i=e.iterator;else if(p)i=e;else{if(!(r=oc(e)))throw cc(tc(e)+" is not iterable");if(nc(r)){for(a=0,o=ic(e);o>a;a++)if((s=v(e[a]))&&rc(dc,s))return s;return new uc(!1)}i=ac(e,r)}for(c=h?e.next:i.next;!(u=Zs(c,i)).done;){try{s=v(u.value)}catch(Yq){sc(i,"throw",Yq)}if("object"==typeof s&&s&&rc(dc,s))return s}return new uc(!1)},hc=Te,pc=TypeError,fc=function(e,t){if(hc(t,e))return e;throw pc("Incorrect invocation")},mc=xt("iterator"),_c=!1;try{var vc=0,gc={next:function(){return{done:!!vc++}},return:function(){_c=!0}};gc[mc]=function(){return this},Array.from(gc,(function(){throw 2}))}catch(Yq){}var yc=function(e,t){if(!t&&!_c)return!1;var n=!1;try{var i={};i[mc]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(Yq){}return n},Sc=_e,bc=ye,kc=Ka,Ic=function(e,t,n){var i,r;return kc&&Sc(i=t.constructor)&&i!==n&&bc(r=i.prototype)&&r!==n.prototype&&kc(e,r),e},Tc=Tr,wc=C,Ec=ee,Rc=_r,Cc=ki,Ac=Bo.exports,xc=lc,Pc=fc,Dc=_e,Oc=oe,Mc=ye,Nc=x,Lc=yc,Uc=Ma,Vc=Ic,jc=function(e,t,n){var i=-1!==e.indexOf("Map"),r=-1!==e.indexOf("Weak"),a=i?"set":"add",o=wc[e],s=o&&o.prototype,c=o,u={},d=function(e){var t=Ec(s[e]);Cc(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(r&&!Mc(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return r&&!Mc(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(r&&!Mc(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(Rc(e,!Dc(o)||!(r||s.forEach&&!Nc((function(){(new o).entries().next()})))))c=n.getConstructor(t,e,i,a),Ac.enable();else if(Rc(e,!0)){var l=new c,h=l[a](r?{}:-0,1)!=l,p=Nc((function(){l.has(1)})),f=Lc((function(e){new o(e)})),m=!r&&Nc((function(){for(var e=new o,t=5;t--;)e[a](t,t);return!e.has(-0)}));f||((c=t((function(e,t){Pc(e,s);var n=Vc(new o,e,c);return Oc(t)||xc(t,n[a],{that:n,AS_ENTRIES:i}),n}))).prototype=s,s.constructor=c),(p||m)&&(d("delete"),d("has"),i&&d("get")),(m||h)&&d(a),r&&s.clear&&delete s.clear}return u[e]=c,Tc({global:!0,constructor:!0,forced:c!=o},u),Uc(c,e),r||n.setStrong(c,e,i),c},Fc=ki,Bc=function(e,t,n){for(var i in t)Fc(e,i,t[i],n);return e},Hc=Ie,Wc=rn,Gc=P,zc=xt("species"),Jc=function(e){var t=Hc(e),n=Wc.f;Gc&&t&&!t[zc]&&n(t,zc,{configurable:!0,get:function(){return this}})},qc=rn.f,Kc=na,Qc=Bc,Xc=xs,Yc=fc,$c=oe,Zc=lc,eu=mo,tu=_o,nu=Jc,iu=P,ru=Bo.exports.fastKey,au=ai.set,ou=ai.getterFor,su={getConstructor:function(e,t,n,i){var r=e((function(e,r){Yc(e,a),au(e,{type:t,index:Kc(null),first:void 0,last:void 0,size:0}),iu||(e.size=0),$c(r)||Zc(r,e[i],{that:e,AS_ENTRIES:n})})),a=r.prototype,o=ou(t),s=function(e,t,n){var i,r,a=o(e),s=c(e,t);return s?s.value=n:(a.last=s={index:r=ru(t,!0),key:t,value:n,previous:i=a.last,next:void 0,removed:!1},a.first||(a.first=s),i&&(i.next=s),iu?a.size++:e.size++,"F"!==r&&(a.index[r]=s)),e},c=function(e,t){var n,i=o(e),r=ru(t);if("F"!==r)return i.index[r];for(n=i.first;n;n=n.next)if(n.key==t)return n};return Qc(a,{clear:function(){for(var e=o(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,iu?e.size=0:this.size=0},delete:function(e){var t=this,n=o(t),i=c(t,e);if(i){var r=i.next,a=i.previous;delete n.index[i.index],i.removed=!0,a&&(a.next=r),r&&(r.previous=a),n.first==i&&(n.first=r),n.last==i&&(n.last=a),iu?n.size--:t.size--}return!!i},forEach:function(e){for(var t,n=o(this),i=Xc(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(i(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Qc(a,n?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),iu&&qc(a,"size",{get:function(){return o(this).size}}),r},setStrong:function(e,t,n){var i=t+" Iterator",r=ou(t),a=ou(i);eu(e,t,(function(e,t){au(this,{type:i,target:e,state:r(e),kind:t,last:void 0})}),(function(){for(var e=a(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?tu("keys"==t?n.key:"values"==t?n.value:[n.key,n.value],!1):(e.target=void 0,tu(void 0,!0))}),n?"entries":"values",!n,!0),nu(t)}};jc("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),su);var cu=Vo,uu=String,du=function(e){if("Symbol"===cu(e))throw TypeError("Cannot convert a Symbol value to a string");return uu(e)},lu=ee,hu=Ri,pu=du,fu=ue,mu=lu("".charAt),_u=lu("".charCodeAt),vu=lu("".slice),gu=function(e){return function(t,n){var i,r,a=pu(fu(t)),o=hu(n),s=a.length;return o<0||o>=s?e?"":void 0:(i=_u(a,o))<55296||i>56319||o+1===s||(r=_u(a,o+1))<56320||r>57343?e?mu(a,o):i:e?vu(a,o,o+2):r-56320+(i-55296<<10)+65536}},yu={codeAt:gu(!1),charAt:gu(!0)},Su=yu.charAt,bu=du,ku=ai,Iu=mo,Tu=_o,wu="String Iterator",Eu=ku.set,Ru=ku.getterFor(wu);Iu(String,"String",(function(e){Eu(this,{type:wu,string:bu(e),index:0})}),(function(){var e,t=Ru(this),n=t.string,i=t.index;return i>=n.length?Tu(void 0,!0):(e=Su(n,i),t.index+=e.length,Tu(e,!1))}));var Cu={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Au=zt("span").classList,xu=Au&&Au.constructor&&Au.constructor.prototype,Pu=xu===Object.prototype?void 0:xu,Du=C,Ou=Cu,Mu=Pu,Nu=Co,Lu=In,Uu=xt,Vu=Uu("iterator"),ju=Uu("toStringTag"),Fu=Nu.values,Bu=function(e,t){if(e){if(e[Vu]!==Fu)try{Lu(e,Vu,Fu)}catch(Yq){e[Vu]=Fu}if(e[ju]||Lu(e,ju,t),Ou[t])for(var n in Nu)if(e[n]!==Nu[n])try{Lu(e,n,Nu[n])}catch(Yq){e[n]=Nu[n]}}};for(var Hu in Ou)Bu(Du[Hu]&&Du[Hu].prototype,Hu);Bu(Mu,"DOMTokenList");var Wu=D,Gu=Function.prototype,zu=Gu.apply,Ju=Gu.call,qu="object"==typeof Reflect&&Reflect.apply||(Wu?Ju.bind(zu):function(){return Ju.apply(zu,arguments)}),Ku=ee([].slice),Qu=TypeError,Xu=function(e,t){if(e<t)throw Qu("Not enough arguments");return e},Yu=C,$u=qu,Zu=_e,ed=Ku,td=Xu,nd=/MSIE .\./.test(we),id=Yu.Function,rd=function(e){return nd?function(t,n){var i=td(arguments.length,1)>2,r=Zu(t)?t:id(t),a=i?ed(arguments,2):void 0;return e(i?function(){$u(r,this,a)}:r,n)}:e},ad={setTimeout:rd(Yu.setTimeout),setInterval:rd(Yu.setInterval)},od=ad.setInterval;Tr({global:!0,bind:!0,forced:C.setInterval!==od},{setInterval:od});var sd=ad.setTimeout;Tr({global:!0,bind:!0,forced:C.setTimeout!==sd},{setTimeout:sd}),jc("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),su);var cd=Y,ud=Array.isArray||function(e){return"Array"==cd(e)},dd=ee,ld=x,hd=_e,pd=Vo,fd=Un,md=function(){},_d=[],vd=Ie("Reflect","construct"),gd=/^\s*(?:class|function)\b/,yd=dd(gd.exec),Sd=!gd.exec(md),bd=function(e){if(!hd(e))return!1;try{return vd(md,_d,e),!0}catch(Yq){return!1}},kd=function(e){if(!hd(e))return!1;switch(pd(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Sd||!!yd(gd,fd(e))}catch(Yq){return!0}};kd.sham=!0;var Id=!vd||ld((function(){var e;return bd(bd.call)||!bd(Object)||!bd((function(){e=!0}))||e}))?kd:bd,Td=ud,wd=Id,Ed=ye,Rd=xt("species"),Cd=Array,Ad=function(e){var t;return Td(e)&&(t=e.constructor,(wd(t)&&(t===Cd||Td(t.prototype))||Ed(t)&&null===(t=t[Rd]))&&(t=void 0)),void 0===t?Cd:t},xd=function(e,t){return new(Ad(e))(0===t?0:t)},Pd=xs,Dd=ae,Od=lt,Md=Li,Nd=xd,Ld=ee([].push),Ud=function(e){var t=1==e,n=2==e,i=3==e,r=4==e,a=6==e,o=7==e,s=5==e||a;return function(c,u,d,l){for(var h,p,f=Od(c),m=Dd(f),_=Pd(u,d),v=Md(m),g=0,y=l||Nd,S=t?y(c,v):n||o?y(c,0):void 0;v>g;g++)if((s||g in m)&&(p=_(h=m[g],g,f),e))if(t)S[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:Ld(S,h)}else switch(e){case 4:return!1;case 7:Ld(S,h)}return a?-1:i||r?r:S}},Vd={forEach:Ud(0),map:Ud(1),filter:Ud(2),some:Ud(3),every:Ud(4),find:Ud(5),findIndex:Ud(6),filterReject:Ud(7)},jd=x,Fd=De,Bd=xt("species"),Hd=function(e){return Fd>=51||!jd((function(){var t=[];return(t.constructor={})[Bd]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Wd=Vd.map;Tr({target:"Array",proto:!0,forced:!Hd("map")},{map:function(e){return Wd(this,e,arguments.length>1?arguments[1]:void 0)}});var Gd=P,zd=ud,Jd=TypeError,qd=Object.getOwnPropertyDescriptor,Kd=Gd&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(Yq){return Yq instanceof TypeError}}(),Qd=TypeError,Xd=function(e){if(e>9007199254740991)throw Qd("Maximum allowed index exceeded");return e},Yd=We,$d=TypeError,Zd=function(e,t){if(!delete e[t])throw $d("Cannot delete property "+Yd(t)+" of "+Yd(e))},el=Tr,tl=lt,nl=Pi,il=Ri,rl=Li,al=Kd?function(e,t){if(zd(e)&&!qd(e,"length").writable)throw Jd("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},ol=Xd,sl=xd,cl=Jo,ul=Zd,dl=Hd("splice"),ll=Math.max,hl=Math.min;el({target:"Array",proto:!0,forced:!dl},{splice:function(e,t){var n,i,r,a,o,s,c=tl(this),u=rl(c),d=nl(e,u),l=arguments.length;for(0===l?n=i=0:1===l?(n=0,i=u-d):(n=l-2,i=hl(ll(il(t),0),u-d)),ol(u+n-i),r=sl(c,i),a=0;a<i;a++)(o=d+a)in c&&cl(r,a,c[o]);if(r.length=i,n<i){for(a=d;a<u-i;a++)s=a+n,(o=a+i)in c?c[s]=c[o]:ul(c,s);for(a=u;a>u-i+n;a--)ul(c,a-1)}else if(n>i)for(a=u-i;a>d;a--)s=a+n-1,(o=a+i-1)in c?c[s]=c[o]:ul(c,s);for(a=0;a<n;a++)c[a+d]=arguments[a+2];return al(c,u-i+n),r}});var pl=x,fl=function(e,t){var n=[][e];return!!n&&pl((function(){n.call(null,t||function(){return 1},1)}))},ml=Vd.forEach,_l=fl("forEach")?[].forEach:function(e){return ml(this,e,arguments.length>1?arguments[1]:void 0)};Tr({target:"Array",proto:!0,forced:[].forEach!=_l},{forEach:_l});var vl=C,gl=Cu,yl=Pu,Sl=_l,bl=In,kl=function(e){if(e&&e.forEach!==Sl)try{bl(e,"forEach",Sl)}catch(Yq){e.forEach=Sl}};for(var Il in gl)gl[Il]&&kl(vl[Il]&&vl[Il].prototype);kl(yl);var Tl=Tr,wl=x,El=ud,Rl=ye,Cl=lt,Al=Li,xl=Xd,Pl=Jo,Dl=xd,Ol=Hd,Ml=De,Nl=xt("isConcatSpreadable"),Ll=Ml>=51||!wl((function(){var e=[];return e[Nl]=!1,e.concat()[0]!==e})),Ul=Ol("concat"),Vl=function(e){if(!Rl(e))return!1;var t=e[Nl];return void 0!==t?!!t:El(e)};Tl({target:"Array",proto:!0,arity:1,forced:!Ll||!Ul},{concat:function(e){var t,n,i,r,a,o=Cl(this),s=Dl(o,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(Vl(a=-1===t?o:arguments[t]))for(r=Al(a),xl(c+r),n=0;n<r;n++,c++)n in a&&Pl(s,c,a[n]);else xl(c+1),Pl(s,c++,a);return s.length=c,s}});var jl=Tr,Fl=ae,Bl=he,Hl=fl,Wl=ee([].join),Gl=Fl!=Object,zl=Hl("join",",");jl({target:"Array",proto:!0,forced:Gl||!zl},{join:function(e){return Wl(Bl(this),void 0===e?",":e)}});var Jl=Vd.filter;Tr({target:"Array",proto:!0,forced:!Hd("filter")},{filter:function(e){return Jl(this,e,arguments.length>1?arguments[1]:void 0)}});var ql=ee,Kl=ki,Ql=Date.prototype,Xl="Invalid Date",Yl="toString",$l=ql(Ql.toString),Zl=ql(Ql.getTime);String(new Date(NaN))!=Xl&&Kl(Ql,Yl,(function(){var e=Zl(this);return e==e?$l(this):Xl}));var eh=Ri,th=du,nh=ue,ih=RangeError,rh=function(e){var t=th(nh(this)),n="",i=eh(e);if(i<0||Infinity==i)throw ih("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n},ah=ee,oh=Mi,sh=du,ch=ue,uh=ah(rh),dh=ah("".slice),lh=Math.ceil,hh=function(e){return function(t,n,i){var r,a,o=sh(ch(t)),s=oh(n),c=o.length,u=void 0===i?" ":sh(i);return s<=c||""==u?o:((a=uh(u,lh((r=s-c)/u.length))).length>r&&(a=dh(a,0,r)),e?o+a:a+o)}},ph={start:hh(!1),end:hh(!0)},fh=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(we),mh=ph.start;Tr({target:"String",proto:!0,forced:fh},{padStart:function(e){return mh(this,e,arguments.length>1?arguments[1]:void 0)}});var _h=un,vh=function(){var e=_h(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},gh=x,yh=C.RegExp,Sh=gh((function(){var e=yh("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),bh=Sh||gh((function(){return!yh("a","y").sticky})),kh={BROKEN_CARET:Sh||gh((function(){var e=yh("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:bh,UNSUPPORTED_Y:Sh},Ih=x,Th=C.RegExp,wh=Ih((function(){var e=Th(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Eh=x,Rh=C.RegExp,Ch=Eh((function(){var e=Rh("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Ah=N,xh=ee,Ph=du,Dh=vh,Oh=kh,Mh=tt.exports,Nh=na,Lh=ai.get,Uh=wh,Vh=Ch,jh=Mh("native-string-replace",String.prototype.replace),Fh=RegExp.prototype.exec,Bh=Fh,Hh=xh("".charAt),Wh=xh("".indexOf),Gh=xh("".replace),zh=xh("".slice),Jh=function(){var e=/a/,t=/b*/g;return Ah(Fh,e,"a"),Ah(Fh,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),qh=Oh.BROKEN_CARET,Kh=void 0!==/()??/.exec("")[1];(Jh||Kh||qh||Uh||Vh)&&(Bh=function(e){var t,n,i,r,a,o,s,c=this,u=Lh(c),d=Ph(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=Ah(Bh,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=qh&&c.sticky,f=Ah(Dh,c),m=c.source,_=0,v=d;if(p&&(f=Gh(f,"y",""),-1===Wh(f,"g")&&(f+="g"),v=zh(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Hh(d,c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,_++),n=new RegExp("^(?:"+m+")",f)),Kh&&(n=new RegExp("^"+m+"$(?!\\s)",f)),Jh&&(i=c.lastIndex),r=Ah(Fh,p?n:c,v),p?r?(r.input=zh(r.input,_),r[0]=zh(r[0],_),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Jh&&r&&(c.lastIndex=c.global?r.index+r[0].length:i),Kh&&r&&r.length>1&&Ah(jh,r[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(r[a]=void 0)})),r&&h)for(r.groups=o=Nh(null),a=0;a<h.length;a++)o[(s=h[a])[0]]=r[s[1]];return r});var Qh=Bh;Tr({target:"RegExp",proto:!0,forced:/./.exec!==Qh},{exec:Qh});var Xh=ee,Yh=ki,$h=Qh,Zh=x,ep=xt,tp=In,np=ep("species"),ip=RegExp.prototype,rp=function(e,t,n,i){var r=ep(e),a=!Zh((function(){var t={};return t[r]=function(){return 7},7!=""[e](t)})),o=a&&!Zh((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[np]=function(){return n},n.flags="",n[r]=/./[r]),n.exec=function(){return t=!0,null},n[r](""),!t}));if(!a||!o||n){var s=Xh(/./[r]),c=t(r,""[e],(function(e,t,n,i,r){var o=Xh(e),c=t.exec;return c===$h||c===ip.exec?a&&!r?{done:!0,value:s(t,n,i)}:{done:!0,value:o(n,t,i)}:{done:!1}}));Yh(String.prototype,e,c[0]),Yh(ip,r,c[1])}i&&tp(ip[r],"sham",!0)},ap=yu.charAt,op=function(e,t,n){return t+(n?ap(e,t).length:1)},sp=ee,cp=lt,up=Math.floor,dp=sp("".charAt),lp=sp("".replace),hp=sp("".slice),pp=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,fp=/\$([$&'`]|\d{1,2})/g,mp=N,_p=un,vp=_e,gp=Y,yp=Qh,Sp=TypeError,bp=function(e,t){var n=e.exec;if(vp(n)){var i=mp(n,e,t);return null!==i&&_p(i),i}if("RegExp"===gp(e))return mp(yp,e,t);throw Sp("RegExp#exec called on incompatible receiver")},kp=qu,Ip=N,Tp=ee,wp=rp,Ep=x,Rp=un,Cp=_e,Ap=oe,xp=Ri,Pp=Mi,Dp=du,Op=ue,Mp=op,Np=Xe,Lp=function(e,t,n,i,r,a){var o=n+e.length,s=i.length,c=fp;return void 0!==r&&(r=cp(r),c=pp),lp(a,c,(function(a,c){var u;switch(dp(c,0)){case"$":return"$";case"&":return e;case"`":return hp(t,0,n);case"'":return hp(t,o);case"<":u=r[hp(c,1,-1)];break;default:var d=+c;if(0===d)return a;if(d>s){var l=up(d/10);return 0===l?a:l<=s?void 0===i[l-1]?dp(c,1):i[l-1]+dp(c,1):a}u=i[d-1]}return void 0===u?"":u}))},Up=bp,Vp=xt("replace"),jp=Math.max,Fp=Math.min,Bp=Tp([].concat),Hp=Tp([].push),Wp=Tp("".indexOf),Gp=Tp("".slice),zp="$0"==="a".replace(/./,"$0"),Jp=!!/./[Vp]&&""===/./[Vp]("a","$0"),qp=!Ep((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));wp("replace",(function(e,t,n){var i=Jp?"$":"$0";return[function(e,n){var i=Op(this),r=Ap(e)?void 0:Np(e,Vp);return r?Ip(r,e,i,n):Ip(t,Dp(i),e,n)},function(e,r){var a=Rp(this),o=Dp(e);if("string"==typeof r&&-1===Wp(r,i)&&-1===Wp(r,"$<")){var s=n(t,a,o,r);if(s.done)return s.value}var c=Cp(r);c||(r=Dp(r));var u=a.global;if(u){var d=a.unicode;a.lastIndex=0}for(var l=[];;){var h=Up(a,o);if(null===h)break;if(Hp(l,h),!u)break;""===Dp(h[0])&&(a.lastIndex=Mp(o,Pp(a.lastIndex),d))}for(var p,f="",m=0,_=0;_<l.length;_++){for(var v=Dp((h=l[_])[0]),g=jp(Fp(xp(h.index),o.length),0),y=[],S=1;S<h.length;S++)Hp(y,void 0===(p=h[S])?p:String(p));var b=h.groups;if(c){var k=Bp([v],y,g,o);void 0!==b&&Hp(k,b);var I=Dp(kp(r,void 0,k))}else I=Lp(v,o,g,y,b,r);g>=m&&(f+=Gp(o,m,g)+I,m=g+v.length)}return f+Gp(o,m)}]}),!qp||!zp||Jp);var Kp=N,Qp=ft,Xp=Te,Yp=vh,$p=RegExp.prototype,Zp=function(e){var t=e.flags;return void 0!==t||"flags"in $p||Qp(e,"flags")||!Xp($p,e)?t:Kp(Yp,e)},ef=xn.PROPER,tf=ki,nf=un,rf=du,af=x,of=Zp,sf="toString",cf=RegExp.prototype.toString,uf=af((function(){return"/a/b"!=cf.call({source:"a",flags:"b"})})),df=ef&&cf.name!=sf;(uf||df)&&tf(RegExp.prototype,sf,(function(){var e=nf(this);return"/"+rf(e.source)+"/"+rf(of(e))}),{unsafe:!0});var lf=x,hf=xt("iterator"),pf=!lf((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,i){t.delete("b"),n+=i+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[hf]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host})),ff=$o,mf=Math.floor,_f=function(e,t){var n=e.length,i=mf(n/2);return n<8?vf(e,t):gf(e,_f(ff(e,0,i),t),_f(ff(e,i),t),t)},vf=function(e,t){for(var n,i,r=e.length,a=1;a<r;){for(i=a,n=e[a];i&&t(e[i-1],n)>0;)e[i]=e[--i];i!==a++&&(e[i]=n)}return e},gf=function(e,t,n,i){for(var r=t.length,a=n.length,o=0,s=0;o<r||s<a;)e[o+s]=o<r&&s<a?i(t[o],n[s])<=0?t[o++]:n[s++]:o<r?t[o++]:n[s++];return e},yf=_f,Sf=Tr,bf=C,kf=N,If=ee,Tf=P,wf=pf,Ef=ki,Rf=Bc,Cf=Ma,Af=Ba,xf=ai,Pf=fc,Df=_e,Of=ft,Mf=xs,Nf=Vo,Lf=un,Uf=ye,Vf=du,jf=na,Ff=H,Bf=qs,Hf=Fs,Wf=Xu,Gf=yf,zf=xt("iterator"),Jf="URLSearchParams",qf="URLSearchParamsIterator",Kf=xf.set,Qf=xf.getterFor(Jf),Xf=xf.getterFor(qf),Yf=Object.getOwnPropertyDescriptor,$f=function(e){if(!Tf)return bf[e];var t=Yf(bf,e);return t&&t.value},Zf=$f("fetch"),em=$f("Request"),tm=$f("Headers"),nm=em&&em.prototype,im=tm&&tm.prototype,rm=bf.RegExp,am=bf.TypeError,om=bf.decodeURIComponent,sm=bf.encodeURIComponent,cm=If("".charAt),um=If([].join),dm=If([].push),lm=If("".replace),hm=If([].shift),pm=If([].splice),fm=If("".split),mm=If("".slice),_m=/\+/g,vm=Array(4),gm=function(e){return vm[e-1]||(vm[e-1]=rm("((?:%[\\da-f]{2}){"+e+"})","gi"))},ym=function(e){try{return om(e)}catch(Yq){return e}},Sm=function(e){var t=lm(e,_m," "),n=4;try{return om(t)}catch(Yq){for(;n;)t=lm(t,gm(n--),ym);return t}},bm=/[!'()~]|%20/g,km={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Im=function(e){return km[e]},Tm=function(e){return lm(sm(e),bm,Im)},wm=Af((function(e,t){Kf(this,{type:qf,iterator:Bf(Qf(e).entries),kind:t})}),"Iterator",(function(){var e=Xf(this),t=e.kind,n=e.iterator.next(),i=n.value;return n.done||(n.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),n}),!0),Em=function(e){this.entries=[],this.url=null,void 0!==e&&(Uf(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===cm(e,0)?mm(e,1):e:Vf(e)))};Em.prototype={type:Jf,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,n,i,r,a,o,s,c=Hf(e);if(c)for(n=(t=Bf(e,c)).next;!(i=kf(n,t)).done;){if(a=(r=Bf(Lf(i.value))).next,(o=kf(a,r)).done||(s=kf(a,r)).done||!kf(a,r).done)throw am("Expected sequence with length 2");dm(this.entries,{key:Vf(o.value),value:Vf(s.value)})}else for(var u in e)Of(e,u)&&dm(this.entries,{key:u,value:Vf(e[u])})},parseQuery:function(e){if(e)for(var t,n,i=fm(e,"&"),r=0;r<i.length;)(t=i[r++]).length&&(n=fm(t,"="),dm(this.entries,{key:Sm(hm(n)),value:Sm(um(n,"="))}))},serialize:function(){for(var e,t=this.entries,n=[],i=0;i<t.length;)e=t[i++],dm(n,Tm(e.key)+"="+Tm(e.value));return um(n,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Rm=function(){Pf(this,Cm);var e=arguments.length>0?arguments[0]:void 0;Kf(this,new Em(e))},Cm=Rm.prototype;if(Rf(Cm,{append:function(e,t){Wf(arguments.length,2);var n=Qf(this);dm(n.entries,{key:Vf(e),value:Vf(t)}),n.updateURL()},delete:function(e){Wf(arguments.length,1);for(var t=Qf(this),n=t.entries,i=Vf(e),r=0;r<n.length;)n[r].key===i?pm(n,r,1):r++;t.updateURL()},get:function(e){Wf(arguments.length,1);for(var t=Qf(this).entries,n=Vf(e),i=0;i<t.length;i++)if(t[i].key===n)return t[i].value;return null},getAll:function(e){Wf(arguments.length,1);for(var t=Qf(this).entries,n=Vf(e),i=[],r=0;r<t.length;r++)t[r].key===n&&dm(i,t[r].value);return i},has:function(e){Wf(arguments.length,1);for(var t=Qf(this).entries,n=Vf(e),i=0;i<t.length;)if(t[i++].key===n)return!0;return!1},set:function(e,t){Wf(arguments.length,1);for(var n,i=Qf(this),r=i.entries,a=!1,o=Vf(e),s=Vf(t),c=0;c<r.length;c++)(n=r[c]).key===o&&(a?pm(r,c--,1):(a=!0,n.value=s));a||dm(r,{key:o,value:s}),i.updateURL()},sort:function(){var e=Qf(this);Gf(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,n=Qf(this).entries,i=Mf(e,arguments.length>1?arguments[1]:void 0),r=0;r<n.length;)i((t=n[r++]).value,t.key,this)},keys:function(){return new wm(this,"keys")},values:function(){return new wm(this,"values")},entries:function(){return new wm(this,"entries")}},{enumerable:!0}),Ef(Cm,zf,Cm.entries,{name:"entries"}),Ef(Cm,"toString",(function(){return Qf(this).serialize()}),{enumerable:!0}),Cf(Rm,Jf),Sf({global:!0,constructor:!0,forced:!wf},{URLSearchParams:Rm}),!wf&&Df(tm)){var Am=If(im.has),xm=If(im.set),Pm=function(e){if(Uf(e)){var t,n=e.body;if(Nf(n)===Jf)return t=e.headers?new tm(e.headers):new tm,Am(t,"content-type")||xm(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),jf(e,{body:Ff(0,Vf(n)),headers:Ff(0,t)})}return e};if(Df(Zf)&&Sf({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Zf(e,arguments.length>1?Pm(arguments[1]):{})}}),Df(em)){var Dm=function(e){return Pf(this,nm),new em(e,arguments.length>1?Pm(arguments[1]):{})};nm.constructor=Dm,Dm.prototype=nm,Sf({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Dm})}}var Om={URLSearchParams:Rm,getState:Qf},Mm=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Nm=N,Lm=un,Um=oe,Vm=ue,jm=Mm,Fm=du,Bm=Xe,Hm=bp;rp("search",(function(e,t,n){return[function(t){var n=Vm(this),i=Um(t)?void 0:Bm(t,e);return i?Nm(i,t,n):new RegExp(t)[e](Fm(n))},function(e){var i=Lm(this),r=Fm(e),a=n(t,i,r);if(a.done)return a.value;var o=i.lastIndex;jm(o,0)||(i.lastIndex=0);var s=Hm(i,r);return jm(i.lastIndex,o)||(i.lastIndex=o),null===s?-1:s.index}]}));(new Date).getTime();var Wm=0,Gm=function(){return(new Date).getTime()+Wm},zm=function(){var e=new Date;return e.setTime(Gm()),e.toLocaleString()},Jm=N,qm=un,Km=oe,Qm=Mi,Xm=du,Ym=ue,$m=Xe,Zm=op,e_=bp;rp("match",(function(e,t,n){return[function(t){var n=Ym(this),i=Km(t)?void 0:$m(t,e);return i?Jm(i,t,n):new RegExp(t)[e](Xm(n))},function(e){var i=qm(this),r=Xm(e),a=n(t,i,r);if(a.done)return a.value;if(!i.global)return e_(i,r);var o=i.unicode;i.lastIndex=0;for(var s,c=[],u=0;null!==(s=e_(i,r));){var d=Xm(s[0]);c[u]=d,""===d&&(i.lastIndex=Zm(r,Qm(i.lastIndex),o)),u++}return 0===u?null:c}]}));var t_=ye,n_=Y,i_=xt("match"),r_=function(e){var t;return t_(e)&&(void 0!==(t=e[i_])?!!t:"RegExp"==n_(e))},a_=rn.f,o_=P,s_=C,c_=ee,u_=_r,d_=Ic,l_=In,h_=Ii.f,p_=Te,f_=r_,m_=du,__=Zp,v_=kh,g_=function(e,t,n){n in e||a_(e,n,{configurable:!0,get:function(){return t[n]},set:function(e){t[n]=e}})},y_=ki,S_=x,b_=ft,k_=ai.enforce,I_=Jc,T_=wh,w_=Ch,E_=xt("match"),R_=s_.RegExp,C_=R_.prototype,A_=s_.SyntaxError,x_=c_(C_.exec),P_=c_("".charAt),D_=c_("".replace),O_=c_("".indexOf),M_=c_("".slice),N_=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,L_=/a/g,U_=/a/g,V_=new R_(L_)!==L_,j_=v_.MISSED_STICKY,F_=v_.UNSUPPORTED_Y,B_=o_&&(!V_||j_||T_||w_||S_((function(){return U_[E_]=!1,R_(L_)!=L_||R_(U_)==U_||"/a/i"!=R_(L_,"i")})));if(u_("RegExp",B_)){for(var H_=function(e,t){var n,i,r,a,o,s,c=p_(C_,this),u=f_(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===H_)return e;if((u||p_(C_,e))&&(e=e.source,d&&(t=__(h))),e=void 0===e?"":m_(e),t=void 0===t?"":m_(t),h=e,T_&&"dotAll"in L_&&(i=!!t&&O_(t,"s")>-1)&&(t=D_(t,/s/g,"")),n=t,j_&&"sticky"in L_&&(r=!!t&&O_(t,"y")>-1)&&F_&&(t=D_(t,/y/g,"")),w_&&(a=function(e){for(var t,n=e.length,i=0,r="",a=[],o={},s=!1,c=!1,u=0,d="";i<=n;i++){if("\\"===(t=P_(e,i)))t+=P_(e,++i);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:x_(N_,M_(e,i+1))&&(i+=2,c=!0),r+=t,u++;continue;case">"===t&&c:if(""===d||b_(o,d))throw new A_("Invalid capture group name");o[d]=!0,a[a.length]=[d,u],c=!1,d="";continue}c?d+=t:r+=t}return[r,a]}(e),e=a[0],l=a[1]),o=d_(R_(e,t),c?this:C_,H_),(i||r||l.length)&&(s=k_(o),i&&(s.dotAll=!0,s.raw=H_(function(e){for(var t,n=e.length,i=0,r="",a=!1;i<=n;i++)"\\"!==(t=P_(e,i))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),r+=t):r+="[\\s\\S]":r+=t+P_(e,++i);return r}(e),n)),r&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{l_(o,"source",""===h?"(?:)":h)}catch(Yq){}return o},W_=h_(R_),G_=0;W_.length>G_;)g_(H_,R_,W_[G_++]);C_.constructor=H_,H_.prototype=C_,y_(s_,"RegExp",H_,{constructor:!0})}I_("RegExp");var z_=ee(1..valueOf),J_="\t\n\v\f\r                　\u2028\u2029\ufeff",q_=ue,K_=du,Q_=ee("".replace),X_="[\t\n\v\f\r                　\u2028\u2029\ufeff]",Y_=RegExp("^"+X_+X_+"*"),$_=RegExp(X_+X_+"*$"),Z_=function(e){return function(t){var n=K_(q_(t));return 1&e&&(n=Q_(n,Y_,"")),2&e&&(n=Q_(n,$_,"")),n}},ev={start:Z_(1),end:Z_(2),trim:Z_(3)},tv=P,nv=C,iv=ee,rv=_r,av=ki,ov=ft,sv=Ic,cv=Te,uv=Be,dv=Vt,lv=x,hv=Ii.f,pv=A.f,fv=rn.f,mv=z_,_v=ev.trim,vv="Number",gv=nv.Number,yv=gv.prototype,Sv=nv.TypeError,bv=iv("".slice),kv=iv("".charCodeAt),Iv=function(e){var t=dv(e,"number");return"bigint"==typeof t?t:Tv(t)},Tv=function(e){var t,n,i,r,a,o,s,c,u=dv(e,"number");if(uv(u))throw Sv("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=_v(u),43===(t=kv(u,0))||45===t){if(88===(n=kv(u,2))||120===n)return NaN}else if(48===t){switch(kv(u,1)){case 66:case 98:i=2,r=49;break;case 79:case 111:i=8,r=55;break;default:return+u}for(o=(a=bv(u,2)).length,s=0;s<o;s++)if((c=kv(a,s))<48||c>r)return NaN;return parseInt(a,i)}return+u};if(rv(vv,!gv(" 0o1")||!gv("0b1")||gv("+0x1"))){for(var wv,Ev=function(e){var t=arguments.length<1?0:gv(Iv(e)),n=this;return cv(yv,n)&&lv((function(){mv(n)}))?sv(Object(t),n,Ev):t},Rv=tv?hv(gv):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),Cv=0;Rv.length>Cv;Cv++)ov(gv,wv=Rv[Cv])&&!ov(Ev,wv)&&fv(Ev,wv,pv(gv,wv));Ev.prototype=yv,yv.constructor=Ev,av(nv,vv,Ev,{constructor:!0})}var Av=Bi.includes,xv=la;Tr({target:"Array",proto:!0,forced:x((function(){return!Array(1).includes()}))},{includes:function(e){return Av(this,e,arguments.length>1?arguments[1]:void 0)}}),xv("includes");var Pv=r_,Dv=TypeError,Ov=function(e){if(Pv(e))throw Dv("The method doesn't accept regular expressions");return e},Mv=xt("match"),Nv=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[Mv]=!1,"/./"[e](t)}catch(i){}}return!1},Lv=Tr,Uv=Ov,Vv=ue,jv=du,Fv=Nv,Bv=ee("".indexOf);Lv({target:"String",proto:!0,forced:!Fv("includes")},{includes:function(e){return!!~Bv(jv(Vv(this)),jv(Uv(e)),arguments.length>1?arguments[1]:void 0)}});var Hv=Tr,Wv=Bi.indexOf,Gv=fl,zv=ee([].indexOf),Jv=!!zv&&1/zv([1],1,-0)<0,qv=Gv("indexOf");Hv({target:"Array",proto:!0,forced:Jv||!qv},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Jv?zv(this,e,t)||0:Wv(this,e,t)}});var Kv=lt,Qv=ba,Xv=pa;Tr({target:"Object",stat:!0,forced:x((function(){Qv(1)})),sham:!Xv},{getPrototypeOf:function(e){return Qv(Kv(e))}});var Yv=qu,$v=qe,Zv=un;Tr({target:"Reflect",stat:!0,forced:!x((function(){Reflect.apply((function(){}))}))},{apply:function(e,t,n){return Yv($v(e),t,Zv(n))}});var eg=P,tg=xn.EXISTS,ng=ee,ig=rn.f,rg=Function.prototype,ag=ng(rg.toString),og=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,sg=ng(og.exec);eg&&!tg&&ig(rg,"name",{configurable:!0,get:function(){try{return sg(og,ag(this))[1]}catch(Yq){return""}}});var cg=Tr,ug=Date,dg=ee(ug.prototype.getTime);cg({target:"Date",stat:!0},{now:function(){return dg(new ug)}});var lg,hg,pg,fg,mg="process"==Y(C.process),_g=Id,vg=We,gg=TypeError,yg=function(e){if(_g(e))return e;throw gg(vg(e)+" is not a constructor")},Sg=un,bg=yg,kg=oe,Ig=xt("species"),Tg=function(e,t){var n,i=Sg(e).constructor;return void 0===i||kg(n=Sg(i)[Ig])?t:bg(n)},wg=/(?:ipad|iphone|ipod).*applewebkit/i.test(we),Eg=C,Rg=qu,Cg=xs,Ag=_e,xg=ft,Pg=x,Dg=Gr,Og=Ku,Mg=zt,Ng=Xu,Lg=wg,Ug=mg,Vg=Eg.setImmediate,jg=Eg.clearImmediate,Fg=Eg.process,Bg=Eg.Dispatch,Hg=Eg.Function,Wg=Eg.MessageChannel,Gg=Eg.String,zg=0,Jg={},qg="onreadystatechange";try{lg=Eg.location}catch(Yq){}var Kg=function(e){if(xg(Jg,e)){var t=Jg[e];delete Jg[e],t()}},Qg=function(e){return function(){Kg(e)}},Xg=function(e){Kg(e.data)},Yg=function(e){Eg.postMessage(Gg(e),lg.protocol+"//"+lg.host)};Vg&&jg||(Vg=function(e){Ng(arguments.length,1);var t=Ag(e)?e:Hg(e),n=Og(arguments,1);return Jg[++zg]=function(){Rg(t,void 0,n)},hg(zg),zg},jg=function(e){delete Jg[e]},Ug?hg=function(e){Fg.nextTick(Qg(e))}:Bg&&Bg.now?hg=function(e){Bg.now(Qg(e))}:Wg&&!Lg?(fg=(pg=new Wg).port2,pg.port1.onmessage=Xg,hg=Cg(fg.postMessage,fg)):Eg.addEventListener&&Ag(Eg.postMessage)&&!Eg.importScripts&&lg&&"file:"!==lg.protocol&&!Pg(Yg)?(hg=Yg,Eg.addEventListener("message",Xg,!1)):hg=qg in Mg("script")?function(e){Dg.appendChild(Mg("script")).onreadystatechange=function(){Dg.removeChild(this),Kg(e)}}:function(e){setTimeout(Qg(e),0)});var $g,Zg,ey,ty,ny,iy,ry,ay,oy={set:Vg,clear:jg},sy=C,cy=/ipad|iphone|ipod/i.test(we)&&void 0!==sy.Pebble,uy=/web0s(?!.*chrome)/i.test(we),dy=C,ly=xs,hy=A.f,py=oy.set,fy=wg,my=cy,_y=uy,vy=mg,gy=dy.MutationObserver||dy.WebKitMutationObserver,yy=dy.document,Sy=dy.process,by=dy.Promise,ky=hy(dy,"queueMicrotask"),Iy=ky&&ky.value;Iy||($g=function(){var e,t;for(vy&&(e=Sy.domain)&&e.exit();Zg;){t=Zg.fn,Zg=Zg.next;try{t()}catch(Yq){throw Zg?ty():ey=void 0,Yq}}ey=void 0,e&&e.enter()},fy||vy||_y||!gy||!yy?!my&&by&&by.resolve?((ry=by.resolve(void 0)).constructor=by,ay=ly(ry.then,ry),ty=function(){ay($g)}):vy?ty=function(){Sy.nextTick($g)}:(py=ly(py,dy),ty=function(){py($g)}):(ny=!0,iy=yy.createTextNode(""),new gy($g).observe(iy,{characterData:!0}),ty=function(){iy.data=ny=!ny}));var Ty=Iy||function(e){var t={fn:e,next:void 0};ey&&(ey.next=t),Zg||(Zg=t,ty()),ey=t},wy=C,Ey=function(e){try{return{error:!1,value:e()}}catch(Yq){return{error:!0,value:Yq}}},Ry=function(){this.head=null,this.tail=null};Ry.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var Cy=Ry,Ay=C.Promise,xy="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Py=!xy&&!mg&&"object"==typeof window&&"object"==typeof document,Dy=C,Oy=Ay,My=_e,Ny=_r,Ly=Un,Uy=xt,Vy=Py,jy=xy,Fy=De;Oy&&Oy.prototype;var By=Uy("species"),Hy=!1,Wy=My(Dy.PromiseRejectionEvent),Gy=Ny("Promise",(function(){var e=Ly(Oy),t=e!==String(Oy);if(!t&&66===Fy)return!0;if(!Fy||Fy<51||!/native code/.test(e)){var n=new Oy((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((n.constructor={})[By]=i,!(Hy=n.then((function(){}))instanceof i))return!0}return!t&&(Vy||jy)&&!Wy})),zy={CONSTRUCTOR:Gy,REJECTION_EVENT:Wy,SUBCLASSING:Hy},Jy={},qy=qe,Ky=TypeError,Qy=function(e){var t,n;this.promise=new e((function(e,i){if(void 0!==t||void 0!==n)throw Ky("Bad Promise constructor");t=e,n=i})),this.resolve=qy(t),this.reject=qy(n)};Jy.f=function(e){return new Qy(e)};var Xy,Yy,$y,Zy=Tr,eS=mg,tS=C,nS=N,iS=ki,rS=Ka,aS=Ma,oS=Jc,sS=qe,cS=_e,uS=ye,dS=fc,lS=Tg,hS=oy.set,pS=Ty,fS=function(e,t){var n=wy.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t))},mS=Ey,_S=Cy,vS=ai,gS=Ay,yS=Jy,SS="Promise",bS=zy.CONSTRUCTOR,kS=zy.REJECTION_EVENT,IS=zy.SUBCLASSING,TS=vS.getterFor(SS),wS=vS.set,ES=gS&&gS.prototype,RS=gS,CS=ES,AS=tS.TypeError,xS=tS.document,PS=tS.process,DS=yS.f,OS=DS,MS=!!(xS&&xS.createEvent&&tS.dispatchEvent),NS="unhandledrejection",LS=function(e){var t;return!(!uS(e)||!cS(t=e.then))&&t},US=function(e,t){var n,i,r,a=t.value,o=1==t.state,s=o?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(o||(2===t.rejection&&HS(t),t.rejection=1),!0===s?n=a:(d&&d.enter(),n=s(a),d&&(d.exit(),r=!0)),n===e.promise?u(AS("Promise-chain cycle")):(i=LS(n))?nS(i,n,c,u):c(n)):u(a)}catch(Yq){d&&!r&&d.exit(),u(Yq)}},VS=function(e,t){e.notified||(e.notified=!0,pS((function(){for(var n,i=e.reactions;n=i.get();)US(n,e);e.notified=!1,t&&!e.rejection&&FS(e)})))},jS=function(e,t,n){var i,r;MS?((i=xS.createEvent("Event")).promise=t,i.reason=n,i.initEvent(e,!1,!0),tS.dispatchEvent(i)):i={promise:t,reason:n},!kS&&(r=tS["on"+e])?r(i):e===NS&&fS("Unhandled promise rejection",n)},FS=function(e){nS(hS,tS,(function(){var t,n=e.facade,i=e.value;if(BS(e)&&(t=mS((function(){eS?PS.emit("unhandledRejection",i,n):jS(NS,n,i)})),e.rejection=eS||BS(e)?2:1,t.error))throw t.value}))},BS=function(e){return 1!==e.rejection&&!e.parent},HS=function(e){nS(hS,tS,(function(){var t=e.facade;eS?PS.emit("rejectionHandled",t):jS("rejectionhandled",t,e.value)}))},WS=function(e,t,n){return function(i){e(t,i,n)}},GS=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,VS(e,!0))},zS=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw AS("Promise can't be resolved itself");var i=LS(t);i?pS((function(){var n={done:!1};try{nS(i,t,WS(zS,n,e),WS(GS,n,e))}catch(Yq){GS(n,Yq,e)}})):(e.value=t,e.state=1,VS(e,!1))}catch(Yq){GS({done:!1},Yq,e)}}};if(bS&&(CS=(RS=function(e){dS(this,CS),sS(e),nS(Xy,this);var t=TS(this);try{e(WS(zS,t),WS(GS,t))}catch(Yq){GS(t,Yq)}}).prototype,(Xy=function(e){wS(this,{type:SS,done:!1,notified:!1,parent:!1,reactions:new _S,rejection:!1,state:0,value:void 0})}).prototype=iS(CS,"then",(function(e,t){var n=TS(this),i=DS(lS(this,RS));return n.parent=!0,i.ok=!cS(e)||e,i.fail=cS(t)&&t,i.domain=eS?PS.domain:void 0,0==n.state?n.reactions.add(i):pS((function(){US(i,n)})),i.promise})),Yy=function(){var e=new Xy,t=TS(e);this.promise=e,this.resolve=WS(zS,t),this.reject=WS(GS,t)},yS.f=DS=function(e){return e===RS||undefined===e?new Yy(e):OS(e)},cS(gS)&&ES!==Object.prototype)){$y=ES.then,IS||iS(ES,"then",(function(e,t){var n=this;return new RS((function(e,t){nS($y,n,e,t)})).then(e,t)}),{unsafe:!0});try{delete ES.constructor}catch(Yq){}rS&&rS(ES,CS)}Zy({global:!0,constructor:!0,wrap:!0,forced:bS},{Promise:RS}),aS(RS,SS,!1),oS(SS);var JS=Ay,qS=zy.CONSTRUCTOR||!yc((function(e){JS.all(e).then(void 0,(function(){}))})),KS=N,QS=qe,XS=Jy,YS=Ey,$S=lc;Tr({target:"Promise",stat:!0,forced:qS},{all:function(e){var t=this,n=XS.f(t),i=n.resolve,r=n.reject,a=YS((function(){var n=QS(t.resolve),a=[],o=0,s=1;$S(e,(function(e){var c=o++,u=!1;s++,KS(n,t,e).then((function(e){u||(u=!0,a[c]=e,--s||i(a))}),r)})),--s||i(a)}));return a.error&&r(a.value),n.promise}});var ZS=Tr,eb=zy.CONSTRUCTOR,tb=Ay,nb=Ie,ib=_e,rb=ki,ab=tb&&tb.prototype;if(ZS({target:"Promise",proto:!0,forced:eb,real:!0},{catch:function(e){return this.then(void 0,e)}}),ib(tb)){var ob=nb("Promise").prototype.catch;ab.catch!==ob&&rb(ab,"catch",ob,{unsafe:!0})}var sb=N,cb=qe,ub=Jy,db=Ey,lb=lc;Tr({target:"Promise",stat:!0,forced:qS},{race:function(e){var t=this,n=ub.f(t),i=n.reject,r=db((function(){var r=cb(t.resolve);lb(e,(function(e){sb(r,t,e).then(n.resolve,i)}))}));return r.error&&i(r.value),n.promise}});var hb=N,pb=Jy;Tr({target:"Promise",stat:!0,forced:zy.CONSTRUCTOR},{reject:function(e){var t=pb.f(this);return hb(t.reject,void 0,e),t.promise}});var fb=un,mb=ye,_b=Jy,vb=function(e,t){if(fb(e),mb(t)&&t.constructor===e)return t;var n=_b.f(e);return(0,n.resolve)(t),n.promise},gb=Tr,yb=zy.CONSTRUCTOR,Sb=vb;Ie("Promise"),gb({target:"Promise",stat:!0,forced:yb},{resolve:function(e){return Sb(this,e)}});var bb=lt,kb=Lr;Tr({target:"Object",stat:!0,forced:x((function(){kb(1)}))},{keys:function(e){return kb(bb(e))}});var Ib="canvas",Tb="audio",wb="video",Eb="screen",Rb="small",Cb="big",Ab="auxiliary",xb="aux",Pb="smallVideo",Db="user",Ob="environment",Mb="mute",Nb="unmute",Lb="ended",Ub="playing",Vb="pause",jb="error",Fb="loadeddata",Bb="audioinput",Hb="videoinput",Wb="detail",Gb="text",zb="main",Jb="backup",qb="banned",Kb="kick",Qb="user_time_out",Xb="room_disband",Yb="sei-message",$b="PLAYING",Zb="PAUSED",ek="STOPPED",tk="inactive",nk="sendonly",ik="recvonly",rk="add",ak="remove",ok="replace",sk="track",ck="wss://trtc.rtc.qq.com",uk="wss://webrtc.qq.com",dk="qcloud",lk="trtc",hk="webrtc",pk="",fk="jssdk_log",mk="jssdk_event",_k="jssdk_new_endreport",vk=function(e){return pk=e},gk=1,yk=2,Sk="live",bk=20,kk=21,Ik="anchor",Tk="audience",wk="5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV",Ek="224d130c-7b5c-415b-aaa2-79c2eb5a6df2",Rk=2,Ck=zb,Ak=Ab,xk="unknown",Pk="DISCONNECTED",Dk="CONNECTING",Ok="RECONNECTING",Mk="CONNECTED",Nk="new",Lk="connecting",Uk="failed",Vk="closed",jk="disconnected",Fk="connected",Bk="completed",Hk=30,Wk="join",Gk="delta-join",zk="rejoin",Jk="leave",qk="delta-leave",Kk="publish",Qk="delta-publish",Xk="unpublish",Yk="subscribe",$k="unsubscribe",Zk="uplink-connection",eI="uplink-reconnection",tI="downlink-connection",nI="downlink-reconnection",iI="setLocalDescription",rI="setRemoteDescription",aI="iceConnectionState",oI="stream-initialize",sI="websocketConnectionState",cI="websocketReconnectionState",uI="update-stream",dI="recover-subscription",lI="start-mix-transcode",hI="stop-mix-transcode",pI="player-error",fI="schedule",mI="unsubscribe",_I="subscribe_change",vI="unified-plan",gI="plan-b",yI={MANUAL:"manual",PRESET_LAYOUT:"preset-layout"},SI={REMOTE:"$PLACE_HOLDER_REMOTE$"},bI={IT_AUDIO_VIDEO:0,IT_PICTURE:2,IT_CANVAS:3,IT_PURE_AUDIO:4,IT_PURE_VIDEO:5},kI="string",II="number",TI="boolean",wI="array",EI="object",RI={ADD:rk,REMOVE:ak},CI={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5},AI=-1,xI=0,PI=1,DI=Cb,OI=Rb,MI=6048e5,NI="schedule.cloud-rtc.com",LI="schedule.rtc.qcloud.com",UI="schedule.rtc.tencentcloud.com",VI="schedule-ecdn.rtc.tencentcloud.com",jI="",FI=function(e){return jI=e},BI="TRTC",HI="Client",WI="LocalStream",GI="RemoteStream",zI="Stream",JI="web.sdk.qcloud.com",qI="web.sdk.tencent.cn",KI="web.sdk.cloud.tencent.cn",QI="https://console.cloud.tencent.com/trtc",XI="https://".concat(JI,"/trtc/webrtc/doc"),YI="".concat(XI,"/zh-cn/"),$I="trtc_error_assistance",ZI="default",eT="communications",tT={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5},nT=1,iT=2,rT=1,aT=2,oT=Object.keys(tT),sT=["normal leave","timeout leave","kick","role change"],cT=2e3,uT="ric",dT="raf",lT="interval",hT="timeout",pT="Resolution reset to 1080p, need to upgrade ability here https://cloud.tencent.com/document/product/647/85386",fT={"TRTC.checkSystemRequirements":40001,"TRTC.isScreenShareSupported":40002,"TRTC.isSmallStreamSupported":40003,"TRTC.createClient.rtc":40004,"TRTC.createClient.live":40005,"TRTC.createClient.intRoomId":40006,"TRTC.createClient.stringRoomId":40007,"TRTC.createClient.autoSubscribe":40008,"TRTC.createClient.manualSubscribe":40009,"TRTC.enableUploadLog":40010,"TRTC.disableUploadLog":40011,"Client.publish":40012,"Client.publish.isAuxiliary":40013,"Client.switchRole":40014,"Client.startPublishCDNStream":40015,"Client.stopPublishCDNStream":40016,"Client.startMixTranscode":40017,"Client.stopMixTranscode":40018,"Client.enableAudioVolumeEvaluation":40019,"Client.enableSmallStream":40020,"Client.disableSmallStream":40021,"Client.setSmallStreamProfile":40022,"Client.setRemoteVideoStreamType":40023,"Client.sendSEIMessage":40024,"Client.setProxyServer":40025,"Client.setTurnServer":40026,"LocalStream.setAudioProfile.standard":40027,"LocalStream.setAudioProfile.high":40028,"LocalStream.setAudioProfile.standard-stereo":40029,"LocalStream.setAudioProfile.high-stereo":40030,"LocalStream.setVideoProfile.120p":40031,"LocalStream.setVideoProfile.120p_2":40032,"LocalStream.setVideoProfile.180p":40033,"LocalStream.setVideoProfile.180p_2":40034,"LocalStream.setVideoProfile.240p":40035,"LocalStream.setVideoProfile.240p_2":40036,"LocalStream.setVideoProfile.360p":40037,"LocalStream.setVideoProfile.360p_2":40038,"LocalStream.setVideoProfile.480p":40039,"LocalStream.setVideoProfile.480p_2":40040,"LocalStream.setVideoProfile.720p":40041,"LocalStream.setVideoProfile.1080p":40042,"LocalStream.setVideoProfile.1440p":40043,"LocalStream.setVideoProfile.4K":40044,"LocalStream.setScreenProfile.480p":40045,"LocalStream.setScreenProfile.480p_2":40046,"LocalStream.setScreenProfile.720p":40047,"LocalStream.setScreenProfile.720p_2":40048,"LocalStream.setScreenProfile.1080p":40049,"LocalStream.setScreenProfile.1080p_2":40050,"LocalStream.setVideoContentHint.motion":40051,"LocalStream.setVideoContentHint.detail":40052,"LocalStream.setVideoContentHint.text":40053,"LocalStream.setAudioCaptureVolume":40054,"LocalStream.getVideoFrame":40055,"RemoteStream.setAudioOutput":40056,"RemoteStream.getVideoFrame":40057,AI_DENOISER:1700,SPATIAL_AUDIO:1701,"2K_4K":1704},mT=["width","height","frameRate","facingMode","sampleRate","sampleSize","channelCount","deviceId"],_T=ue,vT=du,gT=/"/g,yT=ee("".replace),ST=function(e,t,n,i){var r=vT(_T(e)),a="<"+t;return""!==n&&(a+=" "+n+'="'+yT(vT(i),gT,"&quot;")+'"'),a+">"+r+"</"+t+">"},bT=x,kT=function(e){return bT((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))},IT=ST;Tr({target:"String",proto:!0,forced:kT("link")},{link:function(e){return IT(this,"a","href",e)}}),Tr({target:"Array",stat:!0},{isArray:ud});var TT="AVOID_REPEATED_CALL",wT="INVALID_PARAMETER_REQUIRED",ET="INVALID_PARAMETER_TYPE",RT="INVALID_PARAMETER_EMPTY",CT="INVALID_PARAMETER_INSTANCE",AT="INVALID_PARAMETER_RANGE",xT="API_CALL_TIMEOUT",PT="SIGNAL_CHANNEL_RECONNECTION_FAILED",DT="SIGNAL_CHANNEL_SETUP_FAILED",OT="ERROR_MESSAGE",MT="EXCHANGE_SDP_TIMEOUT",NT="DOWNLINK_RECONNECTION_FAILED",LT="EXCHANGE_SDP_FAILED",UT="UPLINK_RECONNECTION_FAILED",VT="INVALID_PURE_AUDIO",jT="INVALID_STREAMID",FT="INVALID_USER_DEFINE_RECORDID",BT="INVALID_USER_DEFINE_PUSH_ARGS",HT="INVALID_PROXY",WT="INVALID_JOIN",GT="INVALID_ROOMID_STRING",zT="INVALID_ROOMID_INTEGER",JT="JOIN_ROOM_TIMEOUT",qT="JOIN_ROOM_FAILED",KT="REJOIN_ROOM_FAILED",QT="INVALID_DESTROY",XT="INVALID_PUBLISH",YT="INVALID_UNPUBLISH",$T="INVALID_AUDIENCE",ZT="INVALID_INITIALIZE",ew="INVALID_DUPLICATE_PUBLISHING",tw="INVALID_REMOTE_STREAM",nw="SUBSCRIBE_FAILED",iw="INVALID_ROLE",rw="INVALID_OPERATION_SWITCH_ROLE",aw="SWITCH_ROLE_TIMEOUT",ow="SWITCH_ROLE_FAILED",sw="CLIENT_BANNED",cw="INVALID_OPERATION_START_PUBLISH_CDN",uw="INVALID_OPERATION_STOP_PUBLISH_CDN",dw="INVALID_STREAM_ID",lw="START_PUBLISH_CDN_FAILED",hw="STOP_PUBLISH_CDN_FAILED",pw="START_MIX_TRANSCODE",fw="STOP_MIX_TRANSCODE",mw="INVALID_AUDIO_VOLUME",_w="ENABLE_SMALL_STREAM_PUBLISHED",vw="DISABLE_SMALL_STREAM_PUBLISHED",gw="NOT_SUPPORTED_SMALL_STREAM",yw="INVALID_SMALL_STREAM_PROFILE",Sw="INVALID_PARAMETER_REMOTE_STREAM",bw="INVALID_SWITCH_DEVICE",kw="INVALID_SWITCH_DEVICE_PUBLISHING",Iw="INVALID_REPLACE_TRACK",Tw="INVALID_INITIALIZE_LOCAL_STREAM",ww="INVALID_ADD_TRACK_REPETITIVE",Ew="INVALID_ADD_TRACK_REMOVING",Rw="INVALID_ADD_TRACK_PUBLISHING",Cw="INVALID_STREAM_INITIALIZED",Aw="INVALID_ADD_TRACK_NUMBER",xw="INVALID_REMOVE_AUDIO_TRACK",Pw="INVALID_REMOVE_AUDIO_ADDING",Dw="INVALID_REMOVE_AUDIO_ON",Ow="INVALID_REMOVE_TRACK_PUBLISHING",Mw="INVALID_REMOVE_TRACK_NOT_PUBLISHING",Nw="INVALID_REMOVE_TRACK_NUMBER",Lw="INVALID_REPLACE_TRACK_NO_TRACK",Uw="REPEAT_JOIN",Vw="CLIENT_DESTROYED",jw="START_MIX_TRANSCODE_FAILED",Fw="STOP_MIX_TRANSCODE_FAILED",Bw="MIX_TRANSCODE_NOT_STARTED",Hw="CANNOT_LESS_THAN_ZERO",Ww="MIX_PARAMS_VIDEO_FRAMERATE",Gw="MIX_PARAMS_VIDEO_GOP",zw="MIX_PARAMS_AUDIO_BITRATE",Jw="MIX_PARAMS_USER_Z_ORDER",qw="MIX_PARAMS_NOT_SELF",Kw="MIX_PARAMS_USER_STREAM",Qw="INVALID_ELEMENT_ID",Xw="INVALID_ELEMENT_ID_TYPE",Yw="PLAY_FAILED",$w="INVALID_CREATE_STREAM_SOURCE",Zw="INVALID_CREATE_STREAM_SCREEN",eE="INVALID_CREATE_STREAM_AUDIO",tE="INVALID_CREATE_STREAM_SCREEN_AUDIO",nE="NOT_SUPPORTED_HTTP",iE="NOT_SUPPORTED_WEBRTC",rE="NOT_SUPPORTED_PROFILE",aE="NOT_SUPPORTED_H264ENCODE",oE="NOT_SUPPORTED_H264DECODE",sE="NOT_SUPPORTED_TRACK",cE="NOT_SUPPORTED_SWITCH_DEVICE",uE="NOT_SUPPORTED_CAPTURE",dE="NOT_SUPPORTED_AUX",lE="MICROPHONE_NOT_FOUND",hE="CAMERA_NOT_FOUND",pE="SIGNAL_RESPONSE_FAILED",fE="CATCH_HANDLER_ERROR",mE="API_NOT_EXIST",_E="CONNECTION_CLOSED",vE="SUBSCRIBE_ALL_FALSE",gE="SEI_NOT_SUPPORT",yE="SEI_DISABLED",SE="SEI_EMPTY",bE="SEI_OVERSIZE",kE="SEI_BEFORE_PUBLISH",IE="SEI_NOT_VIDEO",TE="CALL_FREQUENCY_LIMIT",wE="CONNECTION_ABORTED",EE="API_CALL_ABORTED",RE="DUPLICATE_AUX",CE={AVOID_REPEATED_CALL:function(e){return"previous ".concat(e.name,"() is ongoing, please avoid repeated calls.")},INVALID_PARAMETER_REQUIRED:function(e){var t=e.key,n=e.rule,i=e.fnName,r=e.value;return"'".concat(t||n.name,"' is a required param when calling ").concat(i,"(), received: ").concat(r,".")},INVALID_PARAMETER_TYPE:function(e){var t=e.key,n=e.rule,i=e.fnName,r=e.value,a="".concat(t||n.name),o="";return o=Array.isArray(n.type)?n.type.join("|"):n.type,"'".concat(a,"' must be type of ").concat(o," when calling ").concat(i,"(), received type: ").concat(mC(r),".")},INVALID_PARAMETER_EMPTY:function(e){var t=e.key,n=e.rule,i=e.fnName,r=e.value;return"'".concat(t||n.name,"' cannot be '").concat(r,"' when calling ").concat(i,"().")},INVALID_PARAMETER_INSTANCE:function(e){var t=e.key,n=e.rule,i=e.fnName,r=e.value,a="".concat(t||n.name),o="".concat(n.instanceOf.name||n.instanceOf);return"'".concat(a,"' must be instanceof ").concat(o," when calling ").concat(i,"(), received type: ").concat(mC(r),".")},INVALID_PARAMETER_RANGE:function(e){var t=e.key,n=e.rule,i=e.fnName,r=e.value;return"'".concat(t||n.name,"' must be one of ").concat(n.values.join("|")," when calling ").concat(i,"(), received: ").concat(r,".")},API_CALL_TIMEOUT:function(e){return"".concat(e.commandDesc||e.command," timeout observed.")},SIGNAL_CHANNEL_RECONNECTION_FAILED:"signal channel reconnection failed, please check your network.",SIGNAL_CHANNEL_SETUP_FAILED:function(e){return"SignalChannel setup failure: (errorCode: ".concat(e.errorCode,", errorMsg: ").concat(e.errorMsg," }).")},ERROR_MESSAGE:function(e){var t="".concat(e.type," failed");return e.message&&(t="".concat(t,": ").concat(e.message,".")),t},EXCHANGE_SDP_TIMEOUT:"exchange sdp timeout.",DOWNLINK_RECONNECTION_FAILED:"downlink reconnection failed, please check your network and re-join room.",EXCHANGE_SDP_FAILED:function(e){return"exchange sdp failed ".concat(e.errMsg,".")},UPDATE_OFFER_TIMEOUT:"update offer timeout observed.",UPLINK_RECONNECTION_FAILED:"uplink reconnection failed, please check your network and publish again.",INVALID_RECORDID:"recordId must be an integer number.",INVALID_PURE_AUDIO:"pureAudioPushMode must be 1 or 2.",INVALID_STREAMID:"streamId must be a sting literal within 64 bytes, and not be empty.",INVALID_USER_DEFINE_RECORDID:"userDefineRecordId must be a sting literal contains (a-zA-Z),(0-9), underline and hyphen, within 64 bytes, and not be empty.",INVALID_USER_DEFINE_PUSH_ARGS:"userDefinePushArgs must be a sting literal within 256 bytes, and not be empty.",INVALID_PROXY:'proxy server url must start with "wss://".',INVALID_JOIN:"duplicate join() called.",INVALID_ROOMID_STRING:function(e){return"'".concat(e,"' must be validate string when useStringRoomId is true.")},INVALID_ROOMID_INTEGER:function(e){return"'".concat(e,"' must be an integer between [1, 4294967294] when useStringRoomId is false.")},INVALID_SIGNAL_CHANNEL:"SignalChannel is not ready yet.",JOIN_ROOM_TIMEOUT:"join room timeout.",JOIN_ROOM_FAILED:function(e){var t=e.error,n=e.code;return"Failed to join room - ".concat(t," code: ").concat(n)},REJOIN_ROOM_FAILED:function(e){return"reJoin room: ".concat(e.roomId," failed, please check your network.")},INVALID_DESTROY:"please call leave() before destroy().",INVALID_PUBLISH:"please call join() before publish().",INVALID_UNPUBLISH:"stream has not been published yet.",INVALID_AUDIENCE:"no permission to publish() under live/".concat(Tk,', please call switchRole("').concat(Ik,'") firstly before publish().'),INVALID_INITIALIZE:"cannot publish stream because stream is not initialized, is switching device, or has been closed.",INVALID_DUPLICATE_PUBLISHING:function(e){return"duplicate ".concat(e," stream publishing, please unpublish your prev ").concat(e," stream and then re-publish.")},INVALID_SUBSCRIBE_UNDEFINED:"stream is undefined or null.",INVALID_SUBSCRIBE_LOCAL:"stream cannot be LocalStream.",INVALID_REMOTE_STREAM:"remoteStream does not exist because it has been unpublished by remote peer.",SUBSCRIBE_FAILED:function(e){var t=e.message,n=e.stream;return"failed to subscribe ".concat(n.getUserId()," ").concat(n.getType()," stream, reason: ").concat(t,".")},INVALID_ROLE:"switchRole can only be called in live mode.",INVALID_PARAMETER_SWITCH_ROLE:"role could only be set to a value as ".concat(Ik," or ").concat(Tk,"."),INVALID_OPERATION_SWITCH_ROLE:"please call join() before switchRole().",SWITCH_ROLE_TIMEOUT:"switchRole timeout.",SWITCH_ROLE_FAILED:function(e){return"switchRole failed, errCode: ".concat(e.code," errMsg: ").concat(e.message,".")},CLIENT_BANNED:function(e){return"client was banned because of "+e.message+"."},INVALID_OPERATION_START_PUBLISH_CDN:"please call startPublishCDNStream() before client join the room or after client join the room and successfully publish the local stream.",INVALID_OPERATION_STOP_PUBLISH_CDN:"please call startPublishCDNStream() before stopPublishCDNStream().",START_PUBLISH_CDN_FAILED:function(e){return"startPublishCDNStream failed, errMsg: ".concat(e.message,".")},STOP_PUBLISH_CDN_FAILED:function(e){return"stopPublishCDNStream failed, errMsg: ".concat(e.message,".")},INVALID_STREAM_ID:function(e){return"'".concat(e,"' can only consist of uppercase and lowercase english letters (a-zA-Z), numbers (0-9), hyphens and underscores.")},START_MIX_TRANSCODE:"please call startMixTranscode() after join().",STOP_MIX_TRANSCODE:"please call stopMixTranscode() after startMixTranscode().",INVALID_AUDIO_VOLUME:"interval must be a number.",ENABLE_SMALL_STREAM_PUBLISHED:"Cannot enable small stream after localStream published.",DISABLE_SMALL_STREAM_PUBLISHED:"Cannot disable small stream after localStream published.",NOT_SUPPORTED_SMALL_STREAM:"your browser does not support opening small stream.",INVALID_SMALL_STREAM_PROFILE:"small stream profile is invalid.",INVALID_PARAMETER_REMOTE_STREAM:"remoteStream is invalid.",INVALID_OPERATION_CHANGE_SMALL:"cannot switch to the small stream without subscribing to the video of remoteStream.",REMOTE_NOT_PUBLISH_SMALL_STREAM:"remote peer does not publish small stream.",INVALID_SWITCH_DEVICE:"cannot switch device on current stream.",INVALID_SWITCH_DEVICE_PUBLISHING:"cannot switch device when publishing localStream.",INVALID_REPLACE_TRACK:"cannot replace track when publishing localStream.",INVALID_INITIALIZE_LOCAL_STREAM:"local stream has not initialized yet.",INVALID_ADD_TRACK_REPETITIVE:"previous addTrack is ongoing, please avoid repetitive execution.",INVALID_ADD_TRACK_REMOVING:"cannot add track when a track is removing.",INVALID_ADD_TRACK_PUBLISHING:"cannot add track when publishing localStream.",INVALID_STREAM_INITIALIZED:"your local stream haven't been initialized yet.",INVALID_ADD_TRACK_NUMBER:"a Stream has at most one audio track and one video track.",INVALID_REMOVE_AUDIO_TRACK:"remove audio track is not supported on your browser.",INVALID_REMOVE_AUDIO_ADDING:"cannot remove track when a track is adding.",INVALID_REMOVE_AUDIO_ON:"previous removeTrack is ongoing, please avoid repetitive execution.",INVALID_REMOVE_TRACK_PUBLISHING:"cannot remove track when publishing localStream.",INVALID_REMOVE_TRACK_NOT_PUBLISHING:"the track to be removed is not being publishing.",INVALID_REMOVE_TRACK_NUMBER:"remove the only video track is not supported, please use replaceTrack or muteVideo.",INVALID_REPLACE_TRACK_NO_TRACK:function(e){return"cannot replace ".concat(e.kind," track because stream has not ").concat(e.kind," track")},START_MIX_TRANSCODE_FAILED:function(e){return"startMixTranscode failed, errMsg: ".concat(e.message,".")},STOP_MIX_TRANSCODE_FAILED:function(e){return"stopMixTranscode failed, errMsg: ".concat(e.message,".")},MIX_TRANSCODE_NOT_STARTED:"mixTranscode has not been started.",CANNOT_LESS_THAN_ZERO:function(e){var t=e.key,n=e.rule,i=e.fnName;return e.value,"'".concat(t||n.name,"' cannot be less than 0 when calling ").concat(i,"().")},MIX_PARAMS_VIDEO_FRAMERATE:"'config.videoFramerate' should be an integer between 0 and 30, excluding 0.",MIX_PARAMS_VIDEO_GOP:"'config.videoGOP' should be an integer between 1 and 8.",MIX_PARAMS_AUDIO_BITRATE:"'config.audioBitrate' should be an integer between 32 and 192.",MIX_PARAMS_USER_Z_ORDER:function(e){return"'".concat(e,"' is required and must be between 1 and 15.")},MIX_PARAMS_NOT_SELF:"'config.mixUsers' must contain self.",MIX_PARAMS_USER_STREAM:"'config.videoWidth' and 'config.videoHeight' of output stream should be contain all mix stream.",INVALID_PLAY:"duplicate play() call observed, please stop() firstly.",INVALID_ELEMENT_ID:function(e){var t=e.key,n=e.fnName;return"'".concat(t,"' is not found in the document object when calling ").concat(n,"().")},INVALID_ELEMENT_ID_TYPE:function(e){var t=e.key,n=e.fnName,i=e.type;return"the element corresponding to '".concat(t,"' must be instanceof HTMLDivElement when calling ").concat(n,"(), received: ").concat(i,".")},PLAY_FAILED:function(e){return"".concat(e.media," play failed，browser exception: ").concat(e.error.toString())},INVALID_USERID:"userId cannot be all spaces.",INVALID_CREATE_STREAM_SOURCE:"LocalStream must be created by createStream() with either audio/video or audioSource/videoSource, but can not be mixed with audio/video and audioSource/videoSource.",INVALID_CREATE_STREAM_SCREEN:"screen/video cannot be both true.",INVALID_CREATE_STREAM_AUDIO:"audio/screenAudio cannot be both true.",INVALID_CREATE_STREAM_SCREEN_AUDIO:"when screen is true, screenAudio can be configured.",NOT_SUPPORTED_HTTP:"http protocol does not support the ability to capture and publish streams, please use the https protocol.",NOT_SUPPORTED_WEBRTC:"your browser or environment does not support full WebRTC capabilities.",NOT_SUPPORTED_PROFILE:"your browser does not support setVideoProfile.",NOT_SUPPORTED_MEDIA:"your browser or environment does not support navigator.mediaDevices.",NOT_SUPPORTED_H264ENCODE:"your device does not support H.264 encoding.",NOT_SUPPORTED_H264DECODE:"your device does not support H.264 decoding.",NOT_SUPPORTED_TRACK:function(e){return"".concat(e,"Track is not supported on your browser.")},NOT_SUPPORTED_SWITCH_DEVICE:"switchDevice is not supported on your browser.",NOT_SUPPORTED_CAPTURE:"Your browser or environment does not support screen sharing, please check whether the browser version.",MICROPHONE_NOT_FOUND:"no microphone detected, please check your microphone and the configuration on TRTC.createStream.",CAMERA_NOT_FOUND:"no camera detected, please check your camera and the configuration on TRTC.createStream.",SIGNAL_RESPONSE_FAILED:function(e){return"".concat(e.signalResponse," failed, response code is ").concat(e.code," , errMsg: ").concat(e.message,".")},CATCH_HANDLER_ERROR:function(e){var t=e.name,n=e.event;return"an error was caught on ".concat(t,".on('").concat(n,"', handler), please check your code on 'handler'.")},API_NOT_EXIST:function(e){var t=e.name;return"experimental api ".concat(t," does not exist.")},REPEAT_JOIN:function(e){return"[".concat(e,"] is calling client.join api or has already joined room, please avoid repeated join.")},CONNECTION_CLOSED:"remoteStream has been unsubscribed or unpublished by remote user.",SUBSCRIBE_ALL_FALSE:"cannot subscribe when both audio & video are false, use client.unsubscribe() instead",CLIENT_DESTROYED:function(e){var t=e.funName;return"failed to call ".concat(t,"() because client was destroyed.")},SEI_NOT_SUPPORT:function(e){return"not support to sendSEIMessage".concat(!1===e?" without using h264 codec":"")},SEI_DISABLED:"SEI is disabled, to enable SEI: TRTC.createClient({ enableSEI: true })",SEI_EMPTY:"buffer cannot be empty",SEI_OVERSIZE:function(e){return"buffer size(".concat(e,") is over 1000 Bytes")},SEI_BEFORE_PUBLISH:"please call sendSEIMessage() after publish() success",SEI_NOT_VIDEO:"cannot send sei when localStream has not video.",CALL_FREQUENCY_LIMIT:function(e){var t=e.isSize,n=e.name,i=e.timesInSecond,r=e.maxSizeInSecond;return"api ".concat(n," call ").concat(t?"size":"times"," is over ").concat(t?r+" bytes":i," in a second.")},CONNECTION_ABORTED:function(e){return"connection aborted due to: "+e},API_CALL_ABORTED:function(e){return e.message.includes("REMOTE_STREAM_NOT_EXIST")?"Subscribe ".concat(e.stream.getUserId()," ").concat(e.stream.getType()," stream aborted, reason: remote user ").concat(e.stream.getUserId()," unpublished stream."):"API aborted, reason: ".concat(e.message)},DUPLICATE_AUX:"only one auxiliary stream can be published in a room.",NOT_SUPPORTED_AUX:"publish auxiliary stream is not supported on your browser."},AE=C,xE=x,PE=du,DE=ev.trim,OE=ee("".charAt),ME=AE.parseFloat,NE=AE.Symbol,LE=NE&&NE.iterator,UE=1/ME("\t\n\v\f\r                　\u2028\u2029\ufeff-0")!=-Infinity||LE&&!xE((function(){ME(Object(LE))}))?function(e){var t=DE(PE(e)),n=ME(t);return 0===n&&"-"==OE(t,0)?-0:n}:ME;Tr({global:!0,forced:parseFloat!=UE},{parseFloat:UE});var VE=window.navigator&&window.navigator.userAgent||"",jE=/AppleWebKit\/([\d.]+)/i.exec(VE);jE&&parseFloat(jE.pop());var FE=/iPad/i.test(VE),BE=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/Macintosh/.test(VE),HE=/iPhone/i.test(VE)&&!FE,WE=/iPod/i.test(VE),GE=HE||FE||WE||BE,zE=/Android/i.test(VE);zE&&function(){var e=VE.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);t&&n&&parseFloat(e[1]+"."+e[2])}();zE&&/webkit/i.test(VE);var JE=/Firefox/i.test(VE),qE=JE&&function(){var e=VE.match(/Firefox\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),KE=/Edge\//i.test(VE),QE=KE&&function(){var e=VE.match(/Edge\/(\d+)/i);if(e&&e[1])return e[1]}(),XE=/Edg\//i.test(VE),YE=XE&&function(){var e=VE.match(/Edg\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),$E=/SogouMobileBrowser\//i.test(VE),ZE=$E&&function(){var e=VE.match(/SogouMobileBrowser\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),eR=/MetaSr\s/i.test(VE),tR=eR&&function(){var e=VE.match(/MetaSr(\s\d+(\.\d+)+)/);return e&&e[1]?parseFloat(e[1]):null}(),nR=/TBS\/\d+/i.test(VE),iR=nR&&function(){var e=VE.match(/TBS\/(\d+)/i);if(e&&e[1])return e[1]}(),rR=/XWEB\/\d+/i.test(VE),aR=rR&&function(){var e=VE.match(/XWEB\/(\d+)/i);if(e&&e[1])return e[1]}();/MSIE\s8\.0/.test(VE),/MSIE\/\d+/i.test(VE)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(VE),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(VE)&&/rv:11.0/.test(VE)&&(t=11)}();var oR=/(micromessenger|webbrowser)/i.test(VE),sR=oR&&function(){var e=VE.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])return e[1]}(),cR=!nR&&/MQQBrowser\/\d+/i.test(VE)&&/COVC\/\d+/i.test(VE),uR=!nR&&/MQQBrowser\/\d+/i.test(VE)&&!/COVC\/\d+/i.test(VE),dR=(uR||cR)&&function(){var e=VE.match(/ MQQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),lR=!nR&&/ QQBrowser\/\d+/i.test(VE),hR=lR&&function(){var e=VE.match(/ QQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),pR=!nR&&/QQBrowserLite\/\d+/i.test(VE),fR=pR&&function(){var e=VE.match(/QQBrowserLite\/([\d.]+)/);return e&&e[1]?e[1]:null}(),mR=!nR&&/MQBHD\/\d+/i.test(VE),_R=mR&&function(){var e=VE.match(/MQBHD\/([\d.]+)/);return e&&e[1]?e[1]:null}(),vR=/Windows/i.test(VE),gR=!GE&&/MAC OS X/i.test(VE),yR=!zE&&/Linux/i.test(VE);/MicroMessenger/i.test(VE);var SR=/UCBrowser/i.test(VE);/Electron/i.test(VE);var bR,kR,IR=/MiuiBrowser/i.test(VE),TR=IR&&function(){var e=VE.match(/MiuiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),wR=/HuaweiBrowser/i.test(VE),ER=/Huawei/i.test(VE),RR=wR&&function(){var e=VE.match(/HuaweiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),CR=/SamsungBrowser/i.test(VE),AR=CR&&function(){var e=VE.match(/SamsungBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),xR=/HeyTapBrowser/i.test(VE),PR=xR&&function(){var e=VE.match(/HeyTapBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),DR=/VivoBrowser/i.test(VE),OR=DR&&function(){var e=VE.match(/VivoBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),MR=function(){var e=VE.match(/Chrome\/(\d+)/);return e&&e[1]?Number(e[1]):null},NR=/Chrome/i.test(VE),LR=!KE&&!eR&&!$E&&!nR&&!rR&&!XE&&!lR&&!IR&&!wR&&!CR&&!xR&&!DR&&/Chrome/i.test(VE),UR=LR&&MR(),VR=LR&&function(){var e=VE.match(/Chrome\/([\d.]+)/);return e&&e[1]?e[1]:null}(),jR=!NR&&!uR&&!cR&&!pR&&!mR&&/Safari/i.test(VE),FR=function(){if(jR){var e=VE.match(/Version\/([\d.]+)/);if(e&&e[1])return e[1]}return""}(),BR=/Android.*(wv|.0.0.0)/.test(VE),HR=function(){if(BE)return FR;if(GE){var e=VE.match(/OS (\d+)_(\d+)/i);if(e&&e[1]){var t=e[1];return e[2]&&(t+=".".concat(e[2])),t}}return""}(),WR=Number(HR.split(".")[0]),GR="15.1"===FR,zR="15.1"===HR,JR=14===(bR=Number(HR.split(".")[0]))||13===bR,qR="file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname,KR=function(){if(cC(kR))try{kR=window.localStorage}catch(Yq){MA.warn(Yq),kR=!1}return kR},QR=new Map([[JE,["Firefox",qE]],[XE,["Edg",YE]],[LR,["Chrome",VR]],[jR,["Safari",FR]],[nR,["TBS",iR]],[rR,["XWEB",aR]],[oR&&HE,["WeChat",sR]],[lR,["QQ(Win)",hR]],[uR,["QQ(Mobile)",dR]],[cR,["QQ(Mobile X5)",dR]],[pR,["QQ(Mac)",fR]],[mR,["QQ(iPad)",_R]],[IR,["MI",TR]],[wR,["HW",RR]],[CR,["Samsung",AR]],[xR,["OPPO",PR]],[DR,["VIVO",OR]],[KE,["EDGE",QE]],[$E,["SogouMobile",ZE]],[eR,["Sogou",tR]]]);function XR(){var e="unknown",t="unknown";return QR.get(!0)&&(e=QR.get(!0)[0],t=QR.get(!0)[1]),{name:e,version:t}}var YR=function(e,t){return t?XI+"/"+e+"/"+t:XI+"/"+e+"/index.html"},$R=function(){if(!KR())return!1;var e=localStorage.getItem($I);e&&!function(e){var t=e.saveTime&&(new Date).getTime()-e.saveTime>=MI,n=!e.saveVersion||e.saveVersion!==Dr;return t||n}(JSON.parse(e))||(MA.info("init debug info"),function(){var e=new XMLHttpRequest;if(e.open("GET","https://web.sdk.qcloud.com/trtc/webrtc/download/error-message/0.0.3/script.js",!1),e.send(null),4===e.readyState&&200===e.status){var t=document.createElement("script");t.type="text/javascript",t.text=e.responseText,document.body.appendChild(t),localStorage.setItem($I,JSON.stringify({message:e.responseText,saveTime:(new Date).getTime(),saveVersion:Dr})),document.body.removeChild(t)}}())};function ZR(e){var t=e.key,n=e.data,i=e.link,r=e.addDocLink,a=void 0===r||r,o="",s="",c="";sC(CE[t])?o=CE[t](n):uC(CE[t])&&(o=CE[t]);var u=function(){if(window.TRTC_ERROR_INFO&&window.TRTC_ERROR_LINK)return{TRTC_ERROR_INFO:window.TRTC_ERROR_INFO,TRTC_ERROR_LINK:window.TRTC_ERROR_LINK};var e=localStorage.getItem($I);if(e){e=JSON.parse(e);var t=document.createElement("script");t.type="text/javascript",t.text=e.message,document.body.appendChild(t);var n=window.TRTC_ERROR_INFO,i=window.TRTC_ERROR_LINK;return document.body.removeChild(t),{TRTC_ERROR_INFO:n,TRTC_ERROR_LINK:i}}return{}}(),d=u.TRTC_ERROR_INFO,l=u.TRTC_ERROR_LINK;i?c="".concat(i.className,".html#").concat(i.fnName):l&&l[t]&&(sC(l[t])?c=l[t](n):uC(l[t])&&(c=l[t]));var h=o;return bC()&&(d&&d[t]&&(sC(d[t])?s=d[t](n):uC(d[t])&&(s=d[t])),s&&(h=a?s+"\n请查看文档: "+YR("zh-cn",c)+"\n\n":s+"\n\n",h+=o)),a&&(h+=" \nRefer to: "+YR("en",c)+"\n"),h}var eC=function(){return function(e){var t=window.location.search.match(new RegExp("(\\?|&)"+e+"=([^&]*)(&|$)"));return t?decodeURIComponent(t[2]):""}("trtc_env")},tC=function(e){return(e=Number(e))>0&&e<14e8},nC=function(e,t){var n;n=pk?pk.includes("http")?pk:"https://"+pk:tC(e)?"https://apisgp.my-imcloud.com":"https://yun.tim.qq.com";var i=Math.floor(Math.random()*Math.pow(2,31));return"".concat(n,"/v5/AVQualityReportSvc/C2S?random=").concat(i,"&sdkappid=").concat(e,"&cmdtype=").concat(t)};function iC(){var e=navigator.userAgent,t=navigator.connection,n=e.match(/NetType\/\w+/)?e.match(/NetType\/\w+/)[0]:"";"3gnet"===(n=n.toLowerCase().replace("nettype/",""))&&(n="3g");var i=t&&t.type&&t.type.toLowerCase(),r=t&&t.effectiveType&&t.effectiveType.toLowerCase();"slow-2"===r&&(r="2g");var a=n||"unknown";if(i)switch(i){case"cellular":case"wimax":a=r||"unknown";break;case"wifi":a="wifi";break;case"ethernet":a="wired";break;case"none":case"other":case"unknown":a="unknown"}return a}var rC=function(e){if(!e||"object"!==i(e)||"[object Object]"!=Object.prototype.toString.call(e))return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)};function aC(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return e<=1?n:aC(e-1,n,t+n)}function oC(e){var t=Math.round(e/2)+1;return t>6?13e3:1e3*aC(t)}var sC=function(e){return"function"==typeof e},cC=function(e){return void 0===e},uC=function(e){return"string"==typeof e},dC=function(e){return"number"==typeof e},lC=function(e){return"boolean"==typeof e},hC=function(e){return"object"===mC(e)},pC=function(e){return"array"===mC(e)},fC=function(e){return mC(e)==="MediaStreamTrack".toLowerCase()};function mC(e){return Reflect.apply(Object.prototype.toString,e,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}function _C(e){var t={};return t.urls="turn:".concat(e.url),cC(e.username)||cC(e.credential)||(t.username=e.username,t.credential=e.credential,t.credentialType="password",cC(e.credentialType)||(t.credentialType=e.credentialType)),t}function vC(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}function gC(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"big";if(!uC(e))return 0;var n=e.split(".");return"big"===t?(Number(n[0])<<24|Number(n[1])<<16|Number(n[2])<<8|Number(n[3]))>>>0:(Number(n[3])<<24|Number(n[2])<<16|Number(n[1])<<8|Number(n[0]))>>>0}var yC,SC,bC=function(){var e=navigator.language||navigator.userLanguage;return"zh"===(e=e.substr(0,2))},kC=(yC=!1,SC=document.visibilityState,function(){document.visibilityState!==SC&&MA.info("visibility change: ".concat(document.visibilityState)),yC||(document.addEventListener("visibilitychange",(function(){MA.info("visibility change: "+document.visibilityState),SC=document.visibilityState})),yC=!0)});window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext;var IC=function(){return new window.AudioContext},TC=function(){var e;return function(){if(e)return e;e=new window.AudioContext;return e.onstatechange=function(){MA.info("gain context state: ".concat(e.state)),"suspended"===e.state?(e.resume(),document.addEventListener("click",e.resume)):"interrupted"===e.state?e.resume():document.removeEventListener("click",e.resume)},e}}(),wC=!!window.AudioWorkletNode,EC=function(e,t){var n=e.emit;return e.emit=function(){for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];try{n.apply(e,r)}catch(Yq){var o=ZR({key:fE,data:{name:t,event:r[0]},addDocLink:!1});MA.warn(o+"\n\n"+Yq.stack)}},e},RC=function(e){return+e<10?"0".concat(e):e},CC=function(e){var t=e.match(/^\d+\.\d+\.\d+/)[0];if(!t)return e;var n=t.split("."),i=RC(n[1])+RC(n[2]);return n[1]-15>0&&(n[1]="15"),n[2]-15>0&&(n[2]="15"),n.join(".")+"."+i};function AC(e,t){try{if(pC(e))return"[".concat(e.map((function(e){return AC(e,t)})).join(","),"]");if(!rC(e)||!pC(t))return JSON.stringify(e);var n={},i=new Set(t);return Object.keys(e).forEach((function(t){i.has(t)&&(n[t]=e[t])})),JSON.stringify(n)}catch(Yq){return"{}"}}function xC(e){var t=e.url,n=e.body,i=e.method,r=e.timeout,a=new XMLHttpRequest;return new Promise((function(e,o){a.onload=function(t){if(a.status>=200&&a.status<300&&a.responseText.length>0)try{var n=JSON.parse(a.response);e({data:n})}catch(Yq){e({data:a.response})}else a.status>0&&o({code:a.status,message:"request failed, readyState:".concat(a.readyState," status:").concat(a.status," loaded size:").concat(t.loaded)})};var s=function(e){o({code:a.readyState,message:"request ".concat(e.type,", readyState:").concat(a.readyState," status:").concat(a.status," loaded size:").concat(e.loaded)})};a.onerror=s,a.onabort=s,a.ontimeout=s,a.timeout=r||5e3,a.open(i||"POST",t,!0),a.send(n)}))}var PC={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,i,a,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new r(i,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,a=i.length,o=new Array(a);r<a;r++)o[r]=i[r].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,r,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,i),!0;case 4:return d.fn.call(d.context,t,i,r),!0;case 5:return d.fn.call(d.context,t,i,r,a),!0;case 6:return d.fn.call(d.context,t,i,r,a,o),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,i);break;case 4:d[u].fn.call(d[u].context,t,i,r);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,r){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||r&&!s.once||i&&s.context!==i||o(this,a);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||r&&!s[c].once||i&&s[c].context!==i)&&u.push(s[c]);u.length?this._events[a]=1===u.length?u[0]:u:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}(PC);var DC=PC.exports,OC=new DC,MC=1,NC=2,LC=3,UC=4,VC=5,jC=20,FC=21,BC=22,HC=23,WC=24,GC=27,zC=28,JC=29,qC=30,KC=31,QC=32,XC=33,YC=40,$C=41,ZC=52,eA=100,tA=101,nA=102,iA=103,rA=110,aA=111,oA=112,sA=113,cA=114,uA=115,dA=116,lA=120,hA=121,pA=122,fA=123,mA=130,_A=131,vA=132,gA=133,yA=134,SA=135,bA=136,kA=137,IA=200,TA=201,wA=300,EA=301,RA=302,CA=303;function AA(e){var t=e.retryFunction,i=e.settings,r=e.onError,o=e.onRetrying,s=e.onRetryFailed,c=e.onRetrySuccess,u=e.context;return function(){for(var e=this,d=arguments.length,l=new Array(d),h=0;h<d;h++)l[h]=arguments[h];var p=i.retries||5,f=0,m=-1,_=0,v=function(){var d=a(n().mark((function a(d,h){var g,y,S,b;return n().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return g=u||e,n.prev=1,n.next=4,t.apply(g,l);case 4:y=n.sent,0!==f&&sC(c)&&c.call(g,f),f=0,d(y),n.next=15;break;case 10:n.prev=10,n.t0=n.catch(1),S=function(){clearTimeout(m),f=0,_=2,h(n.t0)},b=function(){2!==_&&f<p?(f++,_=1,sC(o)&&o.call(g,f,S),m=setTimeout((function(){m=-1,v(d,h)}),cC(i.timeout)?1e3:i.timeout)):(S(),sC(s)&&s.call(g,n.t0))},sC(r)?r.call(g,n.t0,b,h,l,f):b();case 15:case"end":return n.stop()}}),a,null,[[1,10]])})));return function(e,t){return d.apply(this,arguments)}}();return new Promise(v)}}var xA=c((function e(t){o(this,e),this.log=t.log,this.level=t.level,this.userId=t.userId,this.sdkAppId=t.sdkAppId,this.forAllJoinedClients=t.forAllJoinedClients,this.uploaded=!1})),PA=function(){function e(t){o(this,e),this.id_=t.id,this.userId_=t.userId,this.sdkAppId_=t.sdkAppId,this.type_=t.type,this.isLocal_=!lC(t.isLocal)||t.isLocal}return c(e,[{key:"setUserId",value:function(e){this.userId_=e}},{key:"setSdkAppId",value:function(e){this.sdkAppId_=e}},{key:"log",value:function(e,t){MA.log({log:"[".concat(this.isLocal_?"↑":"↓").concat(this.id_,"] ").concat(this.type_?this.type_+" ":"").concat(t),level:e,forAllJoinedClients:cC(this.userId_),userId:this.userId_,sdkAppId:this.sdkAppId_})}},{key:"info",value:function(e){this.log(tT.INFO,e)}},{key:"debug",value:function(e){this.log(tT.DEBUG,e)}},{key:"warn",value:function(e){this.log(tT.WARN,e)}},{key:"error",value:function(e){this.log(tT.ERROR,e)}}]),e}(),DA=!(GE||zE),OA=function(){function e(){var t=this;o(this,e),this.clients_=new Set,this.queue_=[],this.timeoutId_=-1,this.logLevel_=tT.DEBUG,this.logLevelToUpload_=tT.INFO,this.enableUploadLog_=!0,this.isAbleToUpload_=!1,this.checkURLParam(),OC.on(qC,(function(e){var n=e.client;-1===t.timeoutId_&&t.startUpload(),t.clients_.add(n)})),OC.on(XC,(function(e){var n=e.client;return t.clients_.delete(n)})),OC.on(KC,(function(e){e&&rC(e.config)&&oT[e.config.logLevelToUpload]&&(t.logLevelToUpload_=e.config.logLevelToUpload)})),OC.on(UC,this.setIsAbleToUpload,this),OC.on(VC,this.setIsAbleToUpload,this)}var t,i;return c(e,[{key:"getIsAbleToUpload",value:function(){return this.isAbleToUpload_}},{key:"setIsAbleToUpload",value:function(){this.isAbleToUpload_=!0,OC.off(UC,this.setIsAbleToUpload,this),OC.off(VC,this.setIsAbleToUpload,this)}},{key:"startUpload",value:(i=a(n().mark((function e(){var t=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.upload();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:this.timeoutId_=setTimeout((function(){return t.startUpload()}),2e3);case 8:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return i.apply(this,arguments)})},{key:"getLogsToUpload",value:function(){var e=this,t={map:new Map,splicedQueue:[]};if(this.queue_[0].forAllJoinedClients&&0===this.clients_.size)return t;for(var n=0,i=function(){if(50===n)return"break";var i=e.queue_[n];if(i.forAllJoinedClients){var r=new Set;e.clients_.forEach((function(e){if(e.getIsJoined()){var n=e.getUserId(),a=e.getSDKAppId();if(!r.has("".concat(n,"-").concat(a)))if(r.add("".concat(n,"-").concat(a)),t.map.has(n))t.map.get(n).logs.push(i);else t.map.set(n,{userId:n,sdkAppId:a,logs:[i]})}}))}else{if(t.map.has(i.userId))t.map.get(i.userId).logs.push(i);else t.map.set(i.userId,{userId:i.userId,sdkAppId:i.sdkAppId,logs:[i]})}};n<this.queue_.length;n++){if("break"===i())break}return t.map.size>0&&(t.splicedQueue=this.queue_.splice(0,n)),t}},{key:"upload",value:(t=a(n().mark((function e(){var t,i,r,a,o,s,c,u,d,l;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this.queue_.length&&this.isAbleToUpload_){e.next=2;break}return e.abrupt("return");case 2:if(t=this.getLogsToUpload(),i=t.map,r=t.splicedQueue,0!==i.size){e.next=5;break}return e.abrupt("return");case 5:e.prev=5,a=b(i.values()),o=0;case 8:if(!(o<a.length)){e.next=16;break}return s=a[o],c=s.userId,u=s.sdkAppId,d=s.logs,e.next=12,this.uploadLogWithRetry(JSON.stringify({timestamp:zm(),sdkAppId:String(u),userId:c,version:Dr,log:d.map((function(e){return e.log})).join("\n")}),u);case 12:d.forEach((function(e){return e.uploaded=!0}));case 13:o++,e.next=8;break;case 16:e.next=20;break;case 18:e.prev=18,e.t0=e.catch(5);case 20:l=r.filter((function(e){return!e.uploaded})),l.length>0&&(this.queue_=l.concat(this.queue_));case 22:case"end":return e.stop()}}),e,this,[[5,18]])}))),function(){return t.apply(this,arguments)})},{key:"uploadLogWithRetry",value:function(e,t){return AA({retryFunction:function(){return xC({url:nC(t,fk),body:e,timeout:5e3})},settings:{retries:3,timeout:1e3},onError:function(e,t){t()}})()}},{key:"getPrefix",value:function(e){var t=new Date;return t.setTime(Gm()),String.prototype.padStart?"[".concat(t.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1"),":").concat(t.getMilliseconds().toString().padStart(3,"0"),"] <").concat(oT[e],">"):"[".concat(t.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1"),":").concat(t.getMilliseconds(),"] <").concat(oT[e],">")}},{key:"getLogLevel",value:function(){return this.logLevel_}},{key:"setLogLevel",value:function(e){cC(oT[e])||(this.logLevel_!==e&&this.info("setLogLevel ".concat(e)),this.logLevel_=e)}},{key:"enableUploadLog",value:function(){this.enableUploadLog_=!0}},{key:"disableUploadLog",value:function(){this.enableUploadLog_=!1}},{key:"log",value:function(e){var t=e.log,n=e.level,i=e.forAllJoinedClients,r=void 0===i||i,a=e.userId,o=e.sdkAppId;if(t="".concat(this.getPrefix(n)," ").concat(t),this.enableUploadLog_&&n>=this.logLevelToUpload_&&this.queue_.push(new xA({log:t,level:n,userId:a,sdkAppId:o,forAllJoinedClients:r})),!(n<this.logLevel_)){var s=oT[n]?oT[n].toLowerCase():"info";DA?console[s]("%cTRTC%c%s","padding: 1px 4px;border-radius: 3px;color: #fff;background: #1E88E5;","display: inline",t):console[s](t)}}},{key:"debug",value:function(e){this.log({log:e,level:tT.DEBUG})}},{key:"info",value:function(e){this.log({log:e,level:tT.INFO})}},{key:"warn",value:function(e){this.log({log:e,level:tT.WARN})}},{key:"error",value:function(e){this.log({log:e,level:tT.ERROR})}},{key:"createLogger",value:function(e){return new PA(e)}},{key:"checkURLParam",value:function(){var e=new URLSearchParams(location.search).get("logLevelToUpload");oT[e]&&(this.logLevelToUpload_=e)}}]),e}(),MA=new OA,NA=!0,LA=ye,UA=Math.floor,VA=Number.isInteger||function(e){return!LA(e)&&isFinite(e)&&UA(e)===e};Tr({target:"Number",stat:!0},{isInteger:VA});var jA,FA=Tr,BA=ee,HA=A.f,WA=Mi,GA=du,zA=Ov,JA=ue,qA=Nv,KA=BA("".startsWith),QA=BA("".slice),XA=Math.min,YA=qA("startsWith");FA({target:"String",proto:!0,forced:!!(YA||(jA=HA(String.prototype,"startsWith"),!jA||jA.writable))&&!YA},{startsWith:function(e){var t=GA(JA(this));zA(e);var n=WA(XA(arguments.length>1?arguments[1]:void 0,t.length)),i=GA(e);return KA?KA(t,i,n):QA(t,n,n+i.length)===i}});var $A=P,ZA=ee,ex=N,tx=x,nx=Lr,ix=Yi,rx=L,ax=lt,ox=ae,sx=Object.assign,cx=Object.defineProperty,ux=ZA([].concat),dx=!sx||tx((function(){if($A&&1!==sx({b:1},sx(cx({},"a",{enumerable:!0,get:function(){cx(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),i="abcdefghijklmnopqrst";return e[n]=7,i.split("").forEach((function(e){t[e]=e})),7!=sx({},e)[n]||nx(sx({},t)).join("")!=i}))?function(e,t){for(var n=ax(e),i=arguments.length,r=1,a=ix.f,o=rx.f;i>r;)for(var s,c=ox(arguments[r++]),u=a?ux(nx(c),a(c)):nx(c),d=u.length,l=0;d>l;)s=u[l++],$A&&!ex(o,c,s)||(n[s]=c[s]);return n}:sx,lx=dx;Tr({target:"Object",stat:!0,arity:2,forced:Object.assign!==lx},{assign:lx});var hx=ee,px=qe,fx=ye,mx=ft,_x=Ku,vx=D,gx=Function,yx=hx([].concat),Sx=hx([].join),bx={},kx=function(e,t,n){if(!mx(bx,t)){for(var i=[],r=0;r<t;r++)i[r]="a["+r+"]";bx[t]=gx("C,a","return new C("+Sx(i,",")+")")}return bx[t](e,n)},Ix=vx?gx.bind:function(e){var t=px(this),n=t.prototype,i=_x(arguments,1),r=function(){var n=yx(i,_x(arguments));return this instanceof r?kx(t,n.length,n):t.apply(e,n)};return fx(n)&&(r.prototype=n),r},Tx=Ix;Tr({target:"Function",proto:!0,forced:Function.bind!==Tx},{bind:Tx});var wx=Tr,Ex=Vd.findIndex,Rx=la,Cx="findIndex",Ax=!0;Cx in[]&&Array(1).findIndex((function(){Ax=!1})),wx({target:"Array",proto:!0,forced:Ax},{findIndex:function(e){return Ex(this,e,arguments.length>1?arguments[1]:void 0)}}),Rx(Cx);var xx=P,Px=ee,Dx=Lr,Ox=he,Mx=Px(L.f),Nx=Px([].push),Lx=function(e){return function(t){for(var n,i=Ox(t),r=Dx(i),a=r.length,o=0,s=[];a>o;)n=r[o++],xx&&!Mx(i,n)||Nx(s,e?[n,i[n]]:i[n]);return s}},Ux={entries:Lx(!0),values:Lx(!1)}.values;Tr({target:"Object",stat:!0},{values:function(e){return Ux(e)}});var Vx=1,jx=5,Fx=2,Bx=3,Hx=4,Wx="DISCONNECTED",Gx="CONNECTING",zx="RECONNECTING",Jx="CONNECTED",qx={CLIENT_BANNED:9,CHANNEL_SETUP_RESULT:19,CHANNEL_RECONNECT_RESULT:514,JOIN_ROOM_RESULT:20,PEER_JOIN:4134,PEER_LEAVE:4135,STREAM_ADDED:16,STREAM_REMOVED:18,UPLINK_NETWORK_STATS:22,UPDATE_REMOTE_MUTE_STAT:23,PUBLISH_RESULT:4098,PUBLISH_STATE_CHANGE_RESULT:4112,UNPUBLISH_RESULT:4100,SUBSCRIBE_RESULT:4102,UNSUBSCRIBE_RESULT:4104,SUBSCRIBE_CHANGE_RESULT:4106,MUTE_RESULT:4108,UPDATE_OFFER_RESULT:4128,START_PUBLISH_TENCENT_CDN_RES:1286,STOP_PUBLISH_TENCENT_CDN_RES:1288,START_PUBLISH_GIVEN_CDN_RES:777,STOP_PUBLISH_GIVEN_CDN_RES:779,START_MIX_TRANSCODE_RES:781,STOP_MIX_TRANSCODE_RES:783,USER_LIST_RES:4137,SWITCH_ROLE_RES:4110,UPDATE_CONSTRAINT_CONFIG_RES:772},Kx=[qx.UPDATE_REMOTE_MUTE_STAT,qx.UPLINK_NETWORK_STATS,qx.USER_LIST_RES,qx.MUTE_RESULT],Qx={CLIENT_BANNED:"client-banned",CHANNEL_SETUP_RESULT:"channel-setup-result",CHANNEL_RECONNECT_RESULT:"channel-reconnect-result",JOIN_ROOM_RESULT:"join-room-result",PEER_JOIN:"peer-join",PEER_LEAVE:"peer-leave",STREAM_ADDED:"stream-added",STREAM_REMOVED:"stream-removed",UPLINK_NETWORK_STATS:"uplink-network-stats",UPDATE_REMOTE_MUTE_STAT:"update-remote-mute-stat",PUBLISH_RESULT:"publish-result",PUBLISH_STATE_CHANGE_RESULT:"publish-state-change-result",UNPUBLISH_RESULT:"unpublish-result",SUBSCRIBE_RESULT:"subscribe-result",SUBSCRIBE_CHANGE_RESULT:"subscribe-change-result",UNSUBSCRIBE_RESULT:"unsubscribe-result",UPDATE_OFFER_RESULT:"update-offer-result",START_PUBLISH_TENCENT_CDN_RES:"start-publish-tencent-cdn-res",STOP_PUBLISH_TENCENT_CDN_RES:"stop-publish-tencent-cdn-res",START_PUBLISH_GIVEN_CDN_RES:"start-publish-given-cdn-res",STOP_PUBLISH_GIVEN_CDN_RES:"stop-publish-given-cdn-res",START_MIX_TRANSCODE_RES:"start-mix-transcode-res",STOP_MIX_TRANSCODE_RES:"stop-mix-transcode-res",USER_LIST_RES:"user-list-res",SWITCH_ROLE_RES:"switch_role_res",MUTE_RESULT:"mute-result",UPDATE_CONSTRAINT_CONFIG_RES:"update-contraint-config-res"},Xx="publish_change",Yx="publish_state_change",$x="join",Zx="leave",eP="quality_report",tP="mute_uplink",nP="publish",iP="unpublish",rP="subscribe",aP="unsubscribe",oP="subscribe_change",sP="start_publishing",cP="stop_publishing",uP="start_push_user_cdn",dP="stop_push_user_cdn",lP="start_mcu_mix",hP="stop_mcu_mix",pP="get_user_list",fP="change_role",mP="update_constraint_config",_P={INVALID_PARAMETER:4096,INVALID_OPERATION:4097,NOT_SUPPORTED:4098,DEVICE_NOT_FOUND:4099,INITIALIZE_FAILED:4100,SIGNAL_CHANNEL_SETUP_FAILED:16385,SIGNAL_CHANNEL_ERROR:16386,ICE_TRANSPORT_ERROR:16387,JOIN_ROOM_FAILED:16388,CREATE_OFFER_FAILED:16389,SIGNAL_CHANNEL_RECONNECTION_FAILED:16390,UPLINK_RECONNECTION_FAILED:16391,DOWNLINK_RECONNECTION_FAILED:16392,REMOTE_STREAM_NOT_EXIST:16400,CLIENT_BANNED:16448,SERVER_TIMEOUT:16449,SUBSCRIPTION_TIMEOUT:16450,PLAY_NOT_ALLOWED:16451,DEVICE_AUTO_RECOVER_FAILED:16452,START_PUBLISH_CDN_FAILED:16453,STOP_PUBLISH_CDN_FAILED:16454,START_MIX_TRANSCODE_FAILED:16455,STOP_MIX_TRANSCODE_FAILED:16456,NOT_SUPPORTED_H264:16457,SWITCH_ROLE_FAILED:16458,API_CALL_TIMEOUT:16459,SCHEDULE_FAILED:16460,API_CALL_ABORTED:16461,UNKNOWN:65535},vP=function(e){d(n,e);var t=v(n);function n(e){var i,r=e.name,a=void 0===r?"RtcError":r,s=e.message,c=e.code,u=void 0===c?_P.UNKNOWN:c,d=e.extraCode,l=void 0===d?0:d,h=e.constraint;o(this,n);var p="<".concat(function(e){for(var t in _P)if(_P[t]===e)return t;return"UNKNOWN"}(u)," 0x").concat(u.toString(16),">");return(i=t.call(this,s+"".concat(h?" constraint: ".concat(h):"")+"".concat(null!=s&&s.includes(p)?"":" "+p))).code_=u,i.extraCode_=l,i.name=a,i.message_=s,h&&(i.constraint=h),i}return c(n,[{key:"getCode",value:function(){return this.code_}},{key:"getExtraCode",value:function(){return this.extraCode_}}]),n}(m(Error)),gP=32768,yP=32769,SP=32770,bP=32771,kP=32772,IP=32773,TP=32774,wP=32775,EP=32777,RP=32778,CP=32779,AP=32780,xP=32781,PP=32782,DP=32783,OP=32784,MP=32785,NP=32786,LP=32787,UP=32788,VP=32789,jP=32790,FP=32791,BP=32792,HP=32793,WP=32794,GP=32795,zP=32796,JP=32797,qP=32798,KP=32799,QP=32800,XP=32801,YP=32802,$P=32803,ZP=32804,eD=new Map,tD=function(e,t){var n=eD.get(e);n||(eD.set(e,[]),n=eD.get(e)),n.push(t)},nD=function(e){var t=eD.get(e),n=[];return t?(eD.delete(e),n=t.map((function(e){return{uint32_event_id:e.eventId,uint64_date:e.timestamp,str_userid:e.remoteUserId,str_event_json:e.eventDesc}}))):n=[],n},iD=Object.prototype.hasOwnProperty;function rD(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(rC(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(var t in e)if(iD.call(e,t))return!1;return!0}return!1}var aD=function(){function e(){o(this,e);var t=XR(),n=t.name,i=t.version;this.roomIdMap_=new Map,this.configs_={sdkAppId:"",userId:"",version:Dr,env:dk,browserVersion:n+i,ua:navigator.userAgent}}return c(e,[{key:"setConfig",value:function(e){var t=e.sdkAppId,n=e.env,i=e.userId,r=e.roomId;t!==this.configs_.sdkAppId&&(this.configs_.sdkAppId=String(t)),this.configs_.env=n,this.configs_.userId=i,this.roomIdMap_.set(i,String(r))}},{key:"logEvent",value:function(e){if(!qR){var n=t(t(t({},e),this.configs_),{},{userId:e.userId||this.configs_.userId});cC(n.code)&&(n.code="failed"===n.result?_P.UNKNOWN:0),this.sendRequest(nC(this.configs_.sdkAppId,mk),n)}}},{key:"logSuccessEvent",value:function(e){qR||(this.logEvent(t(t({},e),{},{result:"success",roomId:this.roomIdMap_.get(e.userId)})),this.configs_.env===dk&&this.uploadEventToKibana(t(t({},e),{},{result:"success"})))}},{key:"logFailedEvent",value:function(e){if(!qR){var n=e.eventType,i=e.code,r=e.error,a=e.userId,o={roomId:this.roomIdMap_.get(a),userId:a,eventType:n,result:"failed",code:i||(r instanceof vP?r.getExtraCode()||r.getCode():_P.UNKNOWN)};this.logEvent(o),this.configs_.env===dk&&this.uploadEventToKibana(t(t({},o),{},{error:r}))}}},{key:"uploadEventToKibana",value:function(e){var t="stat-".concat(e.eventType,"-").concat(e.result);"delta-join"!==e.eventType&&"delta-leave"!==e.eventType&&"delta-publish"!==e.eventType||(t="".concat(e.eventType,":").concat(e.delta)),this.uploadEvent({log:t,userId:e.userId}),"failed"===e.result&&(t="stat-".concat(e.eventType,"-").concat(e.result,"-").concat(e.code),this.uploadEvent({log:t,userId:e.userId,error:e.error}))}},{key:"uploadEvent",value:function(e){var t=e.log,n=e.userId,i=e.error,r={timestamp:zm(),sdkAppId:this.configs_.sdkAppId,userId:n||this.configs_.userId,version:this.configs_.version,log:t};i&&(r.errorInfo=i.message),this.sendRequest(nC(this.configs_.sdkAppId,fk),r)}},{key:"sendRequest",value:function(e,t){var n=this;MA.getIsAbleToUpload()?xC({url:e,body:JSON.stringify(t)}).catch((function(){})):setTimeout((function(){n.sendRequest(e,t)}),1e3)}}]),e}(),oD=new aD,sD=function(){function e(t){o(this,e),this.client_=t.client,this.sdkAppId_=t.sdkAppId,this.userId_=t.userId,this.userSig_=t.userSig,this.url_=t.url,this.backupUrl_=t.backupUrl;var n="?sdkAppId=".concat(encodeURIComponent(this.sdkAppId_),"&userId=").concat(encodeURIComponent(this.userId_),"&userSig=").concat(encodeURIComponent(this.userSig_),"&roomId=").concat(encodeURIComponent(t.roomId)),i=this.client_.getSystemResult();if(i&&i.detail){var r=i.detail,a=r.isH264EncodeSupported,s=r.isVp8EncodeSupported,c=r.isH264DecodeSupported,u=r.isVp8DecodeSupported;n+="&enc264=".concat(Number(a),"&dec264=").concat(Number(c),"&encVp8=").concat(Number(s),"&decVp8=").concat(Number(u))}t.signalDomainWhenUnifiedProxy&&(n+="&signalDomain=".concat(encodeURIComponent(t.signalDomainWhenUnifiedProxy))),this.urlWithParam_="".concat(this.url_).concat(n),this.backupUrlWithParam_="".concat(this.backupUrl_).concat(n),this.isConnected_=!1,this.isConnecting_=!1,this.socketInUse_=null,this.socket_=null,this.backupSocket_=null,this.backupTimer_=-1,this.signalInfo_={},this.currentState_=Wx,this.reconnectionCount_=0,this.reconnectionTimer_=-1,this.lastMessageTime_=-1,this.seq_=0,this.log_=MA.createLogger({id:"ws|"+this.userId_,userId:this.userId_,sdkAppId:this.sdkAppId_}),this.emitter_=new DC}return c(e,[{key:"isOnline",get:function(){return this.currentState_===Jx&&Date.now()-this.lastMessageTime_<12e3}},{key:"connect",value:function(){var e=this;return new Promise((function(t,n){e.log_.info("connect to url: ".concat(e.urlWithParam_)),e.emitConnectionStateChanged(Gx),e.socket_=new WebSocket(e.urlWithParam_),e.bindSocket(e.socket_),e.backupTimer_=setTimeout((function(){e.isConnected_||(e.log_.info("trying to connect to backupUrl"),e.tryConnectBackup())}),5e3);var i=setTimeout((function(){e.close(),n(new vP({code:_P.JOIN_ROOM_FAILED,message:"join room timeout"}))}),1e4);e.once(Bx,(function(){clearTimeout(i),t()})),e.once(Hx,(function(e){clearTimeout(i),n(e)}))}))}},{key:"tryConnectBackup",value:function(){this.backupSocket_||(this.unbindAndCloseSocket(zb),this.log_.debug("try to connect to url: ".concat(this.backupUrlWithParam_)),this.backupSocket_=new WebSocket(this.backupUrlWithParam_),this.bindSocket(this.backupSocket_))}},{key:"bindSocket",value:function(e){e.onopen=this.onopen.bind(this),e.onclose=this.onclose.bind(this),e.onerror=this.onerror.bind(this),e.onmessage=this.onmessage.bind(this)}},{key:"unbindSocket",value:function(e){e.onopen=function(){},e.onclose=function(){},e.onerror=function(){},e.onmessage=function(){}}},{key:"unbindAndCloseSocket",value:function(e){if(e===zb){if(this.socket_){this.unbindSocket(this.socket_);try{this.socket_.close(1e3)}catch(Yq){}this.socket_=null}}else if(this.backupSocket_){this.unbindSocket(this.backupSocket_);try{this.backupSocket_.close(1e3)}catch(Yq){}this.backupSocket_=null}}},{key:"clearBackupTimer",value:function(){-1!==this.backupTimer_&&(clearTimeout(this.backupTimer_),this.backupTimer_=-1)}},{key:"clearReconnectionTimer",value:function(){-1!==this.reconnectionTimer_&&(clearTimeout(this.reconnectionTimer_),this.reconnectionTimer_=-1)}},{key:"onopen",value:function(e){if(!this.isConnected_){this.isConnected_=!0,this.isConnecting_=!1,this.isReconnecting_&&rD(this.signalInfo_)&&this.stopReconnection(),this.clearBackupTimer(),e.target===this.socket_?(this.unbindAndCloseSocket(Jb),this.socketInUse_=this.socket_):(this.unbindAndCloseSocket(zb),this.socketInUse_=this.backupSocket_);var t=e.target.url;this.log_.info("websocket[".concat(t,"] is connected")),this.currentState_===Gx?this.addSignalEvent(FP,"signal channel is connected"):this.currentState_===zx&&this.addSignalEvent(GP,"signal channel reconnect success"),this.emitConnectionStateChanged(Jx),this.emitter_.emit(Bx)}}},{key:"onclose",value:function(e){var t=e.target.url,n=e.target===this.socketInUse_;if(this.log_.info("websocket[".concat(t," InUse: ").concat(n,"] is closed with code: ").concat(e.code)),n&&(this.isConnected_=!1,this.emitConnectionStateChanged(Wx),this.addSignalEvent(jP,"signal channel is disconnected"),!e.wasClean||1e3!==e.code)){this.log_.warn("onclose code:".concat(e.code," reason:").concat(e.reason)),this.log_.warn("close current websocket and schedule a reconnect timeout"),this.socketInUse_.onclose=function(){},this.socketInUse_.close(4011);var i=this.socketInUse_===this.socket_;this.socket_=this.backupSocket_=this.socketInUse_=null,this.reconnect(i?Jb:zb)}}},{key:"onerror",value:function(e){var t=e.target.url;if(this.log_.error("websocket[".concat(t,"] error observed")),this.isConnected_){if(e.target===this.socketInUse_){this.isConnected_=!1,this.unbindAndCloseSocket(zb),this.unbindAndCloseSocket(Jb);var n=this.socketInUse_===this.socket_;this.socketInUse_=null,this.reconnect(n?Jb:zb)}}else this.isReconnecting_||oD.logFailedEvent({userId:this.client_.getUserId(),eventType:sI,code:_P.UNKNOWN}),e.target==this.socket_?(this.unbindAndCloseSocket(zb),this.reconnect(Jb)):(this.unbindAndCloseSocket(Jb),this.reconnect(zb));this.isConnecting_=!1,this.isConnected_=!1}},{key:"onmessage",value:function(e){if(this.isConnected_){this.lastMessageTime_=Date.now();var t=JSON.parse(e.data),n=t.cmd,i=t.data,r=Object.values(qx),a=Object.keys(qx)[r.indexOf(n)],o=Qx[a];switch(Kx.includes(n)||(this.log_.debug("received msg: ".concat(e.data)),this.log_.info("Received event: [ ".concat(o||"unknown cmd: "+n," ]"))),n){case qx.CHANNEL_SETUP_RESULT:if(0===t.code)this.signalInfo_.clientIp=i.clientIp,this.signalInfo_.signalIp=i.signalInnerIp,this.signalInfo_.tinyId=t.tinyId,i.svrTime&&function(e){Wm=e-(new Date).getTime();var t=new Date;t.setTime(e),MA.info("baseTime from server: "+t+" offset: "+Wm)}(i.svrTime),this.log_.info("ChannelSetup Success"),oD.logSuccessEvent({userId:this.userId_,eventType:sI}),this.emitter_.emit(Vx,{signalInfo:this.signalInfo_});else{var s=new vP({code:_P.SIGNAL_CHANNEL_SETUP_FAILED,extraCode:t.code,message:ZR({key:DT,data:{errorCode:t.code,errorMsg:t.message}})});this.log_.error("".concat(t.code,", ").concat(t.message)),this.close(),oD.logFailedEvent({userId:this.userId_,eventType:sI,error:s}),this.emitter_.emit(jx,s)}break;case qx.JOIN_ROOM_RESULT:0===t.code&&(this.signalInfo_.relayIp=i.relayOuterIp,this.signalInfo_.relayInnerIp=i.relayInnerIp,this.signalInfo_.relayPort=i.relayPort,this.log_.info("signalIp:".concat(this.signalInfo_.signalIp," clientIp:").concat(this.signalInfo_.clientIp," relayIp: ").concat(this.signalInfo_.relayIp))),this.emitter_.emit(o,{data:t});break;case qx.CHANNEL_RECONNECT_RESULT:0===t.code?(this.log_.warn("reconnect success"),this.stopReconnection(),oD.logSuccessEvent({userId:this.userId_,eventType:cI}),this.client_.syncUserList(),this.client_.checkConnectionsToReconnect()):(this.log_.warn("reconnect failed, ".concat(t.code," ").concat(t.message)),this.client_.reJoin());break;default:this.emitter_.emit(o,{data:t})}}}},{key:"addSignalEvent",value:function(e,t){tD(this.userId_,{eventId:e,eventDesc:t,timestamp:Gm(),userId:this.userId_,tinyId:this.signalInfo_.tinyId})}},{key:"reconnect",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zb;if(this.isConnecting_||-1!==this.reconnectionTimer_)this.log_.info("signal channel is reconnecting, ignoring current reconnection");else{if(OC.emit(YC,this.client_),this.reconnectionCount_>=Hk){this.log_.warn("SDK has tried reconnect signal channel for ".concat(Hk," times, but all failed. please check your network"));var n=new vP({code:_P.SIGNAL_CHANNEL_RECONNECTION_FAILED,message:ZR({key:PT})});return oD.logFailedEvent({userId:this.client_.getUserId(),eventType:cI,error:n}),this.addSignalEvent(zP,"signal channel reconnect fail"),void this.emitter_.emit(Hx,n)}this.isConnecting_=!0,this.reconnectionCount_++,this.currentState_!==zx&&(this.emitConnectionStateChanged(zx),this.addSignalEvent(WP,"signal channel is reconnecting")),this.log_.warn("reconnecting to ".concat(t," signal channel [").concat(this.reconnectionCount_,"/").concat(Hk,"]"));var i=this.getReconnectionUrl(t);t===zb?(this.socket_=new WebSocket(i),this.bindSocket(this.socket_)):(this.backupSocket_=new WebSocket(i),this.bindSocket(this.backupSocket_));var r=oC(this.reconnectionCount_);this.reconnectionTimer_=setTimeout((function(){e.log_.warn("reconnect ".concat(t," signal channel timeout(").concat(r/1e3,"s), close and try again")),e.isConnecting_=!1,e.clearReconnectionTimer(),e.unbindAndCloseSocket(t),e.reconnect(t===zb?Jb:zb)}),r)}}},{key:"isConnected",value:function(){return this.isConnected_}},{key:"isReconnecting_",get:function(){return-1!==this.reconnectionTimer_}},{key:"getReconnectionUrl",value:function(e){var t=e===zb?this.urlWithParam_:this.backupUrlWithParam_;if(!rD(this.signalInfo_)&&-1===t.indexOf("&rc=1")){var n=this.client_.getRoomId(),i=this.client_.getUseStringRoomId();t+="&rc=1&relayInnerIp=".concat(this.signalInfo_.relayInnerIp,"&relayOuterIp=").concat(this.signalInfo_.relayIp,"&relayPort=").concat(this.signalInfo_.relayPort,"&roomId=").concat(n,"&useStringRoomId=").concat(i)}return t}},{key:"send",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.isConnected_){var n={cmd:e,data:t,userId:this.userId_,tinyId:this.signalInfo_.tinyId,seq:++this.seq_};return this.socketInUse_.send(JSON.stringify(n)),n.seq}}},{key:"sendWaitForResponse",value:function(e){var t=this,n=e.command,i=e.data,r=e.timeout,a=void 0===r?5e3:r,o=e.responseCommand,s=e.commandDesc,c=e.enableLog,u=void 0===c||c;return new Promise((function(e,r){var c=setTimeout((function(){t.off(o,d);var e=new vP({code:_P.API_CALL_TIMEOUT,message:ZR({key:xT,data:{commandDesc:s,command:n}})});u&&t.log_.warn(e),r(e)}),a),d=function n(i){i.data.seq===l&&(clearTimeout(c),t.off(o,n),e(i))};t.on(o,d);var l=t.send(n,i)}))}},{key:"sendWaitForResponseWithRetry",value:function(){var e=this,t=arguments.length<=0?void 0:arguments[0],n=t.commandDesc,i=t.command,r=t.retries,a=void 0===r?0:r,o=t.retryTimeout,s=void 0===o?0:o;return AA({retryFunction:this.sendWaitForResponse,onRetrying:function(t){e.log_.warn("".concat(n||i," timeout observed, retrying [").concat(t,"/").concat(a,"]"))},settings:{retries:a,timeout:s},context:this}).apply(void 0,arguments)}},{key:"getCurrentState",value:function(){return this.currentState_}},{key:"getSignalInfo",value:function(){return this.signalInfo_}},{key:"stopReconnection",value:function(){this.isReconnecting_&&(this.reconnectionCount_=0,this.clearReconnectionTimer())}},{key:"close",value:function(){this.log_.info("close SignalChannel"),this.clearBackupTimer(),this.stopReconnection(),this.signalInfo_={},this.isConnecting_=!1,this.isConnected_=!1,this.socketInUse_=null,this.unbindAndCloseSocket(zb),this.unbindAndCloseSocket(Jb),this.emitConnectionStateChanged(Wx)}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"removeListener",value:function(e,t,n){this.emitter_.removeListener(e,t,n)}},{key:"once",value:function(e,t,n){this.emitter_.once(e,t,n)}},{key:"off",value:function(e,t,n){this.emitter_.off(e,t,n)}},{key:"emitConnectionStateChanged",value:function(e){e!==this.currentState_&&(this.emitter_.emit(Fx,{prevState:this.currentState_,state:e}),this.currentState_=e)}}]),e}(),cD=Tr,uD=Vd.find,dD=la,lD="find",hD=!0;lD in[]&&Array(1).find((function(){hD=!1})),cD({target:"Array",proto:!0,forced:hD},{find:function(e){return uD(this,e,arguments.length>1?arguments[1]:void 0)}}),dD(lD);var pD={},fD={},mD={exports:{}},_D=mD.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:%s 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+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{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:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(_D).forEach((function(e){_D[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},n=function(e,n,i){var r=e.name&&e.names;e.push&&!n[e.push]?n[e.push]=[]:r&&!n[e.name]&&(n[e.name]={});var a=e.push?{}:r?n[e.name]:n;!function(e,n,i,r){if(r&&!i)n[r]=t(e[1]);else for(var a=0;a<i.length;a+=1)null!=e[a+1]&&(n[i[a]]=t(e[a+1]))}(i.match(e.reg),a,e.names,e.name),e.push&&n[e.push].push(a)},i=mD.exports,r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},a=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(r).forEach((function(e){var t=e[0],r=e.slice(2);"m"===t&&(a.push({rtp:[],fmtp:[]}),o=a[a.length-1]);for(var s=0;s<(i[t]||[]).length;s+=1){var c=i[t][s];if(c.reg.test(r))return n(c,o,r)}})),t.media=a,t};var a=function(e,n){var i=n.split(/=(.+)/,2);return 2===i.length?e[i[0]]=t(i[1]):1===i.length&&n.length>1&&(e[i[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var n=[],i=e.split(" ").map(t),r=0;r<i.length;r+=3)n.push({component:i[r],ip:i[r+1],port:i[r+2]});return n},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var n,i=!1;return"~"!==e[0]?n=t(e):(n=t(e.substring(1,e.length)),i=!0),{scid:n,paused:i}}))}))}}(fD);var vD=mD.exports,gD=/%[sdv%]/g,yD=function(e){var t=1,n=arguments,i=n.length;return e.replace(gD,(function(e){if(t>=i)return e;var r=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(r);case"%d":return Number(r);case"%v":return""}}))},SD=function(e,t,n){var i=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var r=0;r<t.names.length;r+=1){var a=t.names[r];t.name?i.push(n[t.name][a]):i.push(n[t.names[r]])}else i.push(n[t.name]);return yD.apply(null,i)},bD=["v","o","s","i","u","e","p","c","b","t","r","z","a"],kD=["i","c","b","a"],ID=fD,TD=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||bD,i=t.innerOrder||kD,r=[];return n.forEach((function(t){vD[t].forEach((function(n){n.name in e&&null!=e[n.name]?r.push(SD(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){r.push(SD(t,n,e))}))}))})),e.media.forEach((function(e){r.push(SD("m",vD.m[0],e)),i.forEach((function(t){vD[t].forEach((function(n){n.name in e&&null!=e[n.name]?r.push(SD(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){r.push(SD(t,n,e))}))}))}))})),r.join("\r\n")+"\r\n"};pD.write=TD,pD.parse=ID.parse,pD.parseParams=ID.parseParams,pD.parseFmtpConfig=ID.parseFmtpConfig,pD.parsePayloads=ID.parsePayloads,pD.parseRemoteCandidates=ID.parseRemoteCandidates,pD.parseImageAttributes=ID.parseImageAttributes,pD.parseSimulcastStreamList=ID.parseSimulcastStreamList;var wD=function(e){return pD.parse(e)},ED=function(e){return pD.write(e)},RD=function(e){var t=wD(e);return t.media.forEach((function(e){e.type===Tb&&e.fmtp.forEach((function(e){e.config+=";sprop-stereo=1;stereo=1"}))})),ED(t)};var CD,AD,xD,PD,DD=Tr,OD=ee,MD=Ri,ND=z_,LD=rh,UD=x,VD=RangeError,jD=String,FD=Math.floor,BD=OD(LD),HD=OD("".slice),WD=OD(1..toFixed),GD=function(e,t,n){return 0===t?n:t%2==1?GD(e,t-1,n*e):GD(e*e,t/2,n)},zD=function(e,t,n){for(var i=-1,r=n;++i<6;)r+=t*e[i],e[i]=r%1e7,r=FD(r/1e7)},JD=function(e,t){for(var n=6,i=0;--n>=0;)i+=e[n],e[n]=FD(i/t),i=i%t*1e7},qD=function(e){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==e[t]){var i=jD(e[t]);n=""===n?i:n+BD("0",7-i.length)+i}return n};DD({target:"Number",proto:!0,forced:UD((function(){return"0.000"!==WD(8e-5,3)||"1"!==WD(.9,0)||"1.25"!==WD(1.255,2)||"1000000000000000128"!==WD(0xde0b6b3a7640080,0)}))||!UD((function(){WD({})}))},{toFixed:function(e){var t,n,i,r,a=ND(this),o=MD(e),s=[0,0,0,0,0,0],c="",u="0";if(o<0||o>20)throw VD("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return jD(a);if(a<0&&(c="-",a=-a),a>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(a*GD(2,69,1))-69)<0?a*GD(2,-t,1):a/GD(2,t,1),n*=4503599627370496,(t=52-t)>0){for(zD(s,0,n),i=o;i>=7;)zD(s,1e7,0),i-=7;for(zD(s,GD(10,i,1),0),i=t-1;i>=23;)JD(s,1<<23),i-=23;JD(s,1<<i),zD(s,1,1),JD(s,2),u=qD(s)}else zD(s,0,n),zD(s,1<<-t,0),u=qD(s)+BD("0",o);return u=o>0?c+((r=u.length)<=o?"0."+BD("0",o-r)+u:HD(u,0,r-o)+"."+HD(u,r-o)):c+u}});var KD=(null===(CD=window)||void 0===CD?void 0:CD.requestIdleCallback)||function(e){var t=Date.now();return setTimeout((function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})}),1e3)},QD=(null===(AD=window)||void 0===AD?void 0:AD.cancelIdleCallback)||function(e){clearTimeout(e)},XD=(null===(xD=window)||void 0===xD?void 0:xD.cancelAnimationFrame)||(null===(PD=window)||void 0===PD?void 0:PD.mozCancelAnimationFrame),YD=function(){function e(){o(this,e)}return c(e,null,[{key:"generateTaskID",value:function(){return this.currentTaskID++}},{key:"run",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hT,n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;i=t(t({},e===lT?{delay:2e3,count:0,backgroundTask:!0}:e===uT?{delay:1e4,count:0}:e===dT?{fps:60,delay:16.6,count:0,backgroundTask:!0}:{delay:2e3,count:0,backgroundTask:!0}),i),hC(n)&&(i=t(t({},i),n)),sC(e)&&(n=e,e=hT);var r=t({taskID:this.generateTaskID(),loopCount:0,intervalID:null,timeoutID:null,rafID:null,ricID:null,taskName:e,callback:n},i);return this.taskMap.set(r.taskID,r),this[e](r),r.taskID}},{key:"interval",value:function(e){var t=this;return e.intervalID=setInterval((function(){e.callback(),e.loopCount+=1,t.isBreakLoop(e)}),e.delay)}},{key:"timeout",value:function(e){var t=this;return e.timeoutID=setTimeout((function n(){if(e.callback(),e.loopCount+=1,!t.isBreakLoop(e))return e.timeoutID=setTimeout(n,e.delay)}),e.delay)}},{key:"ric",value:function(e){var t,n=this,i=vC();return e.ricID=KD((function r(){if((t=vC()-i)>=e.delay&&(i=vC()-Math.floor(t%e.delay),e.callback(),e.loopCount+=1),!n.isBreakLoop(e))return e.ricID=KD(r,{timeout:e.delay})}),{timeout:e.delay})}},{key:"raf",value:function(e){var t=this;e.delay=(1e3/e.fps).toFixed(2);var n,i=vC(),r=function r(){if(document.hidden&&e.backgroundTask){if(n=vC()-i,i=vC(),e.callback(),e.loopCount+=1,t.isBreakLoop(e))return;return e.timeoutID=setTimeout(r,e.delay-Math.floor(n%e.delay))}if((n=vC()-i)>=e.delay&&(i=vC()-Math.floor(n%e.delay),e.callback(),e.loopCount+=1),!t.isBreakLoop(e))return e.rafID=requestAnimationFrame(r)};if(e.rafID=requestAnimationFrame(r),e.backgroundTask){var a=function(){if(document.hidden){var t=vC()-i;t>=e.delay?r():e.timeoutID=setTimeout(r,e.delay-t)}};document.addEventListener("visibilitychange",a),e.onVisibilitychange=a,document.hidden&&a()}return e.taskID}},{key:"hasTask",value:function(e){return this.taskMap.has(e)}},{key:"clearTask",value:function(e){if(!this.taskMap.has(e))return!0;var t=this.taskMap.get(e),n=t.intervalID,i=t.timeoutID,r=t.rafID,a=t.ricID,o=t.onVisibilitychange;return n&&clearInterval(n),i&&clearTimeout(i),r&&XD(r),a&&QD(a),o&&document.removeEventListener("visibilitychange",o),this.taskMap.delete(e),!0}},{key:"isBreakLoop",value:function(e){return!this.taskMap.has(e.taskID)||0!==e.count&&e.loopCount>=e.count&&(this.clearTask(e.taskID),!0)}}]),e}();u(YD,"taskMap",new Map),u(YD,"currentTaskID",1);var $D=function(){function e(){o(this,e),this.prefix_="TRTC",this.queue_=new Map,this.checkStorage()}return c(e,[{key:"getRealKey",value:function(e){return"".concat(this.prefix_,"_").concat(e)}},{key:"checkStorage",value:function(){var e=this;if(KR()){var t=Object.keys(localStorage).filter((function(t){if(t.startsWith(e.prefix_)){var n=JSON.parse(localStorage.getItem(t));if(n&&n.expiresIn<Date.now())return!0}return!1}));t.forEach((function(e){return localStorage.removeItem(e)}))}}},{key:"doFlush",value:function(){if(KR())try{var e,t=T(this.queue_);try{for(t.s();!(e=t.n()).done;){var n=S(e.value,2),i=n[0],r=n[1];localStorage.setItem(i,JSON.stringify(r))}}catch(a){t.e(a)}finally{t.f()}}catch(Yq){MA.warn(Yq)}}},{key:"getItem",value:function(e){if(!KR())return null;try{var t=JSON.parse(localStorage.getItem(this.getRealKey(e)));return t&&t.expiresIn>=Date.now()?t.value:null}catch(Yq){MA.warn(Yq)}}},{key:"setItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(KR())try{var i={expiresIn:Date.now()+MI,value:t};n?localStorage.setItem(this.getRealKey(e),JSON.stringify(i)):(this.queue_.set(this.getRealKey(e),i),YD.hasTask(this.intervalId_)||(this.intervalId_=YD.run(uT,this.doFlush.bind(this),{count:1})))}catch(Yq){MA.warn(Yq)}}},{key:"deleteItem",value:function(e){if(!KR())return!1;try{return e=this.getRealKey(e),this.queue_.delete(e),localStorage.removeItem(e),!0}catch(Yq){return MA.warn(Yq),!1}}},{key:"clear",value:function(){if(KR())try{localStorage.clear()}catch(Yq){MA.warn(Yq)}}}]),e}(),ZD=new $D,eO={result:!1,detail:{isBrowserSupported:!1,isWebRTCSupported:!1,isMediaDevicesSupported:!1,isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH264DecodeSupported:!1,isVp8DecodeSupported:!1}},tO="checkResult";var nO=function(){return!SR&&!KE&&(!(XE&&YE<80)&&!(JE&&qE<56))},iO=function(){return["RTCPeerConnection","webkitRTCPeerConnection","RTCIceGatherer"].filter((function(e){return e in window})).length>0},rO=function(){if(!navigator.mediaDevices)return!1;var e=["getUserMedia","enumerateDevices"];return e.filter((function(e){return e in navigator.mediaDevices})).length===e.length},aO=function(){var e=a(n().mark((function e(){var t,i,r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!eO.detail.isH264EncodeSupported||!eO.detail.isVp8EncodeSupported){e.next=2;break}return e.abrupt("return",{isH264EncodeSupported:eO.detail.isH264EncodeSupported,isVp8EncodeSupported:eO.detail.isVp8EncodeSupported});case 2:return t="",i=!1,r=!1,e.prev=5,a=new RTCPeerConnection,(o=document.createElement(Ib)).getContext("2d"),s=o.captureStream(0),a.addTrack(s.getVideoTracks()[0],s),e.next=13,a.createOffer();case 13:return-1!==(t=e.sent).sdp.toLowerCase().indexOf("h264")&&(i=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0),a.close(),eO.detail.isH264EncodeSupported=i,eO.detail.isVp8EncodeSupported=r,e.abrupt("return",{isH264EncodeSupported:eO.detail.isH264EncodeSupported,isVp8EncodeSupported:eO.detail.isVp8EncodeSupported});case 22:return e.prev=22,e.t0=e.catch(5),e.abrupt("return",{isH264EncodeSupported:!1,isVp8EncodeSupported:!1});case 25:case"end":return e.stop()}}),e,null,[[5,22]])})));return function(){return e.apply(this,arguments)}}();function oO(){return sO.apply(this,arguments)}function sO(){return sO=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=a(n().mark((function e(t){var i,r,o,s,c,u,d,l,h,p,f,m,_,v;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={encode:!1,decode:!1},r=null,e.prev=2,o=document.createElement("canvas"),s=o.getContext("2d"),o.width=640,o.height=480,c=setInterval((function(){s.fillText("test",Math.floor(640*Math.random()),Math.floor(480*Math.random()))}),33),u=-1,d=-1,r=function(){clearInterval(u),clearInterval(c),clearTimeout(d),h.close(),p.close(),l.getTracks().forEach((function(e){return e.stop()}))},d=setTimeout((function(){r(),t(i)}),3e3),l=o.captureStream(),h=new RTCPeerConnection({}),p=new RTCPeerConnection({offerToReceiveAudio:!0,offerToReceiveVideo:!0}),h.addEventListener("icecandidate",(function(e){return p.addIceCandidate(e.candidate)})),p.addEventListener("icecandidate",(function(e){return h.addIceCandidate(e.candidate)})),h.addTrack(l.getVideoTracks()[0],l),e.next=20,h.createOffer();case 20:return f=e.sent,e.next=23,h.setLocalDescription(f);case 23:return e.next=25,p.setRemoteDescription(f);case 25:return e.next=27,p.createAnswer();case 27:return m=e.sent,_=wD(m.sdp),v=_.media[0].rtp.findIndex((function(e){return"H264"===e.codec})),_.media[0].rtp=[_.media[0].rtp[v]],_.media[0].fmtp=_.media[0].fmtp.filter((function(e){return e.payload===_.media[0].rtp[0].payload})),_.media[0].rtcpFb=_.media[0].rtcpFb.filter((function(e){return e.payload===_.media[0].rtp[0].payload})),m.sdp=ED(_),e.next=36,p.setLocalDescription(m);case 36:return e.next=38,h.setRemoteDescription(m);case 38:u=setInterval(a(n().mark((function e(){var a,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.encode&&i.decode&&(r(),t(i)),e.next=3,h.getStats();case 3:return a=e.sent,e.next=6,p.getStats();case 6:o=e.sent,i.encode||a.forEach((function(e){"outbound-rtp"===e.type&&e.mediaType===wb&&e.framesEncoded>0&&(i.encode=!0)})),i.decode||o.forEach((function(e){"inbound-rtp"===e.type&&e.mediaType===wb&&e.framesDecoded>0&&(i.decode=!0)}));case 9:case"end":return e.stop()}}),e)}))),500),e.next=46;break;case 41:e.prev=41,e.t0=e.catch(2),r(),MA.warn(e.t0),t(i);case 46:case"end":return e.stop()}}),e,null,[[2,41]])})));return function(t){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),sO.apply(this,arguments)}var cO=function(){var e=a(n().mark((function e(){var t,i,r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!eO.detail.isH264DecodeSupported||!eO.detail.isVp8DecodeSupported){e.next=2;break}return e.abrupt("return",{isH264DecodeSupported:eO.detail.isH264DecodeSupported,isVp8DecodeSupported:eO.detail.isVp8DecodeSupported});case 2:return t="",i=!1,r=!1,e.prev=5,a=new RTCPeerConnection,e.next=9,a.createOffer({offerToReceiveAudio:1,offerToReceiveVideo:1});case 9:return-1!==(t=e.sent).sdp.toLowerCase().indexOf("h264")&&(i=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0),a.close(),e.abrupt("return",{isH264DecodeSupported:i,isVp8DecodeSupported:r});case 16:return e.prev=16,e.t0=e.catch(5),e.abrupt("return",{isH264DecodeSupported:!1,isVp8DecodeSupported:!1});case 19:case"end":return e.stop()}}),e,null,[[5,16]])})));return function(){return e.apply(this,arguments)}}(),uO=function(){var e=a(n().mark((function e(){var t,i,r,a,o,s,c,u,d,l,h,p,f;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(lO()){e.next=2;break}return e.abrupt("return",eO);case 2:return t=nO(),i=iO(),r=rO(),e.next=7,aO();case 7:return a=e.sent,o=a.isH264EncodeSupported,s=a.isVp8EncodeSupported,e.next=12,cO();case 12:if(c=e.sent,u=c.isH264DecodeSupported,d=c.isVp8DecodeSupported,o&&s){e.next=21;break}return e.next=18,aO();case 18:l=e.sent,o=l.isH264EncodeSupported,s=l.isVp8EncodeSupported;case 21:if(!(o&&u&&(xR||DR||BR)&&!nR&&MR()<79)){e.next=29;break}return e.next=24,oO();case 24:h=e.sent,p=h.encode,f=h.decode,o=p,u=f;case 29:return eO.result=t&&i&&r&&(o||s)&&(u||d),eO.detail.isBrowserSupported=t,eO.detail.isWebRTCSupported=i,eO.detail.isMediaDevicesSupported=r,eO.detail.isH264EncodeSupported=o,eO.detail.isVp8EncodeSupported=s,eO.detail.isH264DecodeSupported=u,eO.detail.isVp8DecodeSupported=d,hO(),ZD.setItem(tO,{ua:navigator.userAgent,checkResult:eO},!0),e.abrupt("return",eO);case 40:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),dO=function(e,t){var n=null;return function(){if(n)return n;for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];return(n=e.apply(t||this,r)).then((function(e){return n=null,e})).catch((function(e){throw n=null,e})),n}}(uO);function lO(){return Object.keys(eO.detail).findIndex((function(e){return!eO.detail[e]}))>=0}function hO(){lO()&&(MA.warn(ZR({key:iE})),MA.info("".concat(navigator.userAgent," ").concat(JSON.stringify(eO.detail))))}function pO(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)}function fO(){return"RTCPeerConnection"in window&&"getReceivers"in window.RTCPeerConnection.prototype}function mO(){return"RTCPeerConnection"in window&&"getSenders"in window.RTCPeerConnection.prototype}function _O(){return"RTCPeerConnection"in window&&"getTransceivers"in window.RTCPeerConnection.prototype}function vO(){return"RTCPeerConnection"in window&&"addTransceiver"in window.RTCPeerConnection.prototype}function gO(){return"RTCRtpSender"in window&&"replaceTrack"in window.RTCRtpSender.prototype}function yO(){return"RTCRtpSender"in window&&"setParameters"in window.RTCRtpSender.prototype&&mO()}function SO(){return!!cC(navigator.mediaDevices)&&(MA.error(CE.NOT_SUPPORTED_MEDIA),!0)}function bO(){return"http:"===location.protocol&&!qR&&(MA.warn(ZR({key:nE})),!0)}var kO="RTCRtpSender"in window&&"createEncodedStreams"in window.RTCRtpSender.prototype&&MR()>=86;function IO(e){return!("candidate-pair"!==e.type||!e.nominated||"in-progress"!==e.state&&"succeeded"!==e.state)&&!(lC(e.selected)&&!e.selected)}var TO=new Map([[zE,"Android"],[GE,"iOS"],[vR,"Windows"],[gR,"MacOS"],[yR,"Linux"]]);function wO(){var e="unknown";return TO.get(!0)&&(e=TO.get(!0)),e}function EO(){var e="";screen.width&&(e+=(screen.width?screen.width*window.devicePixelRatio:"")+" * "+(screen.height?screen.height*window.devicePixelRatio:""));return e}function RO(){var e=!1;return(navigator.getUserMedia||navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)&&(e=!0),e}function CO(){for(var e={isSupported:!1},t=["AudioContext","webkitAudioContext","mozAudioContext","msAudioContext"],n=0;n<t.length;n++)if(t[n]in window){e.isSupported=!0;break}return e.isSupported}function AO(){return!(oR&&MR()<86)&&(!(GE&&dC(HR)&&HR<15)&&(!(UR&&UR<63)&&!(!nO()||!("captureStream"in HTMLCanvasElement.prototype))))}var xO=window.MediaStreamTrack&&"getSettings"in MediaStreamTrack.prototype,PO=window.MediaStreamTrack&&"getCapabilities"in MediaStreamTrack.prototype;var DO=function(){var e,t,n;return(null===(e=window)||void 0===e?void 0:e.OffscreenCanvas)&&(null===(t=window)||void 0===t?void 0:t.MediaStreamTrackProcessor)&&(null===(n=window)||void 0===n?void 0:n.MediaStreamTrackGenerator)};!function(){bO();var e=ZD.getItem(tO);e&&e.ua===navigator.userAgent&&(eO=e.checkResult),dO()}();var OO={STREAM_ADDED:"stream-added",STREAM_REMOVED:"stream-removed",STREAM_UPDATED:"stream-updated",STREAM_PUBLISHED:"stream-published",STREAM_SUBSCRIBED:"stream-subscribed",STREAM_UNSUBSCRIBED:"stream-unsubscribed",STATE_CHANGED:"state-changed",ERROR:"error",CONNECTION_STATE_CHANGED:"connection-state-changed",SEI_MESSAGE:Yb},MO={STREAM_ADDED:"stream-added",STREAM_REMOVED:"stream-removed",STREAM_UPDATED:"stream-updated",STREAM_SUBSCRIBED:"stream-subscribed",CONNECTION_STATE_CHANGED:"connection-state-changed",PEER_JOIN:"peer-join",PEER_LEAVE:"peer-leave",MUTE_AUDIO:"mute-audio",MUTE_VIDEO:"mute-video",UNMUTE_AUDIO:"unmute-audio",UNMUTE_VIDEO:"unmute-video",CLIENT_BANNED:"client-banned",NETWORK_QUALITY:"network-quality",AUDIO_VOLUME:"audio-volume",SEI_MESSAGE:Yb,ERROR:"error"},NO="player-state-changed",LO="screen-sharing-stopped",UO="connection-state-changed",VO="device-auto-recovered",jO="error",FO="player-state-changed",BO=ST;Tr({target:"String",proto:!0,forced:kT("small")},{small:function(){return BO(this,"small","","")}});var HO=function(){function e(t){o(this,e);var n=t.getUserId();this.log_=MA.createLogger({id:n,userId:n,sdkAppId:t.getSDKAppId()}),this.prevReportTime_=0,this.prevReport_={},this.prevEncoderImplementation_="",this.prevQualityLimitationReason_="",this.prevDecoderImplementationMap_=new Map}var t,i,r,s;return c(e,[{key:"statInterval",get:function(){return 0===this.prevReportTime_?2:(Date.now()-this.prevReportTime_)/1e3}},{key:"getSenderStats",value:(s=a(n().mark((function e(t){var i,r,a,o,s=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={audio:{bytesSent:0,packetsSent:0,audioLevel:0,totalAudioEnergy:0},video:{bytesSent:0,packetsSent:0,framesEncoded:0,frameWidth:0,frameHeight:0,framesSent:0,fpsCapture:0},small:{bytesSent:0,packetsSent:0,framesEncoded:0,frameWidth:0,frameHeight:0,framesSent:0,fpsCapture:0},auxiliary:{bytesSent:0,packetsSent:0,framesEncoded:0,frameWidth:0,frameHeight:0,framesSent:0,fpsCapture:0},rtt:0},r=t.getPeerConnection(),a=t.getSSRC(),!r){e.next=15;break}return e.prev=4,e.next=7,r.getStats();case 7:e.sent.forEach((function(e){var n;if("outbound-rtp"===e.type)if((e.mediaType||e.kind)===wb){if(!JE&&0===e.bytesSent)return;e.ssrc!==a.video||cC(e.encoderImplementation)||s.prevEncoderImplementation_===e.encoderImplementation||(s.log_.info("encoderImplementation change to ".concat(e.encoderImplementation)),s.prevEncoderImplementation_=e.encoderImplementation),e.ssrc!==a.video||cC(e.qualityLimitationReason)||s.prevQualityLimitationReason_===e.qualityLimitationReason||(s.log_.info("qualityLimitationReason change to ".concat(e.qualityLimitationReason)),s.prevQualityLimitationReason_=e.qualityLimitationReason);var r=wb;e.ssrc===a.small?r=Rb:e.ssrc===a.auxiliary&&(r=Ab),i[r].bytesSent=e.bytesSent,i[r].packetsSent=e.packetsSent,i[r].framesEncoded=e.framesEncoded}else i.audio.bytesSent=e.bytesSent,i.audio.packetsSent=e.packetsSent;else"candidate-pair"===e.type?IO(e)&&dC(e.currentRoundTripTime)&&(i.rtt=Math.floor(1e3*e.currentRoundTripTime)):"media-source"===e.type&&(e.kind===Tb?(i.audio.audioLevel=e.audioLevel||0,i.audio.totalAudioEnergy=e.totalAudioEnergy||0):e.kind===wb&&(e.trackIdentifier===t.getVideoTrackId(wb)?i.video.fpsCapture=e.framesPerSecond:e.trackIdentifier===t.getVideoTrackId(Ab)?i.auxiliary.fpsCapture=e.framesPerSecond:i.small.fpsCapture=e.framesPerSecond));cC(e.audioLevel)||(i.audio.audioLevel=e.audioLevel||0,i.audio.totalAudioEnergy=e.totalAudioEnergy||0),cC(e.frameWidth)||(e.trackIdentifier===t.getVideoTrackId(wb)||e.ssrc===a.video?n=wb:e.trackIdentifier===t.getVideoTrackId(Ab)||e.ssrc===a.auxiliary?n=Ab:e.trackIdentifier!==t.getVideoTrackId(Rb)&&e.ssrc!==a.small||(n=Rb),n&&(i[n].frameWidth=e.frameWidth,i[n].frameHeight=e.frameHeight,i[n].framesSent=e.framesSent))})),0===i.audio.audioLevel&&(i.audio.audioLevel=(null===(o=t.getLocalStream())||void 0===o?void 0:o.getInternalAudioLevel())||0),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),this.log_.warn("failed to getStats on sender connection "+e.t0);case 15:return e.abrupt("return",i);case 16:case"end":return e.stop()}}),e,this,[[4,12]])}))),function(e){return s.apply(this,arguments)})},{key:"getReceiverStats",value:(r=a(n().mark((function e(t){var i,r,a,o,s,c=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={tinyId:t.getTinyId(),userId:t.getUserId(),rtt:0,hasAudio:!1,hasVideo:!1,hasAuxiliary:!1,audio:{bytesReceived:0,packetsReceived:0,packetsLost:0,jitter:0,audioLevel:0,totalAudioEnergy:0},video:{bytesReceived:0,packetsReceived:0,packetsLost:0,framesReceived:0,framesDecoded:0,frameWidth:0,frameHeight:0},auxiliary:{bytesReceived:0,packetsReceived:0,packetsLost:0,framesReceived:0,framesDecoded:0,frameWidth:0,frameHeight:0}},!(r=t.getPeerConnection())){e.next=16;break}return e.prev=3,a=t.getSSRC(),o=t.getTrackState(),e.next=8,r.getStats();case 8:e.sent.forEach((function(e){if("inbound-rtp"===e.type)if((e.mediaType||e.kind)===Tb){if(e.ssrc!==a.audio||!o.audio)return;i.audio.packetsReceived=e.packetsReceived,i.audio.bytesReceived=e.bytesReceived,i.audio.packetsLost=e.packetsLost,i.audio.jitter=e.jitter,i.hasAudio=!0}else{if(JE&&0===e.bytesReceived)return;e.ssrc===a.video&&o.video&&(i.video.packetsReceived=e.packetsReceived,i.video.bytesReceived=e.bytesReceived,i.video.packetsLost=e.packetsLost,i.video.framesReceived=e.framesReceived,i.video.framesDecoded=e.framesDecoded,i.video.fpsDecoded=e.framesPerSecond,i.hasVideo=!0,!e.decoderImplementation||c.prevDecoderImplementationMap_.has(i.userId)&&c.prevDecoderImplementationMap_.get(i.userId)===e.decoderImplementation||(c.log_.info("".concat(i.userId," decoderImplementation change to ").concat(e.decoderImplementation)),c.prevDecoderImplementationMap_.set(i.userId,e.decoderImplementation))),e.ssrc===a.auxiliary&&o.auxiliary&&(i.auxiliary.packetsReceived=e.packetsReceived,i.auxiliary.bytesReceived=e.bytesReceived,i.auxiliary.packetsLost=e.packetsLost,i.auxiliary.framesReceived=e.framesReceived,i.auxiliary.framesDecoded=e.framesDecoded,i.auxiliary.fpsDecoded=e.framesPerSecond,i.hasAuxiliary=!0)}else"candidate-pair"===e.type&&IO(e)&&dC(e.currentRoundTripTime)&&(i.rtt=Math.floor(1e3*e.currentRoundTripTime));cC(e.frameWidth)||(e.trackIdentifier!==t.getMainStreamVideoTrackId()&&e.ssrc!==a.video||(i.video.frameWidth=e.frameWidth,i.video.frameHeight=e.frameHeight),e.trackIdentifier!==t.getAuxStreamVideoTrackId()&&e.ssrc!==a.auxiliary||(i.auxiliary.frameWidth=e.frameWidth,i.auxiliary.frameHeight=e.frameHeight)),cC(e.audioLevel)||(i.audio.audioLevel=e.audioLevel||0,i.audio.totalAudioEnergy=e.totalAudioEnergy||0)})),0===i.audio.audioLevel&&(i.audio.audioLevel=(null===(s=t.getMainStream())||void 0===s?void 0:s.getInternalAudioLevel())||0),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(3),this.log_.warn("failed to getStats on receiver connection "+e.t0);case 16:return e.abrupt("return",i);case 17:case"end":return e.stop()}}),e,this,[[3,13]])}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(i=a(n().mark((function e(t,i){var r,a,o,s,c,u,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r={},!t){e.next=5;break}return e.next=4,this.getSenderStats(t);case 4:r=e.sent;case 5:a=[],o=T(i),e.prev=7,o.s();case 9:if((s=o.n()).done){e.next=17;break}return(c=S(s.value,2))[0],u=c[1],e.next=13,this.getReceiverStats(u);case 13:d=e.sent,a.push(d);case 15:e.next=9;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(7),o.e(e.t0);case 22:return e.prev=22,o.f(),e.finish(22);case 25:return e.abrupt("return",{senderStats:r,receiverStats:a});case 26:case"end":return e.stop()}}),e,this,[[7,19,22,25]])}))),function(e,t){return i.apply(this,arguments)})},{key:"getDifferenceValue",value:function(e,t){if(rD(e))return t;var n=t-e;return n<0?0:n}},{key:"prepareReport",value:function(e){var t=this,n=e.stats,i=e.report,r=e.freezeMap;if(!rD(n.senderStats)){var a;a={uint32_audio_level:1e8*n.senderStats.audio.audioLevel,uint32_audio_energy:1e6*n.senderStats.audio.totalAudioEnergy,uint32_audio_codec_bitrate:n.senderStats.audio.bytesSent,audioLevel:n.senderStats.audio.audioLevel};var o=[],s={uint32_video_stream_type:2,uint32_video_codec_fps:n.senderStats.video.framesSent,uint32_video_capture_fps:n.senderStats.video.fpsCapture,uint32_video_width:n.senderStats.video.frameWidth,uint32_video_height:n.senderStats.video.frameHeight,uint32_video_codec_bitrate:n.senderStats.video.bytesSent,uint32_video_enc_fps:n.senderStats.video.framesEncoded};if(o.push(s),n.senderStats.small.bytesSent){var c={uint32_video_stream_type:3,uint32_video_codec_fps:n.senderStats.small.framesSent||0,uint32_video_capture_fps:n.senderStats.small.fpsCapture||0,uint32_video_width:n.senderStats.small.frameWidth||0,uint32_video_height:n.senderStats.small.frameHeight||0,uint32_video_codec_bitrate:n.senderStats.small.bytesSent,uint32_video_enc_fps:n.senderStats.small.framesEncoded||0};o.push(c)}if(n.senderStats.auxiliary.bytesSent){var u={uint32_video_stream_type:7,uint32_video_codec_fps:n.senderStats.auxiliary.framesSent||0,uint32_video_capture_fps:n.senderStats.auxiliary.fpsCapture||0,uint32_video_width:n.senderStats.auxiliary.frameWidth||0,uint32_video_height:n.senderStats.auxiliary.frameHeight||0,uint32_video_codec_bitrate:n.senderStats.auxiliary.bytesSent,uint32_video_enc_fps:n.senderStats.auxiliary.framesEncoded||0};o.push(u)}var d={uint32_bitrate:0,uint32_rtt:n.senderStats.rtt};i.msg_up_stream_info={msg_audio_status:a,msg_video_status:o,msg_network_status:d}}var l=this.statInterval;i.msg_down_stream_info=[],n.receiverStats.forEach((function(e){var t={};if(t.msg_user_info={str_identifier:e.userId,uint64_tinyid:e.tinyId},t.msg_network_status={uint32_rtt:e.rtt},t.msg_video_status={},e.hasAudio){var n={uint32_audio_codec_bitrate:e.audio.bytesReceived,uint32_audio_total_bitrate:e.audio.bytesReceived,uint32_audio_level:1e8*e.audio.audioLevel,uint32_audio_energy:1e6*e.audio.totalAudioEnergy,uint32_audio_receive:e.audio.packetsReceived,uint32_audio_origin_lost:e.audio.packetsLost,audioLevel:e.audio.audioLevel};t.msg_audio_status=n}if(t.msg_video_status=[],e.hasVideo){var a=r.get(e.userId+"_"+Ck),o=a?a.duration:0,s={uint32_video_stream_type:2,uint32_video_receive_fps:e.video.framesReceived,uint32_video_width:e.video.frameWidth,uint32_video_height:e.video.frameHeight,uint32_video_codec_bitrate:e.video.bytesReceived,uint32_video_receive:e.video.packetsReceived,uint32_video_origin_lost:e.video.packetsLost,uint32_video_block_time:o,uint32_video_dec_fps:e.video.framesDecoded};t.msg_video_status.push(s)}if(e.hasAuxiliary){var c=r.get(e.userId+"_"+Ak),u=c?c.duration:0,d={uint32_video_stream_type:7,uint32_video_receive_fps:e.auxiliary.framesReceived,uint32_video_width:e.auxiliary.frameWidth,uint32_video_height:e.auxiliary.frameHeight,uint32_video_codec_bitrate:e.auxiliary.bytesReceived,uint32_video_receive:e.auxiliary.packetsReceived+e.auxiliary.packetsLost,uint32_video_origin_lost:e.auxiliary.packetsLost,uint32_video_block_time:u,uint32_video_dec_fps:e.auxiliary.framesDecoded};t.msg_video_status.push(d)}i.msg_down_stream_info.push(t)}));var h=this.prevReport_;if(this.prevReport_=JSON.parse(JSON.stringify(i)),i.msg_up_stream_info.msg_audio_status&&h.msg_up_stream_info.msg_audio_status){var p=h.msg_up_stream_info.msg_audio_status,f=i.msg_up_stream_info.msg_audio_status,m=this.getDifferenceValue(p.uint32_audio_codec_bitrate,f.uint32_audio_codec_bitrate);f.uint32_audio_codec_bitrate=Math.round(8*m/l),i.msg_up_stream_info.msg_network_status.uint32_bitrate+=f.uint32_audio_codec_bitrate}var _=h.msg_up_stream_info.msg_video_status;i.msg_up_stream_info.msg_video_status.forEach((function(e){var n=_.find((function(t){return t.uint32_video_stream_type===e.uint32_video_stream_type}));if(!n||0===n.uint32_video_codec_bitrate)return e.uint32_video_codec_bitrate=0,e.uint32_video_enc_fps=0,void(e.uint32_video_codec_fps=0);var r=n.uint32_video_codec_bitrate,a=n.uint32_video_enc_fps,o=n.uint32_video_codec_fps,s=t.getDifferenceValue(r,e.uint32_video_codec_bitrate);e.uint32_video_codec_bitrate=Math.round(8*s/l),i.msg_up_stream_info.msg_network_status.uint32_bitrate+=e.uint32_video_codec_bitrate,e.uint32_video_enc_fps=Math.round(t.getDifferenceValue(a,e.uint32_video_enc_fps)/l),e.uint32_video_codec_fps=Math.round(t.getDifferenceValue(o,e.uint32_video_codec_fps)/l)}));var v=i.msg_down_stream_info,g=h.msg_down_stream_info;return v.forEach((function(e){var n=g.find((function(t){return t.msg_user_info.uint64_tinyid===e.msg_user_info.uint64_tinyid}));if(n){if(e.msg_audio_status&&n.msg_audio_status){var i=e.msg_audio_status,r=n.msg_audio_status;i.uint32_audio_origin_lost=t.getDifferenceValue(r.uint32_audio_origin_lost,i.uint32_audio_origin_lost),i.uint32_audio_receive=t.getDifferenceValue(r.uint32_audio_receive,i.uint32_audio_receive),i.uint32_audio_receive+=i.uint32_audio_origin_lost;var a=t.getDifferenceValue(r.uint32_audio_codec_bitrate,i.uint32_audio_codec_bitrate);i.uint32_audio_codec_bitrate=Math.round(8*a/l),i.uint32_audio_total_bitrate=Math.round(8*a/l)}if(e.msg_video_status&&n.msg_video_status){var o=e.msg_video_status,s=n.msg_video_status;o.forEach((function(e){var n=s.find((function(t){return t.uint32_video_stream_type===e.uint32_video_stream_type}));if(!n)return e.uint32_video_receive=0,e.uint32_video_origin_lost=0,e.uint32_video_codec_bitrate=0,e.uint32_video_receive_fps=0,void(e.uint32_video_dec_fps=0);var i=n.uint32_video_receive,r=n.uint32_video_origin_lost,a=n.uint32_video_codec_bitrate,o=n.uint32_video_receive_fps,c=n.uint32_video_dec_fps;e.uint32_video_origin_lost=t.getDifferenceValue(r,e.uint32_video_origin_lost),e.uint32_video_receive=t.getDifferenceValue(i,e.uint32_video_receive)+e.uint32_video_origin_lost;var u=t.getDifferenceValue(a,e.uint32_video_codec_bitrate);e.uint32_video_codec_bitrate=Math.round(8*u/l);var d=t.getDifferenceValue(o,e.uint32_video_receive_fps);e.uint32_video_receive_fps=Math.round(d/l),e.uint32_video_dec_fps=Math.round(t.getDifferenceValue(c,e.uint32_video_dec_fps)/l)}))}}})),i}},{key:"getStatsReport",value:(t=a(n().mark((function e(t){var i,r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.uplinkConnection,r=t.downlinkConnections,a=t.freezeMap,o={msg_up_stream_info:{msg_audio_status:{uint32_audio_format:0,uint32_audio_sample_rate:0,uint32_audio_codec_bitrate:0,uint32_audio_receive:0,uint32_audio_origin_lost:0,uint32_audio_level:0,uint32_audio_energy:0,audioLevel:0},msg_video_status:[{uint32_video_stream_type:0,uint32_video_codec_fps:0,uint32_video_capture_fps:0,uint32_video_width:0,uint32_video_height:0,uint32_video_codec_bitrate:0,uint32_video_receive:0,uint32_video_origin_lost:0,uint32_video_final_lost:0,uint32_video_enc_fps:0}],msg_network_status:{uint32_bitrate:0,uint32_rtt:0,uint32_lost:0}},msg_down_stream_info:[{msg_user_info:{str_identifier:"",uint64_tinyid:""},msg_audio_status:{uint32_audio_format:0,uint32_audio_sample_rate:0,uint32_audio_codec_bitrate:0,uint32_audio_total_bitrate:0,uint32_audio_level:0,uint32_audio_energy:0,uint32_audio_receive:0,uint32_audio_origin_lost:0,uint32_audio_final_lost:0,audioLevel:0},msg_video_status:[{uint32_video_stream_type:0,uint32_video_receive_fps:0,uint32_video_width:0,uint32_video_height:0,uint32_video_codec_bitrate:0,uint32_video_receive:0,uint32_video_origin_lost:0,uint32_video_block_time:0,uint32_video_dec_fps:0}],msg_network_status:{uint32_bitrate:0,uint32_rtt:0,uint32_lost:0,uint32_jitter:0}}]},e.next=4,this.getStats(i,r);case 4:return s=e.sent,"{}"===JSON.stringify(this.prevReport_)&&(this.prevReport_=JSON.parse(JSON.stringify(o))),this.prepareReport({stats:s,report:o,freezeMap:a,uplinkConnection:i,downlinkConnections:r}),this.prevReportTime_=Date.now(),e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"reset",value:function(){this.prevReportTime_=0,this.prevReport_={},this.prevEncoderImplementation_="",this.prevQualityLimitationReason_="",this.prevDecoderImplementationMap_=new Map}}]),e}(),WO=function(){function e(t){var n=t.signalChannel,i=t.connections,r=t.client;o(this,e),this.client_=r,this.signalChannel_=n,this.connections_=i,this.client_=r,this.log_=MA.createLogger({id:"q|"+this.client_.getUserId(),userId:this.client_.getUserId(),sdkAppId:this.client_.getSDKAppId()}),this.uplinkConnection_=null,this.uplinkNetworkQuality_=0,this.uplinkRTT_=0,this.uplinkLoss_=0,this.downlinkNetworkQuality_=0,this.downlinkRTT_=0,this.downlinkLoss_=0,this.downlinkPrevStatMap_=new Map,this.downlinkLossAndRTTMap_=new Map,this.interval_=-1,this.emitter_=new DC,this.initialize()}var t,i;return c(e,[{key:"uplinkNetworkQuality",get:function(){return this.uplinkNetworkQuality_},set:function(e){e!==this.uplinkNetworkQuality_&&this.log_.info("uplink network quality change ".concat(this.uplinkNetworkQuality," -> ").concat(e,", rtt: ").concat(this.uplinkRTT_,", loss: ").concat(this.uplinkLoss_)),this.uplinkNetworkQuality_=e}},{key:"downlinkNetworkQuality",get:function(){return this.downlinkNetworkQuality_},set:function(e){if(e!==this.downlinkNetworkQuality_){var t=this.getAverageLossAndRTT(b(this.downlinkLossAndRTTMap_.values())),n=t.rtt,i=t.loss;this.log_.info("downlink network quality change ".concat(this.downlinkNetworkQuality," -> ").concat(e,", rtt: ").concat(n,", loss: ").concat(i))}this.downlinkNetworkQuality_=e}},{key:"initialize",value:function(){var e=this;this.signalChannel_.on(Qx.UPLINK_NETWORK_STATS,(function(t){e.handleUplinkNetworkQuality(t)})),this.signalChannel_.on(Fx,this.handleSignalConnectionStateChange.bind(this)),this.start()}},{key:"handleUplinkNetworkQuality",value:function(e){if(!this.uplinkConnection_)return this.uplinkNetworkQuality=0,this.uplinkLoss_=0,void(this.uplinkRTT_=0);var t=this.uplinkConnection_.getPeerConnection();if(t&&this.isPeerConnectionDisconnected(t))return this.uplinkNetworkQuality=6,this.uplinkLoss_=0,void(this.uplinkRTT_=0);if(0===e.data.code){var n=e.data.data,i=n.expectAudPkg+n.expectVidPkg,r=n.recvAudPkg+n.recvVidPkg,a=i-r,o=n.delay;if(o&&this.updateDelay(o),0===i&&0===r)return;this.uplinkLoss_=a<=0?0:Math.round(a/i*100),this.uplinkRTT_=n.rtt,this.uplinkNetworkQuality=this.getNetworkQuality(this.uplinkLoss_,this.uplinkRTT_)}}},{key:"handleDownlinkNetworkQuality",value:(i=a(n().mark((function e(){var t,i,r,a,o,s,c,u,d,l,h,p,f,m,_,v=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connections_&&0!==this.connections_.size){e.next=3;break}return this.downlinkNetworkQuality=0,e.abrupt("return");case 3:if(t=b(this.connections_.values()),i=t.filter((function(e){return e.getPeerConnection()&&e.getPeerConnection().connectionState===Fk})),t.filter((function(e){return e.getPeerConnection()&&v.isPeerConnectionDisconnected(e.getPeerConnection())})).length!==t.length){e.next=9;break}return this.downlinkNetworkQuality=6,e.abrupt("return");case 9:r=0;case 10:if(!(r<i.length)){e.next=31;break}return a=i[r].getPeerConnection(),e.next=14,this.getStat(a);case 14:if(o=e.sent,s=o.rtt,c=o.totalPacketsLost,u=o.totalPacketsReceived,this.downlinkPrevStatMap_.has(a)){e.next=21;break}return this.downlinkPrevStatMap_.set(a,{totalPacketsLost:c,totalPacketsReceived:u}),e.abrupt("continue",28);case 21:d=0,l=this.downlinkPrevStatMap_.get(a),h=c-l.totalPacketsLost,p=u-l.totalPacketsReceived,d=h<=0||p<0?0:Math.round(h/(h+p)*100),this.downlinkPrevStatMap_.set(a,{totalPacketsLost:c,totalPacketsReceived:u}),this.downlinkLossAndRTTMap_.set(a,{rtt:s,loss:d,userId:i[r].getUserId()});case 28:r++,e.next=10;break;case 31:if(b(this.downlinkPrevStatMap_.keys()).forEach((function(e){v.isPeerConnectionDisconnected(e)&&(v.downlinkPrevStatMap_.delete(e),v.downlinkLossAndRTTMap_.delete(e))})),0!==this.downlinkLossAndRTTMap_.size){e.next=34;break}return e.abrupt("return");case 34:f=this.getAverageLossAndRTT(b(this.downlinkLossAndRTTMap_.values())),m=f.rtt,_=f.loss,this.downlinkRTT_=m,this.downlinkLoss_=_,this.downlinkNetworkQuality=this.getNetworkQuality(_,m);case 38:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"getStat",value:(t=a(n().mark((function e(t){var i,r,a,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={rtt:0,totalPacketsLost:0,totalPacketsReceived:0},t&&fO()){e.next=3;break}return e.abrupt("return",i);case 3:r=t.getReceivers(),e.prev=4,a=0;case 6:if(!(a<r.length)){e.next=15;break}return o=r[a],e.next=10,o.getStats();case 10:e.sent.forEach((function(e){"candidate-pair"===e.type&&dC(e.currentRoundTripTime)&&(i.rtt=Math.round(1e3*e.currentRoundTripTime)),"inbound-rtp"!==e.type||e.mediaType!==Tb&&e.mediaType!==wb||(i.totalPacketsLost+=e.packetsLost,i.totalPacketsReceived+=e.packetsReceived)}));case 12:a++,e.next=6;break;case 15:return e.abrupt("return",i);case 18:return e.prev=18,e.t0=e.catch(4),e.abrupt("return",i);case 21:case"end":return e.stop()}}),e,null,[[4,18]])}))),function(e){return t.apply(this,arguments)})},{key:"getAverageLossAndRTT",value:function(e){var t={rtt:0,loss:0};return Array.isArray(e)&&e.length>0&&(e.forEach((function(e){t.rtt+=e.rtt,t.loss+=e.loss})),Object.keys(t).forEach((function(n){t[n]=Math.round(t[n]/e.length)}))),t}},{key:"getNetworkQuality",value:function(e,t){return e>50||t>500?5:e>30||t>350?4:e>20||t>200?3:e>10||t>100?2:e>=0||t>=0?1:0}},{key:"handleSignalConnectionStateChange",value:function(e){e.state===Wx?(this.uplinkRTT_=0,this.uplinkLoss_=0,this.uplinkNetworkQuality=6):e.state===Jx&&6===this.uplinkNetworkQuality&&(this.uplinkNetworkQuality=5)}},{key:"handleUplinkConnectionStateChange",value:function(e){var t=e.state;t===Pk?(this.uplinkLoss_=0,this.uplinkRTT_=0,this.uplinkNetworkQuality=6):t===Mk&&6===this.uplinkNetworkQuality&&(this.uplinkNetworkQuality=5)}},{key:"isPeerConnectionDisconnected",value:function(e){return!(!e||e.connectionState!==jk&&e.connectionState!==Uk&&e.connectionState!==Vk)}},{key:"setUplinkConnection",value:function(e){this.uplinkConnection_=e,this.uplinkConnection_?this.uplinkConnection_.on(OO.CONNECTION_STATE_CHANGED,this.handleUplinkConnectionStateChange.bind(this)):(this.uplinkNetworkQuality=0,this.uplinkRTT_=0,this.uplinkLoss_=0)}},{key:"start",value:function(){var e=this;-1===this.interval_?(this.log_.info("start network quality calculating"),this.interval_=YD.run(uT,(function(){e.handleDownlinkNetworkQuality(),OC.emit(wA,{client:e.client_,uplinkNetworkQuality:e.uplinkNetworkQuality,downlinkNetworkQuality:e.downlinkNetworkQuality,uplinkRTT:e.uplinkRTT_,uplinkLoss:e.uplinkLoss_,downlinkRTT:e.downlinkRTT_,downlinkLoss:e.downlinkLoss_,downlinkLossAndRTTMap:e.downlinkLossAndRTTMap_}),e.emitter_.emit(MO.NETWORK_QUALITY,{uplinkNetworkQuality:e.uplinkNetworkQuality,downlinkNetworkQuality:e.downlinkNetworkQuality,uplinkRTT:e.uplinkRTT_,uplinkLoss:e.uplinkLoss_,downlinkRTT:e.downlinkRTT_,downlinkLoss:e.downlinkLoss_})}),{delay:2e3})):this.log_.info("network quality calculating is already started")}},{key:"stop",value:function(){this.log_.info("stop network quality calculating"),-1!==this.interval_&&(YD.clearTask(this.interval_),this.interval_=-1),this.downlinkLossAndRTTMap_.clear(),this.downlinkPrevStatMap_.clear()}},{key:"on",value:function(e,t){this.emitter_.on(e,t)}},{key:"updateDelay",value:function(e){var t=this;e.forEach((function(e){var n=e.srcTinyId,i=e.videoDelay,r=e.audioDelay,a=t.connections_.get(n);a&&a.setDelay({videoDelay:i,audioDelay:r})}))}}]),e}(),GO=function(){function e(t){o(this,e),this.log_=MA.createLogger({id:t.client.getUserId(),userId:t.client.getUserId(),sdkAppId:t.client.getSDKAppId()}),this.localStream_=null,this.prevDevices_=[],this.initialize()}var t,i;return c(e,[{key:"initialize",value:function(){navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&(this.onDeviceChange=this.onDeviceChange.bind(this),navigator.mediaDevices.addEventListener("devicechange",this.onDeviceChange))}},{key:"destroy",value:function(){navigator.mediaDevices&&navigator.mediaDevices.removeEventListener&&navigator.mediaDevices.removeEventListener("devicechange",this.onDeviceChange)}},{key:"onDeviceChange",value:(i=a(n().mark((function e(){var t,i,r,a=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.localStream_&&this.localStream_.getMediaStream()&&!this.localStream_.getScreen()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,QO();case 4:t=e.sent,i=t.filter((function(e){return a.prevDevices_.findIndex((function(t){var n=t.deviceId;return e.deviceId===n}))<0})),r=this.prevDevices_.filter((function(e){return t.findIndex((function(t){var n=t.deviceId;return e.deviceId===n}))<0})),i.length>0&&this.handleDeviceAdded(this.prevDevices_,i),r.length>0&&this.handleDeviceRemoved(t,r),this.prevDevices_=t;case 10:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"setLocalStream",value:(t=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return e.next=3,QO();case 3:this.prevDevices_=e.sent;case 4:this.localStream_=t;case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"handleDeviceAdded",value:function(e,t){var n,i;if(this.localStream_){this.log_.warn("devicesAdded: ".concat(JSON.stringify(t))),this.localStream_.updateDeviceIdInUse();var r=t.filter((function(e){return e.kind===Hb})),a=t.filter((function(e){return e.kind===Bb})),o=e.filter((function(e){return e.kind===Hb})),s=e.filter((function(e){return e.kind===Bb})),c=r.length>0&&0===o.length&&"live"!==(null===(n=this.localStream_.getVideoTrack())||void 0===n?void 0:n.readyState),u=a.length>0&&0===s.length&&"live"!==(null===(i=this.localStream_.getAudioTrack())||void 0===i?void 0:i.readyState);if(u&&c)return this.log_.info("new microphone and camera detected, but there was no device before."),void this.localStream_.recoverCapture({audio:!0,video:!0,cameraId:r[0].deviceId,microphoneId:a[0].deviceId});c&&(this.log_.info("new camera detected, but there was no camera before."),this.localStream_.recoverCapture({audio:!1,video:!0,cameraId:r[0].deviceId})),u&&(this.log_.info("new microphone detected, but there was no microphone before."),this.localStream_.recoverCapture({audio:!0,video:!1,microphoneId:a[0].deviceId}))}}},{key:"handleDeviceRemoved",value:function(e,t){if(this.localStream_){this.log_.warn("devicesRemoved: ".concat(JSON.stringify(t))),this.localStream_.updateDeviceIdInUse();var n=!1,i=!1,r=this.localStream_.getCameraId(),a=this.localStream_.getMicrophoneId();if(a===ZI){var o=this.localStream_.getMicrophoneGroupId(),s=e.filter((function(e){return e.deviceId===ZI&&e.kind===Bb}))[0];s&&s.groupId!==o&&(i=!0)}if(t.forEach((function(e){var t=e.deviceId;r.length>0&&t===r?n=!0:a.length>0&&t===a&&(i=!0)})),n&&i)return this.log_.warn("current camera and microphone in use is lost, cameraId: ".concat(r,", microphoneId: ").concat(a)),void((this.localStream_.getAudio()||this.localStream_.getVideo())&&this.localStream_.recoverCapture({video:!0,audio:!0}));n&&(this.log_.warn("current camera in use is lost, deviceId: ".concat(r)),this.localStream_.getVideo()&&this.localStream_.recoverCapture({video:!0,audio:!1})),i&&(this.log_.warn("current microphone in use is lost, deviceId: ".concat(a)),this.localStream_.getAudio()&&this.localStream_.recoverCapture({video:!1,audio:!0}))}}}]),e}();function zO(){return zO=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!bO()&&!SO()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,qO();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return e.kind===Hb})).map((function(e,t){var n=e.label;e.label||(n="camera_"+t);var i={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(i.groupId=e.groupId),e.getCapabilities&&(i.getCapabilities=function(){return e.getCapabilities()}),i})));case 6:case"end":return e.stop()}}),e)}))),zO.apply(this,arguments)}var JO=new Set;function qO(){return KO.apply(this,arguments)}function KO(){return(KO=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!bO()&&!SO()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return(t=e.sent).forEach((function(e){JO.add("".concat(e.deviceId,"_").concat(e.kind))})),e.abrupt("return",t);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function QO(){return XO.apply(this,arguments)}function XO(){return XO=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qO();case 2:return t=e.sent,e.abrupt("return",t.filter((function(e){return e.kind!==Bb||e.deviceId!=eT})).map((function(e,t){var n=e.label;e.label||(n=e.kind+"_"+t);var i={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(i.groupId=e.groupId),e.getCapabilities&&(i.getCapabilities=function(){return e.getCapabilities()}),i})));case 4:case"end":return e.stop()}}),e)}))),XO.apply(this,arguments)}function YO(){return $O.apply(this,arguments)}function $O(){return $O=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qO();case 2:return t=e.sent,e.abrupt("return",t.filter((function(e){return e.kind===Bb&&e.deviceId!==eT})).map((function(e,t){var n=e.label;e.label||(n="microphone_"+t);var i={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(i.groupId=e.groupId),e.getCapabilities&&(i.getCapabilities=function(){return e.getCapabilities()}),i})));case 4:case"end":return e.stop()}}),e)}))),$O.apply(this,arguments)}function ZO(){return eM.apply(this,arguments)}function eM(){return eM=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qO();case 2:return t=e.sent,e.abrupt("return",t.filter((function(e){return"audiooutput"===e.kind})).map((function(e,t){var n=e.label;e.label||(n="speaker_"+t);var i={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(i.groupId=e.groupId),i})));case 4:case"end":return e.stop()}}),e)}))),eM.apply(this,arguments)}function tM(e){var t;if(e instanceof CanvasCaptureMediaStreamTrack)return!1;if(!(e instanceof window.MediaStreamTrack))return!1;var n=e.label.toLocaleLowerCase();if(n.includes("camera")||n.includes("webcam"))return!0;var i="".concat(null===(t=e.getSettings())||void 0===t?void 0:t.deviceId,"_").concat(Hb);return!!JO.has(i)}function nM(e,t){return iM.apply(this,arguments)}function iM(){return(iM=a(n().mark((function e(t,i){var r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,YO();case 2:if(r=e.sent,(null==(a=r.find((function(e){return e.deviceId===ZI})))?void 0:a.groupId)!==t||a.label!==i){e.next=6;break}return e.abrupt("return",!0);case 6:return e.abrupt("return",!1);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var rM,aM=Tn.exports,oM=rn,sM=un,cM=Ys,uM=xs,dM=N,lM=lt,hM=function(e,t,n,i){try{return i?t(sM(n)[0],n[1]):t(n)}catch(Yq){cM(e,"throw",Yq)}},pM=Ms,fM=Id,mM=Li,_M=Jo,vM=qs,gM=Fs,yM=Array,SM=function(e){var t=lM(e),n=fM(this),i=arguments.length,r=i>1?arguments[1]:void 0,a=void 0!==r;a&&(r=uM(r,i>2?arguments[2]:void 0));var o,s,c,u,d,l,h=gM(t),p=0;if(!h||this===yM&&pM(h))for(o=mM(t),s=n?new this(o):yM(o);o>p;p++)l=a?r(t[p],p):t[p],_M(s,p,l);else for(d=(u=vM(t,h)).next,s=n?new this:[];!(c=dM(d,u)).done;p++)l=a?hM(u,r,[c.value,p],!0):c.value,_M(s,p,l);return s.length=p,s},bM=ee,kM=2147483647,IM=/[^\0-\u007E]/,TM=/[.\u3002\uFF0E\uFF61]/g,wM="Overflow: input needs wider integers to process",EM=RangeError,RM=bM(TM.exec),CM=Math.floor,AM=String.fromCharCode,xM=bM("".charCodeAt),PM=bM([].join),DM=bM([].push),OM=bM("".replace),MM=bM("".split),NM=bM("".toLowerCase),LM=function(e){return e+22+75*(e<26)},UM=function(e,t,n){var i=0;for(e=n?CM(e/700):e>>1,e+=CM(e/t);e>455;)e=CM(e/35),i+=36;return CM(i+36*e/(e+38))},VM=function(e){var t=[];e=function(e){for(var t=[],n=0,i=e.length;n<i;){var r=xM(e,n++);if(r>=55296&&r<=56319&&n<i){var a=xM(e,n++);56320==(64512&a)?DM(t,((1023&r)<<10)+(1023&a)+65536):(DM(t,r),n--)}else DM(t,r)}return t}(e);var n,i,r=e.length,a=128,o=0,s=72;for(n=0;n<e.length;n++)(i=e[n])<128&&DM(t,AM(i));var c=t.length,u=c;for(c&&DM(t,"-");u<r;){var d=kM;for(n=0;n<e.length;n++)(i=e[n])>=a&&i<d&&(d=i);var l=u+1;if(d-a>CM((kM-o)/l))throw EM(wM);for(o+=(d-a)*l,a=d,n=0;n<e.length;n++){if((i=e[n])<a&&++o>kM)throw EM(wM);if(i==a){for(var h=o,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var m=h-f,_=36-f;DM(t,AM(LM(f+m%_))),h=CM(m/_),p+=36}DM(t,AM(LM(h))),s=UM(o,l,u==c),o=0,u++}}o++,a++}return PM(t,"")},jM=Tr,FM=P,BM=pf,HM=C,WM=xs,GM=ee,zM=ki,JM=function(e,t,n){return n.get&&aM(n.get,t,{getter:!0}),n.set&&aM(n.set,t,{setter:!0}),oM.f(e,t,n)},qM=fc,KM=ft,QM=dx,XM=SM,YM=$o,$M=yu.codeAt,ZM=function(e){var t,n,i=[],r=MM(OM(NM(e),TM,"."),".");for(t=0;t<r.length;t++)n=r[t],DM(i,RM(IM,n)?"xn--"+VM(n):n);return PM(i,".")},eN=du,tN=Ma,nN=Xu,iN=Om,rN=ai,aN=rN.set,oN=rN.getterFor("URL"),sN=iN.URLSearchParams,cN=iN.getState,uN=HM.URL,dN=HM.TypeError,lN=HM.parseInt,hN=Math.floor,pN=Math.pow,fN=GM("".charAt),mN=GM(/./.exec),_N=GM([].join),vN=GM(1..toString),gN=GM([].pop),yN=GM([].push),SN=GM("".replace),bN=GM([].shift),kN=GM("".split),IN=GM("".slice),TN=GM("".toLowerCase),wN=GM([].unshift),EN="Invalid scheme",RN="Invalid host",CN="Invalid port",AN=/[a-z]/i,xN=/[\d+-.a-z]/i,PN=/\d/,DN=/^0x/i,ON=/^[0-7]+$/,MN=/^\d+$/,NN=/^[\da-f]+$/i,LN=/[\0\t\n\r #%/:<>?@[\\\]^|]/,UN=/[\0\t\n\r #/:<>?@[\\\]^|]/,VN=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,jN=/[\t\n\r]/g,FN=function(e){var t,n,i,r;if("number"==typeof e){for(t=[],n=0;n<4;n++)wN(t,e%256),e=hN(e/256);return _N(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,n=1,i=null,r=0,a=0;a<8;a++)0!==e[a]?(r>n&&(t=i,n=r),i=null,r=0):(null===i&&(i=a),++r);return r>n&&(t=i,n=r),t}(e),n=0;n<8;n++)r&&0===e[n]||(r&&(r=!1),i===n?(t+=n?":":"::",r=!0):(t+=vN(e[n],16),n<7&&(t+=":")));return"["+t+"]"}return e},BN={},HN=QM({},BN,{" ":1,'"':1,"<":1,">":1,"`":1}),WN=QM({},HN,{"#":1,"?":1,"{":1,"}":1}),GN=QM({},WN,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),zN=function(e,t){var n=$M(e,0);return n>32&&n<127&&!KM(t,e)?e:encodeURIComponent(e)},JN={ftp:21,file:null,http:80,https:443,ws:80,wss:443},qN=function(e,t){var n;return 2==e.length&&mN(AN,fN(e,0))&&(":"==(n=fN(e,1))||!t&&"|"==n)},KN=function(e){var t;return e.length>1&&qN(IN(e,0,2))&&(2==e.length||"/"===(t=fN(e,2))||"\\"===t||"?"===t||"#"===t)},QN=function(e){return"."===e||"%2e"===TN(e)},XN={},YN={},$N={},ZN={},eL={},tL={},nL={},iL={},rL={},aL={},oL={},sL={},cL={},uL={},dL={},lL={},hL={},pL={},fL={},mL={},_L={},vL=function(e,t,n){var i,r,a,o=eN(e);if(t){if(r=this.parse(o))throw dN(r);this.searchParams=null}else{if(void 0!==n&&(i=new vL(n,!0)),r=this.parse(o,null,i))throw dN(r);(a=cN(new sN)).bindURL(this),this.searchParams=a}};vL.prototype={type:"URL",parse:function(e,t,n){var i,r,a,o,s,c=this,u=t||XN,d=0,l="",h=!1,p=!1,f=!1;for(e=eN(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=SN(e,VN,"")),e=SN(e,jN,""),i=XM(e);d<=i.length;){switch(r=i[d],u){case XN:if(!r||!mN(AN,r)){if(t)return EN;u=$N;continue}l+=TN(r),u=YN;break;case YN:if(r&&(mN(xN,r)||"+"==r||"-"==r||"."==r))l+=TN(r);else{if(":"!=r){if(t)return EN;l="",u=$N,d=0;continue}if(t&&(c.isSpecial()!=KM(JN,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&JN[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=uL:c.isSpecial()&&n&&n.scheme==c.scheme?u=ZN:c.isSpecial()?u=iL:"/"==i[d+1]?(u=eL,d++):(c.cannotBeABaseURL=!0,yN(c.path,""),u=fL)}break;case $N:if(!n||n.cannotBeABaseURL&&"#"!=r)return EN;if(n.cannotBeABaseURL&&"#"==r){c.scheme=n.scheme,c.path=YM(n.path),c.query=n.query,c.fragment="",c.cannotBeABaseURL=!0,u=_L;break}u="file"==n.scheme?uL:tL;continue;case ZN:if("/"!=r||"/"!=i[d+1]){u=tL;continue}u=rL,d++;break;case eL:if("/"==r){u=aL;break}u=pL;continue;case tL:if(c.scheme=n.scheme,r==rM)c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=YM(n.path),c.query=n.query;else if("/"==r||"\\"==r&&c.isSpecial())u=nL;else if("?"==r)c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=YM(n.path),c.query="",u=mL;else{if("#"!=r){c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=YM(n.path),c.path.length--,u=pL;continue}c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=YM(n.path),c.query=n.query,c.fragment="",u=_L}break;case nL:if(!c.isSpecial()||"/"!=r&&"\\"!=r){if("/"!=r){c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,u=pL;continue}u=aL}else u=rL;break;case iL:if(u=rL,"/"!=r||"/"!=fN(l,d+1))continue;d++;break;case rL:if("/"!=r&&"\\"!=r){u=aL;continue}break;case aL:if("@"==r){h&&(l="%40"+l),h=!0,a=XM(l);for(var m=0;m<a.length;m++){var _=a[m];if(":"!=_||f){var v=zN(_,GN);f?c.password+=v:c.username+=v}else f=!0}l=""}else if(r==rM||"/"==r||"?"==r||"#"==r||"\\"==r&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=XM(l).length+1,l="",u=oL}else l+=r;break;case oL:case sL:if(t&&"file"==c.scheme){u=lL;continue}if(":"!=r||p){if(r==rM||"/"==r||"?"==r||"#"==r||"\\"==r&&c.isSpecial()){if(c.isSpecial()&&""==l)return RN;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(o=c.parseHost(l))return o;if(l="",u=hL,t)return;continue}"["==r?p=!0:"]"==r&&(p=!1),l+=r}else{if(""==l)return RN;if(o=c.parseHost(l))return o;if(l="",u=cL,t==sL)return}break;case cL:if(!mN(PN,r)){if(r==rM||"/"==r||"?"==r||"#"==r||"\\"==r&&c.isSpecial()||t){if(""!=l){var g=lN(l,10);if(g>65535)return CN;c.port=c.isSpecial()&&g===JN[c.scheme]?null:g,l=""}if(t)return;u=hL;continue}return CN}l+=r;break;case uL:if(c.scheme="file","/"==r||"\\"==r)u=dL;else{if(!n||"file"!=n.scheme){u=pL;continue}if(r==rM)c.host=n.host,c.path=YM(n.path),c.query=n.query;else if("?"==r)c.host=n.host,c.path=YM(n.path),c.query="",u=mL;else{if("#"!=r){KN(_N(YM(i,d),""))||(c.host=n.host,c.path=YM(n.path),c.shortenPath()),u=pL;continue}c.host=n.host,c.path=YM(n.path),c.query=n.query,c.fragment="",u=_L}}break;case dL:if("/"==r||"\\"==r){u=lL;break}n&&"file"==n.scheme&&!KN(_N(YM(i,d),""))&&(qN(n.path[0],!0)?yN(c.path,n.path[0]):c.host=n.host),u=pL;continue;case lL:if(r==rM||"/"==r||"\\"==r||"?"==r||"#"==r){if(!t&&qN(l))u=pL;else if(""==l){if(c.host="",t)return;u=hL}else{if(o=c.parseHost(l))return o;if("localhost"==c.host&&(c.host=""),t)return;l="",u=hL}continue}l+=r;break;case hL:if(c.isSpecial()){if(u=pL,"/"!=r&&"\\"!=r)continue}else if(t||"?"!=r)if(t||"#"!=r){if(r!=rM&&(u=pL,"/"!=r))continue}else c.fragment="",u=_L;else c.query="",u=mL;break;case pL:if(r==rM||"/"==r||"\\"==r&&c.isSpecial()||!t&&("?"==r||"#"==r)){if(".."===(s=TN(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==r||"\\"==r&&c.isSpecial()||yN(c.path,"")):QN(l)?"/"==r||"\\"==r&&c.isSpecial()||yN(c.path,""):("file"==c.scheme&&!c.path.length&&qN(l)&&(c.host&&(c.host=""),l=fN(l,0)+":"),yN(c.path,l)),l="","file"==c.scheme&&(r==rM||"?"==r||"#"==r))for(;c.path.length>1&&""===c.path[0];)bN(c.path);"?"==r?(c.query="",u=mL):"#"==r&&(c.fragment="",u=_L)}else l+=zN(r,WN);break;case fL:"?"==r?(c.query="",u=mL):"#"==r?(c.fragment="",u=_L):r!=rM&&(c.path[0]+=zN(r,BN));break;case mL:t||"#"!=r?r!=rM&&("'"==r&&c.isSpecial()?c.query+="%27":c.query+="#"==r?"%23":zN(r,BN)):(c.fragment="",u=_L);break;case _L:r!=rM&&(c.fragment+=zN(r,HN))}d++}},parseHost:function(e){var t,n,i;if("["==fN(e,0)){if("]"!=fN(e,e.length-1))return RN;if(t=function(e){var t,n,i,r,a,o,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return fN(e,l)};if(":"==h()){if(":"!=fN(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=n=0;n<4&&mN(NN,h());)t=16*t+lN(h(),16),l++,n++;if("."==h()){if(0==n)return;if(l-=n,u>6)return;for(i=0;h();){if(r=null,i>0){if(!("."==h()&&i<4))return;l++}if(!mN(PN,h()))return;for(;mN(PN,h());){if(a=lN(h(),10),null===r)r=a;else{if(0==r)return;r=10*r+a}if(r>255)return;l++}c[u]=256*c[u]+r,2!=++i&&4!=i||u++}if(4!=i)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(o=u-d,u=7;0!=u&&o>0;)s=c[u],c[u--]=c[d+o-1],c[d+--o]=s;else if(8!=u)return;return c}(IN(e,1,-1)),!t)return RN;this.host=t}else if(this.isSpecial()){if(e=ZM(e),mN(LN,e))return RN;if(t=function(e){var t,n,i,r,a,o,s,c=kN(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(n=[],i=0;i<t;i++){if(""==(r=c[i]))return e;if(a=10,r.length>1&&"0"==fN(r,0)&&(a=mN(DN,r)?16:8,r=IN(r,8==a?1:2)),""===r)o=0;else{if(!mN(10==a?MN:8==a?ON:NN,r))return e;o=lN(r,a)}yN(n,o)}for(i=0;i<t;i++)if(o=n[i],i==t-1){if(o>=pN(256,5-t))return null}else if(o>255)return null;for(s=gN(n),i=0;i<n.length;i++)s+=n[i]*pN(256,3-i);return s}(e),null===t)return RN;this.host=t}else{if(mN(UN,e))return RN;for(t="",n=XM(e),i=0;i<n.length;i++)t+=zN(n[i],BN);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return KM(JN,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&qN(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,n=e.username,i=e.password,r=e.host,a=e.port,o=e.path,s=e.query,c=e.fragment,u=t+":";return null!==r?(u+="//",e.includesCredentials()&&(u+=n+(i?":"+i:"")+"@"),u+=FN(r),null!==a&&(u+=":"+a)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?o[0]:o.length?"/"+_N(o,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw dN(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new gL(e.path[0]).origin}catch(Yq){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+FN(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(eN(e)+":",XN)},getUsername:function(){return this.username},setUsername:function(e){var t=XM(eN(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var n=0;n<t.length;n++)this.username+=zN(t[n],GN)}},getPassword:function(){return this.password},setPassword:function(e){var t=XM(eN(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var n=0;n<t.length;n++)this.password+=zN(t[n],GN)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?FN(e):FN(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,oL)},getHostname:function(){var e=this.host;return null===e?"":FN(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,sL)},getPort:function(){var e=this.port;return null===e?"":eN(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=eN(e))?this.port=null:this.parse(e,cL))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+_N(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,hL))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=eN(e))?this.query=null:("?"==fN(e,0)&&(e=IN(e,1)),this.query="",this.parse(e,mL)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=eN(e))?("#"==fN(e,0)&&(e=IN(e,1)),this.fragment="",this.parse(e,_L)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var gL=function(e){var t=qM(this,yL),n=nN(arguments.length,1)>1?arguments[1]:void 0,i=aN(t,new vL(e,!1,n));FM||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},yL=gL.prototype,SL=function(e,t){return{get:function(){return oN(this)[e]()},set:t&&function(e){return oN(this)[t](e)},configurable:!0,enumerable:!0}};if(FM&&(JM(yL,"href",SL("serialize","setHref")),JM(yL,"origin",SL("getOrigin")),JM(yL,"protocol",SL("getProtocol","setProtocol")),JM(yL,"username",SL("getUsername","setUsername")),JM(yL,"password",SL("getPassword","setPassword")),JM(yL,"host",SL("getHost","setHost")),JM(yL,"hostname",SL("getHostname","setHostname")),JM(yL,"port",SL("getPort","setPort")),JM(yL,"pathname",SL("getPathname","setPathname")),JM(yL,"search",SL("getSearch","setSearch")),JM(yL,"searchParams",SL("getSearchParams")),JM(yL,"hash",SL("getHash","setHash"))),zM(yL,"toJSON",(function(){return oN(this).serialize()}),{enumerable:!0}),zM(yL,"toString",(function(){return oN(this).serialize()}),{enumerable:!0}),uN){var bL=uN.createObjectURL,kL=uN.revokeObjectURL;bL&&zM(gL,"createObjectURL",WM(bL,uN)),kL&&zM(gL,"revokeObjectURL",WM(kL,uN))}tN(gL,"URL"),jM({global:!0,constructor:!0,forced:!BM,sham:!FM},{URL:gL});var IL,TL,wL=new Blob(["class VolumeMeter extends AudioWorkletProcessor{constructor(){super();this.volume=0;this.intervalTime=200;this.tick=this.intervalTime;this.isStop=false;this.port.onmessage=event=>{const{data}=event;switch(data.name){case'setIntervalTime':this.intervalTime=data.intervalTime;break;case'stop':this.isStop=true;break}}}process(inputs){const input=inputs[0];if(this.isStop){return false}if(input.length>0){const firstChannel=input[0];let sum=0;let rms;for(let i=0;i<firstChannel.length;++i){sum+=firstChannel[i]*firstChannel[i]}rms=Math.sqrt(sum/firstChannel.length);this.volume=Math.max(rms,this.volume*0.95);this.tick-=firstChannel.length;if(this.tick<0){this.tick+=(this.intervalTime/1000)*sampleRate;this.port.postMessage({volume:this.volume})}}return true}}registerProcessor('volume-meter',VolumeMeter);"],{type:"application/javascript"}),EL=!1,RL=function(){function e(t){o(this,e),this.context_=t.context,this.addModuleToContext()}var t;return c(e,[{key:"addModuleToContext",value:(t=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.context_.audioWorklet.addModule(URL.createObjectURL(wL));case 3:MA.info("worklet addModule success"),OC.emit(RA),EL=!0,e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),MA.info("worklet addModule catch error. ".concat(e.t0.message)),OC.emit(CA);case 12:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return t.apply(this,arguments)})},{key:"initWorkletSuccess",get:function(){return EL}}]),e}(),CL=0,AL=function(){function e(t){o(this,e);var n=t.track,i=t.log,r=t.stream;this.volume_=0,this.log_=i,this.track_=n,this.stream_=r,CL+=1,IL||(IL=IC()),this.audioCtx_=IL,this.destination_=this.audioCtx_.destination;var a=new MediaStream;a.addTrack(this.track_),this.streamSource_=this.audioCtx_.createMediaStreamSource(a),this.audioWorkletNode_=null,this.scriptProcessorNode_=null,this.interval_=200,OC.on(EA,this.resume,this),OC.on(QC,this.handleAudioLevelInterval,this),wC?(OC.on(RA,this.initAudioWorklet,this),OC.on(CA,this.initScriptProcessor,this),this.preload()):this.initScriptProcessor()}return c(e,[{key:"preload",value:function(){TL?TL.initWorkletSuccess&&this.initAudioWorklet():TL=new RL({context:IL})}},{key:"initAudioWorklet",value:function(){var e=this;if(!this.audioWorkletNode_)try{this.audioWorkletNode_=new AudioWorkletNode(this.audioCtx_,"volume-meter"),this.audioWorkletNode_.port.onmessage=function(t){e.volume_=t.data.volume||0},this.streamSource_.connect(this.audioWorkletNode_).connect(this.destination_),this.handleAudioLevelInterval({interval:this.interval_})}catch(Yq){this.log_.warn("load volume meter failed, load again. error: "+Yq),this.initScriptProcessor()}}},{key:"initScriptProcessor",value:function(){var e=this;if(!this.scriptProcessorNode_)try{this.scriptProcessorNode_=this.audioCtx_.createScriptProcessor(2048,1,1),this.scriptProcessorNode_.onaudioprocess=function(t){for(var n=t.inputBuffer.getChannelData(0),i=0,r=0;r<n.length;++r)i+=n[r]*n[r];e.volume_=Math.sqrt(i/n.length)||0},this.streamSource_.connect(this.scriptProcessorNode_),this.scriptProcessorNode_.connect(this.destination_)}catch(Yq){this.log_.error("volumeMeter init script processor error: "+Yq),CL-=1}}},{key:"destroy",value:function(){var e;(this.streamSource_&&this.streamSource_.disconnect(),this.scriptProcessorNode_&&(this.scriptProcessorNode_.onaudioprocess=null,this.scriptProcessorNode_.disconnect()),this.audioWorkletNode_&&(this.audioWorkletNode_.port.postMessage({name:"stop"}),this.audioWorkletNode_.port.onmessage=null,this.audioWorkletNode_.disconnect()),this.audioWorkletNode_=null,this.scriptProcessorNode_=null,this.audioCtx_=null,OC.off(EA,this.resume,this),OC.off(QC,this.handleAudioLevelInterval,this),OC.off(RA,this.initAudioWorklet,this),OC.off(CA,this.initScriptProcessor,this),CL>0&&(CL-=1),0===CL)&&(null===(e=IL)||void 0===e||e.close(),IL=null,TL=null)}},{key:"resume",value:function(){var e;null===(e=IL)||void 0===e||e.resume()}},{key:"getInternalAudioLevel",value:function(){return this.volume_}},{key:"getCalculatedVolume",value:function(){return this.volume_.toFixed(2)}},{key:"handleAudioLevelInterval",value:function(e){var t,n=e.interval;this.interval_=n,null===(t=this.audioWorkletNode_)||void 0===t||t.port.postMessage({name:"setIntervalTime",intervalTime:n})}}]),e}(),xL=function(){function e(t){o(this,e),this.stream_=t.stream,this.userId_=t.stream.getUserId(),this.log_=this.stream_.getLogger(),this.track_=t.track,t.gainedTrack&&(this.gainedTrack_=t.gainedTrack),this.div_=t.div,this.muted_=t.muted,this.outputDeviceId_=t.outputDeviceId,this.volume_=t.volume,this.pausedRetryCount_=5,this.emitter_=new DC,this.initializeElement(),this.state_="NONE",this.volumeMeter_=new AL({stream:this.stream_,track:this.gainedTrack_||this.track_,log:this.log_})}var t,i,r,s;return c(e,[{key:"isPlaying",get:function(){return this.state_===$b}},{key:"initializeElement",value:function(){if(this.isAudioElementInit()){var e=new MediaStream;e.addTrack(this.gainedTrack_||this.track_);var t=document.createElement(Tb);t.srcObject=e,t.muted=this.muted_,t.setAttribute("id","audio_".concat(this.stream_.getId())),t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this.div_.appendChild(t),this.element_=t}this.handleEvents()}},{key:"setMuted",value:function(e){this.element_&&(this.element_.muted=e,this.muted_=e)}},{key:"play",value:(s=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.outputDeviceId_||!this.element_){e.next=3;break}return e.next=3,this.element_.setSinkId(this.outputDeviceId_);case 3:if(this.setVolume(this.volume_),e.prev=4,!this.element_){e.next=8;break}return e.next=8,this.element_.play();case 8:e.next=16;break;case 10:if(e.prev=10,e.t0=e.catch(4),t=ZR({key:Yw,data:{media:"Audio",error:e.t0}}),this.log_.warn(t),!t.includes("NotAllowedError")){e.next=16;break}throw new vP({code:_P.PLAY_NOT_ALLOWED,message:t});case 16:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return s.apply(this,arguments)})},{key:"handleEvents",value:function(){this.handleElementEvent=this.handleElementEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.element_&&(this.element_.addEventListener(Ub,this.handleElementEvent),this.element_.addEventListener(Lb,this.handleElementEvent),this.element_.addEventListener(Vb,this.handleElementEvent),this.element_.addEventListener(jb,this.handleElementEvent)),this.track_.addEventListener(Lb,this.handleTrackEvent),this.track_.addEventListener(Mb,this.handleTrackEvent),this.track_.addEventListener(Nb,this.handleTrackEvent),this.track_.readyState===Lb&&this.handleTrackEvent({type:Lb}),this.track_.muted&&this.handleTrackEvent({type:Mb})}},{key:"handleElementEvent",value:(r=a(n().mark((function e(t){var i,r,a,o,s,c,u,d=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=t.type,e.t0=i,e.next=e.t0===Ub?4:e.t0===Lb?9:e.t0===Vb?12:e.t0===jb?21:32;break;case 4:return this.log_.info("audio player is playing"),this.state_=$b,OC.emit(iA,{stream:this.stream_}),this.emitter_.emit(FO,{state:this.state_,reason:Ub}),e.abrupt("break",32);case 9:return this.log_.info("audio player is ended"),this.state_!==ek&&(this.state_=ek,this.emitter_.emit(FO,{state:this.state_,reason:Lb})),e.abrupt("break",32);case 12:return this.log_.info("audio player is paused"),this.state_=Zb,this.emitter_.emit(FO,{state:this.state_,reason:Vb}),(r=this.div_&&document.getElementById(this.div_.id))||this.log_.warn("audio player has been remove, element ID: ".concat(this.div_.id)),a=MR(),this.pausedRetryCount_>0&&(dC(a)&&a<=70||!r)&&(this.resume(),this.pausedRetryCount_--),GE&&(this.interval_=YD.run((function(){d.element_&&d.state_===Zb&&d.resume()}),{delay:3e3})),e.abrupt("break",32);case 21:if(!this.element_||!this.element_.error){e.next=31;break}return o="".concat(wO(),"/").concat(XR().name,"/").concat(XR().version),e.next=25,Xq.getSpeakers();case 25:s=e.sent,c=s[0].label,(u=s.find((function(e){return e.deviceId===d.outputDeviceId_})))&&(c=u.label),this.log_.error("audio player error observed. code: ".concat(this.element_.error.code," message: ").concat(this.element_.error.message," deviceInfo: ").concat(o," speaker: ").concat(c)),oD.uploadEvent({log:"stat-".concat(this.stream_.getType(),"-audio-").concat(pI,"-").concat(this.element_.error.code,"-").concat(o,"-").concat(c),userId:this.userId_,error:this.element_.error});case 31:return e.abrupt("break",32);case 32:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"handleTrackEvent",value:function(e){var t=e.type;switch(t){case Lb:this.log_.info("audio track is ended"),this.state_!==ek&&(this.state_=ek,this.emitter_.emit(FO,{state:this.state_,reason:Lb})),OC.emit(kA,{stream:this.stream_,type:t});break;case Mb:this.log_.info("audio track is unable to provide media output"),this.stream_.isRemote()||kC(),this.state_!==Zb&&(this.state_=Zb,this.emitter_.emit(FO,{state:this.state_,reason:Mb})),OC.emit(bA,{stream:this.stream_,type:t});break;case Nb:this.log_.info("audio track is able to provide media output"),this.state_===Zb&&(this.state_=$b,this.emitter_.emit(FO,{state:this.state_,reason:Nb}))}}},{key:"unbindEvents",value:function(){this.element_&&(this.element_.removeEventListener(Ub,this.handleElementEvent),this.element_.removeEventListener(Lb,this.handleElementEvent),this.element_.removeEventListener(Vb,this.handleElementEvent),this.element_.removeEventListener(jb,this.handleElementEvent)),this.track_&&(this.track_.removeEventListener(Lb,this.handleTrackEvent),this.track_.removeEventListener(Mb,this.handleTrackEvent),this.track_.removeEventListener(Nb,this.handleTrackEvent))}},{key:"setSinkId",value:(i=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.outputDeviceId_===t){e.next=5;break}if(!this.element_){e.next=4;break}return e.next=4,this.element_.setSinkId(t);case 4:this.outputDeviceId_=t;case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"setVolume",value:function(e){this.element_&&(this.log_.info("audioElement setVolume to : ".concat(e)),this.element_.volume=e)}},{key:"getAudioLevel",value:function(){return this.volumeMeter_.getCalculatedVolume()}},{key:"getInternalAudioLevel",value:function(){return this.volumeMeter_.getInternalAudioLevel()}},{key:"stop",value:function(){this.unbindEvents(),this.element_&&(this.div_.removeChild(this.element_),this.element_.srcObject=null,this.element_=null),this.volumeMeter_&&(this.volumeMeter_.destroy(),this.volumeMeter_=null),this.interval_>0&&YD.clearTask(this.interval_)}},{key:"resume",value:(t=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.volumeMeter_&&this.volumeMeter_.resume(),!this.element_){e.next=5;break}return e.next=5,this.element_.play();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),t=ZR({key:Yw,data:{media:"Audio",error:e.t0}}),this.log_.warn(t),!t.includes("NotAllowedError")){e.next=13;break}throw new vP({code:_P.PLAY_NOT_ALLOWED,message:t});case 13:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return t.apply(this,arguments)})},{key:"on",value:function(e,t){this.emitter_.on(e,t)}},{key:"isAudioElementInit",value:function(){return!("15.2"===HR||"15.3"===HR||"15.4"===HR)||"local"!==this.stream_.getType()||!this.muted_||(this.log_.info("audioElement is muted."),!1)}}]),e}(),PL=xn.PROPER,DL=x,OL=J_,ML=ev.trim;Tr({target:"String",proto:!0,forced:function(e){return DL((function(){return!!OL[e]()||"​᠎"!=="​᠎"[e]()||PL&&OL[e].name!==e}))}("trim")},{trim:function(){return ML(this)}});var NL="trtc_autoplay",LL="".concat(NL,"_mask"),UL="".concat(NL,"_wrapper"),VL="".concat(NL,"_header"),jL="".concat(NL,"_content"),FL="".concat(NL,"_action_wrapper"),BL="".concat(NL,"_question"),HL="".concat(NL,"_collapse"),WL="".concat(NL,"_action_confirm"),GL="".concat(NL,"_detail"),zL="#2473E8",JL="dialog",qL="".concat(JL,"-show"),KL="".concat(JL,"-1"),QL="".concat(JL,"-2"),XL=!1,YL=function(){return!!document.querySelector(".".concat(UL))},$L="".concat(XI,"/").concat(bC()?"zh-cn":"en","/tutorial-21-advanced-auto-play-policy.html"),ZL="<br><a href='".concat($L,"' target='_blank'>").concat(bC()?"其他方案？":"Any other solution?","</a>"),eU="".concat(bC()?"浏览器自动播放策略：在用户与页面产生交互（点击、触摸）之前，浏览器禁止播放有声媒体。该弹窗用于帮助用户恢复音视频播放。".concat(ZL):"Autoplay Policy: Before user interacts with the web page (clicking, touching), page will not be allowed to play media with sound. This Dialog is used to help users resume playback. ".concat(ZL)),tU=function(){function e(){if(o(this,e),this.dialogNode_=null,this.bodyPosition_="",this.content="音视频播放被浏览器拦截，请点击“恢复播放”。",bC()||(this.content='Media playback failed. Click the "Resume" to resume playback.'),!XL){var t=document.createElement("style");t.innerHTML=".".concat(LL,"{position:fixed;top:0;left:0;right:0;bottom:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,0.5);z-index:1500;}.").concat(LL," div:not(.").concat(FL,"){display:block !important;}.").concat(UL,"{padding:14px;background:#fff;border-radius:3px;box-shadow:0px 3px 15px #434343;border:1px solid #d1cfcf;max-width:500px;}.").concat(UL," a{color:").concat(zL,";}.").concat(VL,"{overflow:hidden;text-overflow:ellipsis;font-size:16px;font-weight:600;}.").concat(jL,"{margin:8px 0;}.").concat(FL,"{width:100%;display:flex !important;align-items:center;justify-content:right;float:right;}.").concat(HL,"{margin-right:auto;cursor:pointer}.").concat(BL,"{height:100%;line-height:16px;cursor:pointer;}.").concat(WL,"{margin-left:8px;color:#fff;background:").concat(zL,";padding:4px 12px;outline:none;border:1px solid;border-radius:3px;font-weight:bold;}.").concat(WL,":hover{opacity:0.9;}.").concat(HL,",.").concat(WL,",.").concat(jL,",.").concat(BL,"{font-size:14px;}@media screen and (max-width:750px){.").concat(UL,"{width:80vw;}}"),document.head.appendChild(t),XL=!0}this.showDetail_=!1,this.isCollapseClicked_=!1,this.isQuestionClicked_=!1,this.addDiaLog()}return c(e,[{key:"createDiaLog",value:function(){var e=document.createElement("template");e.innerHTML='<div class="'.concat(LL,"\"><div class='").concat(UL,"'><div class='").concat(VL,"'>").concat(location.host,"</div><div class='").concat(jL,"'>").concat(this.content,"</div><div class='").concat(GL,'\' style="visibility:hidden;width:100%;height:0;font-size:12px;color:gray;">').concat(eU,"</div><div class='").concat(FL,"'></div></div></div>").trim();var t=document.createElement("button");t.className=WL,t.innerText=bC()?"恢复播放":"Resume",t.onclick=this.onConfirm.bind(this);var n=document.createElement("div");n.className=BL,n.innerHTML='<?xml version="1.0" encoding="UTF-8"?>\n    <svg class="icon" width="18" height="18" p-id="2030" t="1639646523624" version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\n    <path d="m464 784.35c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z" p-id="2031"/>\n    <path d="m512 960c-247.04 0-448-200.96-448-448s200.96-448 448-448 448 200.96 448 448-200.96 448-448 448zm0-831.71c-211.58 0-383.71 172.13-383.71 383.71 0 211.55 172.13 383.71 383.71 383.71 211.55 0 383.71-172.16 383.71-383.71 0-211.58-172.16-383.71-383.71-383.71z" p-id="2032"/>\n    <path d="m512 673.7c-17.665 0-32.001-14.336-32.001-31.999v-54.112c0-52.353 40-92.352 75.328-127.65 25.887-25.92 52.672-52.672 52.672-74.017 0-53.343-43.072-96.735-95.999-96.735-53.823 0-95.999 41.536-95.999 94.559 0 17.665-14.336 31.999-32.001 31.999s-32.001-14.336-32.001-31.999c0-87.424 71.775-158.56 160-158.56s160 72.095 160 160.74c0 47.904-36.32 84.192-71.424 119.3-27.84 27.776-56.576 56.512-56.576 82.336v54.112c0 17.665-14.336 32.032-32.001 32.032z" p-id="2033"/>\n    </svg>\n    ',n.onclick=this.onQuestionClick.bind(this);var i=document.createElement("div");i.className=HL,i.innerText="".concat(bC()?"详情 >":"Detail >"),i.onclick=this.onCollapseClick.bind(this);var r=e.content.firstChild,a=r.querySelector(".".concat(FL));return a.appendChild(i),a.appendChild(n),a.appendChild(t),r}},{key:"addDiaLog",value:function(){YL()||(this.dialogNode_=this.createDiaLog(),document.body.appendChild(this.dialogNode_),this.dialogNode_.onclick=this.onConfirm.bind(this),this.dialogNode_.querySelector(".".concat(UL)).onclick=function(e){return e.stopPropagation()},this.bodyPosition_=document.body.style.position,document.body.style.position="fixed",MA.info("show autoplay dialog"),oD.uploadEvent({log:qL}))}},{key:"deleteDiaLog",value:function(){this.dialogNode_&&(document.body.removeChild(this.dialogNode_),document.body.style.position=this.bodyPosition_,this.dialogNode_=null)}},{key:"onConfirm",value:function(){MA.warn("confirm clicked, try resume stream"),OC.emit(EA),this.deleteDiaLog()}},{key:"onCollapseClick",value:function(){var e=this.dialogNode_.querySelector(".".concat(GL));e.style.visibility="".concat(this.showDetail_?"hidden":"visible"),e.style.height="".concat(this.showDetail_?0:"fit-content"),this.showDetail_=!this.showDetail_,this.isCollapseClicked_||oD.uploadEvent({log:KL}),this.isCollapseClicked_=!0}},{key:"onQuestionClick",value:function(){window.open($L,"_blank"),this.isQuestionClicked_||oD.uploadEvent({log:QL}),this.isQuestionClicked_=!0}}]),e}(),nU=function(){function e(t){o(this,e),this.stream_=t.stream,this.userId_=t.stream.getUserId(),this.log_=this.stream_.getLogger(),this.track_=t.track,this.div_=t.div,this.muted_=t.muted,this.objectFit_=t.objectFit,this.mirror_=t.mirror,this.emitter_=new DC,this.initializeElement(),this.state_="NONE",this.pausedRetryCount_=5}var t;return c(e,[{key:"isPlaying",get:function(){return this.state_===$b}},{key:"initializeElement",value:function(){var e=new MediaStream;e.addTrack(this.track_);var t=document.createElement(wb);t.srcObject=e,t.muted=!0;var n="width: 100%; height: 100%; object-fit: ".concat(this.objectFit_,";");this.mirror_&&(n+="transform: scaleX(-1);"),t.setAttribute("id","video_".concat(this.stream_.getId())),t.setAttribute("style",n),t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this.element_=t,"17.0"!==HR&&"17.1"!==HR||this.initCanvasElement(n),this.div_&&this.div_.appendChild(this.canvas_||t),this.handleEvents()}},{key:"initCanvasElement",value:function(e){var t=this;if(this.track_&&!this.stream_.isRemote()){var n=document.createElement("canvas"),i=function(){var e,i=null===(e=t.track_)||void 0===e?void 0:e.getSettings();i&&i.width&&i.height&&(n.width=i.width,n.height=i.height)};i(),n.setAttribute("style",e);var r=n.getContext("2d");this.canvasTimerId_=YD.run("raf",(function(){t.element_&&r&&(i(),r.drawImage(t.element_,0,0,n.width,n.height))}),{backgroundTask:!1}),this.log_.warn("use canvas for playback"),this.canvas_=n}}},{key:"setRect",value:function(e){var t=e.width,n=e.height;this.element_&&(this.element_.style.width=t+"px",this.element_.style.height=n+"px")}},{key:"setMirror",value:function(e){this.element_&&(this.element_.style.transform=e?"scaleX(-1)":"",this.mirror_=e)}},{key:"setObjectFit",value:function(e){this.element_&&(this.element_.style.objectFit="".concat(e),this.objectFit_=e)}},{key:"play",value:(t=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.element_.play();case 3:e.next=11;break;case 5:if(e.prev=5,e.t0=e.catch(0),t=ZR({key:Yw,data:{media:"Video",error:e.t0}}),this.log_.warn(t),!t.includes("NotAllowedError")){e.next=11;break}throw new vP({code:_P.PLAY_NOT_ALLOWED,message:t});case 11:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return t.apply(this,arguments)})},{key:"handleEvents",value:function(){this.handleElementEvent=this.handleElementEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.element_.addEventListener(Ub,this.handleElementEvent),this.element_.addEventListener(Lb,this.handleElementEvent),this.element_.addEventListener(Vb,this.handleElementEvent),this.element_.addEventListener(jb,this.handleElementEvent),this.element_.addEventListener(Fb,this.handleElementEvent),this.track_.addEventListener(Lb,this.handleTrackEvent),this.track_.addEventListener(Mb,this.handleTrackEvent),this.track_.addEventListener(Nb,this.handleTrackEvent),this.track_.readyState===Lb&&this.handleTrackEvent({type:Lb}),this.track_.muted&&this.handleTrackEvent({type:Mb})}},{key:"handleElementEvent",value:function(e){var t=this;switch(e.type){case Ub:this.log_.info("video player is playing"),this.state_=$b,OC.emit(nA,{stream:this.stream_}),this.emitter_.emit(FO,{state:this.state_,reason:Ub}),this.interval_&&(YD.clearTask(this.interval_),this.interval_=null);break;case Lb:this.log_.info("video player is ended"),this.state_!==ek&&(this.state_=ek,this.emitter_.emit(FO,{state:this.state_,reason:Lb}));break;case Vb:this.log_.info("video player is paused"),this.div_&&!document.getElementById(this.div_.id)&&this.log_.warn("video player has been remove, element ID: ".concat(this.div_.id)),this.state_=Zb,this.emitter_.emit(FO,{state:this.state_,reason:Vb}),this.pausedRetryCount_>0&&!YL()&&(this.log_.info("video player auto resume when video paused"),this.resume(),this.pausedRetryCount_--),GE&&(this.interval_=YD.run((function(){t.element_&&t.state_===Zb&&t.resume()}),{delay:3e3}));break;case jb:if(this.element_&&this.element_.error){var n="".concat(wO(),"/").concat(XR().name,"/").concat(XR().version);this.log_.error("video player error observed. code: ".concat(this.element_.error.code," message: ").concat(this.element_.error.message," deviceInfo: ").concat(n)),oD.uploadEvent({log:"stat-".concat(this.stream_.getType(),"-video-").concat(pI,"-").concat(this.element_.error.code,"-").concat(n),userId:this.userId_,error:this.element_.error})}break;case Fb:OC.emit(gA,{stream:this.stream_})}}},{key:"handleTrackEvent",value:function(e){var t=e.type;switch(t){case Lb:this.log_.info("video track is ended"),OC.emit(SA,{stream:this.stream_,type:t}),this.state_!==ek&&(this.state_=ek,this.emitter_.emit(FO,{state:this.state_,reason:Lb}));break;case Mb:this.log_.info("video track is unable to provide media output"),this.stream_.isRemote()||kC(),OC.emit(mA,{stream:this.stream_,type:t}),this.state_!==Zb&&(this.state_=Zb,this.emitter_.emit(FO,{state:this.state_,reason:Mb}));break;case Nb:this.log_.info("video track is able to provide media output"),OC.emit(_A,{stream:this.stream_}),this.state_===Zb&&(this.state_=$b,this.emitter_.emit(FO,{state:this.state_,reason:Nb}))}}},{key:"unbindEvents",value:function(){this.element_&&(this.element_.removeEventListener(Ub,this.handleElementEvent),this.element_.removeEventListener(Lb,this.handleElementEvent),this.element_.removeEventListener(Vb,this.handleElementEvent),this.element_.removeEventListener(jb,this.handleElementEvent),this.element_.removeEventListener(Fb,this.handleElementEvent)),this.track_&&(this.track_.removeEventListener(Lb,this.handleTrackEvent),this.track_.removeEventListener(Mb,this.handleTrackEvent),this.track_.removeEventListener(Nb,this.handleTrackEvent))}},{key:"stop",value:function(){this.unbindEvents(),this.element_&&(this.element_.remove(),this.element_.srcObject=null,this.element_=null),this.interval_&&YD.clearTask(this.interval_),this.canvasTimerId_&&YD.clearTask(this.canvasTimerId_),this.canvas_&&(this.canvas_.remove(),this.canvas_=null)}},{key:"resume",value:function(){return this.play()}},{key:"getVideoFrame",value:function(){var e=document.createElement("canvas");return e.width=this.element_.videoWidth,e.height=this.element_.videoHeight,e.getContext("2d").drawImage(this.element_,0,0),e.toDataURL("image/png")}},{key:"on",value:function(e,t){this.emitter_.on(e,t)}},{key:"getElement",value:function(){return this.element_?this.element_:null}}]),e}(),iU="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,rU=Ri,aU=Mi,oU=RangeError,sU=function(e){if(void 0===e)return 0;var t=rU(e),n=aU(t);if(t!==n)throw oU("Wrong length or index");return n},cU=Array,uU=Math.abs,dU=Math.pow,lU=Math.floor,hU=Math.log,pU=Math.LN2,fU={pack:function(e,t,n){var i,r,a,o=cU(n),s=8*n-t-1,c=(1<<s)-1,u=c>>1,d=23===t?dU(2,-24)-dU(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=uU(e))!=e||Infinity===e?(r=e!=e?1:0,i=c):(i=lU(hU(e)/pU),e*(a=dU(2,-i))<1&&(i--,a*=2),(e+=i+u>=1?d/a:d*dU(2,1-u))*a>=2&&(i++,a/=2),i+u>=c?(r=0,i=c):i+u>=1?(r=(e*a-1)*dU(2,t),i+=u):(r=e*dU(2,u-1)*dU(2,t),i=0));t>=8;)o[h++]=255&r,r/=256,t-=8;for(i=i<<t|r,s+=t;s>0;)o[h++]=255&i,i/=256,s-=8;return o[--h]|=128*l,o},unpack:function(e,t){var n,i=e.length,r=8*i-t-1,a=(1<<r)-1,o=a>>1,s=r-7,c=i-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(n=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)n=256*n+e[c--],s-=8;if(0===d)d=1-o;else{if(d===a)return n?NaN:u?-Infinity:Infinity;n+=dU(2,t),d-=o}return(u?-1:1)*n*dU(2,d-t)}},mU=lt,_U=Pi,vU=Li,gU=function(e){for(var t=mU(this),n=vU(t),i=arguments.length,r=_U(i>1?arguments[1]:void 0,n),a=i>2?arguments[2]:void 0,o=void 0===a?n:_U(a,n);o>r;)t[r++]=e;return t},yU=C,SU=ee,bU=P,kU=iU,IU=xn,TU=In,wU=Bc,EU=x,RU=fc,CU=Ri,AU=Mi,xU=sU,PU=fU,DU=ba,OU=Ka,MU=Ii.f,NU=rn.f,LU=gU,UU=$o,VU=Ma,jU=IU.PROPER,FU=IU.CONFIGURABLE,BU=ai.get,HU=ai.set,WU="ArrayBuffer",GU="DataView",zU="Wrong index",JU=yU.ArrayBuffer,qU=JU,KU=qU&&qU.prototype,QU=yU.DataView,XU=QU&&QU.prototype,YU=Object.prototype,$U=yU.Array,ZU=yU.RangeError,eV=SU(LU),tV=SU([].reverse),nV=PU.pack,iV=PU.unpack,rV=function(e){return[255&e]},aV=function(e){return[255&e,e>>8&255]},oV=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},sV=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},cV=function(e){return nV(e,23,4)},uV=function(e){return nV(e,52,8)},dV=function(e,t){NU(e.prototype,t,{get:function(){return BU(this)[t]}})},lV=function(e,t,n,i){var r=xU(n),a=BU(e);if(r+t>a.byteLength)throw ZU(zU);var o=BU(a.buffer).bytes,s=r+a.byteOffset,c=UU(o,s,s+t);return i?c:tV(c)},hV=function(e,t,n,i,r,a){var o=xU(n),s=BU(e);if(o+t>s.byteLength)throw ZU(zU);for(var c=BU(s.buffer).bytes,u=o+s.byteOffset,d=i(+r),l=0;l<t;l++)c[u+l]=d[a?l:t-l-1]};if(kU){var pV=jU&&JU.name!==WU;if(EU((function(){JU(1)}))&&EU((function(){new JU(-1)}))&&!EU((function(){return new JU,new JU(1.5),new JU(NaN),1!=JU.length||pV&&!FU})))pV&&FU&&TU(JU,"name",WU);else{(qU=function(e){return RU(this,KU),new JU(xU(e))}).prototype=KU;for(var fV,mV=MU(JU),_V=0;mV.length>_V;)(fV=mV[_V++])in qU||TU(qU,fV,JU[fV]);KU.constructor=qU}OU&&DU(XU)!==YU&&OU(XU,YU);var vV=new QU(new qU(2)),gV=SU(XU.setInt8);vV.setInt8(0,2147483648),vV.setInt8(1,2147483649),!vV.getInt8(0)&&vV.getInt8(1)||wU(XU,{setInt8:function(e,t){gV(this,e,t<<24>>24)},setUint8:function(e,t){gV(this,e,t<<24>>24)}},{unsafe:!0})}else KU=(qU=function(e){RU(this,KU);var t=xU(e);HU(this,{bytes:eV($U(t),0),byteLength:t}),bU||(this.byteLength=t)}).prototype,QU=function(e,t,n){RU(this,XU),RU(e,KU);var i=BU(e).byteLength,r=CU(t);if(r<0||r>i)throw ZU("Wrong offset");if(r+(n=void 0===n?i-r:AU(n))>i)throw ZU("Wrong length");HU(this,{buffer:e,byteLength:n,byteOffset:r}),bU||(this.buffer=e,this.byteLength=n,this.byteOffset=r)},XU=QU.prototype,bU&&(dV(qU,"byteLength"),dV(QU,"buffer"),dV(QU,"byteLength"),dV(QU,"byteOffset")),wU(XU,{getInt8:function(e){return lV(this,1,e)[0]<<24>>24},getUint8:function(e){return lV(this,1,e)[0]},getInt16:function(e){var t=lV(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=lV(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return sV(lV(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return sV(lV(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return iV(lV(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return iV(lV(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){hV(this,1,e,rV,t)},setUint8:function(e,t){hV(this,1,e,rV,t)},setInt16:function(e,t){hV(this,2,e,aV,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){hV(this,2,e,aV,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){hV(this,4,e,oV,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){hV(this,4,e,oV,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){hV(this,4,e,cV,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){hV(this,8,e,uV,t,arguments.length>2?arguments[2]:void 0)}});VU(qU,WU),VU(QU,GU);var yV={ArrayBuffer:qU,DataView:QU},SV=Tr,bV=ee,kV=x,IV=un,TV=Pi,wV=Mi,EV=Tg,RV=yV.ArrayBuffer,CV=yV.DataView,AV=CV.prototype,xV=bV(RV.prototype.slice),PV=bV(AV.getUint8),DV=bV(AV.setUint8);SV({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:kV((function(){return!new RV(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(xV&&void 0===t)return xV(IV(this),e);for(var n=IV(this).byteLength,i=TV(e,n),r=TV(void 0===t?n:t,n),a=new(EV(this,RV))(wV(r-i)),o=new CV(this),s=new CV(a),c=0;i<r;)DV(s,c++,PV(o,i++));return a}}),Tr({global:!0,constructor:!0,forced:!iU},{DataView:yV.DataView});var OV=Tr,MV=ud,NV=ee([].reverse),LV=[1,2];OV({target:"Array",proto:!0,forced:String(LV)===String(LV.reverse())},{reverse:function(){return MV(this)&&(this.length=this.length),NV(this)}});var UV=qe,VV=lt,jV=ae,FV=Li,BV=TypeError,HV=function(e){return function(t,n,i,r){UV(n);var a=VV(t),o=jV(a),s=FV(a),c=e?s-1:0,u=e?-1:1;if(i<2)for(;;){if(c in o){r=o[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw BV("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in o&&(r=n(r,o[c],c,a));return r}},WV={left:HV(!1),right:HV(!0)},GV=WV.left,zV=De,JV=mg;Tr({target:"Array",proto:!0,forced:!fl("reduce")||!JV&&zV>79&&zV<83},{reduce:function(e){var t=arguments.length;return GV(this,e,t,t>1?arguments[1]:void 0)}});var qV=Jc,KV="ArrayBuffer",QV=yV.ArrayBuffer;Tr({global:!0,constructor:!0,forced:C.ArrayBuffer!==QV},{ArrayBuffer:QV}),qV(KV);var XV=Tr,YV=ud,$V=Id,ZV=ye,ej=Pi,tj=Li,nj=he,ij=Jo,rj=xt,aj=Ku,oj=Hd("slice"),sj=rj("species"),cj=Array,uj=Math.max;XV({target:"Array",proto:!0,forced:!oj},{slice:function(e,t){var n,i,r,a=nj(this),o=tj(a),s=ej(e,o),c=ej(void 0===t?o:t,o);if(YV(a)&&(n=a.constructor,($V(n)&&(n===cj||YV(n.prototype))||ZV(n)&&null===(n=n[sj]))&&(n=void 0),n===cj||void 0===n))return aj(a,s,c);for(i=new(void 0===n?cj:n)(uj(c-s,0)),r=0;s<c;s++,r++)s in a&&ij(i,r,a[s]);return i.length=r,i}});var dj=C,lj=x,hj=ee,pj=du,fj=ev.trim,mj=J_,_j=dj.parseInt,vj=dj.Symbol,gj=vj&&vj.iterator,yj=/^[+-]?0x/i,Sj=hj(yj.exec),bj=8!==_j(mj+"08")||22!==_j(mj+"0x16")||gj&&!lj((function(){_j(Object(gj))}))?function(e,t){var n=fj(pj(e));return _j(n,t>>>0||(Sj(yj,n)?16:10))}:_j;Tr({global:!0,forced:parseInt!=bj},{parseInt:bj});var kj,Ij,Tj,wj={exports:{}},Ej=iU,Rj=P,Cj=C,Aj=_e,xj=ye,Pj=ft,Dj=Vo,Oj=We,Mj=In,Nj=ki,Lj=rn.f,Uj=Te,Vj=ba,jj=Ka,Fj=xt,Bj=yt,Hj=ai.enforce,Wj=ai.get,Gj=Cj.Int8Array,zj=Gj&&Gj.prototype,Jj=Cj.Uint8ClampedArray,qj=Jj&&Jj.prototype,Kj=Gj&&Vj(Gj),Qj=zj&&Vj(zj),Xj=Object.prototype,Yj=Cj.TypeError,$j=Fj("toStringTag"),Zj=Bj("TYPED_ARRAY_TAG"),eF="TypedArrayConstructor",tF=Ej&&!!jj&&"Opera"!==Dj(Cj.opera),nF=!1,iF={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},rF={BigInt64Array:8,BigUint64Array:8},aF=function(e){var t=Vj(e);if(xj(t)){var n=Wj(t);return n&&Pj(n,eF)?n.TypedArrayConstructor:aF(t)}},oF=function(e){if(!xj(e))return!1;var t=Dj(e);return Pj(iF,t)||Pj(rF,t)};for(kj in iF)(Tj=(Ij=Cj[kj])&&Ij.prototype)?Hj(Tj).TypedArrayConstructor=Ij:tF=!1;for(kj in rF)(Tj=(Ij=Cj[kj])&&Ij.prototype)&&(Hj(Tj).TypedArrayConstructor=Ij);if((!tF||!Aj(Kj)||Kj===Function.prototype)&&(Kj=function(){throw Yj("Incorrect invocation")},tF))for(kj in iF)Cj[kj]&&jj(Cj[kj],Kj);if((!tF||!Qj||Qj===Xj)&&(Qj=Kj.prototype,tF))for(kj in iF)Cj[kj]&&jj(Cj[kj].prototype,Qj);if(tF&&Vj(qj)!==Qj&&jj(qj,Qj),Rj&&!Pj(Qj,$j))for(kj in nF=!0,Lj(Qj,$j,{get:function(){return xj(this)?this[Zj]:void 0}}),iF)Cj[kj]&&Mj(Cj[kj],Zj,kj);var sF={NATIVE_ARRAY_BUFFER_VIEWS:tF,TYPED_ARRAY_TAG:nF&&Zj,aTypedArray:function(e){if(oF(e))return e;throw Yj("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Aj(e)&&(!jj||Uj(Kj,e)))return e;throw Yj(Oj(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,i){if(Rj){if(n)for(var r in iF){var a=Cj[r];if(a&&Pj(a.prototype,e))try{delete a.prototype[e]}catch(Yq){try{a.prototype[e]=t}catch(o){}}}Qj[e]&&!n||Nj(Qj,e,n?t:tF&&zj[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,n){var i,r;if(Rj){if(jj){if(n)for(i in iF)if((r=Cj[i])&&Pj(r,e))try{delete r[e]}catch(Yq){}if(Kj[e]&&!n)return;try{return Nj(Kj,e,n?t:tF&&Kj[e]||t)}catch(Yq){}}for(i in iF)!(r=Cj[i])||r[e]&&!n||Nj(r,e,t)}},getTypedArrayConstructor:aF,isView:function(e){if(!xj(e))return!1;var t=Dj(e);return"DataView"===t||Pj(iF,t)||Pj(rF,t)},isTypedArray:oF,TypedArray:Kj,TypedArrayPrototype:Qj},cF=C,uF=x,dF=yc,lF=sF.NATIVE_ARRAY_BUFFER_VIEWS,hF=cF.ArrayBuffer,pF=cF.Int8Array,fF=!lF||!uF((function(){pF(1)}))||!uF((function(){new pF(-1)}))||!dF((function(e){new pF,new pF(null),new pF(1.5),new pF(e)}),!0)||uF((function(){return 1!==new pF(new hF(2),1,void 0).length})),mF=Ri,_F=RangeError,vF=function(e){var t=mF(e);if(t<0)throw _F("The argument can't be less than 0");return t},gF=RangeError,yF=function(e,t){var n=vF(e);if(n%t)throw gF("Wrong offset");return n},SF=Vo,bF=ee("".slice),kF=Vt,IF=TypeError,TF=function(e){var t=kF(e,"number");if("number"==typeof t)throw IF("Can't convert number to bigint");return BigInt(t)},wF=xs,EF=N,RF=yg,CF=lt,AF=Li,xF=qs,PF=Fs,DF=Ms,OF=function(e){return"Big"===bF(SF(e),0,3)},MF=sF.aTypedArrayConstructor,NF=TF,LF=Tr,UF=C,VF=N,jF=P,FF=fF,BF=sF,HF=yV,WF=fc,GF=H,zF=In,JF=VA,qF=Mi,KF=sU,QF=yF,XF=Bt,YF=ft,$F=Vo,ZF=ye,eB=Be,tB=na,nB=Te,iB=Ka,rB=Ii.f,aB=function(e){var t,n,i,r,a,o,s,c,u=RF(this),d=CF(e),l=arguments.length,h=l>1?arguments[1]:void 0,p=void 0!==h,f=PF(d);if(f&&!DF(f))for(c=(s=xF(d,f)).next,d=[];!(o=EF(c,s)).done;)d.push(o.value);for(p&&l>2&&(h=wF(h,arguments[2])),n=AF(d),i=new(MF(u))(n),r=OF(i),t=0;n>t;t++)a=p?h(d[t],t):d[t],i[t]=r?NF(a):+a;return i},oB=Vd.forEach,sB=Jc,cB=rn,uB=A,dB=Ic,lB=ai.get,hB=ai.set,pB=ai.enforce,fB=cB.f,mB=uB.f,_B=Math.round,vB=UF.RangeError,gB=HF.ArrayBuffer,yB=gB.prototype,SB=HF.DataView,bB=BF.NATIVE_ARRAY_BUFFER_VIEWS,kB=BF.TYPED_ARRAY_TAG,IB=BF.TypedArray,TB=BF.TypedArrayPrototype,wB=BF.aTypedArrayConstructor,EB=BF.isTypedArray,RB="BYTES_PER_ELEMENT",CB="Wrong length",AB=function(e,t){wB(e);for(var n=0,i=t.length,r=new e(i);i>n;)r[n]=t[n++];return r},xB=function(e,t){fB(e,t,{get:function(){return lB(this)[t]}})},PB=function(e){var t;return nB(yB,e)||"ArrayBuffer"==(t=$F(e))||"SharedArrayBuffer"==t},DB=function(e,t){return EB(e)&&!eB(t)&&t in e&&JF(+t)&&t>=0},OB=function(e,t){return t=XF(t),DB(e,t)?GF(2,e[t]):mB(e,t)},MB=function(e,t,n){return t=XF(t),!(DB(e,t)&&ZF(n)&&YF(n,"value"))||YF(n,"get")||YF(n,"set")||n.configurable||YF(n,"writable")&&!n.writable||YF(n,"enumerable")&&!n.enumerable?fB(e,t,n):(e[t]=n.value,e)};jF?(bB||(uB.f=OB,cB.f=MB,xB(TB,"buffer"),xB(TB,"byteOffset"),xB(TB,"byteLength"),xB(TB,"length")),LF({target:"Object",stat:!0,forced:!bB},{getOwnPropertyDescriptor:OB,defineProperty:MB}),wj.exports=function(e,t,n){var i=e.match(/\d+$/)[0]/8,r=e+(n?"Clamped":"")+"Array",a="get"+e,o="set"+e,s=UF[r],c=s,u=c&&c.prototype,d={},l=function(e,t){fB(e,t,{get:function(){return function(e,t){var n=lB(e);return n.view[a](t*i+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,r){var a=lB(e);n&&(r=(r=_B(r))<0?0:r>255?255:255&r),a.view[o](t*i+a.byteOffset,r,!0)}(this,t,e)},enumerable:!0})};bB?FF&&(c=t((function(e,t,n,r){return WF(e,u),dB(ZF(t)?PB(t)?void 0!==r?new s(t,QF(n,i),r):void 0!==n?new s(t,QF(n,i)):new s(t):EB(t)?AB(c,t):VF(aB,c,t):new s(KF(t)),e,c)})),iB&&iB(c,IB),oB(rB(s),(function(e){e in c||zF(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,n,r){WF(e,u);var a,o,s,d=0,h=0;if(ZF(t)){if(!PB(t))return EB(t)?AB(c,t):VF(aB,c,t);a=t,h=QF(n,i);var p=t.byteLength;if(void 0===r){if(p%i)throw vB(CB);if((o=p-h)<0)throw vB(CB)}else if((o=qF(r)*i)+h>p)throw vB(CB);s=o/i}else s=KF(t),a=new gB(o=s*i);for(hB(e,{buffer:a,byteOffset:h,byteLength:o,length:s,view:new SB(a)});d<s;)l(e,d++)})),iB&&iB(c,IB),u=c.prototype=tB(TB)),u.constructor!==c&&zF(u,"constructor",c),pB(u).TypedArrayConstructor=c,kB&&zF(u,kB,r);var h=c!=s;d[r]=c,LF({global:!0,constructor:!0,forced:h,sham:!bB},d),RB in c||zF(c,RB,i),RB in u||zF(u,RB,i),sB(r)}):wj.exports=function(){},(0,wj.exports)("Uint8",(function(e){return function(t,n,i){return e(this,t,n,i)}}));var NB=lt,LB=Pi,UB=Li,VB=Zd,jB=Math.min,FB=[].copyWithin||function(e,t){var n=NB(this),i=UB(n),r=LB(e,i),a=LB(t,i),o=arguments.length>2?arguments[2]:void 0,s=jB((void 0===o?i:LB(o,i))-a,i-r),c=1;for(a<r&&r<a+s&&(c=-1,a+=s-1,r+=s-1);s-- >0;)a in n?n[r]=n[a]:VB(n,r),r+=c,a+=c;return n},BB=sF,HB=ee(FB),WB=BB.aTypedArray;(0,BB.exportTypedArrayMethod)("copyWithin",(function(e,t){return HB(WB(this),e,t,arguments.length>2?arguments[2]:void 0)}));var GB=Vd.every,zB=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("every",(function(e){return GB(zB(this),e,arguments.length>1?arguments[1]:void 0)}));var JB=gU,qB=TF,KB=Vo,QB=N,XB=x,YB=sF.aTypedArray,$B=sF.exportTypedArrayMethod,ZB=ee("".slice);$B("fill",(function(e){var t=arguments.length;YB(this);var n="Big"===ZB(KB(this),0,3)?qB(e):+e;return QB(JB,this,n,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),XB((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})));var eH=Li,tH=Tg,nH=sF.aTypedArrayConstructor,iH=sF.getTypedArrayConstructor,rH=function(e){return nH(tH(e,iH(e)))},aH=function(e,t){for(var n=0,i=eH(t),r=new e(i);i>n;)r[n]=t[n++];return r},oH=rH,sH=Vd.filter,cH=function(e,t){return aH(oH(e),t)},uH=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("filter",(function(e){var t=sH(uH(this),e,arguments.length>1?arguments[1]:void 0);return cH(this,t)}));var dH=Vd.find,lH=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("find",(function(e){return dH(lH(this),e,arguments.length>1?arguments[1]:void 0)}));var hH=Vd.findIndex,pH=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("findIndex",(function(e){return hH(pH(this),e,arguments.length>1?arguments[1]:void 0)}));var fH=Vd.forEach,mH=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("forEach",(function(e){fH(mH(this),e,arguments.length>1?arguments[1]:void 0)}));var _H=Bi.includes,vH=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("includes",(function(e){return _H(vH(this),e,arguments.length>1?arguments[1]:void 0)}));var gH=Bi.indexOf,yH=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("indexOf",(function(e){return gH(yH(this),e,arguments.length>1?arguments[1]:void 0)}));var SH=C,bH=x,kH=ee,IH=sF,TH=Co,wH=xt("iterator"),EH=SH.Uint8Array,RH=kH(TH.values),CH=kH(TH.keys),AH=kH(TH.entries),xH=IH.aTypedArray,PH=IH.exportTypedArrayMethod,DH=EH&&EH.prototype,OH=!bH((function(){DH[wH].call([1])})),MH=!!DH&&DH.values&&DH[wH]===DH.values&&"values"===DH.values.name,NH=function(){return RH(xH(this))};PH("entries",(function(){return AH(xH(this))}),OH),PH("keys",(function(){return CH(xH(this))}),OH),PH("values",NH,OH||!MH,{name:"values"}),PH(wH,NH,OH||!MH,{name:"values"});var LH=sF.aTypedArray,UH=sF.exportTypedArrayMethod,VH=ee([].join);UH("join",(function(e){return VH(LH(this),e)}));var jH=qu,FH=he,BH=Ri,HH=Li,WH=fl,GH=Math.min,zH=[].lastIndexOf,JH=!!zH&&1/[1].lastIndexOf(1,-0)<0,qH=WH("lastIndexOf"),KH=JH||!qH?function(e){if(JH)return jH(zH,this,arguments)||0;var t=FH(this),n=HH(t),i=n-1;for(arguments.length>1&&(i=GH(i,BH(arguments[1]))),i<0&&(i=n+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:zH,QH=qu,XH=KH,YH=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return QH(XH,YH(this),t>1?[e,arguments[1]]:[e])}));var $H=Vd.map,ZH=rH,eW=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("map",(function(e){return $H(eW(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(ZH(e))(t)}))}));var tW=WV.left,nW=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return tW(nW(this),e,t,t>1?arguments[1]:void 0)}));var iW=WV.right,rW=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return iW(rW(this),e,t,t>1?arguments[1]:void 0)}));var aW=sF.aTypedArray,oW=sF.exportTypedArrayMethod,sW=Math.floor;oW("reverse",(function(){for(var e,t=this,n=aW(t).length,i=sW(n/2),r=0;r<i;)e=t[r],t[r++]=t[--n],t[n]=e;return t}));var cW=C,uW=N,dW=sF,lW=Li,hW=yF,pW=lt,fW=x,mW=cW.RangeError,_W=cW.Int8Array,vW=_W&&_W.prototype,gW=vW&&vW.set,yW=dW.aTypedArray,SW=dW.exportTypedArrayMethod,bW=!fW((function(){var e=new Uint8ClampedArray(2);return uW(gW,e,{length:1,0:3},1),3!==e[1]})),kW=bW&&dW.NATIVE_ARRAY_BUFFER_VIEWS&&fW((function(){var e=new _W(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));SW("set",(function(e){yW(this);var t=hW(arguments.length>1?arguments[1]:void 0,1),n=pW(e);if(bW)return uW(gW,this,n,t);var i=this.length,r=lW(n),a=0;if(r+t>i)throw mW("Wrong length");for(;a<r;)this[t+a]=n[a++]}),!bW||kW);var IW=rH,TW=Ku,wW=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("slice",(function(e,t){for(var n=TW(wW(this),e,t),i=IW(this),r=0,a=n.length,o=new i(a);a>r;)o[r]=n[r++];return o}),x((function(){new Int8Array(1).slice()})));var EW=Vd.some,RW=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("some",(function(e){return EW(RW(this),e,arguments.length>1?arguments[1]:void 0)}));var CW=we.match(/firefox\/(\d+)/i),AW=!!CW&&+CW[1],xW=/MSIE|Trident/.test(we),PW=we.match(/AppleWebKit\/(\d+)\./),DW=!!PW&&+PW[1],OW=ee,MW=x,NW=qe,LW=yf,UW=AW,VW=xW,jW=De,FW=DW,BW=sF.aTypedArray,HW=sF.exportTypedArrayMethod,WW=C.Uint16Array,GW=WW&&OW(WW.prototype.sort),zW=!(!GW||MW((function(){GW(new WW(2),null)}))&&MW((function(){GW(new WW(2),{})}))),JW=!!GW&&!MW((function(){if(jW)return jW<74;if(UW)return UW<67;if(VW)return!0;if(FW)return FW<602;var e,t,n=new WW(516),i=Array(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,i[e]=e-2*t+3;for(GW(n,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(n[e]!==i[e])return!0}));HW("sort",(function(e){return void 0!==e&&NW(e),JW?GW(this,e):LW(BW(this),function(e){return function(t,n){return void 0!==e?+e(t,n)||0:n!=n?-1:t!=t?1:0===t&&0===n?1/t>0&&1/n<0?1:-1:t>n}}(e))}),!JW||zW);var qW=Mi,KW=Pi,QW=rH,XW=sF.aTypedArray;(0,sF.exportTypedArrayMethod)("subarray",(function(e,t){var n=XW(this),i=n.length,r=KW(e,i);return new(QW(n))(n.buffer,n.byteOffset+r*n.BYTES_PER_ELEMENT,qW((void 0===t?i:KW(t,i))-r))}));var YW=qu,$W=sF,ZW=x,eG=Ku,tG=C.Int8Array,nG=$W.aTypedArray,iG=$W.exportTypedArrayMethod,rG=[].toLocaleString,aG=!!tG&&ZW((function(){rG.call(new tG(1))}));iG("toLocaleString",(function(){return YW(rG,aG?eG(nG(this)):nG(this),eG(arguments))}),ZW((function(){return[1,2].toLocaleString()!=new tG([1,2]).toLocaleString()}))||!ZW((function(){tG.prototype.toLocaleString.call([1,2])})));var oG=sF.exportTypedArrayMethod,sG=x,cG=ee,uG=C.Uint8Array,dG=uG&&uG.prototype||{},lG=[].toString,hG=cG([].join);sG((function(){lG.call({})}))&&(lG=function(){return hG(this)});var pG=dG.toString!=lG;oG("toString",lG,pG);var fG=function(){function e(t,n,i){o(this,e),this.isUplink_=i,this.connection_=t,this.log_=n,this.seiMessageList_=[],this.smallVideoSeiMessageList_=[],this.seiPayloadType_=243,this.runningAbortMap_=new Map,this.abortMap_=new Map,this.onSEIMessage=null}return c(e,[{key:"isRunning",get:function(){return!!this.runningAbortMap_.size>0}},{key:"start",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.seiMessageList_,i=e.createEncodedStreams(),r=i.readable,a=i.writable,o=new TransformStream({transform:this.isUplink_?function(e,i){return t.encodeVideoFrame(e,i,n)}:function(n,i){var r,a;return t.decodeVideoFrame(n,i,e===(null===(r=t.connection_)||void 0===r||null===(a=r.getPeerConnection())||void 0===a?void 0:a.getReceivers()[aT]))}}),s=new AbortController;r.pipeThrough(o).pipeTo(a,{signal:s.signal}).catch((function(){})),this.runningAbortMap_.set(e,s)}},{key:"restart",value:function(e,t){this.stop(),this.start(e,t)}},{key:"stop",value:function(e){var t;null===(t=this.runningAbortMap_.get(e))||void 0===t||t.abort(),this.runningAbortMap_.delete(e)}},{key:"destroy",value:function(){this.stop(),this.runningAbortMap_.forEach((function(e){return e.abort()})),this.runningAbortMap_.clear(),this.abortMap_.forEach((function(e){return e.abort()})),this.abortMap_.clear(),this.log_=null,this.onSEIMessage=null,this.connection_=null}},{key:"handleEncodedStreams",value:function(){var e=this;try{var t=this.connection_.getPeerConnection();this.clearUnusedSenderOrReceiver(t),this.isUplink_?t.getSenders().forEach((function(t,n){if(!e.runningAbortMap_.has(t)&&!e.abortMap_.has(t))if(n===nT||n===iT){var i=n===iT?e.smallVideoSeiMessageList_:e.seiMessageList_;e.isRunning?e.restart(t,i):e.start(t,i)}else e.pipeSenderOrReceiver(t)})):t.getReceivers().forEach((function(t,n){var i;e.runningAbortMap_.has(t)||e.abortMap_.has(t)||(n!==rT&&n!==aT||(null===(i=t.track)||void 0===i?void 0:i.kind)!==wb?e.pipeSenderOrReceiver(t):e.isRunning?e.restart(t):e.start(t))}))}catch(Yq){this.log_.warn(Yq)}}},{key:"pipeSenderOrReceiver",value:function(e){var t=e.createEncodedStreams(),n=t.readable,i=t.writable,r=new AbortController;this.abortMap_.set(e,r),n.pipeTo(i,{signal:r.signal}).catch((function(){}))}},{key:"clearUnusedSenderOrReceiver",value:function(e){var t=this;this.abortMap_.forEach((function(n,i){(t.isUplink_?e.getSenders():e.getReceivers()).find((function(e){return e===i}))||(n.abort(),t.abortMap_.delete(i))}))}},{key:"push",value:function(e,t){t&&t.seiPayloadType&&(this.seiPayloadType_=t.seiPayloadType),this.seiMessageList_.push(e),this.smallVideoSeiMessageList_.push(e)}},{key:"hasSEI",value:function(e){var t=new DataView(e);return 1===t.getInt32(0)&&6===t.getInt8(4)}},{key:"isEmptyFrame",value:function(e){return"empty"===e.type||0===e.data.byteLength}},{key:"getNaluCount",value:function(e){for(var t=0,n=0,i=new DataView(e),r=0;r<e.byteLength;r++)switch(i.getUint8(r)){case 0:t++;break;case 1:2!==t&&3!==t||n++,t=0;break;default:t=0}return n}},{key:"encodeVideoFrame",value:function(e,t,n){try{if(this.connection_.isH264&&n.length>0&&!this.isEmptyFrame(e)){var i=9-this.getNaluCount(e.data);if(i<=0)return;for(var r=n.splice(0,i).reverse().map(this.encodeSEINalu.bind(this)),a=r.reduce((function(e,t){return e+t.dataView.byteLength}),0),o=new ArrayBuffer(a+e.data.byteLength),s=new DataView(o),c=new DataView(e.data),u=0,d=0;d<r.length;d++)for(var l=0;l<r[d].dataView.byteLength;l++)s.setInt8(u++,r[d].dataView.getInt8(l));for(var h=0;h<e.data.byteLength;h++)s.setInt8(u++,c.getInt8(h));e.data=o,this.log_.debug("".concat(r.length," sei sent"))}}catch(Yq){this.log_.warn(Yq)}t.enqueue(e)}},{key:"decodeVideoFrame",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{if(this.connection_.isH264&&!this.isEmptyFrame(e)&&this.hasSEI(e.data)){for(var r=[],a=new DataView(e.data),o=0,s=-1,c=-1,u=0;u<e.data.byteLength;u++){var d=a.getUint8(u);if(0===d)o++;else if(1===d){if(2===o||3===o){var l=u-o;-1===s?s=l:-1===c&&(c=l,r.push(new mG(new DataView(a.buffer.slice(s,c)))),s=l,c=-1);var h=6===a.getUint8(u+1);if(!h){e.data=new DataView(a.buffer.slice(l)).buffer;break}}o=0}else o=0}this.log_.debug("".concat(r.length," sei received")),sC(this.onSEIMessage)&&r.reverse().forEach((function(e){n.onSEIMessage({seiPayloadType:e.seiPayloadType,data:e.seiPayload.buffer,isFromAuxiliary:i})}))}}catch(Yq){this.log_.warn(Yq)}t.enqueue(e)}},{key:"encodeSEINalu",value:function(e){var t=e.byteLength,n=parseInt(t/255),i=t%255,r=[];r.push(0,0,0,1,6,this.seiPayloadType_);for(var a=0;a<n;a++)r.push(255);r.push(i);var o=new DataView(e);return r.push.apply(r,b(new Uint8Array(o.buffer))),r.push(128),new mG(new DataView(new Uint8Array(r).buffer),!0)}}]),e}(),mG=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];o(this,e),this.dataView=t,this.isSEI&&(n?this.addPreventionByte():this.removePreventionByte())}return c(e,[{key:"addPreventionByte",value:function(){for(var e=this.seiPayloadStartIndex,t=this.dataView.byteLength-2,n=[],i=0,r=e;r<=t;r++){var a=this.dataView.getInt8(r);switch(a){case 0:case 1:case 2:case 3:2===i&&(n.push(3),i=0),0==a?i++:i=0,n.push(a);break;default:i=0,n.push(a)}}n.push(this.dataView.getInt8(this.dataView.byteLength-1));var o=new DataView(new Uint8Array([].concat(b(new Uint8Array(this.dataView.buffer).slice(0,e)),n)).buffer);this.dataView=o}},{key:"removePreventionByte",value:function(){for(var e=this.seiPayloadStartIndex,t=this.dataView.byteLength-1,n=[],i=0,r=e;r<=t;r++)switch(this.dataView.getInt8(r)){case 0:i++,n.push(this.dataView.getInt8(r));break;case 3:2!==i&&n.push(this.dataView.getInt8(r)),i=0;break;default:n.push(this.dataView.getInt8(r)),i=0}var a=new DataView(new Uint8Array([].concat(b(new Uint8Array(this.dataView.buffer).slice(0,e)),n)).buffer);this.dataView=a}},{key:"isSEI",get:function(){return 6===this.dataView.getUint8(4)}},{key:"seiPayloadStartIndex",get:function(){for(var e=6,t=6;t<this.dataView.buffer.byteLength&&(e++,255===this.dataView.getUint8(t));t++);return e}},{key:"seiPayloadType",get:function(){return this.isSEI?this.dataView.getUint8(5):null}},{key:"seiPayload",get:function(){if(!this.isSEI)return null;for(var e=0,t=6,n=6;n<this.dataView.buffer.byteLength;n++){var i=this.dataView.getUint8(n);if(t++,255!==i){e+=i;break}e+=255}for(var r=new ArrayBuffer(e),a=new DataView(r),o=0;o<r.byteLength;o++,t++)a.setInt8(o,this.dataView.getInt8(t));return a}}]),e}(),_G=function(){function e(t){o(this,e),this.userId_=t.userId,this.tinyId_=t.tinyId,this.client_=t.client,this.sdpSemantics_=t.client.getSdpSemantics(),this.isUplink_=t.isUplink,this.log_=MA.createLogger({id:"n|"+this.userId_,userId:this.client_.getUserId(),sdkAppId:this.client_.getSDKAppId(),isLocal:this.isUplink_}),this.signalChannel_=t.signalChannel,this.peerConnection_=null,this.isErrorObserved_=!1,this.emitter_=new DC,this.currentState_=Pk,this.waitForPeerConnectionConnectedPromise_=null,this.isReconnecting_=!1,this.reconnectionCount_=0,this.reconnectionTimer_=-1,this.isFirstConnection_=!0,this.delay_={audioDelay:0,videoDelay:0},this.enableSEI_=t.enableSEI,this.enableSEI_&&kO&&(this.sei_=new fG(this,this.log_,this.isUplink_))}var t;return c(e,[{key:"initialize",value:function(){var e={encodedInsertableStreams:this.enableSEI_&&kO,iceServers:this.client_.getIceServers(),iceTransportPolicy:this.client_.getIceTransportPolicy(),sdpSemantics:this.sdpSemantics_,bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",tcpCandidatePolicy:"disable",IceTransportsType:"nohost"};this.peerConnection_=new RTCPeerConnection(e),this.peerConnection_.onconnectionstatechange=this.onConnectionStateChange.bind(this)}},{key:"close",value:function(){this.log_.info("closing connection"),this.closePeerConnection(),this.sei_&&(this.sei_.destroy(),this.sei_=null)}},{key:"closePeerConnection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.peerConnection_&&(this.peerConnection_.onconnectionstatechange=function(){},this.peerConnection_.close(),this.peerConnection_=null,e&&this.emitConnectionStateChangedEvent(Pk))}},{key:"getDTLSTransportState",value:function(){if(!this.peerConnection_)return xk;var e=null;if(this.isUplink_){if(!mO()||0===this.peerConnection_.getSenders().length)return xk;e=this.peerConnection_.getSenders()[0].transport}else{if(!fO()||0===this.peerConnection_.getReceivers().length)return xk;e=this.peerConnection_.getReceivers()[0].transport}return e?e.state:xk}},{key:"onConnectionStateChange",value:function(e){var t=this.peerConnection_.iceConnectionState,n=this.getDTLSTransportState();if(this.log_.info("onConnectionStateChange() connectionState: "+e.target.connectionState),this.log_.info("ICE Transport state: ".concat(t,", DTLS Transport state: ").concat(n)),e.target.connectionState===Lk&&this.emitConnectionStateChangedEvent(Dk),e.target.connectionState===Uk||e.target.connectionState===Vk){var i="".concat(this.isUplink_?"uplink":"downlink"," ICE/DTLS Transport connection ").concat(e.target.connectionState,". ICE Transport state: ").concat(t,", DTLS Transport state: ").concat(n),r=new vP({message:i,code:_P.ICE_TRANSPORT_ERROR});oD.logFailedEvent({userId:this.client_.getUserId(),eventType:aI,error:r}),this.emitConnectionStateChangedEvent(Pk),this.isErrorObserved_||this.emitter_.emit(OO.ERROR,r)}e.target.connectionState!==Fk&&e.target.connectionState!==Bk||(this.logSelectedCandidate(),oD.logSuccessEvent({userId:this.client_.getUserId(),eventType:aI}),this.emitConnectionStateChangedEvent(Mk))}},{key:"emitConnectionStateChangedEvent",value:function(e){e!==this.currentState_&&(this.currentState_===Ok&&e===Dk||(OC.emit(IA,{client:this.client_,connection:this,prevState:this.currentState_,state:e}),this.emitter_.emit(OO.CONNECTION_STATE_CHANGED,{prevState:this.currentState_,state:e}),this.currentState_=e))}},{key:"hitTest",value:function(e){return(0===e||"0"===e)&&this.isUplink_||e===this.tinyId_}},{key:"addEventInternal",value:function(e,t){var n=this.client_.getUserId(),i={eventId:e,eventDesc:t,timestamp:Gm(),userId:n,tinyId:this.client_.getTinyId()};this.isUplink_||(i.remoteUserId=this.userId_,i.remoteTinyId=this.tinyId_),tD(n,i)}},{key:"getPeerConnection",value:function(){return this.peerConnection_}},{key:"getClient",value:function(){return this.client_}},{key:"getUserId",value:function(){return this.userId_}},{key:"getTinyId",value:function(){return this.tinyId_}},{key:"logSelectedCandidate",value:(t=a(n().mark((function e(){var t,i,r,a,o,s,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.peerConnection_){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.peerConnection_.getStats();case 4:t=e.sent,i=T(t),e.prev=6,i.s();case 8:if((r=i.n()).done){e.next=18;break}if((a=S(r.value,2))[0],!IO(o=a[1])){e.next=16;break}return s=t.get(o.localCandidateId),c=t.get(o.remoteCandidateId),s&&this.log_.info("local candidate: ".concat(s.candidateType," ").concat(s.protocol,":").concat(s.ip||s.address,":").concat(s.port," ").concat(s.networkType||""," ").concat("relay"===s.candidateType?"relayProtocol:"+s.relayProtocol:"")),c&&this.log_.info("remote candidate: ".concat(c.candidateType," ").concat(c.protocol,":").concat(c.ip||c.address,":").concat(c.port)),e.abrupt("break",18);case 16:e.next=8;break;case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(6),i.e(e.t0);case 23:return e.prev=23,i.f(),e.finish(23);case 26:case"end":return e.stop()}}),e,this,[[6,20,23,26]])}))),function(){return t.apply(this,arguments)})},{key:"getCurrentState",value:function(){return this.currentState_}},{key:"waitForPeerConnectionConnected",value:function(){var e=this;return this.waitForPeerConnectionConnectedPromise_||(this.waitForPeerConnectionConnectedPromise_=new Promise((function(t,n){if(e.currentState_===Mk)return t();var i=-1,r=function(e){e.state===Mk&&(clearTimeout(i),o(),t())},a=function(t){t.client===e.client_&&(clearTimeout(i),o(),n(new vP({code:_P.API_CALL_ABORTED,message:ZR({key:wE,data:"leave room"})})))},o=function(){OC.off(BC,a,e),e.emitter_.off(OO.CONNECTION_STATE_CHANGED,r,e)};i=setTimeout((function(){o();var e=new vP({code:_P.API_CALL_TIMEOUT,message:"connection timeout"});n(e)}),1e4),OC.on(BC,a,e),e.emitter_.on(OO.CONNECTION_STATE_CHANGED,r,e)})),this.waitForPeerConnectionConnectedPromise_=this.waitForPeerConnectionConnectedPromise_.then((function(t){return e.waitForPeerConnectionConnectedPromise_=null,t})).catch((function(t){throw e.waitForPeerConnectionConnectedPromise_=null,t}))),this.waitForPeerConnectionConnectedPromise_}},{key:"getReconnectionCount",value:function(){return this.reconnectionCount_}},{key:"startReconnection",value:function(){this.isReconnecting_=!0,this.emitConnectionStateChangedEvent(Ok),this.reconnect(),this.addEventInternal(this.isUplink_?JP:QP,"".concat(this.isUplink_?"uplink":"downlink","-connection is reconnecting"))}},{key:"stopReconnection",value:function(){this.log_.info("stop reconnection"),this.isReconnecting_=!1,this.reconnectionCount_=0,this.clearReconnectionTimer(),this.signalChannel_.off(Bx,this.reconnect,this)}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"off",value:function(e,t,n){this.emitter_.off(e,t,n)}},{key:"setDelay",value:function(e){var t=e.audioDelay,n=e.videoDelay;this.delay_={audioDelay:t,videoDelay:n}}},{key:"getDelay",value:function(){return this.delay_}},{key:"isH264",get:function(){var e,t;return!(null===(e=this.peerConnection_)||void 0===e||null===(t=e.remoteDescription)||void 0===t||!t.sdp.includes("H264"))}}]),e}(),vG=function(){function ClientManager(){o(this,ClientManager),this.set_=new Set,OC.on(MC,this.add,this),OC.on(UC,this.add,this),OC.on(VC,this.delete,this),OC.on(BC,this.delete,this)}return c(ClientManager,[{key:"add",value:function(e){var t=e.client,n=e.roomId,i=this.getKey(t.getUserId(),n||t.getRoomId(),t.getSDKAppId(),t.getUseStringRoomId());this.set_.add(i)}},{key:"delete",value:function(e){var t=e.client,n=this.getKey(t.getUserId(),t.getRoomId(),t.getSDKAppId(),t.getUseStringRoomId());this.set_.delete(n)}},{key:"getKey",value:function(e,t,n,i){return"".concat(n,"_").concat(t,"_").concat(e,"_").concat(i)}},{key:"isJoined",value:function(e){var t=e.userId,n=e.roomId,i=e.sdkAppId,r=e.client;return this.set_.has(this.getKey(t,n,i,r.getUseStringRoomId()))}}]),ClientManager}(),gG=new vG;function yG(e,t,n,i){if(this.useStringRoomId_){if(!(uC(e)&&/^[A-Za-z\d\s!#$%&()+\-:;<=.>?@[\]^_{}|~,]{1,64}$/.test(e)))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:GT,data:t,link:{className:i,fnName:n}})})}else if(!(dC(e)&&/^[1-9]\d*$/.test(String(e))&&e<4294967295))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:zT,data:t,link:{className:i,fnName:n}})})}function SG(e,t,n,i){if(!/^[A-Za-z\d_-]*$/.test(e))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:dw,data:t,link:{className:i,fnName:n}})})}var bG={createClient:{name:"clientConfig",required:!0,type:EI,properties:{sdkAppId:{required:!0,type:II,allowEmpty:!1},userId:{required:!0,type:kI,allowEmpty:!1},userSig:{required:!0,type:kI,allowEmpty:!1},mode:{required:!0,type:kI,values:["rtc",Sk]},useStringRoomId:{type:TI},autoSubscribe:{type:TI},enableAutoPlayDialog:{type:TI},streamId:{type:kI},userDefineRecordId:{type:kI},pureAudioPushMode:{type:II,values:[1,2]},enableSEI:{type:TI}}},createStream:{name:"streamConfig",required:!0,type:EI,properties:{userId:{type:kI},audio:{type:TI},video:{type:TI},screen:{type:TI},screenAudio:{type:TI},microphoneId:{type:kI},cameraId:{type:kI},facingMode:{type:[kI,EI]},audioSource:{instanceOf:window.MediaStreamTrack},videoSource:{instanceOf:window.MediaStreamTrack}},validate:function(e){if(!cC(e.screen)&&e.screen&&cC(e.audio)&&(e.audio=!1),!(cC(e.audio)&&cC(e.video)||cC(e.audioSource)&&cC(e.videoSource)))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:$w})});if(!cC(e.screen)&&!0===e.screen&&!0===e.video)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Zw})});if(e.audio&&e.screenAudio)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:eE})});if(!0!==e.screen&&!0===e.screenAudio)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:tE})});if(!cC(e.screen)&&!0===e.screen&&!this.isScreenShareSupported())throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:uE})})}}},kG={join:{name:"options",required:!0,type:EI,properties:{roomId:{required:!0,type:[II,kI],allowEmpty:!1,validate:yG},role:{type:[kI],values:[Ik,Tk]},privateMapKey:{type:[kI]}},validate:function(e){if(this.isJoined_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:WT})});if(this.checkDestroy(),gG.isJoined({userId:this.userId_,roomId:e.roomId,sdkAppId:this.sdkAppId_,client:this}))throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Uw,data:this.userId_})})}},publish:[{name:"stream",required:!0,instanceOf:WI,validate:function(e){if(!this.isJoined_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:XT})});if(this.mode_===Sk&&this.role_===Tk)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:$T})});if(!e.getIsReadyToPublish())throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:ZT})});if(this.notPublishWithoutH264Supported_)throw new vP({code:_P.NOT_SUPPORTED_H264,message:ZR({key:aE})})}},{name:"options",type:EI,defaultValue:{isAuxiliary:!1},properties:{isAuxiliary:{type:TI,defaultValue:!1,validate:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e&&!vO())throw new vP({code:_P.NOT_SUPPORTED,message:ZR({key:dE})});if(this.uplinkConnection_&&(e&&this.uplinkConnection_.isAuxStreamPublished||!e&&this.uplinkConnection_.isMainStreamPublished))throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:ew,data:e?Ab:"local"})});var t=this.localScreenStream_||b(this.connections_.values()).findIndex((function(e){return e.getTrackState().auxiliary}))>=0;if(!this.enableMultiAuxStream_&&e&&t)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:RE})})}}}}],unpublish:{name:"stream",required:!0,instanceOf:WI,validate:function(e){if(e!==this.localStream_&&e!==this.localAuxStream_){if(this.localStream_||this.localAuxStream_)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:YT})});this.log_.warn("Client currently has no published stream, please call publish() first.")}}},subscribe:[{name:"stream",required:!0,instanceOf:GI,validate:function(e){if(!e.getConnection())throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:tw})});if(this.notSubscribeWithoutH264Supported_)throw new vP({code:_P.NOT_SUPPORTED_H264,message:ZR({key:oE})})}},{name:"options",type:EI,properties:{audio:{type:TI},video:{type:TI},smallVideo:{type:TI}},validate:function(e){var t=e.audio,n=e.video,i=e.smallVideo;if(!1===t&&!1===n&&(cC(i)||!1===i))throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:vE})})}}],unsubscribe:{name:"stream",required:!0,instanceOf:GI,validate:function(e){if(!e.getConnection())throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:tw})})}},switchRole:{name:"role",required:!0,values:[Ik,Tk],validate:function(){if(this.mode_!==Sk)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:iw})});if(!this.isJoined_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:rw})})}},startPublishCDNStream:{name:"options",required:!1,properties:{streamId:{type:kI,validate:SG},streamType:{type:kI,values:["main","auxiliary"]},appId:{type:II,allowEmpty:!1},bizId:{type:II,allowEmpty:!1},url:{type:kI,allowEmpty:!1}},validate:function(){if(this.isDestroyed_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Vw,data:{funName:"startPublishCDNStream"}})})}},startMixTranscode:{name:"config",required:!0,type:EI,properties:{mode:{type:kI,values:["preset-layout","manual"]},streamId:{type:kI,validate:SG},videoWidth:{type:II,notLessThanZero:!0},videoHeight:{type:II,notLessThanZero:!0},videoBitrate:{type:II,notLessThanZero:!0,allowEmpty:!1},videoFramerate:{type:II,validate:function(e,t,n,i){if(e<=0||e>30)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Ww,link:{className:i,fnName:n}})})}},videoGOP:{type:II,validate:function(e,t,n,i){if(e<1||e>8)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Gw,link:{className:i,fnName:n}})})}},audioSampleRate:{type:II,notLessThanZero:!0},audioBitrate:{type:II,validate:function(e,t,n,i){if(e<32||e>192)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:zw,link:{className:i,fnName:n}})})}},audioChannels:{type:II,values:[1,2]},backgroundColor:{type:II},backgroundImage:{type:kI},mixUsers:{required:!0,type:wI,arrayItem:{require:!0,type:EI,properties:{userId:{required:!0,type:kI},roomId:{type:[kI,II],validate:yG},pureAudio:{type:TI},width:{type:II,notLessThanZero:!0},height:{type:II,notLessThanZero:!0},locationX:{type:II,notLessThanZero:!0},locationY:{type:II,notLessThanZero:!0},zOrder:{type:II},streamType:{type:kI,values:["main","auxiliary"]},renderMode:{type:II,values:[0,1,2,4]}}}}},validate:function(e,t,n,i,r){var a=0,o=0,s=e.mixUsers,c=[];if(s.forEach((function(e,t){if(c.push(e.userId),!e.pureAudio){if(!e.zOrder||e.zOrder<1||e.zOrder>15)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Jw,data:"config.mixUsers[".concat(t,"].zOrder"),link:{className:i,fnName:n}})});e.width+e.locationX>a&&(a=e.width+e.locationX),e.height+e.locationY>o&&(o=e.height+e.locationY)}})),c.indexOf(this.getUserId())<0)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:qw,link:{className:i,fnName:n}})});if(e.videoWidth<a||e.videoHeight<o)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Kw,link:{className:i,fnName:n}})})}},sendSEIMessage:[{name:"buffer",required:!0,instanceOf:ArrayBuffer,validate:function(e){if(!kO)throw new vP({code:_P.NOT_SUPPORTED,message:ZR({key:gE})});if(!this.enableSEI_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:yE})});if(e.byteLength>1e3)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:bE,data:e.byteLength})});if(0===e.byteLength)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:SE})});if(!this.uplinkConnection_||!this.localStream_)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:kE})});if(!this.localStream_.hasVideo())throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:IE})});var t=this.uplinkConnection_.isH264;if(!t)throw new vP({code:_P.NOT_SUPPORTED,message:ZR({key:gE,data:t})})}},{name:"options",type:EI,properties:{seiPayloadType:{type:II,values:[5,243]}}}]},IG={switchDevice:[{name:"type",required:!0,type:kI,values:[Tb,wb]},{name:"deviceId",required:!0,type:kI,validate:function(){if(this.screen_&&!this.audio_||this.audioSource_||this.videoSource_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:bw})});if(this.publishState_===xI)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:kw})});if(!gO())throw new vP({code:_P.NOT_SUPPORTED,message:ZR({key:cE})})}}],setAudioCaptureVolume:{name:"volume",type:II}},TG={play:[{name:"elementId",required:!0,type:[kI,"HTMLDivElement"],validate:function(e,t,n){if(uC(e)){var i=document.getElementById(e);if(!i)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Qw,data:{key:t,fnName:n}})});if(!(i instanceof HTMLDivElement))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Xw,data:{key:t,fnName:n,type:mC(i)}})})}}},{name:"options",type:EI,properties:{objectFit:{type:kI,values:["contain","cover","fill"]},muted:{type:TI},mirror:{type:TI}}}],addTrack:{name:sk,instanceOf:window.MediaStreamTrack,validate:function(e){if(this.isAddingTrack_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:ww})});if(this.isRemovingTrack_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Ew})});if(this.publishState_===xI)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Rw})});var t=this.getMediaStream();if(!t)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Cw})});if(e.kind===Tb&&t.getAudioTracks().length>0||e.kind===wb&&t.getVideoTracks().length>0)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Aw})});if(!_O()&&!mO())throw new vP({code:_P.NOT_SUPPORTED,message:ZR({key:sE,data:rk})})}},removeTrack:{name:sk,instanceOf:window.MediaStreamTrack,validate:function(e){if(this.isAddingTrack_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Pw})});if(this.isRemovingTrack_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Dw})});if(this.publishState_===xI)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Ow})});var t=this.getMediaStream();if(!t)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Cw})});if(-1===t.getTracks().indexOf(e))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Mw})});if(!_O()){if(1===t.getTracks().length)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Nw})});if(e.kind===Tb)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:xw})});if(!mO())throw new vP({code:_P.NOT_SUPPORTED,message:ZR({key:sE,data:ak})})}}},replaceTrack:{name:sk,instanceOf:window.MediaStreamTrack,validate:function(e){var t=this.getMediaStream();if(!t)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Tw})});if(this.publishState_===xI)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Iw})});if(e.kind===Tb&&t.getAudioTracks().length<=0||e.kind===wb&&t.getVideoTracks().length<=0)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Lw,data:e})});if(!gO())throw new vP({code:_P.NOT_SUPPORTED,message:ZR({key:sE,data:ok})})}}},wG={TRTC:bG,CLIENT:kG,LOCAL_STREAM:IG,STREAM:TG};function EG(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e,n,i){var r=i.value;return i.value=function(){for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];return CG.call(this,t,i,n,this.name_),r.apply(this,i)},i}}function RG(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return function(e,i,r){var o=r.value;return r.value=a(n().mark((function e(){var r,a,s,c=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=c.length,a=new Array(r),s=0;s<r;s++)a[s]=c[s];return CG.call(this,t,a,i,this.name_),e.abrupt("return",o.apply(this,a));case 3:case"end":return e.stop()}}),e,this)}))),r}}function CG(e,t,n,i){try{for(var r=0;r<e.length;r++)AG.call(this,{rule:e[r],value:t[r],key:e[r].name,fnName:n,className:i})}catch(Yq){throw MA.error(Yq),Yq}}function AG(e){var t=this,n=e.rule,i=e.value,r=e.key,a=e.fnName,o=e.className;if(cC(i)){if(n.required)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:wT,data:{key:r,rule:n,fnName:a,value:i},link:{className:o,fnName:a}})});if(cC(n.defaultValue))return;i=n.defaultValue}if(Array.isArray(n.type)){if(!n.type.map((function(e){return e.toLowerCase()})).includes(mC(i)))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:ET,data:{key:r,rule:n,fnName:a,value:i},link:{className:o,fnName:a}})})}else if(!cC(n.type)&&mC(i)!==n.type)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:ET,data:{key:r,rule:n,fnName:a,value:i},link:{className:o,fnName:a}})});if(!1===n.allowEmpty){var s=dC(i)&&(0===i||Number.isNaN(i)),c=uC(i)&&""===i.trim();if(s||c)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:RT,data:{key:r,rule:n,fnName:a,value:i},link:{className:o,fnName:a}})})}if(n.notLessThanZero&&dC(i)&&i<0)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Hw,data:{key:r,rule:n,fnName:a,value:i},link:{className:o,fnName:a}})});if(uC(n.instanceOf)){if(!i||i.name_!==n.instanceOf)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:CT,data:{key:r,rule:n,fnName:a,value:i},link:{className:o,fnName:a}})})}else if(sC(n.instanceOf)&&!(i instanceof n.instanceOf))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:CT,data:{key:r,rule:n,fnName:a,value:i},link:{className:o,fnName:a}})});if(n.values&&!n.values.includes(i))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:AT,data:{key:r,rule:n,fnName:a,value:i},link:{className:o,fnName:a}})});var u=n.properties;rC(u)&&hC(i)&&Object.keys(u).forEach((function(e){AG.call(t,{rule:u[e],value:i&&i[e],key:"".concat(r,".").concat(e),fnName:a,className:o})}));var d=n.arrayItem;rC(d)&&pC(i)&&i.forEach((function(e,n){AG.call(t,{rule:d,value:e,key:"".concat(r,"[").concat(n,"]"),fnName:a,className:o})})),sC(n.validate)&&n.validate.call(this,i,r,a,o,this)}Tr({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var xG=Tr,PG=x,DG=Ho.f;xG({target:"Object",stat:!0,forced:PG((function(){return!Object.getOwnPropertyNames(1)}))},{getOwnPropertyNames:DG});var OG,MG,NG=SM;function LG(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{retries:5,timeout:2e3};return function(t,n,i){var r=AA({retryFunction:i.value,settings:e,onError:e.onError,onRetrying:e.onRetrying,onRetryFailed:e.onRetryFailed});return i.value=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(this,t)},i}}Tr({target:"Array",stat:!0,forced:!yc((function(e){Array.from(e)}))},{from:NG});var UG,VG,jG,FG,BG=5e3,HG={msg_user_info:0,uint32_video_avg_fps:0,uint32_video_width:0,uint32_video_height:0,uint32_video_avg_bitrate:0,uint32_video_block_time:0,uint32_video_play_time:0,uint32_audio_block_time:0,uint32_audio_play_time:0,uint32_audio_play_db:0,uint32_avg_down_loss:0,uint32_stream_type:0,uint32_video_render_first:0,uint32_video_block_count:0,uint32_audio_block_count:0,uint32_audio_bitrate:0,uint32_video_black_screen_subjective:0,uint32_audio_recv_bitrate:0,uint32_video_external_block_time:0},WG=c((function e(t){o(this,e),this.str_identifier=String(t.userId),this.uint64_tinyid=Number(t.tinyId),this.uint32_role=t.role})),GG=(OG=LG({timeout:500,retries:3}),MG=function(){function e(t){var i=this;o(this,e),this.frameWorkType_=t.frameWorkType||30,this.component_=t.component||0,this.client_=t.client,this.keyPrefix_="key_point",this.storageKey_="".concat(this.keyPrefix_,"_").concat(this.client_.getUserId()),this.log_=MA.createLogger({id:"kpm|"+this.client_.getUserId(),userId:this.client_.getUserId(),sdkAppId:this.client_.getSDKAppId()}),Object.getOwnPropertyNames(this.__proto__).forEach((function(e){e.startsWith("handle")&&sC(i[e])&&(i[e]=function(e){var t=e.fn,i=e.context;return a(n().mark((function e(){var r,a,o,s=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(e.prev=0,r=s.length,a=new Array(r),o=0;o<r;o++)a[o]=s[o];return e.next=4,t.apply(i||this,a);case 4:return e.abrupt("return",e.sent);case 7:e.prev=7,e.t0=e.catch(0),MA.error("".concat(t.name,"() error observed ")+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])})))}({fn:i[e],context:i}))})),this.initData(),this.installEvents(),this.intervalId_=YD.run(uT,this.setStorage.bind(this),{delay:2e4})}var i,r,s;return c(e,[{key:"initData",value:function(){var e;this.firstPublishedUserList_=[],this.networkQuality_={totalUplinkRTT:0,totalUplinkLoss:0,count:0,totalDownlinkRTTAndLossMap:new Map},this.basicInfo={string_sdk_version:Dr,uint32_os_type:15,string_device_name:"",string_http_user_agent:navigator.userAgent,string_os_version:"",string_domain:location.host,uint32_avg_rtt:0,uint32_avg_up_loss:0,uint32_scene:"live"===(null===(e=this.client_)||void 0===e?void 0:e.getMode())?1:0,uint32_joining_duration:0,uint32_networkType:CI[iC()],uint32_framework:this.frameWorkType_,uint32_component:this.component_},this.pathJoinRoom_={uint64_start_time:0,uint64_init_audio_start_time:0,uint64_init_audio_end_time:0,uint64_init_camera_start_time:0,uint64_init_camera_end_time:0,uint64_send_request_acc_ip_cmd_start_time:0,uint64_send_request_acc_ip_cmd_end_time:0,uint64_send_request_enter_room_cmd_start_time:0,uint64_send_request_enter_room_cmd_end_time:0,uint64_send_first_video_frame_time:0,uint64_recv_userlist_time:0,uint64_end_time:0,int32_init_audio_ret:0,int32_init_camera_ret:0,int32_send_request_acc_ip_cmd_ret:0,int32_send_request_enter_room_cmd_ret:0,int32_end_ret:0},this.pathLeaveRoom_={uint64_start_time:0,uint64_send_request_exit_room_cmd_start_time:0,uint64_send_request_exit_room_cmd_end_time:0,uint64_end_time:0,int32_send_request_exit_room_cmd_ret:0,int32_end_ret:0},this.pathMainVideoMap_=new Map,this.pathMainAudioMap_=new Map,this.pathAuxiliaryMap_=new Map,this.localStreamStats_={totalVideoBitrate:0,totalVideoFPS:0,totalVideoHeight:0,totalVideoWidth:0,totalAudioLevel:0,videoCount:0,audioLevelCount:0,publishStartTime:0,statsToReport:{uint32_audio_capture_db:0,uint32_video_big_capture_fps:0,uint32_video_big_bitrate:0,uint32_video_big_resolution:0}},this.remoteStreamStatsMap_=new Map}},{key:"installEvents",value:function(){OC.on(MC,this.handleJoinStart,this),OC.on(zC,this.handleWSStart,this),OC.on(JC,this.handleWSEnd,this),OC.on(NC,this.handleJoinSendCMD,this),OC.on(LC,this.handleJoinReceivedCMDResponce,this),OC.on(UC,this.handleJoinSuccess,this),OC.on(VC,this.handleJoinFailed,this),OC.on(WC,this.handleReceivedPublishUserList,this),OC.on(IA,this.handleConnectionStateChanged,this),OC.on(jC,this.handleLeaveStart,this),OC.on(BC,this.handleLeaveSuccess,this),OC.on(FC,this.handleLeaveSendCMD,this),OC.on(TA,this.handleSendSubscribeCMD,this),OC.on(nA,this.handleVideoPlaying,this),OC.on(iA,this.handleAudioPlaying,this),OC.on(wA,this.handleNetworkQuality,this),OC.on(HC,this.handleHeartbeatStats,this),OC.on(aA,this.handleRemoteStreamAdded,this),OC.on(oA,this.handleRemoteStreamSubscribeStart,this),OC.on(sA,this.handleRemoteStreamSubscribed,this),OC.on(dA,this.handleRemoteStreamRemoved,this),OC.on(gA,this.handleVideoLoadedData,this),OC.on(vA,this.handlePlayStream,this),OC.on(GC,this.handlePublishStart,this),OC.on(hA,this.handleLocalStreamInitStart,this),OC.on(pA,this.handleLocalStreamInitEnd,this),OC.on(fA,this.handleLocalStreamInitFailed,this)}},{key:"uninstallEvents",value:function(){OC.off(MC,this.handleJoinStart,this),OC.off(zC,this.handleWSStart,this),OC.off(JC,this.handleWSEnd,this),OC.off(NC,this.handleJoinSendCMD,this),OC.off(LC,this.handleJoinReceivedCMDResponce,this),OC.off(WC,this.handleReceivedPublishUserList,this),OC.off(IA,this.handleConnectionStateChanged,this),OC.off(jC,this.handleLeaveStart,this),OC.off(BC,this.handleLeaveSuccess,this),OC.off(UC,this.handleJoinSuccess,this),OC.off(VC,this.handleJoinFailed,this),OC.off(FC,this.handleLeaveSendCMD,this),OC.off(TA,this.handleSendSubscribeCMD,this),OC.off(nA,this.handleVideoPlaying,this),OC.off(iA,this.handleAudioPlaying,this),OC.off(wA,this.handleNetworkQuality,this),OC.off(HC,this.handleHeartbeatStats,this),OC.off(aA,this.handleRemoteStreamAdded,this),OC.off(oA,this.handleRemoteStreamSubscribeStart,this),OC.off(sA,this.handleRemoteStreamSubscribed,this),OC.off(dA,this.handleRemoteStreamRemoved,this),OC.off(gA,this.handleVideoLoadedData,this),OC.off(vA,this.handlePlayStream,this),OC.off(GC,this.handlePublishStart,this),OC.off(hA,this.handleLocalStreamInitStart,this),OC.off(pA,this.handleLocalStreamInitEnd,this),OC.off(fA,this.handleLocalStreamInitFailed,this)}},{key:"destroy",value:function(){this.uninstallEvents(),YD.clearTask(this.intervalId_),this.client_=null}},{key:"handleJoinStart",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_start_time&&(this.pathJoinRoom_.uint64_start_time=Date.now(),this.checkStorage())}},{key:"handleWSStart",value:function(e){var t=e.client;this.hitTest(t)&&0===this.pathJoinRoom_.uint64_send_request_acc_ip_cmd_start_time&&(this.pathJoinRoom_.uint64_send_request_acc_ip_cmd_start_time=Date.now())}},{key:"handleWSEnd",value:function(e){var t=e.client,n=e.error;this.hitTest(t)&&0===this.pathJoinRoom_.uint64_send_request_acc_ip_cmd_end_time&&(this.pathJoinRoom_.uint64_send_request_acc_ip_cmd_end_time=Date.now(),n&&(this.pathJoinRoom_.int32_send_request_acc_ip_cmd_ret=n instanceof vP?Number(n.getExtraCode()||n.getCode()):_P.UNKNOWN,this.pathJoinRoom_.int32_end_ret=2))}},{key:"handleJoinSendCMD",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_send_request_enter_room_cmd_start_time&&(this.pathJoinRoom_.uint64_send_request_enter_room_cmd_start_time=Date.now())}},{key:"handleJoinReceivedCMDResponce",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_send_request_enter_room_cmd_end_time&&(this.pathJoinRoom_.uint64_send_request_enter_room_cmd_end_time=Date.now(),this.pathJoinRoom_.int32_send_request_enter_room_cmd_ret=e.code,0!==e.code&&(this.pathJoinRoom_.int32_end_ret=3))}},{key:"handleJoinSuccess",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_end_time&&(this.pathJoinRoom_.uint64_end_time=Date.now(),this.pathJoinRoom_.int32_end_ret=0)}},{key:"handleJoinFailed",value:function(e){var t=e.client;this.hitTest(t)&&(this.pathJoinRoom_.uint64_end_time=Date.now(),0===this.pathJoinRoom_.int32_end_ret&&(this.pathJoinRoom_.int32_end_ret=3),this.prepareReport(),this.report())}},{key:"handleReceivedPublishUserList",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_recv_userlist_time&&(this.pathJoinRoom_.uint64_recv_userlist_time=Date.now(),this.firstPublishedUserList_=e.data.data&&e.data.data.userList||[])}},{key:"handleConnectionStateChanged",value:function(e){var t=e.client,n=e.state,i=e.connection;if(this.hitTest(t)&&n===Mk){this.client_.getUplinkConnection()===i&&0===this.pathJoinRoom_.uint64_send_first_video_frame_time&&this.localStreamStats_.publishStartTime>this.pathJoinRoom_.uint64_end_time&&this.localStreamStats_.publishStartTime-this.pathJoinRoom_.uint64_end_time<=100&&(this.pathJoinRoom_.uint64_send_first_video_frame_time=Date.now());var r=this.pathMainVideoMap_.get("".concat(i.getUserId(),"_").concat(Ck));r&&0===r.statsToReport.uint64_pc_connected_time&&(r.statsToReport.uint64_pc_connected_time=Date.now())}}},{key:"handleLeaveStart",value:function(e){this.hitTest(e.client)&&(this.pathLeaveRoom_.uint64_start_time=Date.now())}},{key:"handleLeaveSuccess",value:function(e){this.hitTest(e.client)&&0===this.pathLeaveRoom_.uint64_end_time&&(this.pathLeaveRoom_.uint64_end_time=Date.now(),0!==this.pathJoinRoom_.uint64_end_time?this.basicInfo.uint32_joining_duration=this.pathLeaveRoom_.uint64_end_time-this.pathJoinRoom_.uint64_end_time:this.log_.warn("pathJoinRoom endTime is 0"),this.report())}},{key:"handleLeaveSendCMD",value:function(e){this.hitTest(e.client)&&(this.pathLeaveRoom_.uint64_send_request_exit_room_cmd_start_time=Date.now(),this.pathLeaveRoom_.uint64_send_request_exit_room_cmd_end_time=Date.now())}},{key:"handleRemoteStreamAdded",value:function(e){var n=e.client,i=e.stream;if(this.hitTest(n)){var r=i.getUserId(),a=i.getType(),o="".concat(r,"_").concat(a),s=this.remoteStreamStatsMap_.get(o);if(s)s.stream=i;else{var c={userId:r,totalVideoFPS:0,totalVideoBitrate:0,totalAudioLevel:0,totalAudioBitrate:0,totalLoss:0,audioCount:0,audioLevelCount:0,videoCount:0,networkQualityCount:0,streamAddedTime:Date.now(),subscribeStartTime:0,subscribedTime:0,playStreamTime:0,statsToReport:t({},HG),stream:i};c.statsToReport.msg_user_info=new WG({userId:r,tinyId:i.getTinyId(),role:bk}),c.statsToReport.uint32_stream_type=a===Ck?2:7,this.remoteStreamStatsMap_.set(o,c)}}}},{key:"handleRemoteStreamSubscribeStart",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var i=n.getUserId(),r=n.getType(),a="".concat(i,"_").concat(r),o=this.remoteStreamStatsMap_.get(a);o&&0===o.subscribeStartTime&&(o.subscribeStartTime=Date.now())}}},{key:"handleSendSubscribeCMD",value:function(e){if(this.hitTest(e.client)){var t=new WG(e),n=Date.now(),i="".concat(e.userId,"_").concat(Ck);e.trackState.video&&e.subscribeState.video&&!this.pathMainVideoMap_.has(i)&&this.pathMainVideoMap_.set(i,{statsToReport:{msg_user_info:t,uint64_start_enter_time:this.pathJoinRoom_.uint64_start_time,uint64_render_first_frame_time:0,uint64_combine_first_frame_time:0,uint64_pc_connected_time:0},userId:e.userId,sendSubscribeCMDTime:n}),e.trackState.audio&&e.subscribeState.audio&&!this.pathMainAudioMap_.has(i)&&this.pathMainAudioMap_.set(i,{statsToReport:{msg_user_info:t,uint64_start_enter_time:this.pathJoinRoom_.uint64_start_time,uint64_play_first_frame_time:0},userId:e.userId,sendSubscribeCMDTime:n});var r="".concat(e.userId,"_").concat(Ak);e.trackState.auxiliary&&e.subscribeState.auxiliary&&!this.pathAuxiliaryMap_.has(r)&&this.pathAuxiliaryMap_.set(r,{sendSubscribeCMDTime:n})}}},{key:"handleRemoteStreamSubscribed",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var i=n.getUserId(),r=n.getType(),a="".concat(i,"_").concat(r),o=this.remoteStreamStatsMap_.get(a);o&&0===o.subscribedTime&&(o.subscribedTime=Date.now(),o.stream=n)}}},{key:"handleRemoteStreamRemoved",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var i=n.getUserId(),r=n.getType(),a=this.remoteStreamStatsMap_.get("".concat(i,"_").concat(r));a&&(a.stream=null)}}},{key:"handlePlayStream",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),i="".concat(n,"_").concat(t.getType());if(this.remoteStreamStatsMap_.has(i)){var r=this.remoteStreamStatsMap_.get(i);0===r.playStreamTime&&(r.playStreamTime=Date.now())}}}},{key:"handleVideoLoadedData",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),i="".concat(n,"_").concat(t.getType());if(this.pathMainVideoMap_.has(i)){var r=this.pathMainVideoMap_.get(i);0===r.statsToReport.uint64_combine_first_frame_time&&(r.statsToReport.uint64_combine_first_frame_time=Date.now())}}}},{key:"handleVideoPlaying",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),i="".concat(n,"_").concat(t.getType()),r=Date.now();if(this.pathMainVideoMap_.has(i)){var a=this.pathMainVideoMap_.get(i);if(0===a.statsToReport.uint64_render_first_frame_time&&(a.statsToReport.uint64_render_first_frame_time=r),this.remoteStreamStatsMap_.has(i)){var o=this.remoteStreamStatsMap_.get(i),s=o.statsToReport,c=o.playStreamTime,u=o.subscribedTime;0===s.uint32_video_render_first&&c-u<=100&&(s.uint32_video_render_first=r-a.sendSubscribeCMDTime)}}if(t.getType()===Ak&&this.pathAuxiliaryMap_.has(i)&&this.remoteStreamStatsMap_.has(i)){var d=this.remoteStreamStatsMap_.get(i),l=d.statsToReport,h=d.playStreamTime,p=d.subscribedTime;0===l.uint32_video_render_first&&h-p<=100&&(l.uint32_video_render_first=r-this.pathAuxiliaryMap_.get(i).sendSubscribeCMDTime)}}}},{key:"handleAudioPlaying",value:function(e){if(e.stream.isRemote()&&e.stream.getConnection()&&this.hitTest(e.stream.getConnection().getClient())){var t=e.stream.getConnection().getUserId(),n="".concat(t,"_").concat(e.stream.getType());if(this.pathMainAudioMap_.has(n)){var i=this.pathMainAudioMap_.get(n);0===i.statsToReport.uint64_play_first_frame_time&&(i.statsToReport.uint64_play_first_frame_time=Date.now())}}}},{key:"handleNetworkQuality",value:function(e){var t=this;this.hitTest(e.client)&&(this.networkQuality_.totalUplinkLoss+=e.uplinkLoss,this.networkQuality_.totalUplinkRTT+=e.uplinkRTT,this.networkQuality_.count++,e.downlinkLossAndRTTMap.forEach((function(e){var n=e.rtt,i=e.loss,r=e.userId,a=t.networkQuality_.totalDownlinkRTTAndLossMap.get(r);a?(a.totalRTT+=n,a.totalLoss+=i,a.count++):t.networkQuality_.totalDownlinkRTTAndLossMap.set(r,{totalRTT:n,totalLoss:i,count:1})})))}},{key:"handleHeartbeatStats",value:function(e){var t=this;if(this.hitTest(e.client)){var n=e.stats,i=n.msg_up_stream_info,r=n.msg_down_stream_info;if(i.msg_video_status[0]){var a=i.msg_video_status[0],o=a.uint32_video_codec_bitrate,s=a.uint32_video_enc_fps,c=a.uint32_video_width,u=a.uint32_video_height;this.localStreamStats_.totalVideoBitrate+=o,this.localStreamStats_.totalVideoFPS+=s,this.localStreamStats_.totalVideoWidth+=c,this.localStreamStats_.totalVideoHeight+=u,this.localStreamStats_.videoCount++}if(i.msg_audio_status){var d=i.msg_audio_status.audioLevel;Math.floor(100*d)>0&&(this.localStreamStats_.totalAudioLevel+=d,this.localStreamStats_.audioLevelCount++)}r.forEach((function(e){var n=e.msg_user_info,i=e.msg_audio_status,r=e.msg_video_status,a=n.str_identifier;if(r.forEach((function(e){var n=2===e.uint32_video_stream_type,i=7===e.uint32_video_stream_type,r="".concat(a,"_").concat(n?Ck:Ak);if(t.remoteStreamStatsMap_.has(r)){var o,s,c=t.remoteStreamStatsMap_.get(r);(n&&null!==(o=c.stream)&&void 0!==o&&o.isMainVideoSubscribed||i&&null!==(s=c.stream)&&void 0!==s&&s.isAuxVideoSubscribed)&&(c.totalVideoFPS+=e.uint32_video_receive_fps,c.totalVideoBitrate+=e.uint32_video_codec_bitrate,c.videoCount++,0===c.statsToReport.uint32_video_width&&(c.statsToReport.uint32_video_width=e.uint32_video_width),0===c.statsToReport.uint32_video_height&&(c.statsToReport.uint32_video_height=e.uint32_video_height))}})),i){var o="".concat(a,"_").concat(Ck);if(t.remoteStreamStatsMap_.has(o)){var s,c=t.remoteStreamStatsMap_.get(o);null!==(s=c.stream)&&void 0!==s&&s.isMainAudioSubscribed&&(c.totalAudioBitrate+=i.uint32_audio_codec_bitrate,c.audioCount++,Math.floor(100*i.audioLevel)>0&&(c.totalAudioLevel+=i.audioLevel,c.audioLevelCount++))}}}))}}},{key:"handlePublishStart",value:function(e){var t=e.client;this.hitTest(t)&&0===this.localStreamStats_.publishStartTime&&(this.localStreamStats_.publishStartTime=Date.now())}},{key:"handleLocalStreamInitStart",value:function(e){var t=e.audio,n=e.video;t&&0===this.pathJoinRoom_.uint64_init_audio_start_time&&(this.pathJoinRoom_.uint64_init_audio_start_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_start_time&&(this.pathJoinRoom_.uint64_init_camera_start_time=Date.now())}},{key:"handleLocalStreamInitEnd",value:function(e){var t=e.audio,n=e.video;t&&0===this.pathJoinRoom_.uint64_init_audio_end_time&&(this.pathJoinRoom_.uint64_init_audio_end_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_end_time&&(this.pathJoinRoom_.uint64_init_camera_end_time=Date.now())}},{key:"handleLocalStreamInitFailed",value:function(e){var t=e.audio,n=e.video,i=e.error,r=i instanceof vP?i.getExtraCode()||i.getCode():{NotFoundError:1,NotAllowedError:2,NotReadableError:3,OverConstrainedError:4,AbortError:5}[i.name]||_P.UNKNOWN;t&&0===this.pathJoinRoom_.uint64_init_audio_end_time&&(this.pathJoinRoom_.int32_init_audio_ret=r,this.pathJoinRoom_.uint64_init_audio_end_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_end_time&&(this.pathJoinRoom_.int32_init_camera_ret=r,this.pathJoinRoom_.uint64_init_camera_end_time=Date.now())}},{key:"hasVideoFlag",value:function(e){return this.firstPublishedUserList_.findIndex((function(t){return t.userId===e&&1&t.flag}))>=0}},{key:"hasAudioFlag",value:function(e){return this.firstPublishedUserList_.findIndex((function(t){return t.userId===e&&8&t.flag}))>=0}},{key:"hasAuxFlag",value:function(e){return this.firstPublishedUserList_.findIndex((function(t){return t.userId===e&&4&t.flag}))>=0}},{key:"hitTest",value:function(e){return e===this.client_}},{key:"checkStorage",value:(s=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(t=ZD.getItem(this.storageKey_))){e.next=6;break}return e.next=5,this.upload(t);case 5:ZD.deleteItem(this.storageKey_);case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.log_.warn(e.t0);case 11:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return s.apply(this,arguments)})},{key:"setStorage",value:function(){this.prepareReport();var e=this.getReportData();0!==e.msg_path_enter_room.uint64_start_time&&ZD.setItem(this.storageKey_,e)}},{key:"prepareReport",value:function(){var e=this;if(this.networkQuality_.count>0&&(this.basicInfo.uint32_avg_rtt=Math.floor(this.networkQuality_.totalUplinkRTT/this.networkQuality_.count),this.basicInfo.uint32_avg_up_loss=Math.floor(this.networkQuality_.totalUplinkLoss/this.networkQuality_.count)),this.localStreamStats_.videoCount>0){this.localStreamStats_.statsToReport.uint32_video_big_capture_fps=Math.floor(this.localStreamStats_.totalVideoFPS/this.localStreamStats_.videoCount),this.localStreamStats_.statsToReport.uint32_video_big_bitrate=Math.floor(this.localStreamStats_.totalVideoBitrate/this.localStreamStats_.videoCount);var t=Math.floor(this.localStreamStats_.totalVideoWidth/this.localStreamStats_.videoCount),n=Math.floor(this.localStreamStats_.totalVideoHeight/this.localStreamStats_.videoCount);this.localStreamStats_.statsToReport.uint32_video_big_resolution=t<<16|n}this.localStreamStats_.audioLevelCount>0&&(this.localStreamStats_.statsToReport.uint32_audio_capture_db=Math.floor(this.localStreamStats_.totalAudioLevel/this.localStreamStats_.audioLevelCount*100)),this.remoteStreamStatsMap_.forEach((function(t,n){var i=t.userId;if(e.networkQuality_.totalDownlinkRTTAndLossMap.has(i)){var r=e.networkQuality_.totalDownlinkRTTAndLossMap.get(i),a=r.totalLoss,o=r.count;t.statsToReport.uint32_avg_down_loss=Math.floor(a/o)}t.videoCount>0&&(t.statsToReport.uint32_video_avg_fps=Math.floor(t.totalVideoFPS/t.videoCount),t.statsToReport.uint32_video_avg_bitrate=Math.floor(t.totalVideoBitrate/t.videoCount)),t.audioCount>0&&(t.statsToReport.uint32_audio_recv_bitrate=t.statsToReport.uint32_audio_bitrate=Math.floor(t.totalAudioBitrate/t.audioCount)),t.audioLevelCount>0&&(t.statsToReport.uint32_audio_play_db=Math.floor(t.totalAudioLevel/t.audioLevelCount*100));var s=e.client_.getCallDurationCalculator();s&&(t.statsToReport.uint32_audio_play_time=s.getDuration(n,Tb),t.statsToReport.uint32_video_play_time=s.getDuration(n,wb)),t.statsToReport.uint32_video_render_first=Math.min(t.statsToReport.uint32_video_render_first,BG);var c=e.client_.getBadCaseDetector();if(c){var u=c.getDataFreezeDuration(n),d=u.dataFreeze,l=u.count,h=c.getRenderFreezeDuration(n).renderFreeze;t.statsToReport.uint32_video_block_count=l,t.statsToReport.uint32_video_block_time=Math.min(d,t.statsToReport.uint32_video_play_time),t.statsToReport.uint32_video_external_block_time=Math.min(h,t.statsToReport.uint32_video_play_time),c.isBlackStream(n)&&0===t.statsToReport.uint32_video_avg_fps?t.statsToReport.uint32_video_black_screen_subjective=1:t.statsToReport.uint32_video_black_screen_subjective=0}(0===t.subscribeStartTime||t.subscribeStartTime-t.streamAddedTime>100||0===t.playStreamTime)&&(e.pathMainAudioMap_.delete(n),e.pathMainVideoMap_.delete(n),t.statsToReport.uint32_video_render_first=0)})),this.pathMainAudioMap_.forEach((function(t,n){e.hasAudioFlag(t.userId)?t.statsToReport.uint64_play_first_frame_time-t.statsToReport.uint64_start_enter_time>BG&&(t.statsToReport.uint64_play_first_frame_time=t.statsToReport.uint64_start_enter_time+BG):e.pathMainAudioMap_.delete(n)})),this.pathMainVideoMap_.forEach((function(t,n){e.hasVideoFlag(t.userId)?t.statsToReport.uint64_render_first_frame_time-t.statsToReport.uint64_start_enter_time>BG&&(t.statsToReport.uint64_render_first_frame_time=t.statsToReport.uint64_start_enter_time+BG):e.pathMainVideoMap_.delete(n)})),this.pathJoinRoom_.uint64_end_time-this.pathJoinRoom_.uint64_start_time>BG&&(this.pathJoinRoom_.uint64_end_time=this.pathJoinRoom_.uint64_start_time+BG)}},{key:"getReportData",value:function(){var e=this.client_.getSignalInfo();return{uint32_sdk_app_id:Number(this.client_.getSDKAppId()),msg_user_info:new WG({userId:this.client_.getUserId(),tinyId:this.client_.getTinyId(),role:this.client_.getRole()===Ik?bk:kk}),msg_basic_info:this.basicInfo,uint32_acc_ip:gC(e.relayIp),uint32_client_ip:gC(e.clientIp,"small"),uint32_acc_port:0,uint64_timestamp:Date.now(),uint32_seq:Math.floor(Math.random()*Math.pow(2,31)),msg_path_enter_room:this.pathJoinRoom_,msg_path_exit_room:this.pathLeaveRoom_,msg_path_recv_video:b(this.pathMainVideoMap_.values()).map((function(e){return e.statsToReport})),msg_quality_statistics:b(this.remoteStreamStatsMap_.values()).map((function(e){return e.statsToReport})),str_room_name:String(this.client_.getRoomId()),msg_path_recv_audio:b(this.pathMainAudioMap_.values()).map((function(e){return e.statsToReport})),uint32_info_client_ip:gC(e.clientIp,"small"),error_code:[],msg_local_statistics:this.localStreamStats_.statsToReport,msg_function_state:zG.getStateArray()}}},{key:"report",value:(r=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=this.getReportData(),e.next=4,this.upload(t);case 4:ZD.deleteItem(this.storageKey_),zG.clearStateArray(),this.initData(),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),this.log_.warn(e.t0);case 12:case"end":return e.stop()}}),e,this,[[0,9]])}))),function(){return r.apply(this,arguments)})},{key:"upload",value:(i=a(n().mark((function e(t){var i,r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(qR||0===t.msg_path_enter_room.uint64_start_time||[JI,qI,KI].findIndex((function(e){return e===location.host}))>=0)){e.next=2;break}return e.abrupt("return");case 2:return i=Number(this.client_.getSDKAppId()),r=nC(i,_k),e.next=6,xC({url:r,body:JSON.stringify(t)});case 6:if("ok"===(a=e.sent).data){e.next=9;break}throw"key point upload failed: ".concat(a.data);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}]),e}(),w(MG.prototype,"upload",[OG],Object.getOwnPropertyDescriptor(MG.prototype,"upload"),MG.prototype),MG),zG=function(){function e(){o(this,e)}return c(e,null,[{key:"handleFunctionState",value:function(e){var t,n,i,r,a=e.className,o=e.fnName,s=e.params;if(!(qR||[JI,qI,KI].findIndex((function(e){return e===location.host}))>=0)){var c,u=[];if(a)switch(o){case"createClient":null!==(t=s[0])&&void 0!==t&&t.mode&&u.push("".concat(a,".").concat(o,".").concat(s[0].mode)),null!==(n=s[0])&&void 0!==n&&n.useStringRoomId?u.push("".concat(a,".").concat(o,".stringRoomId")):u.push("".concat(a,".").concat(o,".intRoomId")),null!==(i=s[0])&&void 0!==i&&i.autoSubscribe?u.push("".concat(a,".").concat(o,".autoSubscribe")):u.push("".concat(a,".").concat(o,".manualSubscribe"));break;case"publish":null!==(r=s[1])&&void 0!==r&&r.isAuxiliary?u.push("".concat(a,".").concat(o,".isAuxiliary")):u.push("".concat(a,".").concat(o));break;case"setAudioProfile":case"setVideoProfile":case"setScreenProfile":case"setVideoContentHint":uC(s[0])&&u.push("".concat(a,".").concat(o,".").concat(s[0]));break;default:u.push("".concat(a,".").concat(o))}else u.push(o);for(var d=0;d<u.length;d++){if(!(c=fT[u[d]]))return;if(this.stateMap.has(c))this.stateMap.get(c).int32_call_times+=1;else this.stateMap.set(c,{int32_id:c,int32_call_times:1})}}}},{key:"getStateArray",value:function(){return Array.from(this.stateMap.values())}},{key:"clearStateArray",value:function(){this.stateMap.clear()}}]),e}();function JG(e){return function(t,n,i){var r=i.value;return i.value=function(){for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];try{e||(e=this.name_),zG.handleFunctionState({className:e,fnName:n,params:i}),e=void 0}catch(Yq){this.log_.info(Yq)}return r.apply(this,i)},i}}u(zG,"stateMap",new Map);var qG=(UG=RG.apply(void 0,b(wG.STREAM.play)),VG=JG(),jG=JG(),FG=function(){function e(t){o(this,e),this.name_=zI,this.userId_=t.userId,this.isRemote_=t.isRemote,this.type_=t.type,this.log_=MA.createLogger({id:"s".concat(t.seq?t.seq:"","|").concat(this.userId_),userId:cC(t.client)?void 0:t.client.getUserId(),sdkAppId:cC(t.client)?void 0:t.client.getSDKAppId(),isLocal:!this.isRemote_,type:this.isRemote_?this.type_:""}),this.client_=null,cC(t.client)||(this.client_=t.client),this.mediaStream_=null,this.div_=null,this.isPlaying_=!1,this.connection_=null,this.audioPlayer_=null,this.videoPlayer_=null,this.muted_=!1,this.objectFit_="cover",this.mirror_=!1,this.id_="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),this.audioOutputDeviceId_=0,this.audioVolume_=1,this.emitter_=EC(new DC,this.name_),this.connectionState_=Pk,this.installEvents(),cC(t.mirror)||this.log_.warn('TRTC.createStream "mirror" option was deprecated since v4.12.1，please use localStream.play to set up preview mirror. refer to '.concat(XI,"/en/LocalStream.html#play. TRTC.createStream 接口的 mirror 选项从 v4.12.1 开始被废弃，请使用 localStream.play 设置本地流预览镜像，参考文档：").concat(XI,"/zh-cn/LocalStream.html#play。"))}var i,r,s,u,d;return c(e,[{key:"installEvents",value:function(){OC.on(EA,this.restartPlayback,this)}},{key:"uninstallEvents",value:function(){OC.off(EA,this.restartPlayback,this)}},{key:"getType",value:function(){return this.type_}},{key:"getLogger",value:function(){return this.log_}},{key:"isSubscribed",get:function(){return this.type_===Ck&&this.connection_.isMainStreamSubscribed||this.type_===Ak&&this.connection_.isAuxStreamSubscribed}},{key:"isMainVideoSubscribed",get:function(){var e=this.getSubscribedState();return this.type_===Ck&&e&&e.video}},{key:"isMainAudioSubscribed",get:function(){var e=this.getSubscribedState();return this.type_===Ck&&e&&e.audio}},{key:"isAuxVideoSubscribed",get:function(){var e=this.getSubscribedState();return this.type_===Ak&&e&&e.auxiliary}},{key:"isSmallVideoSubscribed",get:function(){var e=this.getSubscribedState();return this.type_===Ck&&e&&e.smallVideo}},{key:"emitConnectionStateChanged",value:function(e){e.state!==this.connectionState_&&(e.state!==Pk&&this.isRemote_&&!this.isSubscribed||(this.emitter_.emit(UO,e),this.connectionState_=e.state))}},{key:"setConnection",value:function(e){this.connection_!==e&&(e instanceof _G?(null!==this.connection_&&this.connection_.off(OO.CONNECTION_STATE_CHANGED,this.emitConnectionStateChanged,this),e.on(OO.CONNECTION_STATE_CHANGED,this.emitConnectionStateChanged,this)):null===e&&this.connection_.off(OO.CONNECTION_STATE_CHANGED,this.emitConnectionStateChanged,this),this.connection_=e)}},{key:"getConnection",value:function(){return this.connection_}},{key:"play",value:(d=a(n().mark((function e(t,i){var r,a,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.log_.info("stream ".concat(this.isPlaying_?"update":"start to"," play with elementId: ").concat(t," and options: ").concat(JSON.stringify(i),".")),!this.isPlaying_){e.next=9;break}return i&&!cC(i.muted)&&(this.muted_=i.muted),i&&!cC(i.objectFit)&&(this.objectFit_=i.objectFit),this.isScreenShare()?this.mirror_=!1:i&&!cC(i.mirror)&&(this.mirror_=i.mirror),this.audioPlayer_&&this.audioPlayer_.setMuted(this.muted_),this.videoPlayer_&&(this.videoPlayer_.setObjectFit(this.objectFit_),this.videoPlayer_.setMirror(this.mirror_)),this.elementId_!==t&&(r=t,uC(t)&&(r=document.getElementById(t)),r.appendChild(this.div_),this.elementId_=t),e.abrupt("return");case 9:return this.isPlaying_=!0,(a=document.createElement("div")).setAttribute("id","player_".concat(this.id_)),a.setAttribute("style","width: 100%; height: 100%; position: relative; background-color: black; overflow: hidden;"),o=t,uC(t)&&(o=document.getElementById(t)),o.appendChild(a),this.elementId_=t,this.div_=a,this.isRemote_||(this.muted_=!0),i&&!cC(i.muted)&&(this.muted_=i.muted),this.isScreenShare()&&(this.objectFit_="contain"),i&&!cC(i.objectFit)&&(this.objectFit_=i.objectFit),this.isScreenShare()?this.mirror_=!1:(this.isRemote_||(this.mirror_=!0),i&&!cC(i.mirror)&&(this.mirror_=i.mirror)),OC.emit(vA,{stream:this}),e.next=26,Promise.all([this.playAudio(),this.playVideo()]);case 26:OC.emit(eA,{stream:this});case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"playAudio",value:(u=a(n().mark((function e(){var i,r,a=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasAudio()&&(!this.isRemote_||this.isMainAudioSubscribed)){e.next=2;break}return e.abrupt("return");case 2:if(i=this.getAudioTrack(),this.audioPlayer_||!i){e.next=17;break}return this.log_.info("create AudioPlayer and play"),this.audioPlayer_=new xL({stream:this,track:i,gainedTrack:null===(r=this.gain_)||void 0===r?void 0:r.audioTrack,div:this.div_,muted:this.muted_,outputDeviceId:this.audioOutputDeviceId_,volume:this.audioVolume_}),this.audioPlayer_.on(FO,(function(e){var n={type:Tb,state:e.state,reason:e.reason};OC.emit(tA,t({stream:a},n)),a.emitter_.emit(NO,n)})),e.prev=7,e.next=10,this.audioPlayer_.play();case 10:e.next=17;break;case 12:throw e.prev=12,e.t0=e.catch(7),this.client_&&this.client_.getEnableAutoPlayDialog()&&new tU,this.emitter_.emit(jO,e.t0),e.t0;case 17:case"end":return e.stop()}}),e,this,[[7,12]])}))),function(){return u.apply(this,arguments)})},{key:"playVideo",value:(s=a(n().mark((function e(){var i,r=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasVideo()&&(!this.isRemote_||this.isMainVideoSubscribed||this.isAuxVideoSubscribed||this.isSmallVideoSubscribed)){e.next=2;break}return e.abrupt("return");case 2:if(i=this.getVideoTrack(),this.videoPlayer_||!i){e.next=18;break}return OC.emit(yA,{stream:this}),this.log_.info("create VideoPlayer and play"),this.videoPlayer_=new nU({stream:this,track:i,div:this.div_,muted:this.muted_,objectFit:this.objectFit_,mirror:this.mirror_}),this.videoPlayer_.on(FO,(function(e){var n={type:wb,state:e.state,reason:e.reason};OC.emit(tA,t({stream:r},n)),r.emitter_.emit(NO,n)})),e.prev=8,e.next=11,this.videoPlayer_.play();case 11:e.next=18;break;case 13:throw e.prev=13,e.t0=e.catch(8),this.client_&&this.client_.getEnableAutoPlayDialog()&&new tU,this.emitter_.emit(jO,e.t0),e.t0;case 18:case"end":return e.stop()}}),e,this,[[8,13]])}))),function(){return s.apply(this,arguments)})},{key:"stopAudio",value:function(){this.audioPlayer_&&(this.log_.info("stop AudioPlayer"),this.audioPlayer_.stop(),this.audioPlayer_=null)}},{key:"stopVideo",value:function(){this.videoPlayer_&&(this.log_.info("stop VideoPlayer"),this.videoPlayer_.stop(),this.videoPlayer_=null)}},{key:"restartPlayback",value:function(){this.audioPlayer_&&!this.audioPlayer_.isPlaying&&this.restartAudio(),this.videoPlayer_&&!this.videoPlayer_.isPlaying&&this.restartVideo()}},{key:"restartAudio",value:function(){this.isPlaying_&&(this.stopAudio(),this.playAudio().catch((function(e){})))}},{key:"restartVideo",value:function(){this.isPlaying_&&(this.stopVideo(),this.playVideo().catch((function(e){})))}},{key:"stop",value:function(){this.isPlaying_&&(this.isPlaying_=!1,this.stopAudio(),this.stopVideo(),this.div_.parentNode.removeChild(this.div_))}},{key:"resume",value:(r=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isPlaying_){e.next=2;break}return e.abrupt("return");case 2:if(this.log_.info("resume"),!this.audioPlayer_){e.next=6;break}return e.next=6,this.audioPlayer_.resume();case 6:if(!this.videoPlayer_){e.next=9;break}return e.next=9,this.videoPlayer_.resume();case 9:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"close",value:function(){this.log_.info("close stream"),this.isPlaying_&&this.stop(),this.isRemote_||(this.mediaStream_&&(this.mediaStream_.preventEvent=1,this.mediaStream_.getTracks().forEach((function(e){e.stop()})),this.mediaStream_=null),this.uninstallEvents())}},{key:"muteAudio",value:function(){return this.addRemoteEvent(!0,Tb),this.doEnableTrack(Tb,!1)}},{key:"muteVideo",value:function(){return this.addRemoteEvent(!0,wb),this.doEnableTrack(wb,!1)}},{key:"unmuteAudio",value:function(){return this.addRemoteEvent(!1,Tb),this.doEnableTrack(Tb,!0)}},{key:"unmuteVideo",value:function(){return this.addRemoteEvent(!1,wb),this.doEnableTrack(wb,!0)}},{key:"addRemoteEvent",value:function(e,t){if(this.isRemote_&&this.client_){var n=this.client_.getUserId(),i="".concat(e?Mb:Nb," remote ").concat(t);tD(n,{eventId:t===Tb?e?MP:LP:e?OP:NP,eventDesc:i,timestamp:(new Date).getTime(),userId:n,tinyId:this.client_.getTinyId(),remoteUserId:this.userId_,remoteTinyId:this.connection_.getTinyId()})}}},{key:"doEnableTrack",value:function(e,t){var n=!1;return e===Tb?this.mediaStream_.getAudioTracks().forEach((function(e){n=!0,e.enabled=t})):this.mediaStream_.getVideoTracks().forEach((function(e){n=!0,e.enabled=t})),n}},{key:"getId",value:function(){return this.id_}},{key:"getUserId",value:function(){return this.userId_}},{key:"getTinyId",value:function(){return this.connection_?this.connection_.getTinyId():""}},{key:"isPlaying",value:function(){return this.isPlaying_}},{key:"setAudioOutput",value:(i=a(n().mark((function e(t){var i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.log_.info("setAudioOutput ".concat(t)),this.audioOutputDeviceId_=t,!this.audioPlayer_){e.next=5;break}return e.next=5,this.audioPlayer_.setSinkId(t);case 5:return e.next=7,ZO();case 7:i=e.sent,this.log_.info("speakers: ".concat(JSON.stringify(i)));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"setAudioVolume",value:function(e){this.audioVolume_=e,this.log_.info("setAudioVolume to ".concat(e)),this.audioPlayer_&&this.audioPlayer_.setVolume(e)}},{key:"getAudioLevel",value:function(){var e=0;return this.audioPlayer_&&(e=this.audioPlayer_.getAudioLevel()),e}},{key:"getInternalAudioLevel",value:function(){var e=0;return this.audioPlayer_&&(e=this.audioPlayer_.getInternalAudioLevel()),e}},{key:"hasAudio",value:function(){if(this.isRemote_){if(!this.connection_)return!1;var e=this.connection_.getTrackState();return this.type_===Ck&&e.audio}return!!this.getAudioTrack()}},{key:"hasVideo",value:function(){if(this.isRemote_){if(!this.connection_)return!1;var e=this.connection_.getTrackState();return this.type_===Ak?e.auxiliary:e.video}return!!this.getVideoTrack()}},{key:"getSubscribedState",value:function(){return this.isRemote_&&this.connection_?this.connection_.getSubscribeState():null}},{key:"getAudioTrack",value:function(){var e=null;if(this.mediaStream_){var t=this.mediaStream_.getAudioTracks();t.length>0&&(e=t[0])}return e}},{key:"getVideoTrack",value:function(){var e=null;if(this.mediaStream_){var t=this.mediaStream_.getVideoTracks();t.length>0&&(e=t[0])}return e}},{key:"getVideoFrame",value:function(){return this.videoPlayer_?this.videoPlayer_.getVideoFrame():null}},{key:"getMediaStream",value:function(){return this.mediaStream_}},{key:"setMediaStream",value:function(e){e!==this.mediaStream_&&(this.mediaStream_&&this.mediaStream_.getTracks().forEach((function(e){return e.stop()})),this.mediaStream_=e)}},{key:"updateVideoPlayingState",value:function(e){this.isPlaying_&&(e?(this.log_.info("playing state updated, play video"),this.playVideo().catch((function(e){}))):(this.log_.info("playing state updated, stop video"),this.stopVideo()))}},{key:"updateAudioPlayingState",value:function(e){this.isPlaying_&&(e?(this.log_.info("playing state updated, play audio"),this.playAudio().catch((function(e){}))):(this.log_.info("playing state updated, stop audio"),this.stopAudio()))}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"off",value:function(e,t,n){"*"===e?this.emitter_.removeAllListeners():this.emitter_.off(e,t,n)}},{key:"isRemote",value:function(){return this.isRemote_}},{key:"isScreenShare",value:function(){return!this.isRemote_&&this.screen_||this.isRemote_&&this.getType()===Ab}},{key:"getDiv",value:function(){return this.div_}},{key:"getObjectFit",value:function(){return this.objectFit_}},{key:"getMuted",value:function(){return this.muted_}},{key:"getClient",value:function(){return this.client_}}]),e}(),w(FG.prototype,"play",[UG],Object.getOwnPropertyDescriptor(FG.prototype,"play"),FG.prototype),w(FG.prototype,"setAudioOutput",[VG],Object.getOwnPropertyDescriptor(FG.prototype,"setAudioOutput"),FG.prototype),w(FG.prototype,"getVideoFrame",[jG],Object.getOwnPropertyDescriptor(FG.prototype,"getVideoFrame"),FG.prototype),FG),KG=function(e){d(RemoteStream,e);var n=v(RemoteStream);function RemoteStream(e){var i;o(this,RemoteStream);var r={isRemote:!0,type:e.type},a=t(t({},e),r);return(i=n.call(this,a)).name_=GI,i.isStreamAddedEventEmitted_=!1,i.isAbleToCallSubscription_=!0,i}return c(RemoteStream,[{key:"installEvents",value:function(){y(l(RemoteStream.prototype),"installEvents",this).call(this),OC.on(sA,this.handleStreamSubscribed,this),OC.on(cA,this.handleStreamUnsubscribed,this)}},{key:"uninstallEvents",value:function(){y(l(RemoteStream.prototype),"uninstallEvents",this).call(this),OC.off(sA,this.handleStreamSubscribed,this),OC.off(cA,this.handleStreamUnsubscribed,this)}},{key:"handleStreamSubscribed",value:function(e){e.client===this.client_&&e.stream===this&&this.connection_.getCurrentState()===Mk&&this.emitConnectionStateChanged({prevState:Pk,state:Mk})}},{key:"handleStreamUnsubscribed",value:function(e){e.client===this.client_&&e.stream===this&&this.emitConnectionStateChanged({prevState:Mk,state:Pk})}},{key:"getType",value:function(){return y(l(RemoteStream.prototype),"getType",this).call(this)}},{key:"getIsAbleToCallSubscription",value:function(){return this.isAbleToCallSubscription_}},{key:"setIsAbleToCallSubscription",value:function(e){this.isAbleToCallSubscription_=e}},{key:"setIsStreamAddedEventEmitted",value:function(e){this.isStreamAddedEventEmitted_=e}},{key:"getIsStreamAddedEventEmitted",value:function(){return this.isStreamAddedEventEmitted_}},{key:"getAudioTrack",value:function(){return this.connection_&&this.connection_.getTrackState().audio?y(l(RemoteStream.prototype),"getAudioTrack",this).call(this):null}},{key:"getVideoTrack",value:function(){if(!this.connection_)return null;var e=this.connection_.getTrackState();return(this.type_!==Ck||e.video)&&(this.type_!==Ak||e.auxiliary)?y(l(RemoteStream.prototype),"getVideoTrack",this).call(this):null}},{key:"close",value:function(){y(l(RemoteStream.prototype),"close",this).call(this)}}]),RemoteStream}(qG),QG=function(){function e(t){o(this,e),this.client_=t.client,this.subscribedStreams_=new Map,this.unsubscribedStreams_=new Map,this.subscriptedOptions_=new Map,this.autoRecoveryFlags_=new Map}var t,i,r;return c(e,[{key:"isEnabled",get:function(){return"webrtc"!==this.client_.getEnv()}},{key:"recover",value:(r=a(n().mark((function e(t){var i,r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.getUserId(),r=t.getType(),this.hasAutoRecoveryFlag(i,r)){e.next=5;break}return e.abrupt("return");case 5:if(a=this.getUnsubscribedStream(i,r)?"unsubscribe":"subscribe",e.prev=6,MA.warn("recover() try to recover subscription [".concat(a,"][").concat(i,"][").concat(r,"]")),"subscribe"!==a){e.next=13;break}return e.next=11,this.recoverSubscription(i,t);case 11:e.next=15;break;case 13:return e.next=15,this.recoverUnsubscription(i,t);case 15:oD.logSuccessEvent({userId:this.client_.getUserId(),eventType:dI}),MA.warn("recover() recover successfully [".concat(a,"][").concat(i,"][").concat(r,"]")),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(6),MA.error("recover() recover failed [".concat(a,"][").concat(i,"][").concat(r,"]"),e.t0),oD.logFailedEvent({userId:this.client_.getUserId(),eventType:dI,error:e.t0});case 23:this.deleteAutoRecoveryFlag(i,r);case 24:case"end":return e.stop()}}),e,this,[[6,19]])}))),function(e){return r.apply(this,arguments)})},{key:"recoverSubscription",value:(i=a(n().mark((function e(t,i){var r,a,o,s,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getOptions(t,i.getType()),a=this.getSubscribedStream(t,i.getType()),r&&a){e.next=4;break}return e.abrupt("return");case 4:o=this.getStreamMuteState(a),s=o.isAudioMuted,c=o.isVideoMuted,this.mergeStream(a,i),this.recoverPlayingState(a),s&&a.doEnableTrack(Tb,!1),c&&a.doEnableTrack(wb,!1);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"recoverUnsubscription",value:(t=a(n().mark((function e(t,i){var r;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getUnsubscribedStream(t,i.getType())){e.next=3;break}return e.abrupt("return");case 3:this.mergeStream(r,i);case 4:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"getStreamMuteState",value:function(e){var t={isAudioMuted:!1,isVideoMuted:!1},n=e.getMediaStream();return n&&(t.isAudioMuted=n.getAudioTracks().map((function(e){return e.enabled})).includes(!1),t.isVideoMuted=n.getVideoTracks().map((function(e){return e.enabled})).includes(!1)),t}},{key:"recoverPlayingState",value:function(e){var t=e.isPlaying(),n=e.getDiv();if(t&&n){var i=n.parentNode;e.stop(),e.play(i,{objectFit:e.getObjectFit(),muted:e.getMuted()})}}},{key:"mergeStream",value:function(e,t){var n=t.getConnection(),i=t.getMediaStream();e.setConnection(n),n.setRemoteStream(i.id,e),e.setMediaStream(i),e.updateAudioPlayingState(t.hasAudio()),e.updateVideoPlayingState(t.hasVideo())}},{key:"addSubscriptionRecord",value:function(e,t,n){var i=t.getType();if(this.subscribedStreams_.has(e))this.subscribedStreams_.get(e).set(i,t);else{var r=new Map;r.set(t.getType(),t),this.subscribedStreams_.set(e,r)}if(this.subscriptedOptions_.has(e))this.subscriptedOptions_.get(e).set(i,n);else{var a=new Map;a.set(t.getType(),n),this.subscriptedOptions_.set(e,a)}this.deleteUnsubscriptionRecord(e,i)}},{key:"addUnsubscriptionRecord",value:function(e,t){if(this.unsubscribedStreams_.has(e))this.unsubscribedStreams_.get(e).set(t.getType(),t);else{var n=new Map;n.set(t.getType(),t),this.unsubscribedStreams_.set(e,n)}this.deleteSubscriptionRecord(e,t.getType())}},{key:"getSubscribedStream",value:function(e,t){return this.subscribedStreams_.has(e)&&this.subscribedStreams_.get(e).has(t)?this.subscribedStreams_.get(e).get(t):null}},{key:"getOptions",value:function(e,t){return this.subscriptedOptions_.has(e)&&this.subscriptedOptions_.get(e).has(t)?this.subscriptedOptions_.get(e).get(t):null}},{key:"getUnsubscribedStream",value:function(e,t){return this.unsubscribedStreams_.has(e)&&this.unsubscribedStreams_.get(e).has(t)?this.unsubscribedStreams_.get(e).get(t):null}},{key:"deleteSubscriptionRecord",value:function(e,t){this.subscribedStreams_.has(e)&&this.subscribedStreams_.get(e).delete(t),this.subscriptedOptions_.has(e)&&this.subscriptedOptions_.get(e).delete(t)}},{key:"deleteUnsubscriptionRecord",value:function(e,t){this.unsubscribedStreams_.has(e)&&this.unsubscribedStreams_.get(e).delete(t)}},{key:"markAllStream",value:function(){for(var e=0,t=b(this.subscribedStreams_.entries());e<t.length;e++)for(var n=S(t[e],2),i=n[0],r=0,a=b(n[1].entries());r<a.length;r++){var o=S(a[r],1)[0];this.setAutoRecoveryFlag(i,o)}for(var s=0,c=b(this.unsubscribedStreams_.entries());s<c.length;s++)for(var u=S(c[s],2),d=u[0],l=0,h=b(u[1].entries());l<h.length;l++){var p=S(h[l],1)[0];this.setAutoRecoveryFlag(d,p)}}},{key:"setAutoRecoveryFlag",value:function(e,t){if(MA.info("setAutoRecoveryFlag() mark [".concat(e,"][").concat(t,"]")),this.autoRecoveryFlags_.has(e))this.autoRecoveryFlags_.get(e).set(t);else{var n=new Map;n.set(t),this.autoRecoveryFlags_.set(e,n)}}},{key:"hasAutoRecoveryFlag",value:function(e,t){return!!this.isEnabled&&(this.autoRecoveryFlags_.has(e)&&this.autoRecoveryFlags_.get(e).has(t))}},{key:"deleteAutoRecoveryFlag",value:function(e,t){this.autoRecoveryFlags_.has(e)&&this.autoRecoveryFlags_.get(e).delete(t)}},{key:"delete",value:function(e){this.unsubscribedStreams_.delete(e),this.subscribedStreams_.delete(e),this.subscriptedOptions_.delete(e),this.autoRecoveryFlags_.delete(e)}}]),e}(),XG=function(){function e(t){o(this,e),this.player_=t,this.canvas_=document.createElement(Ib),this.canvasCtx_=this.canvas_.getContext("2d")}return c(e,[{key:"setCanvasRect",value:function(e,t){this.canvas_.width=e,this.canvas_.height=t}},{key:"drawVideoToCanvas",value:function(){var e=this.player_.getElement(),t=e.videoHeight,n=e.videoWidth,i=n*this.canvas_.height/(t*this.canvas_.width);if(i>1.05||i<.95){var r=n*t/(this.canvas_.width*this.canvas_.height);this.setCanvasRect(n/Math.sqrt(r),t/Math.sqrt(r))}this.canvasCtx_.drawImage(e,0,0,this.canvas_.width,this.canvas_.height)}},{key:"generateVideoTrackFromCanvasCapture",value:function(e){return this.canvas_.captureStream(e).getVideoTracks()[0]}},{key:"generateStreamFromTrack",value:function(e){var t=new MediaStream;return t.addTrack(e),t}},{key:"destroy",value:function(){this.player_.stop(),this.canvas_.width=0,this.canvas_.height=0,this.canvas_=null,this.canvasCtx_=null}},{key:"canvas",get:function(){return this.canvas_}},{key:"canvasCtx",get:function(){return this.canvasCtx_}},{key:"canDrawVideoToCanvas",get:function(){if(this.player_){var e=this.player_.getElement();if(e)return e.readyState===e.HAVE_ENOUGH_DATA}return!1}}]),e}(),YG=new Blob(['let t,e,a,i;onmessage=function(n){const{action:h,data:s}=n.data;switch(h){case"render":a=s.canvas,t=a.width,e=a.height,i=a.getContext("2d"),function(t,e){const n=new TransformStream({async transform(t,e){const n=t.displayWidth,h=t.displayHeight,s=n*a.height/(h*a.width);if(s>1.05||s<.95){const t=n*h/(a.width*a.height);a.width=n/Math.sqrt(t),a.height=h/Math.sqrt(t)}i.drawImage(t,0,0,a.width,a.height);const o=new VideoFrame(a,{timestamp:t.timestamp});t.close(),e.enqueue(o)}});t.pipeThrough(n).pipeTo(e)}(s.readable,s.writable)}}'],{type:"application/javascript"}),$G=function(){function e(t){o(this,e);var n=t.videoTrack;this.width=void 0,this.height=void 0,this.canvas=document.createElement("canvas"),this.offscreen=null,this.smallGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.smallWritable=this.smallGenerator.writable,this.bigProcessor=new MediaStreamTrackProcessor({track:n}),this.bigReadable=this.bigProcessor.readable,this.initWorker()}return c(e,[{key:"initWorker",value:function(){try{this.worker=new Worker(URL.createObjectURL(YG)),MA.info("init worker processor success")}catch(e){MA.warn("init worker processor failed. ".concat(e.error))}}},{key:"setCanvasRect",value:function(e,t){this.width=e,this.height=t,this.canvas.width=e,this.canvas.height=t,this.offscreen=this.canvas.transferControlToOffscreen(),this.worker.postMessage({action:"render",data:{canvas:this.offscreen,readable:this.bigReadable,writable:this.smallWritable}},[this.offscreen,this.bigReadable,this.smallWritable])}},{key:"generatorVideoTrack",value:function(){var e=new MediaStream([this.smallGenerator]);return null==e?void 0:e.getTracks()[0]}},{key:"destroy",value:function(){this.worker.terminate()}}]),e}(),ZG=function(){function e(t){o(this,e),this.localStream_=t,this.player_=null,this.processor_=null,this.initOffscreenSuccess_=!1}var t;return c(e,[{key:"initialize",value:(t=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(DO()&&(null===(t=navigator)||void 0===t?void 0:t.hardwareConcurrency)>=6)){e.next=13;break}return e.prev=1,e.next=4,this.initOffscreen();case 4:this.initOffscreenSuccess_=!0,MA.info("Initialize VideoGenerator successfully!"),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),this.initCanvas();case 11:e.next=14;break;case 13:this.initCanvas();case 14:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(){return t.apply(this,arguments)})},{key:"generateSmallVideoTrack",value:function(e){var t,n=e.height,i=e.width,r=e.frameRate,a=this.getSmallVideoProfile(i,n);return this.initOffscreenSuccess_?(this.processor_.setCanvasRect(a.width,a.height),t=this.processor_.generatorVideoTrack()):(this.processor_.setCanvasRect(a.width,a.height),this.player_.setRect({width:a.width,height:a.height}),t=this.processor_.generateVideoTrackFromCanvasCapture(r),this.interval_=YD.run(dT,this.render.bind(this),{fps:r})),t}},{key:"render",value:function(){this.processor_.canDrawVideoToCanvas&&this.processor_.drawVideoToCanvas()}},{key:"destroy",value:function(){YD.clearTask(this.interval_),this.processor_&&this.processor_.destroy()}},{key:"initOffscreen",value:function(){this.processor_=new $G({videoTrack:this.localStream_.getVideoTrack()})}},{key:"initCanvas",value:function(){this.player_=new nU({stream:this.localStream_,track:this.localStream_.getVideoTrack(),muted:!0,objectFit:"cover",mirror:!1}),this.player_.play().then((function(){MA.info("VideoGenerator: play local video success")})).catch((function(){MA.error("VideoGenerator: Failed to play local video")})),this.processor_=new XG(this.player_)}},{key:"getSmallVideoProfile",value:function(e,t){var n,i=this.localStream_.getVideoTrack(),r=this.localStream_.getVideoProfile();if(xO){var a=i.getSettings();a&&a.width&&a.height&&(r.width=a.width,r.height=a.height)}var o=r.width*r.height,s=e*t;return MA.info("big stream resolution: ".concat(r.width,"*").concat(r.height," small stream resolution: ").concat(e,"*").concat(t," ")),n=o>s?o/s:o/19200,{width:parseInt(r.width/Math.sqrt(n)),height:parseInt(r.height/Math.sqrt(n))}}}]),e}(),ez=new Map;var tz=function(){var e=a(n().mark((function e(t){var i,r,a,o,s,c,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!SO()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,iz(t);case 4:if(i=e.sent,MA.info("getUserMedia with constraints: "+JSON.stringify(i)),!i.audio){e.next=11;break}return e.next=9,Xq.getMicrophones();case 9:r=e.sent,MA.info("microphones: ".concat(AC(r,["deviceId","label"])));case 11:if(!i.video){e.next=16;break}return e.next=14,Xq.getCameras();case 14:a=e.sent,MA.info("cameras: ".concat(AC(a,["deviceId","label"])));case 16:return e.prev=16,e.next=19,navigator.mediaDevices.getUserMedia(i);case 19:return e.abrupt("return",e.sent);case 22:if(e.prev=22,e.t0=e.catch(16),"NotFoundError"!==e.t0.name){e.next=29;break}if(!a||0!==a.length){e.next=27;break}throw new vP({code:_P.DEVICE_NOT_FOUND,message:ZR({key:hE})});case 27:if(!r||0!==r.length){e.next=29;break}throw new vP({code:_P.DEVICE_NOT_FOUND,message:ZR({key:lE})});case 29:throw i.audio&&(null===(o=r)||void 0===o?void 0:o.length)>0&&(c=r.find((function(e){return e.deviceId===t.microphoneId})))&&c.getCapabilities&&MA.warn(AC(c.getCapabilities(),mT)),i.video&&(null===(s=a)||void 0===s?void 0:s.length)>0&&(u=a.find((function(e){return e.deviceId===t.cameraId})))&&u.getCapabilities&&MA.warn(AC(u.getCapabilities(),mT)),new vP({code:_P.INITIALIZE_FAILED,name:e.t0.name,message:e.t0.message,constraint:e.t0.constraint});case 32:case"end":return e.stop()}}),e,null,[[16,22]])})));return function(t){return e.apply(this,arguments)}}(),nz=AA({retryFunction:tz,settings:{retries:3,timeout:500},onError:function(e,t,n,i,r){var a=r+1;MA.warn("getUserMedia error: ".concat(e)),"NotReadableError"===e.name||"OverconstrainedError"===e.name?(1===r&&i[0].video?(i[0].maxResoution=!1,i[0].frameRate=i[0].frameRate>10?10:5):2===a?i[0].useDeviceIdOnly=!0:3!==a||i[0].useExact||(i[0].useTrueAsConstraint=!0),e.message.includes("deviceId")&&i[0].retryWhenExactFailed&&(i[0].useExact=!1),t()):n(e)},onRetrying:function(e){MA.warn("getUserMedia retrying [".concat(e,"/3]"))},onRetryFailed:function(){oD.uploadEvent({log:"stat-getUserMedia-retry-failed"})},onRetrySuccess:function(e){oD.uploadEvent({log:"stat-getUserMedia-retry-success-"+e})}});function iz(e){return{audio:rz(e),video:az(e)}}function rz(e){if(!e.audio)return!1;if(e.useTrueAsConstraint)return!0;var t={};return!rD(e.microphoneId)&&(t.deviceId=e.useExact?{exact:e.microphoneId}:e.microphoneId,e.useDeviceIdOnly)?t:(dC(e.channelCount)&&e.channelCount>1&&(t.channelCount=e.channelCount),lC(e.echoCancellation)&&!e.echoCancellation&&(t.echoCancellation=!1),lC(e.noiseSuppression)&&!e.noiseSuppression&&(t.noiseSuppression=!1),lC(e.autoGainControl)&&!e.autoGainControl&&(t.autoGainControl=!1),!!rD(t)||t)}function az(e){if(!e.video)return!1;if(e.useTrueAsConstraint)return!0;var t=e.maxResoution,n=void 0===t||t,i={};return e.facingMode?i.facingMode=e.facingMode:e.cameraId&&(i.deviceId=e.useExact?{exact:e.cameraId}:e.cameraId),e.useDeviceIdOnly&&!rD(i)?i:(e.width&&(i.width={ideal:e.width},n&&!JE&&(i.width.max=e.width)),e.height&&(i.height={ideal:e.height},n&&!JE&&(i.height.max=e.height)),JE&&gR&&e.width&&e.height&&e.width*e.height<101376&&(i.width=e.width,i.height=e.height),e.frameRate&&(i.frameRate=e.frameRate),!!rD(i)||i)}var oz=function(){var e=a(n().mark((function e(t){var i,r,a,o,s,c,u,d,l;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!SO()){e.next=2;break}return e.abrupt("return");case 2:if(i=null,!(LR&&UR<74||jR)){e.next=27;break}return r=cz(t),MA.info("getDisplayMedia with constraints: "+JSON.stringify(r)),e.next=8,navigator.mediaDevices.getDisplayMedia(r);case 8:if(a=e.sent,!t.screenAudio){e.next=14;break}return MA.warn("Your browser not support capture system audio"),e.abrupt("return",a);case 14:if(!t.audio){e.next=24;break}return o=sz(t),MA.info("getUserMedia with constraints: "+JSON.stringify(o)),e.next=19,navigator.mediaDevices.getUserMedia(o);case 19:return i=e.sent,a.addTrack(i.getAudioTracks()[0]),e.abrupt("return",a);case 24:return e.abrupt("return",a);case 25:e.next=53;break;case 27:if(!t.screenAudio){e.next=37;break}return t.audioConstraints={echoCancellation:t.echoCancellation,autoGainControl:t.autoGainControl,noiseSuppression:t.noiseSuppression,sampleRate:44100},s=cz(t),MA.info("getDisplayMedia with constraints: "+JSON.stringify(s)),e.next=33,navigator.mediaDevices.getDisplayMedia(s);case 33:return c=e.sent,e.abrupt("return",c);case 37:return u=cz(t),MA.info("getDisplayMedia with constraints: "+JSON.stringify(u)),e.next=41,navigator.mediaDevices.getDisplayMedia(u);case 41:if(d=e.sent,!t.audio){e.next=52;break}return l=sz(t),MA.info("getUserMedia with constraints: "+JSON.stringify(l)),e.next=47,navigator.mediaDevices.getUserMedia(l);case 47:return i=e.sent,d.addTrack(i.getAudioTracks()[0]),e.abrupt("return",d);case 52:return e.abrupt("return",d);case 53:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function sz(e){var t={echoCancellation:e.echoCancellation,autoGainControl:e.autoGainControl,noiseSuppression:e.noiseSuppression,sampleRate:e.sampleRate,channelCount:e.channelCount};return cC(e.microphoneId)||(t.deviceId=e.microphoneId),{audio:t,video:!1}}function cz(e){var t={systemAudio:"include",selfBrowserSurface:"include",surfaceSwitching:"include"},n={width:jR?{max:e.width}:{ideal:e.width,max:e.width},height:jR?{max:e.height}:{ideal:e.height,max:e.height},frameRate:e.frameRate,displaySurface:"monitor"};return t.video=n,cC(e.audioConstraints)||(t.audio=e.audioConstraints),t}var uz,dz,lz,hz,pz,fz,mz,_z,vz,gz,yz,Sz,bz,kz,Iz=new Map([["120p",{width:160,height:120,frameRate:15,bitrate:200}],["120p_2",{width:160,height:120,frameRate:15,bitrate:100}],["180p",{width:320,height:180,frameRate:15,bitrate:350}],["180p_2",{width:320,height:180,frameRate:15,bitrate:150}],["240p",{width:320,height:240,frameRate:15,bitrate:400}],["240p_2",{width:320,height:240,frameRate:15,bitrate:200}],["360p",{width:640,height:360,frameRate:15,bitrate:800}],["360p_2",{width:640,height:360,frameRate:15,bitrate:400}],["480p",{width:640,height:480,frameRate:15,bitrate:900}],["480p_2",{width:640,height:480,frameRate:15,bitrate:500}],["720p",{width:1280,height:720,frameRate:15,bitrate:1500}],["1080p",{width:1920,height:1080,frameRate:15,bitrate:2e3}],["1440p",{width:2560,height:1440,frameRate:30,bitrate:4860}],["4K",{width:3840,height:2160,frameRate:30,bitrate:9e3}]]),Tz=new Map([["480p",{width:640,height:480,frameRate:5,bitrate:900}],["480p_2",{width:640,height:480,frameRate:30,bitrate:1e3}],["720p",{width:1280,height:720,frameRate:5,bitrate:1200}],["720p_2",{width:1280,height:720,frameRate:30,bitrate:3e3}],["1080p",{width:1920,height:1080,frameRate:5,bitrate:1600}],["1080p_2",{width:1920,height:1080,frameRate:30,bitrate:4e3}]]),wz=new Map([["standard",{sampleRate:48e3,channelCount:1,bitrate:40}],["standard-stereo",{sampleRate:48e3,channelCount:2,bitrate:64}],["high",{sampleRate:48e3,channelCount:1,bitrate:128}],["high-stereo",{sampleRate:48e3,channelCount:2,bitrate:192}]]),Ez=new Map,Rz=(uz=JG(WI),dz=JG(WI),lz=JG(WI),hz=JG(WI),pz=RG.apply(void 0,b(wG.LOCAL_STREAM.switchDevice)),fz=RG(wG.STREAM.addTrack),mz=RG(wG.STREAM.removeTrack),_z=RG(wG.STREAM.replaceTrack),vz=LG({retries:10,timeout:3e3,onRetryFailed:function(e){oD.logFailedEvent({userId:this.client_?this.client_.getUserId():this.userId_,eventType:uI,error:e}),this.emitter_.emit(jO,new vP({code:_P.DEVICE_AUTO_RECOVER_FAILED,message:e.message}))}}),gz=EG(wG.LOCAL_STREAM.setAudioCaptureVolume),yz=JG(WI),Sz=function(e){d(LocalStream,e);var r,s,u,h,p,f,m,_,g,S,b,k,I,T=v(LocalStream);function LocalStream(e){var n;o(this,LocalStream);var i=t(t({},e),{isRemote:!1,type:"local"});return(n=T.call(this,i)).name_=WI,n.client_=null,n.video_=e.video,n.audio_=e.audio,n.cameraId_=e.cameraId,n.cameraGroupId_="",n.facingMode_=e.facingMode,n.microphoneId_=e.microphoneId,n.microphoneGroupId_="",n.microphoneLabel_="",n.videoSource_=e.videoSource,n.audioSource_=e.audioSource,n.screen_=e.screen,n.screenAudio_=e.screenAudio,n.audioProfile_={echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0,sampleRate:48e3,channelCount:1,bitrate:40},n.screenAudio_&&(n.audioProfile_.echoCancellation=!0,n.audioProfile_.autoGainControl=!1,n.audioProfile_.noiseSuppression=!1),lC(e.echoCancellation)&&(n.audioProfile_.echoCancellation=e.echoCancellation),lC(e.autoGainControl)&&(n.audioProfile_.autoGainControl=e.autoGainControl),lC(e.noiseSuppression)&&(n.audioProfile_.noiseSuppression=e.noiseSuppression),n.videoProfile_=Iz.get("480p_2"),n.screenProfile_=Tz.get("1080p"),n.videoSetting_=null,n.muteState_={video:!1,audio:!1,auxVideo:!1},n.beautyStatus_=!1,n.prevAudioRecoverTime_=0,n.prevVideoRecoverTime_=0,n.isAudioRecovering_=!1,n.isVideoRecovering_=!1,n.initState(),n.canvas_=null,n.canvasInterval_=null,n.canvasTrack_=null,n.gain_={audioTrack:null,source:null,gainNode:null},n.captureVolume_=100,n.enableAutoRecoverCapture_=!!cC(e.enableAutoRecoverCapture)||e.enableAutoRecoverCapture,n.enableAutoRecoverOther_=!lC(e.enableAutoRecoverOther)||e.enableAutoRecoverOther,n.log_.info("stream created: ".concat(n.id_," autoRecover: ").concat(n.enableAutoRecoverCapture_)),n.isAIDenoiser=!1,n}return c(LocalStream,[{key:"scaleResolutionDownBy",get:function(){var e=this.getVideoTrack();if(!e||!xO)return 1;var t,n,i,r=e.getSettings();return r.width===this.videoProfile_.width&&r.height===this.videoProfile_.height?1:null!==(t=window.screen)&&void 0!==t&&null!==(n=t.orientation)&&void 0!==n&&null!==(i=n.type)&&void 0!==i&&i.includes("portrait")&&this.videoProfile_.width>this.videoProfile_.height&&r.height>r.width?Math.max(r.width/this.videoProfile_.height,r.height/this.videoProfile_.width,1):Math.max(r.width/this.videoProfile_.width,r.height/this.videoProfile_.height,1)}},{key:"initState",value:function(){this.isAddingTrack_=!1,this.isRemovingTrack_=!1,this.setIsReadyToPublish(!1),this.setPublishState(AI)}},{key:"installEvents",value:function(){y(l(LocalStream.prototype),"installEvents",this).call(this),OC.on(SA,this.onVideoTrackStopped,this),OC.on(mA,this.onVideoTrackStopped,this),OC.on(kA,this.onAudioTrackStopped,this),OC.on(bA,this.onAudioTrackStopped,this)}},{key:"uninstallEvents",value:function(){y(l(LocalStream.prototype),"uninstallEvents",this).call(this),OC.off(SA,this.onVideoTrackStopped,this),OC.off(mA,this.onVideoTrackStopped,this),OC.off(kA,this.onAudioTrackStopped,this),OC.off(bA,this.onAudioTrackStopped,this)}},{key:"initialize",value:function(){var e=this;return new Promise((function(t,n){if(bO())n(new vP({code:_P.INVALID_OPERATION,message:ZR({key:nE})}));else{if(cC(e.audio_)){var i=new MediaStream;return cC(e.audioSource_)||(i.addTrack(e.audioSource_),e.updateAudioPlayingState(!0)),cC(e.videoSource_)||(i.addTrack(e.videoSource_),e.updateVideoPlayingState(!0)),e.setMediaStream(i),oD.logSuccessEvent({userId:e.client_?e.client_.getUserId():e.userId_,eventType:oI,kind:"custom"}),e.setIsReadyToPublish(!0),t()}e.screen_?(e.log_.info("initialize stream audio: "+e.audio_+" screenAudio: "+e.screenAudio_+" screen: "+e.screen_),oz({audio:e.audio_,screenAudio:e.screenAudio_,microphoneId:e.microphoneId_,width:e.screenProfile_.width,height:e.screenProfile_.height,frameRate:e.screenProfile_.frameRate,sampleRate:e.audioProfile_.sampleRate,channelCount:e.audioProfile_.channelCount,autoGainControl:e.audioProfile_.autoGainControl,noiseSuppression:e.audioProfile_.noiseSuppression,echoCancellation:e.audioProfile_.echoCancellation}).then((function(n){e.setMediaStream(n),e.updateAudioPlayingState(e.audio_||e.screenAudio_),e.updateVideoPlayingState(!0);var i=e.getVideoTrack();return i.applyConstraints&&i.applyConstraints({frameRate:{min:e.screenProfile_.frameRate,ideal:e.screenProfile_.frameRate},width:e.screenProfile_.width,height:e.screenProfile_.height}).catch((function(t){e.warn("screen applyConstraints failed: ".concat(t))})),e.listenForScreenSharingStopped(i),e.setVideoContentHint(Wb),e.updateDeviceIdInUse(),e.setIsReadyToPublish(!0),e.log_.info(JSON.stringify(i.getSettings())),oD.logSuccessEvent({userId:e.client_?e.client_.getUserId():e.userId_,eventType:oI,kind:"getDisplayMedia"}),t()})).catch((function(t){oD.logFailedEvent({userId:e.client_?e.client_.getUserId():e.userId_,eventType:oI,kind:"getDisplayMedia",error:t}),e.log_.error("getDisplayMedia error observed "+t),n(t instanceof vP?t:new vP({code:_P.INITIALIZE_FAILED,name:t.name,message:t.message}))}))):(OC.emit(hA,{stream:e,audio:e.audio_,video:e.video_}),e.log_.info("initialize stream audio: "+e.audio_+" video: "+e.video_),nz({audio:e.audio_,video:e.video_,facingMode:e.facingMode_,cameraId:e.cameraId_,microphoneId:e.microphoneId_,width:e.videoProfile_.width,height:e.videoProfile_.height,frameRate:e.videoProfile_.frameRate,sampleRate:e.audioProfile_.sampleRate,channelCount:e.audioProfile_.channelCount,autoGainControl:e.audioProfile_.autoGainControl,noiseSuppression:e.audioProfile_.noiseSuppression,echoCancellation:e.audioProfile_.echoCancellation,useExact:!0,retryWhenExactFailed:!0}).then((function(n){return OC.emit(pA,{stream:e,audio:e.audio_,video:e.video_}),e.setMediaStream(n),n.getTracks().forEach((function(t){if(xO){var n=t.getSettings();e.log_.debug("".concat(t.kind," settings: ").concat(JSON.stringify(n))),t.kind===wb&&(e.videoSetting_=n)}PO&&e.log_.info("".concat(t.kind," capabilities: ").concat(AC(t.getCapabilities(),mT)))})),e.updateAudioPlayingState(e.audio_),e.updateVideoPlayingState(e.video_),e.updateDeviceIdInUse(),e.log_.info("gotStream hasAudio: "+e.hasAudio()+" hasVideo: "+e.hasVideo()),e.setIsReadyToPublish(!0),oD.logSuccessEvent({userId:e.client_?e.client_.getUserId():e.userId_,eventType:oI,kind:"getUserMedia"}),t()})).catch((function(t){OC.emit(fA,{stream:e,audio:e.audio_,video:e.video_,error:t}),oD.logFailedEvent({userId:e.client_?e.client_.getUserId():e.userId_,eventType:oI,kind:"getUserMedia",error:t}),e.log_.error("getUserMedia error observed "+t),n(t)})))}}))}},{key:"listenForScreenSharingStopped",value:function(e){var t=this;e.addEventListener("ended",(function(e){t.log_.info("screen sharing was stopped because the video track is ended"),t.emitter_.emit(LO)}))}},{key:"muteAudio",value:function(){var e=y(l(LocalStream.prototype),"muteAudio",this).call(this);return e&&(this.log_.info("localStream mute audio"),this.sendMutedFlag(Tb,!0)),e}},{key:"muteVideo",value:function(){var e=y(l(LocalStream.prototype),"muteVideo",this).call(this);return e&&(this.log_.info("localStream mute video"),this.sendMutedFlag(wb,!0)),e}},{key:"unmuteAudio",value:function(){var e=y(l(LocalStream.prototype),"unmuteAudio",this).call(this);return e&&(this.log_.info("localStream unmute audio"),this.sendMutedFlag(Tb,!1)),e}},{key:"unmuteVideo",value:function(){var e=y(l(LocalStream.prototype),"unmuteVideo",this).call(this);return e&&(this.log_.info("localStream unmute video"),this.sendMutedFlag(wb,!1)),e}},{key:"sendMutedFlag",value:function(e,t){this.setMuteState(e,t);var n=this.getConnection();if(n){n.sendMutedFlag(this.muteState_,this);var i=n.getUserId(),r=n.getTinyId(),a="".concat(t?Mb:Nb," local ").concat(e," track");tD(i,{eventId:e===Tb?t?kP:TP:t?IP:wP,eventDesc:a,timestamp:Gm(),userId:i,tinyId:r})}}},{key:"setMuteState",value:function(e,t){this.muteState_[e]=t,this.log_.info("set ".concat(e," muted state: [").concat(t?"mute":"unmute","]"))}},{key:"setAudioProfile",value:(I=a(n().mark((function e(r){var a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("object"===i(r)?a=r:void 0===(a=wz.get(r))&&(a=wz.get("standard")),this.log_.info("setAudioProfile: "+JSON.stringify(a)),!(o=this.getAudioTrack())){e.next=6;break}return e.next=6,o.applyConstraints(a);case 6:if(s=this.audioProfile_.bitrate!==a.bitrate,this.audioProfile_=t(t({},this.audioProfile_),a),!s||!this.connection_){e.next=12;break}return e.next=11,this.connection_.setBandwidth({bandwidth:this.audioProfile_.bitrate,type:Tb});case 11:this.connection_.sendMediaSettings(this);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"setVideoProfile",value:(k=a(n().mark((function e(i){var r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.connection_||yO()){e.next=2;break}throw new vP({code:_P.NOT_SUPPORTED,message:ZR({key:rE})});case 2:if(rC(i)?a=t(t({},this.videoProfile_),i):uC(i)&&(a=Iz.get(i),cC(a)&&(a=Iz.get("480p_2"))),null!==(r=this.client_)&&void 0!==r&&r.get2k4kFlag()&&(1!==this.client_.get2k4kFlag()&&!this.screen_&&a.height*a.width>=3686400?(a.width=1920,a.height=1080,this.log_.warn(pT)):zG.handleFunctionState({fnName:"2K_4K"})),a&&a.width*a.height>921600&&JR&&(a.width=1280,a.height=720,this.log_.warn("reset to 1280 * 720 on iOS 13~14")),this.log_.info("setVideoProfile "+JSON.stringify(a)),!(o=this.getVideoTrack())){e.next=10;break}return e.next=10,o.applyConstraints(a);case 10:if(s=this.videoProfile_.bitrate!==a.bitrate,this.videoProfile_=a,!s||!this.connection_){e.next=16;break}return e.next=15,this.connection_.setBandwidth({bandwidth:a.bitrate,type:wb,videoType:Cb});case 15:this.connection_.sendMediaSettings(this);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"getVideoBitrate",value:function(){return this.screen_?this.screenProfile_.bitrate:this.videoProfile_.bitrate}},{key:"getAudioBitrate",value:function(){return this.audioProfile_.bitrate}},{key:"setScreenProfile",value:function(e){var t=e;uC(e)&&(t=Tz.get(e)||Tz.get("1080p")),this.log_.info("setScreenProfile "+JSON.stringify(e)),this.screenProfile_=t}},{key:"getVideoProfile",value:function(){return this.screen_?this.screenProfile_:this.videoProfile_}},{key:"getAudioProfile",value:function(){return this.audioProfile_}},{key:"setVideoContentHint",value:function(e){var t=this.getVideoTrack();t&&"contentHint"in t&&(this.log_.info("set video track contentHint to: "+e),t.contentHint=e,t.contentHint!==e&&this.log_.warn("Invalid video track contentHint: "+e))}},{key:"switchDevice",value:(b=a(n().mark((function e(t,i){var r,a,o,s,c,u,d,l,h,p,f,m,_,v,g,y,S,b;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaStream_&&this.cameraId_!==i&&this.facingMode_!==i){e.next=2;break}return e.abrupt("return");case 2:if(a=t===wb,!(r=t===Tb)||i!==this.microphoneId_){e.next=11;break}if(i===ZI){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,nM(this.microphoneGroupId_,this.microphoneLabel_);case 9:if(!e.sent){e.next=11;break}return e.abrupt("return");case 11:return this.setIsReadyToPublish(!1),this.log_.info("switchDevice "+t+" to: "+i),r&&(o=this.getAudioTrack(),s=this.getMicrophoneTrackMixed(),o&&o.stop(),s&&s.stop()),a&&((c=this.getVideoTrack())&&c.stop(),ER&&(u=this.getAudioTrack())&&(this.log_.info("stop audio track first in huawei env"),u.stop())),e.prev=15,e.next=18,nz({audio:r||ER,video:a,facingMode:i===Db||i===Ob?i:void 0,cameraId:a?i:this.cameraId_,microphoneId:r?i:this.microphoneId_,width:this.videoProfile_.width,height:this.videoProfile_.height,frameRate:this.videoProfile_.frameRate,sampleRate:this.audioProfile_.sampleRate,channelCount:this.audioProfile_.channelCount,autoGainControl:this.audioProfile_.autoGainControl,noiseSuppression:this.audioProfile_.noiseSuppression,echoCancellation:this.audioProfile_.echoCancellation,useExact:!0,retryWhenExactFailed:!1});case 18:if(d=e.sent,l=null,!r){e.next=34;break}if(!(h=d.getAudioTracks()[0])||!this.isAudioTrackMixed()){e.next=31;break}return p=this.getAudioTrack(),f=Xq.AudioMixerPlugin.getAudioTrackMap(),e.next=27,Xq.AudioMixerPlugin.mix({targetTrack:h,sourceList:f.get(p.id).sourceList,trackList:f.get(p.id).trackList});case 27:m=e.sent,l=m,e.next=32;break;case 31:l=h;case 32:e.next=43;break;case 34:if(!(l=d.getVideoTracks()[0])||!this.isVideoTrackBeautified()){e.next=39;break}return e.next=38,this.generateBeautyTrack(l);case 38:l=e.sent;case 39:if(!(_=d.getAudioTracks()[0])||!ER){e.next=43;break}return e.next=43,this.replaceTrack(_);case 43:return e.next=45,this.replaceTrack(l);case 45:this.updateDeviceIdInUse(),(v=this.getConnection())&&(g=v.getUserId(),y=v.getTinyId(),S=AP,b="switch camera",r&&(S=xP,b="switch microphone"),tD(g,{eventId:S,eventDesc:b,timestamp:Gm(),userId:g,tinyId:y})),this.log_.info("switch ".concat(r?"microphone":"camera"," success ")),r&&(this.audio_=!0),a&&(this.video_=!0,i!==Ob&&i!==Db||(this.facingMode_=i)),this.setIsReadyToPublish(!0),e.next=59;break;case 54:throw e.prev=54,e.t0=e.catch(15),this.log_.error(e.t0),r?this.recoverCapture({audio:!0,video:!1,microphoneId:this.microphoneId_}):this.recoverCapture({audio:!1,video:!0,cameraId:this.cameraId_,facingMode:this.facingMode_}),e.t0;case 59:case"end":return e.stop()}}),e,this,[[15,54]])}))),function(e,t){return b.apply(this,arguments)})},{key:"addTrack",value:(S=a(n().mark((function e(t){var i,r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,t.kind===wb&&xO&&(i=t.getSettings(),!this.videoSetting_||i.width===this.videoSetting_.width&&i.height===this.videoSetting_.height||this.log_.warn("video resolution of the track (".concat(i.width," x ").concat(i.height,") shall be kept the same as the previous: ").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,". It may cause abnormal Cloud Recording."))),this.isAddingTrack_=!0,this.keepMuteState(t),this.mediaStream_.addTrack(t),!(r=this.getConnection())){e.next=11;break}return a=null,t.kind===wb&&(zR||GR)&&fC(t)&&(a=this.getCanvasTrack()),e.next=11,r.addTrack(a||t,this);case 11:t.kind===Tb?(this.audio_=!0,this.updateAudioPlayingState(!0),100!==this.captureVolume_&&this.setAudioCaptureVolume(this.captureVolume_)):(this.video_=!0,this.updateVideoPlayingState(!0)),this.isAddingTrack_=!1,e.next=20;break;case 15:throw e.prev=15,e.t0=e.catch(0),this.mediaStream_.removeTrack(t),this.isAddingTrack_=!1,e.t0;case 20:case"end":return e.stop()}}),e,this,[[0,15]])}))),function(e){return S.apply(this,arguments)})},{key:"removeTrack",value:(g=a(n().mark((function e(t){var i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.isRemovingTrack_=!0,!(i=this.getConnection())){e.next=17;break}if(t.kind!==wb||!zR&&!GR||!this.canvasTrack_){e.next=10;break}return e.next=7,i.removeTrack(this.canvasTrack_,this);case 7:this.clearCanvas(),e.next=17;break;case 10:if(t.kind!==Tb||!this.gain_.audioTrack){e.next=15;break}return e.next=13,i.removeTrack(this.gain_.audioTrack,this);case 13:e.next=17;break;case 15:return e.next=17,i.removeTrack(t,this);case 17:this.mediaStream_.removeTrack(t),t.kind===Tb?(this.audio_=!1,this.updateAudioPlayingState(!1),this.stopGainNode()):(this.video_=!1,this.updateVideoPlayingState(!1)),this.isRemovingTrack_=!1,e.next=26;break;case 22:throw e.prev=22,e.t0=e.catch(0),this.isRemovingTrack_=!1,e.t0;case 26:case"end":return e.stop()}}),e,this,[[0,22]])}))),function(e){return g.apply(this,arguments)})},{key:"replaceTrack",value:(_=a(n().mark((function e(t){var i,r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.kind===wb&&xO&&(i=t.getSettings(),!this.videoSetting_||i.width===this.videoSetting_.width&&i.height===this.videoSetting_.height||this.log_.warn("video resolution of the track (".concat(i.width," x ").concat(i.height,") shall be kept the same as the previous: ").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,". It may cause abnormal Cloud Recording."))),this.keepMuteState(t),r=this.mediaStream_,t.kind!==Tb){e.next=12;break}if(r.removeTrack(r.getAudioTracks()[0]),r.addTrack(t),y(l(LocalStream.prototype),"restartAudio",this).call(this),!this.gain_.gainNode){e.next=10;break}return this.reconnectGainNode(t),e.abrupt("return");case 10:e.next=15;break;case 12:r.removeTrack(r.getVideoTracks()[0]),r.addTrack(t),y(l(LocalStream.prototype),"restartVideo",this).call(this);case 15:if(!(a=this.getConnection())){e.next=21;break}if(t.kind!==wb||!zR&&!GR||!this.canvasTrack_){e.next=19;break}return e.abrupt("return");case 19:return e.next=21,a.replaceTrack(t,this);case 21:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"recoverCapture",value:(m=a(n().mark((function e(t){var i,r,a,o,s,c,u,d,l,h,p,f,m,_,v,g,y;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!this.mediaStream_||!this.enableAutoRecoverCapture_||t.audio&&!t.video&&this.isAudioRecovering_||t.video&&!t.audio&&this.isVideoRecovering_)){e.next=2;break}return e.abrupt("return");case 2:return t.audio&&(this.isAudioRecovering_=!0),t.video&&(this.isVideoRecovering_=!0),this.log_.warn("recoverCapture() trying "+JSON.stringify(t)),i=this.audio_&&t.audio,r=this.video_&&t.video,e.prev=7,e.next=10,Xq.getCameras();case 10:return a=e.sent,e.next=13,Xq.getMicrophones();case 13:if(o=e.sent,r&&0===a.length&&(r=!1,this.log_.warn("recoverCapture() video flag is true, but no camera detected, set video to false")),i&&0===o.length&&(i=!1,this.log_.warn("recoverCapture() audio flag is true, but no microphone detected, set audio to false")),i||r){e.next=21;break}return t.audio&&(this.isAudioRecovering_=!1),t.video&&(this.isVideoRecovering_=!1),this.log_.warn("recoverCapture() both audio and video are false, aborted"),e.abrupt("return");case 21:return s=t&&a.findIndex((function(e){return e.deviceId===t.cameraId}))>=0,c=t&&o.findIndex((function(e){return e.deviceId===t.microphoneId}))>=0,i&&(null===(u=this.getAudioTrack())||void 0===u||u.stop()),r&&(null===(d=this.getVideoTrack())||void 0===d||d.stop()),e.next=27,nz({audio:i,video:r,cameraId:s?t.cameraId:void 0,microphoneId:c?t.microphoneId:void 0,facingMode:this.facingMode_,width:this.videoProfile_.width,height:this.videoProfile_.height,frameRate:this.videoProfile_.frameRate,sampleRate:this.audioProfile_.sampleRate,channelCount:this.audioProfile_.channelCount,autoGainControl:this.audioProfile_.autoGainControl,noiseSuppression:this.audioProfile_.noiseSuppression,echoCancellation:this.audioProfile_.echoCancellation});case 27:l=e.sent,h=l.getTracks(),p=0;case 30:if(!(p<h.length)){e.next=59;break}if((f=h[p]).kind!==Tb||!this.isAudioTrackMixed()){e.next=45;break}if(m=this.getAudioTrack(),_=Xq.AudioMixerPlugin.getAudioTrackMap(),(v=_.get(m.id)).hasMicrophone){e.next=39;break}return f.stop(),e.abrupt("continue",56);case 39:return e.next=41,Xq.AudioMixerPlugin.mix({targetTrack:f,sourceList:v.sourceList,trackList:v.trackList});case 41:return g=e.sent,e.next=44,this.replaceTrack(g);case 44:return e.abrupt("continue",56);case 45:if(f.kind!==wb||!this.isVideoTrackBeautified()){e.next=52;break}return e.next=48,this.generateBeautyTrack(f);case 48:return y=e.sent,e.next=51,this.replaceTrack(y);case 51:return e.abrupt("continue",56);case 52:return e.next=54,this.replaceTrack(f);case 54:if("ended"!==f.readyState){e.next=56;break}throw new Error("new track is failed, muted ".concat(f.muted," readyState ").concat(f.readyState));case 56:p++,e.next=30;break;case 59:this.updateDeviceIdInUse(),oD.logSuccessEvent({userId:this.client_?this.client_.getUserId():this.userId_,eventType:uI}),t.audio&&(this.isAudioRecovering_=!1),t.video&&(this.isVideoRecovering_=!1),this.log_.warn("recoverCapture() successfully"),this.emitter_.emit(VO,{isCamera:t.video,isMicrophone:t.audio,cameraId:this.cameraId_,microphoneId:this.microphoneId_}),e.next=73;break;case 67:throw e.prev=67,e.t0=e.catch(7),t.audio&&(this.isAudioRecovering_=!1),t.video&&(this.isVideoRecovering_=!1),this.log_.warn("recoverCapture() failed, "+e.t0),e.t0;case 73:case"end":return e.stop()}}),e,this,[[7,67]])}))),function(e){return m.apply(this,arguments)})},{key:"updateDeviceIdInUse",value:function(){var e=this;if(!this.mediaStream_)return this.cameraId_="",this.cameraGroupId_="",this.microphoneId_="",void(this.microphoneGroupId_="");xO&&this.mediaStream_.getTracks().forEach((function(t){if(t.kind===Tb&&e.isAudioTrackMixed()){var n=e.getMicrophoneTrackMixed();if(n){var i=n.getSettings(),r=i.deviceId,a=i.groupId;r&&(e.microphoneId_=r,e.microphoneGroupId_=a,e.microphoneLabel_=n.label)}}else if(t.kind===wb&&e.isVideoTrackBeautified()){var o=e.getBeautyOriginTrack();if(o){var s=o.getSettings(),c=s.deviceId,u=s.groupId;c&&(e.cameraId_=c,e.cameraGroupId_=u)}}else{var d=t.getSettings(),l=d.deviceId,h=d.groupId;l&&(t.kind===Tb?(e.microphoneId_=l,e.microphoneGroupId_=h,e.microphoneLabel_=t.label):t.kind!==wb||e.screen_||(e.cameraId_=l,e.cameraGroupId_=h))}}));var t=this.mediaStream_.getAudioTracks(),n=this.mediaStream_.getVideoTracks();t&&0===t.length&&(this.microphoneId_="",this.microphoneGroupId_=""),n&&0===n.length&&(this.cameraId_="",this.cameraGroupId_="")}},{key:"isAudioTrackMixed",value:function(){if(Xq.AudioMixerPlugin){var e=Xq.AudioMixerPlugin.getAudioTrackMap(),t=this.getAudioTrack();if(e&&t&&e.has(t.id))return!0}return!1}},{key:"getMicrophoneTrackMixed",value:function(){if(Xq.AudioMixerPlugin){var e=Xq.AudioMixerPlugin.getAudioTrackMap(),t=this.getAudioTrack();if(e&&t&&e.has(t.id)){var n=e.get(t.id);return n.hasMicrophone?n.microphoneTrack:null}}return null}},{key:"isVideoTrackBeautified",value:function(){if(Xq.beautyTrackMap){var e=Xq.beautyTrackMap,t=this.getVideoTrack();if(t&&e.has(t.id))return!0}return!1}},{key:"getBeautyOriginTrack",value:function(){if(Xq.beautyTrackMap){var e=Xq.beautyTrackMap,t=this.getVideoTrack();if(t&&e.has(t.id)){var n=e.get(t.id);if(n.originTrack)return n.originTrack}}return null}},{key:"generateBeautyTrack",value:(f=a(n().mark((function e(t){var i,r,a,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null,r=this.getVideoTrack(),a=Xq.beautyTrackMap.get(r.id),o=a.param,a.type){e.next=8;break}i=a.pluginInstance.generateBeautyTrack(t),e.next=22;break;case 8:e.t0=a.type,e.next="beauty"===e.t0?11:"virtual"===e.t0?13:"mixed"===e.t0?17:21;break;case 11:return i=a.pluginInstance.generateBeautyTrack(t),e.abrupt("break",22);case 13:return e.next=15,a.pluginInstance.generateVirtualTrack({videoTrack:t,type:o.type,img:o.img});case 15:case 19:return i=e.sent,e.abrupt("break",22);case 17:return e.next=19,a.pluginInstance.generateMixedTrack({videoTrack:t,type:o.type,img:o.img});case 21:return e.abrupt("break",22);case 22:return a.pluginInstance.deleteSource(r.id),this.log_.info("regenerate beauty track, track id = ".concat(t.id)),e.abrupt("return",i);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"getScreen",value:function(){return this.screen_}},{key:"hasScreenTrack",value:function(){if(this.screen_)return!0;var e=this.getVideoTrack();return!!e&&(e.contentHint===Wb||e.contentHint===Gb)}},{key:"getVideo",value:function(){return this.video_}},{key:"getAudio",value:function(){return this.audio_}},{key:"getCameraId",value:function(){return this.cameraId_}},{key:"getMicrophoneId",value:function(){return this.microphoneId_}},{key:"getMicrophoneGroupId",value:function(){return this.microphoneGroupId_}},{key:"getIsReadyToPublish",value:function(){return this.isReadyToPublish_}},{key:"setIsReadyToPublish",value:function(e){this.isReadyToPublish_=e}},{key:"setPublishState",value:function(e){this.publishState_=e}},{key:"setBeautyStatus",value:function(e){this.beautyStatus_=!!e}},{key:"getBeautyStatus",value:function(){return this.beautyStatus_}},{key:"syncMuteState",value:function(){var e=this.getAudioTrack(),t=this.getVideoTrack();if(e){var n=!e.enabled;this.setMuteState(Tb,n)}if(t){var i=!t.enabled;this.setMuteState(wb,i)}this.connection_&&this.connection_.sendMutedFlag(this.muteState_,this)}},{key:"keepMuteState",value:function(e){e instanceof window.MediaStreamTrack&&this.muteState_[e.kind]&&(e.enabled=!1,this.log_.warn("prev ".concat(e.kind," track is muted, keep mute state")))}},{key:"onVideoTrackStopped",value:(p=a(n().mark((function e(t){var i,r,a=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.stream,r=t.type,i===this&&this.video_&&this.cameraId_&&tM(this.getVideoTrack())&&!this.isVideoRecovering_&&(r!==Mb||!gR||!jR)){e.next=3;break}return e.abrupt("return");case 3:if(!(Date.now()-this.prevVideoRecoverTime_<cT)){e.next=6;break}return setTimeout((function(){return a.onVideoTrackStopped({stream:i,type:r})}),cT),e.abrupt("return");case 6:r===Mb?setTimeout((function(){var e=a.getVideoTrack();null!=e&&e.muted&&"visible"===document.visibilityState&&a.recoverVideoCapture(r)}),5e3):this.recoverVideoCapture(r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"onAudioTrackStopped",value:(h=a(n().mark((function e(t){var i,r,a=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.stream,r=t.type,!(i!==this||!this.audio_||!this.microphoneId_||this.isAudioRecovering_||r===Mb&&gR&&jR)){e.next=3;break}return e.abrupt("return");case 3:if(!(Date.now()-this.prevAudioRecoverTime_<cT)){e.next=6;break}return setTimeout((function(){return a.onAudioTrackStopped({stream:i,type:r})}),cT),e.abrupt("return");case 6:r===Mb?setTimeout((function(){var e=a.getAudioTrack();null!=e&&e.muted&&"visible"===document.visibilityState&&a.recoverAudioCapture(r)}),5e3):this.recoverAudioCapture(r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"recoverAudioCapture",value:(u=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.prevAudioRecoverTime_=Date.now(),oD.uploadEvent({log:"stat-local-audio-".concat(t),userId:this.userId_}),e.t0=this,e.next=5,this.getRecoverCaptureDeviceId(!1);case 5:e.t1=e.sent,e.t2={audio:!0,video:!1,microphoneId:e.t1},e.t0.recoverCapture.call(e.t0,e.t2);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"recoverVideoCapture",value:(s=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.prevVideoRecoverTime_=Date.now(),oD.uploadEvent({log:"stat-local-video-".concat(t),userId:this.userId_}),e.t0=this,e.next=5,this.getRecoverCaptureDeviceId(!0);case 5:e.t1=e.sent,e.t2={audio:!1,video:!0,cameraId:e.t1},e.t0.recoverCapture.call(e.t0,e.t2);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getRecoverCaptureDeviceId",value:(r=a(n().mark((function e(){var t,i,r,a,o=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!(o.length>0&&void 0!==o[0])||o[0],!(i=t?this.cameraId_:this.microphoneId_)||!this.enableAutoRecoverOther_){e.next=17;break}if(Ez.has(i)?Ez.set(i,Ez.get(i)+1):Ez.set(i,1),!((r=Ez.get(i))>=3)){e.next=17;break}if(!t){e.next=12;break}return e.next=9,Xq.getCameras();case 9:e.t0=e.sent.find((function(e){return!Ez.has(e.deviceId)})),e.next=15;break;case 12:return e.next=14,Xq.getMicrophones();case 14:e.t0=e.sent.find((function(e){return!Ez.has(e.deviceId)}));case 15:(a=e.t0)&&(this.log_.warn("".concat(t?"camera":"mic"," ").concat(i," capture fail ").concat(r," times, change new ").concat(a.deviceId)),i=a.deviceId);case 17:return e.abrupt("return",i);case 18:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"setAudioVolume",value:function(e){y(l(LocalStream.prototype),"setAudioVolume",this).call(this,e)}},{key:"clearCanvas",value:function(){this.canvasInterval_&&(YD.clearTask(this.canvasInterval_),this.canvasInterval_=null,this.canvas_=null,this.canvasTrack_=null)}},{key:"getCanvasTrack",value:function(){var e=this;if(this.canvasTrack_)return this.canvasTrack_;this.log_.info("gen canvas track");var t=this.getVideoTrack().getSettings(),n=t.width,i=t.height,r=t.frameRate;this.canvas_=document.createElement("canvas");var a=this.canvas_.getContext("2d");this.canvas_.width=n,this.canvas_.height=i,this.canvasInterval_=YD.run(dT,(function(){if(e.hasVideo()){var t=e.getVideoTrack().getSettings();t.width===e.canvas_.width&&t.height===e.canvas_.height||(e.canvas_.width=t.width,e.canvas_.height=t.height)}e.videoPlayer_&&e.videoPlayer_.element_&&a.drawImage(e.videoPlayer_.element_,0,0,e.canvas_.width,e.canvas_.height)}),{fps:Math.max(15,r)});var o=this.canvas_.captureStream();return this.canvasTrack_=o.getVideoTracks()[0],this.canvasTrack_}},{key:"setClient",value:function(e,t){e&&(this.log_.setUserId(e.getUserId()),this.log_.setSdkAppId(e.getSDKAppId()),t||this.syncMuteState()),this.client_=e}},{key:"setAudioCaptureVolume",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;if(!this.hasAudio()||t<0||!gO())return!1;if(this.captureVolume_===t)return!0;this.captureVolume_=t,this.log_.info("setCaptureVolume "+t),t/=100;var n=TC();if(this.gain_.gainNode)this.gain_.gainNode.gain.value=t;else{var i,r=new MediaStream;r.addTrack(this.getAudioTrack());var a=n.createMediaStreamDestination(),o=n.createMediaStreamSource(r),s=n.createGain();s.gain.value=t,o.connect(s),s.connect(a);var c=a.stream.getAudioTracks()[0],u=function(t){return e.log_.info("gained audio track ".concat(t))};c.onmute=function(){return u("muted")},c.onunmute=function(){return u("unmuted")},c.onended=function(){return u("ended")},this.gain_={source:o,audioTrack:c,gainNode:s},null===(i=this.connection_)||void 0===i||i.replaceTrack(c),y(l(LocalStream.prototype),"restartAudio",this).call(this)}return!0}},{key:"getGainedTrack",value:function(){return this.gain_.audioTrack}},{key:"reconnectGainNode",value:function(e){this.log_.warn("reconnect gain node");var t=new MediaStream;t.addTrack(e);var n=TC().createMediaStreamSource(t);n.connect(this.gain_.gainNode),this.gain_.source.disconnect(),this.gain_.source=n}},{key:"stopGainNode",value:function(){var e=this.gain_,t=e.audioTrack,n=e.source,i=e.gainNode;i&&(n.disconnect(),i.disconnect(),t.onmute=null,t.onunmute=null,t.onended=null,t.stop(),this.gain_={source:null,gainNode:null,audioTrack:null}),this.captureVolume_=100}},{key:"close",value:function(){this.setIsReadyToPublish(!1),this.stopGainNode(),y(l(LocalStream.prototype),"close",this).call(this)}},{key:"setIsAIDenoiser",value:function(e){this.isAIDenoiser=e}}]),LocalStream}(qG),w(Sz.prototype,"setAudioProfile",[uz],Object.getOwnPropertyDescriptor(Sz.prototype,"setAudioProfile"),Sz.prototype),w(Sz.prototype,"setVideoProfile",[dz],Object.getOwnPropertyDescriptor(Sz.prototype,"setVideoProfile"),Sz.prototype),w(Sz.prototype,"setScreenProfile",[lz],Object.getOwnPropertyDescriptor(Sz.prototype,"setScreenProfile"),Sz.prototype),w(Sz.prototype,"setVideoContentHint",[hz],Object.getOwnPropertyDescriptor(Sz.prototype,"setVideoContentHint"),Sz.prototype),w(Sz.prototype,"switchDevice",[pz],Object.getOwnPropertyDescriptor(Sz.prototype,"switchDevice"),Sz.prototype),w(Sz.prototype,"addTrack",[fz],Object.getOwnPropertyDescriptor(Sz.prototype,"addTrack"),Sz.prototype),w(Sz.prototype,"removeTrack",[mz],Object.getOwnPropertyDescriptor(Sz.prototype,"removeTrack"),Sz.prototype),w(Sz.prototype,"replaceTrack",[_z],Object.getOwnPropertyDescriptor(Sz.prototype,"replaceTrack"),Sz.prototype),w(Sz.prototype,"recoverCapture",[vz],Object.getOwnPropertyDescriptor(Sz.prototype,"recoverCapture"),Sz.prototype),w(Sz.prototype,"setAudioCaptureVolume",[gz,yz],Object.getOwnPropertyDescriptor(Sz.prototype,"setAudioCaptureVolume"),Sz.prototype),Sz),Cz={voiceActivityDetection:!1},Az=(bz=LG({retries:1,timeout:0,onRetrying:function(e){this.log_.warn("connection timeout, retrying [".concat(e,"]"))},onError:function(e,t,n){e.message.includes("timeout")?(this.reset(),this.initialize(),t()):n(e)}}),kz=function(e){d(P,e);var i,r,s,u,h,p,f,m,_,g,S,b,k,I,T,w,E,R,C,A,x=v(P);function P(e){var t;return o(this,P),(t=x.call(this,e)).localStream_=null,t.exchangeSDPTimeout_=-1,t.localAuxStream_=null,t.publishingStream_=null,t.isPublishingAuxStream_=!1,t.smallGenerator_=null,t.isSDPExchanging_=!1,t.ssrc_={audio:0,video:0,small:0,auxiliary:0},t.mediaSettings_={videoCodec:"",videoWidth:0,videoHeight:0,videoBps:0,videoFps:0,audioCodec:"opus",audioFs:0,audioChannel:0,audioBps:0,smallVideoWidth:0,smallVideoHeight:0,smallVideoFps:0,smallVideoBps:0,auxVideoWidth:0,auxVideoHeight:0,auxVideoFps:0,auxVideoBps:0},t.mixedAudioTrack_=null,t}return c(P,[{key:"isMainStreamPublished",get:function(){return!!this.localStream_}},{key:"isAuxStreamPublished",get:function(){return!!this.localAuxStream_}},{key:"publishState",get:function(){var e=this,t={audio:!1,bigVideo:!1,smallVideo:!1,auxVideo:!1};if(this.peerConnection_){var n,i,r,a,o=this.peerConnection_.getSenders();if(o)if(_O())t.audio=!(null===(n=o[0])||void 0===n||!n.track),t.bigVideo=!(null===(i=o[1])||void 0===i||!i.track),t.smallVideo=!(null===(r=o[2])||void 0===r||!r.track),t.auxVideo=!(null===(a=o[3])||void 0===a||!a.track);else o.forEach((function(n){n.track&&(n.track.kind===Tb?t.audio=!0:(t.bigVideo=!0,e.smallGenerator_&&(t.smallVideo=!0)))}))}return t}},{key:"initialize",value:function(){y(l(P.prototype),"initialize",this).call(this),this.installEvents()}},{key:"reset",value:function(){this.isReconnecting_&&this.stopReconnection(),this.closePeerConnection(),this.uninstallEvents(),this.clearExchangeSDPTimeout(),this.localStream_&&this.localStream_.clearCanvas()}},{key:"close",value:function(){y(l(P.prototype),"close",this).call(this),this.reset(),this.emitConnectionStateChangedEvent(Pk),this.smallGenerator_&&(this.smallGenerator_.destroy(),this.smallGenerator_=null)}},{key:"installEvents",value:function(){this.emitter_.on(OO.ERROR,this.handleError,this),this.emitter_.on(OO.CONNECTION_STATE_CHANGED,this.handleConnectionStateChange,this)}},{key:"uninstallEvents",value:function(){this.emitter_.off(OO.ERROR,this.handleError,this),this.emitter_.off(OO.CONNECTION_STATE_CHANGED,this.handleConnectionStateChange,this)}},{key:"publish",value:(A=a(n().mark((function e(t,i){var r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.publishingStream_=t,this.isPublishingAuxStream_=i,a=t.getVideoTrack(),o=null,!a||i||!this.client_.getIsEnableSmallStream()){e.next=9;break}return this.smallGenerator_=new ZG(t),e.next=8,this.smallGenerator_.initialize();case 8:o=this.smallGenerator_.generateSmallVideoTrack(this.client_.smallStreamConfig_);case 9:if(s=t.getVideoProfile(),!this.client_.get2k4kFlag()){e.next=18;break}if(1===this.client_.get2k4kFlag()||t.getScreen()||!(s.height*s.width>=3686400)){e.next=18;break}return s.width=1920,s.height=1080,this.log_.warn(pT),e.next=18,t.setVideoProfile(s);case 18:if(!(zE&&115===MR()&&s.width*s.height<=230400)){e.next=22;break}return this.log_.warn("fallback video to 480p"),e.next=22,t.setVideoProfile("480p_2");case 22:if(this.updateMediaSettings(t,i),!vO()){e.next=33;break}if(!GE||11!==WR){e.next=29;break}return e.next=27,this.publishByAddTrack(t,o);case 27:e.next=31;break;case 29:return e.next=31,this.publishByTransceiver(t,o,i);case 31:e.next=35;break;case 33:return e.next=35,this.publishByAddTrack(t,o);case 35:return this.publishingStream_=null,this.isPublishingAuxStream_=!1,i?this.localAuxStream_=t:this.localStream_=t,null===(r=this.sei_)||void 0===r||r.handleEncodedStreams(),e.abrupt("return",t);case 40:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"publishByTransceiver",value:(C=a(n().mark((function e(t,i,r){var a,o,s,c,u,d,l;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.log_.info("publish by transceiver"),a=t.getMediaStream(),o=t.getAudioTrack(),s=t.getVideoTrack(),c=null,(zR||GR)&&fC(s)&&(c=t.getCanvasTrack()),0!==(u=this.peerConnection_.getTransceivers()).length){e.next=16;break}return this.peerConnection_.addTransceiver(o||Tb,{direction:nk,streams:[a]}),this.peerConnection_.addTransceiver(r?wb:c||s||wb,{direction:nk,streams:[a]}),this.peerConnection_.addTransceiver(i||wb,{direction:nk,streams:[a]}),this.peerConnection_.addTransceiver(r?c||s:wb,{direction:nk,streams:[a]}),e.next=14,this.connect();case 14:e.next=46;break;case 16:if(d=[],!o){e.next=29;break}if(!u[0].sender.track){e.next=24;break}return this.mixAudioTrack(u[0].sender.track,o),e.next=22,u[0].sender.replaceTrack(this.mixedAudioTrack_);case 22:e.next=27;break;case 24:return e.next=26,u[0].sender.replaceTrack(o);case 26:d.push(0);case 27:return e.next=29,this.setBandwidth({bandwidth:t.getAudioBitrate(),type:Tb});case 29:if(!s){e.next=42;break}return l=r?3:1,e.next=33,u[l].sender.replaceTrack(c||s);case 33:return e.next=35,this.setBandwidth({bandwidth:t.getVideoBitrate(),type:wb,videoType:r?Ab:Cb,scaleResolutionDownBy:r?1:t.scaleResolutionDownBy});case 35:if(d.push(l),!i){e.next=42;break}return e.next=39,u[2].sender.replaceTrack(i);case 39:return e.next=41,this.setBandwidth({bandwidth:this.client_.smallStreamConfig.bitrate,type:wb,videoType:Rb});case 41:d.push(2);case 42:return e.next=44,this.setTransceiverDirection(nk,d);case 44:return e.next=46,this.doPublishChange();case 46:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return C.apply(this,arguments)})},{key:"publishByAddTrack",value:(R=a(n().mark((function e(t,i){var r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.log_.info("publish by addtrack"),r=t.getMediaStream(),a=t.getAudioTrack(),o=t.getVideoTrack(),a&&this.peerConnection_.addTrack(a,r),o&&(this.peerConnection_.addTrack(o,r),i&&((s=new MediaStream).addTrack(i),this.peerConnection_.addTrack(i,s))),e.next=8,this.connect();case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"unpublish",value:(E=a(n().mark((function e(i){var r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_O()){e.next=2;break}return e.abrupt("return",this.doUnpublish());case 2:if(r=i.getAudioTrack(),a=i===this.localAuxStream_,o=[],!this.peerConnection_){e.next=33;break}if(s=this.peerConnection_.getSenders(),!r){e.next=18;break}if(!this.mixedAudioTrack_){e.next=15;break}return this.log_.info("has mixed audioTrack, use another audioTrack"),e.next=12,s[0].replaceTrack(a?this.localStream_.getAudioTrack():this.localAuxStream_.getAudioTrack());case 12:this.destroyMixedAudioTrack(),e.next=18;break;case 15:return e.next=17,s[0].replaceTrack(null);case 17:o.push(0);case 18:if(!a){e.next=26;break}return e.next=21,s[3].replaceTrack(null);case 21:this.localAuxStream_=null,this.mediaSettings_=t(t({},this.mediaSettings_),{},{auxVideoBps:0,auxVideoFps:0,auxVideoWidth:0,auxVideoHeight:0}),o.push(3),e.next=33;break;case 26:return e.next=28,s[1].replaceTrack(null);case 28:return e.next=30,s[2].replaceTrack(null);case 30:this.localStream_=null,this.mediaSettings_=t(t({},this.mediaSettings_),{},{videoWidth:0,videoHeight:0,videoBps:0,videoFps:0,audioFs:0,audioChannel:0,audioBps:0,smallVideoWidth:0,smallVideoHeight:0,smallVideoFps:0,smallVideoBps:0}),o.push(1,2);case 33:if(!this.localStream_&&!this.localAuxStream_){e.next=40;break}return e.next=36,this.setTransceiverDirection(tk,o);case 36:return e.next=38,this.doPublishChange();case 38:e.next=42;break;case 40:return e.next=42,this.doUnpublish();case 42:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"doPublishChange",value:(w=a(n().mark((function e(){var t,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={state:this.publishState,constraintConfig:this.mediaSettings_},e.next=3,this.signalChannel_.sendWaitForResponse({command:Yx,data:t,responseCommand:Qx.PUBLISH_STATE_CHANGE_RESULT});case 3:i=e.sent,this.checkPublishResultCode(i.data.code,i.data.message);case 5:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:"doUnpublish",value:function(){var e=this;return this.signalChannel_.sendWaitForResponse({command:iP,commandDesc:"unpublish",responseCommand:Qx.UNPUBLISH_RESULT}).then((function(){e.close()})).catch((function(){e.close()}))}},{key:"updateMediaSettings",value:function(e,t){var n=this;this.localAuxStream_&&e===this.localAuxStream_&&(t=!0);var i=this.client_.getSystemResult().detail,r=i.isH264EncodeSupported,a=i.isVp8EncodeSupported;if(r?this.mediaSettings_.videoCodec="H264":a&&(this.mediaSettings_.videoCodec="VP8"),xO){var o=e.getMediaStream();null==o||o.getTracks().forEach((function(i){var r=i.getSettings();if(i.kind===Tb){var a=1;r.channelCount&&(a=r.channelCount),n.mediaSettings_.audioChannel=a,n.mediaSettings_.audioBps=1e3*e.getAudioBitrate(),n.mediaSettings_.audioFs=r.sampleRate}else if(i.kind===wb){if(t)return n.mediaSettings_.auxVideoWidth=r.width,n.mediaSettings_.auxVideoHeight=r.height,n.mediaSettings_.auxVideoFps=r.frameRate,void(n.mediaSettings_.auxVideoBps=1e3*e.getVideoBitrate());n.client_.getIsEnableSmallStream()&&(n.mediaSettings_.smallVideoWidth=n.client_.smallStreamConfig.width,n.mediaSettings_.smallVideoHeight=n.client_.smallStreamConfig.height,n.mediaSettings_.smallVideoFps=n.client_.smallStreamConfig.frameRate,n.mediaSettings_.smallVideoBps=1e3*n.client_.smallStreamConfig.bitrate),n.mediaSettings_.videoWidth=r.width,n.mediaSettings_.videoHeight=r.height,n.mediaSettings_.videoFps=r.frameRate,n.mediaSettings_.videoBps=1e3*e.getVideoBitrate()}}))}else this.updateMediaSettingsFromProfile(e);this.log_.info("updateMediaSettings: "+JSON.stringify(this.mediaSettings_))}},{key:"updateMediaSettingsFromProfile",value:function(e){if(e){if(e.hasAudio()){var t=e.getAudioProfile();this.mediaSettings_.audioChannel=t.channelCount,this.mediaSettings_.audioBps=1e3*t.bitrate,this.mediaSettings_.audioFs=t.sampleRate}if(e.hasVideo()){var n=e.getVideoProfile();this.mediaSettings_.videoWidth=n.width,this.mediaSettings_.videoHeight=n.height,this.mediaSettings_.videoFps=n.frameRate,this.mediaSettings_.videoBps=1e3*n.bitrate}}}},{key:"sendMediaSettings",value:function(e){var t=this;this.updateMediaSettings(e),this.signalChannel_.sendWaitForResponse({command:mP,data:this.mediaSettings_,responseCommand:Qx.UPDATE_CONSTRAINT_CONFIG_RES}).then((function(e){0!==e.data.code&&t.log_.warn(e.data.message)})).catch(this.log_.warn)}},{key:"addTrack",value:(T=a(n().mark((function e(t,i){var r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.peerConnection_){e.next=2;break}return e.abrupt("return");case 2:if(a=i===this.localAuxStream_,this.log_.info("is adding ".concat(t.kind," track to current published local ").concat(a?Ab:zb," stream")),null===(r=this.sei_)||void 0===r||r.handleEncodedStreams(),!_O()){e.next=10;break}return e.next=8,this.addTrackByTransceiver(t,i);case 8:e.next=12;break;case 10:return e.next=12,this.addTrackBySender(t);case 12:tD(this.userId_,{eventId:t.kind===Tb?yP:gP,eventDesc:"add ".concat(t.kind," track to current published stream"),timestamp:Gm(),userId:this.userId_,tinyId:this.tinyId_});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"addTrackByTransceiver",value:(I=a(n().mark((function e(t,i){var r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i===this.localAuxStream_,a=this.peerConnection_.getTransceivers(),t.kind!==Tb){e.next=13;break}if(!a[0].sender.track){e.next=9;break}return this.mixAudioTrack(a[0].sender.track,t),e.next=7,a[0].sender.replaceTrack(this.mixedAudioTrack_);case 7:e.next=11;break;case 9:return e.next=11,a[0].sender.replaceTrack(t);case 11:e.next=26;break;case 13:return o=r?3:1,e.next=16,a[o].sender.replaceTrack(t);case 16:if(1!==o||!this.client_.getIsEnableSmallStream()){e.next=23;break}return this.smallGenerator_=new ZG(this.localStream_),e.next=20,this.smallGenerator_.initialize();case 20:return s=this.smallGenerator_.generateSmallVideoTrack(this.client_.smallStreamConfig_),e.next=23,a[2].sender.replaceTrack(s);case 23:if(a[o].direction!==tk){e.next=26;break}return e.next=26,this.setTransceiverDirection(nk,[o]);case 26:return this.updateMediaSettings(i,r),e.next=29,this.doPublishChange();case 29:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"addTrackBySender",value:(k=a(n().mark((function e(t){var i,r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(_O()&&this.peerConnection_.getTransceivers().findIndex((function(e){return"stopped"===e.direction}))>=0)){e.next=4;break}return this.log_.warn("transceiver is stopping, negotiate sdp first"),e.next=4,this.updateOffer(RI.REMOVE,t);case 4:if(!(i=this.peerConnection_.getSenders().find((function(e){return e.track&&e.track.kind===t.kind})))){e.next=11;break}return this.log_.warn("sender already exists, remove sender first"),r=i.track,this.removeSender(i),e.next=11,this.updateOffer(RI.REMOVE,r);case 11:if(a=this.localStream_.getMediaStream(),this.peerConnection_.addTrack(t,a),t.kind!==wb||!this.client_.getIsEnableSmallStream()){e.next=21;break}return this.smallGenerator_=new ZG(this.localStream_),e.next=17,this.smallGenerator_.initialize();case 17:o=this.smallGenerator_.generateSmallVideoTrack(this.client_.smallStreamConfig_),(s=new MediaStream).addTrack(o),this.peerConnection_.addTrack(o,s);case 21:return e.next=23,this.updateOffer(RI.ADD,t);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"isNeedToResetOfferOrder",value:function(){if(this.sdpSemantics_===gI||!this.peerConnection_||!this.peerConnection_.localDescription)return!1;for(var e=this.peerConnection_.localDescription.sdp,t=wD(e),n=0;n<t.media.length;n++)if(0===t.media[n].mid&&t.media[n].type===wb)return!0;return!1}},{key:"removeSender",value:function(e){var t=null;_O()&&(t=this.peerConnection_.getTransceivers().find((function(t){return t.sender&&t.sender.track===e.track}))),this.peerConnection_.removeTrack(e),t&&sC(t.stop)&&(this.log_.info("stop transceiver"),t.stop())}},{key:"removeTrack",value:(b=a(n().mark((function e(t,i){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.peerConnection_){e.next=2;break}return e.abrupt("return");case 2:if(this.log_.info("is removing ".concat(t.kind," track from current published local ").concat(i===this.localAuxStream_?Ab:zb," stream")),!_O()){e.next=8;break}return e.next=6,this.removeTrackByTransceiver(t,i);case 6:e.next=10;break;case 8:return e.next=10,this.removeTrackBySender(t);case 10:tD(this.userId_,{eventId:t.kind===Tb?bP:SP,eventDesc:"remove ".concat(t.kind," track from current published stream"),timestamp:Gm(),userId:this.userId_,tinyId:this.tinyId_});case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"removeTrackByTransceiver",value:(S=a(n().mark((function e(t,i){var r,a,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i===this.localAuxStream_,a=this.peerConnection_.getTransceivers(),t.kind!==Tb){e.next=13;break}if(!this.mixedAudioTrack_){e.next=9;break}return e.next=6,a[0].sender.replaceTrack(r?this.localStream_.getAudioTrack():this.localAuxStream_.getAudioTrack());case 6:this.destroyMixedAudioTrack(),e.next=11;break;case 9:return e.next=11,a[0].sender.replaceTrack(null);case 11:e.next=23;break;case 13:return o=r?3:1,e.next=16,a[o].sender.replaceTrack(null);case 16:if(1!==o||!this.smallGenerator_){e.next=21;break}return this.smallGenerator_.destroy(),this.smallGenerator_=null,e.next=21,a[2].sender.replaceTrack(null);case 21:return e.next=23,this.setTransceiverDirection(tk,[o]);case 23:return this.updateMediaSettings(i,r),e.next=26,this.doPublishChange();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"setTransceiverDirection",value:(g=a(n().mark((function e(t,i){var r,a,o,s,c,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JE){e.next=2;break}return e.abrupt("return");case 2:if(r=!1,a=!1,this.log_.info("setting transceiver ".concat(i.join(",")," direction to ").concat(t)),o=this.peerConnection_.getTransceivers(),i.forEach((function(e){o[e].direction!==t&&(o[e].direction=t,r=!0)})),!r){e.next=14;break}return this.log_.info("updating offer"),e.next=11,this.peerConnection_.createOffer();case 11:return s=e.sent,e.next=14,this.peerConnection_.setLocalDescription(s);case 14:if(c=-1,u=this.peerConnection_.remoteDescription.sdp.split("\r\n").map((function(e){if(e.match(new RegExp("a=(".concat(tk,"|").concat(ik,"|").concat(nk,")")))&&c++,i.includes(c)){if(t===tk&&e.includes("a=".concat(ik)))return a=!0,"a=".concat(t);if(t===nk&&e.includes("a=".concat(tk)))return a=!0,"a=".concat(ik)}return e})).join("\r\n"),!a){e.next=20;break}return this.log_.info("updating answer"),e.next=20,this.peerConnection_.setRemoteDescription({type:"answer",sdp:u});case 20:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"removeTrackBySender",value:(_=a(n().mark((function e(t){var i,r,a=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.kind!==wb||!this.isNeedToResetOfferOrder()){e.next=7;break}return this.reset(),this.initialize(),null===(i=this.localStream_.getMediaStream())||void 0===i||i.removeTrack(t),e.next=6,this.publish(this.localStream_);case 6:return e.abrupt("return");case 7:return(r=this.peerConnection_.getSenders().find((function(e){return e.track===t})))&&(this.removeSender(r),t.kind===wb&&this.smallGenerator_&&(this.smallGenerator_.destroy(),this.smallGenerator_=null,this.peerConnection_.getSenders().forEach((function(e){e.track&&e.track.kind===wb&&a.removeSender(e)})))),e.next=11,this.updateOffer(RI.REMOVE,t);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"replaceTrack",value:(m=a(n().mark((function e(t,i){var r,a,o,s,c,u,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((a=null===(r=this.peerConnection_)||void 0===r?void 0:r.getSenders())&&0!==a.length){e.next=3;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Iw})});case 3:if(o=i===this.localAuxStream_,this.log_.info("is replacing ".concat(t.kind," track to current published local ").concat(o?Ab:zb," stream")),t.kind!==Tb||!a[0]){e.next=16;break}if(!(this.mixedAudioTrack_&&null!==(s=this.localStream_)&&void 0!==s&&s.hasAudio()&&null!==(c=this.localAuxStream_)&&void 0!==c&&c.hasAudio())){e.next=14;break}return this.destroyMixedAudioTrack(),u=o?this.localStream_.getAudioTrack():this.localAuxStream_.getAudioTrack(),this.mixAudioTrack(t,u),e.next=12,a[0].replaceTrack(this.mixedAudioTrack_);case 12:e.next=16;break;case 14:return e.next=16,a[0].replaceTrack(t);case 16:if(t.kind!==wb){e.next=32;break}if(i!==this.localStream_||!a[1]){e.next=29;break}return e.next=20,a[1].replaceTrack(t);case 20:if(!this.smallGenerator_||!a[2]){e.next=29;break}return this.log_.info("replacing smallVideo"),this.smallGenerator_.destroy(),this.smallGenerator_=new ZG(this.localStream_),e.next=26,this.smallGenerator_.initialize();case 26:return d=this.smallGenerator_.generateSmallVideoTrack(this.client_.smallStreamConfig_),e.next=29,a[2].replaceTrack(d);case 29:if(i!==this.localAuxStream_||!a[3]){e.next=32;break}return e.next=32,a[3].replaceTrack(t);case 32:tD(this.userId_,{eventId:t.kind===Tb?DP:PP,eventDesc:"replace ".concat(t.kind," track from current published stream"),timestamp:Gm(),userId:this.userId_,tinyId:this.tinyId_});case 33:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"updateOffer",value:(f=a(n().mark((function e(t,i){var r,a,o,s,c,u,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection_.createOffer(Cz);case 3:return r=e.sent,JE&&(r.sdp=this.setSDPDirection(r.sdp,"sendrecv")),e.next=7,this.peerConnection_.setLocalDescription(r);case 7:return a=this.updateMediaSettings(this.localStream_||this.localAuxStream_),o={action:t,trackId:i.id,kind:i.kind===wb?"bigVideo":i.kind,type:"offer",sdp:this.peerConnection_.localDescription.sdp,constraintConfig:a,state:this.publishState},this.log_.info("createOffer success, sending updated offer to remote server"),this.log_.debug("updatedOffer: "+o.sdp),e.next=13,this.signalChannel_.sendWaitForResponse({command:Xx,data:o,responseCommand:Qx.UPDATE_OFFER_RESULT,timeout:1e4,commandDesc:"update offer"});case 13:return s=e.sent,c=s.data,u=c.code,d=c.message,0!==u&&this.checkPublishResultCode(u,d),e.next=18,this.acceptAnswer(s.data.data);case 18:this.updateSSRC(r.sdp),oD.logSuccessEvent({userId:this.client_.getUserId(),eventType:iI,kind:"offer"}),e.next=27;break;case 22:throw e.prev=22,e.t0=e.catch(0),this.log_.error(e.t0),oD.logFailedEvent({userId:this.client_.getUserId(),eventType:iI,kind:"offer",error:e.t0}),e.t0;case 27:case"end":return e.stop()}}),e,this,[[0,22]])}))),function(e,t){return f.apply(this,arguments)})},{key:"setBandwidth",value:(p=a(n().mark((function e(t){var i,r,a,o,s,c,u,d,l,h;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.bandwidth,r=t.type,a=t.videoType,o=void 0===a?"":a,s=t.sdp,c=t.scaleResolutionDownBy,u=void 0===c?1:c,yO()||!s){e.next=3;break}return e.abrupt("return",r===wb?this.updateVideoBandwidthRestriction(s,i,o):this.updateAudioBandwidthRestriction(s,i));case 3:if(d=null,vO()?(l=0,r===wb&&(l=o===Rb?2:o===Ab?3:1),d=this.peerConnection_.getSenders()[l]):d=this.peerConnection_.getSenders().find((function(e){return e.track&&e.track.kind===r})),!d){e.next=22;break}return(h=d.getParameters()).encodings&&0!==h.encodings.length||(h.encodings=[{}]),"unlimited"===i?delete h.encodings[0].maxBitrate:h.encodings[0].maxBitrate=1e3*i,u>1&&(this.log_.warn("".concat(o," scaleResolutionDownBy ").concat(u)),h.encodings[0].scaleResolutionDownBy=u),e.prev=10,e.next=13,d.setParameters(h);case 13:return this.log_.info(o+r+" bandwidth was set to "+i+" kbps"),e.abrupt("return",s);case 17:if(e.prev=17,e.t0=e.catch(10),this.log_.info("failed to set bandwidth by setting maxBitrate: "+e.t0),!s){e.next=22;break}return e.abrupt("return",r===wb?this.updateVideoBandwidthRestriction(s,i,o):this.updateAudioBandwidthRestriction(s,i));case 22:return e.abrupt("return",s);case 23:case"end":return e.stop()}}),e,this,[[10,17]])}))),function(e){return p.apply(this,arguments)})},{key:"updateVideoBandwidthRestriction",value:function(e,t,n){var i="AS";JE&&(i="TIAS",t*=1e3);var r=0,a=-1;return n===Rb?r=1:n===Ab&&(r=2),e=e.replace(/m=video (.*)\r\nc=IN (.*)\r\n/g,(function(e){return++a===r?"".concat(e,"b=").concat(i,":").concat(t,"\r\n"):e})),e}},{key:"updateAudioBandwidthRestriction",value:function(e,t){var n="AS";return JE&&(n="TIAS",t*=1e3),e=e.replace(/m=audio (.*)\r\nc=IN (.*)\r\n/,"m=audio $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n")}},{key:"removeBandwidthRestriction",value:function(e){return e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"")}},{key:"removeVideoOrientation",value:function(e){return e.replace(/urn:3gpp:video-orientation/,"")}},{key:"connect",value:(h=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.exchangeSDP();case 3:return e.next=5,this.waitForPeerConnectionConnected();case 5:e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(0),this.closePeerConnection(!0),e.t0;case 11:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return h.apply(this,arguments)})},{key:"exchangeSDP",value:(u=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.isSDPExchanging_=!0,e.next=4,this.createOffer();case 4:return this.log_.info("createOffer success, sending offer to remote server"),e.next=7,this.doExchangeSDP();case 7:this.isSDPExchanging_=!1,e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),this.isSDPExchanging_=!1,e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return u.apply(this,arguments)})},{key:"createOffer",value:(s=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection_.createOffer(Cz);case 3:return t=e.sent,e.next=6,this.peerConnection_.setLocalDescription(t);case 6:this.updateSSRC(t.sdp),oD.logSuccessEvent({userId:this.client_.getUserId(),eventType:iI,kind:"offer"}),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),oD.logFailedEvent({userId:this.client_.getUserId(),eventType:iI,kind:"offer",error:e.t0}),e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return s.apply(this,arguments)})},{key:"doExchangeSDP",value:function(){var e=this;return new Promise((function(t,i){e.exchangeSDPTimeout_=setTimeout((function(){e.signalChannel_.off(Qx.PUBLISH_RESULT,r),e.clearExchangeSDPTimeout();var t=new vP({code:_P.API_CALL_TIMEOUT,message:ZR({key:MT})});i(t)}),1e4);var r=function(){var r=a(n().mark((function r(a){var o,s,c;return n().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,e.clearExchangeSDPTimeout(),o=a.data,s=o.code,c=o.message,0!==s){n.next=9;break}return n.next=6,e.acceptAnswer(a.data.data);case 6:t(),n.next=10;break;case 9:e.checkPublishResultCode(s,c);case 10:n.next=15;break;case 12:n.prev=12,n.t0=n.catch(0),i(n.t0);case 15:case"end":return n.stop()}}),r,null,[[0,12]])})));return function(e){return r.apply(this,arguments)}}(),o={type:e.peerConnection_.localDescription.type,sdp:e.removeVideoOrientation(e.peerConnection_.localDescription.sdp),screen:(e.publishingStream_||e.localStream_).hasScreenTrack(),state:e.publishState,constraintConfig:e.mediaSettings_};e.signalChannel_.once(Qx.PUBLISH_RESULT,r),e.log_.debug("sending sdp offer: "+o.sdp),e.signalChannel_.send(nP,o)}))}},{key:"setSDPDirection",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all",i=wD(e);return i.media.forEach((function(e){"all"!==n&&e.type!==n||(e.direction=t)})),ED(i)}},{key:"acceptAnswer",value:(r=a(n().mark((function e(t){var i,r,a,o,s,c,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,i=this.removeVideoOrientation(t.sdp),!(r=this.publishingStream_||this.localStream_)){e.next=15;break}if(a=r.getVideoBitrate(),o=r.getAudioBitrate(),!a){e.next=11;break}return s=this.isPublishingAuxStream_?Ab:Cb,e.next=10,this.setBandwidth({sdp:i,videoType:s,type:wb,bandwidth:a,scaleResolutionDownBy:this.isPublishingAuxStream_?1:r.scaleResolutionDownBy});case 10:i=e.sent;case 11:if(!o){e.next=15;break}return e.next=14,this.setBandwidth({bandwidth:o,type:Tb,sdp:i});case 14:i=e.sent;case 15:if(!this.client_.getIsEnableSmallStream()){e.next=20;break}return c=this.client_.smallStreamConfig,e.next=19,this.setBandwidth({bandwidth:c.bitrate,type:wb,videoType:Rb,sdp:i});case 19:i=e.sent;case 20:return u={type:t.type,sdp:i},e.next=23,this.peerConnection_.setRemoteDescription(u);case 23:this.log_.debug("accepted answer: "+i),oD.logSuccessEvent({userId:this.client_.getUserId(),eventType:rI,kind:"answer"}),e.next=32;break;case 27:throw e.prev=27,e.t0=e.catch(0),oD.logFailedEvent({userId:this.client_.getUserId(),eventType:rI,kind:"answer",error:e.t0}),this.log_.error("failed to accept remote answer "+e.t0),e.t0;case 32:case"end":return e.stop()}}),e,this,[[0,27]])}))),function(e){return r.apply(this,arguments)})},{key:"sendMutedFlag",value:function(e,t){if(t!==this.localAuxStream_){var n={audio:e.audio,bigVideo:e.video,auxVideo:e.auxVideo};this.log_.info("send muted state: ".concat(JSON.stringify(n))),this.signalChannel_.send(tP,n)}}},{key:"getIsReconnecting",value:function(){return this.isReconnecting_}},{key:"reconnect",value:(i=a(n().mark((function e(){var t,i,r=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(-1===this.reconnectionTimer_){e.next=3;break}return this.log_.warn("reconnect() uplink is reconnecting, ignore current reconnection"),e.abrupt("return");case 3:if(!(this.reconnectionCount_>=30)){e.next=12;break}return this.log_.warn("SDK has tried reconnect uplink for ".concat(30," times, but all failed, please check your network")),this.stopReconnection(),t=new vP({code:_P.UPLINK_RECONNECTION_FAILED,message:ZR({key:UT})}),oD.logFailedEvent({userId:this.client_.getUserId(),eventType:eI,error:t}),this.addEventInternal(KP,"uplink-connection reconnect fail"),this.emitConnectionStateChangedEvent(Pk),this.emitter_.emit(OO.ERROR,t),e.abrupt("return");case 12:if(this.signalChannel_.getCurrentState()===Jx){e.next=16;break}return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"),this.signalChannel_.once(Bx,this.reconnect,this),e.abrupt("return");case 16:if(this.reconnectionCount_++,e.prev=17,this.log_.warn("reconnect() try to reconnect uplink [".concat(this.reconnectionCount_,"/").concat(30,"]")),i=oC(this.reconnectionCount_),this.reconnectionTimer_=setTimeout((function(){r.log_.warn("reconnect() uplink reconnect timeout(".concat(i/1e3,"s), try again")),r.clearReconnectionTimer(),r.reconnect()}),i),!(this.isSDPExchanging_||this.peerConnection_&&this.peerConnection_.connectionState===Lk)){e.next=23;break}return e.abrupt("return");case 23:return e.next=25,this.signalChannel_.sendWaitForResponse({command:iP,responseCommand:Qx.UNPUBLISH_RESULT,enableLog:!1});case 25:if(this.reset(),this.initialize(),!this.localStream_){e.next=30;break}return e.next=30,this.publish(this.localStream_);case 30:if(!this.localAuxStream_){e.next=33;break}return e.next=33,this.publish(this.localAuxStream_,!0);case 33:oD.logSuccessEvent({userId:this.client_.getUserId(),eventType:eI}),this.log_.warn("reconnect() uplink reconnect successfully"),this.addEventInternal(qP,"uplink-connection reconnect success"),this.stopReconnection(),this.localStream_.syncMuteState(),e.next=42;break;case 40:e.prev=40,e.t0=e.catch(17);case 42:case"end":return e.stop()}}),e,this,[[17,40]])}))),function(){return i.apply(this,arguments)})},{key:"clearExchangeSDPTimeout",value:function(){-1!==this.exchangeSDPTimeout_&&(clearTimeout(this.exchangeSDPTimeout_),this.exchangeSDPTimeout_=-1)}},{key:"clearReconnectionTimer",value:function(){-1!==this.reconnectionTimer_&&(clearTimeout(this.reconnectionTimer_),this.reconnectionTimer_=-1)}},{key:"handleError",value:function(e){e.getCode()===_P.ICE_TRANSPORT_ERROR&&(this.isFirstConnection_&&(this.isFirstConnection_=!1,oD.logFailedEvent({userId:this.client_.getUserId(),eventType:Zk,error:e})),this.isReconnecting_||this.startReconnection())}},{key:"handleConnectionStateChange",value:function(e){e.state===Mk&&this.isFirstConnection_&&(this.isFirstConnection_=!1,oD.logSuccessEvent({userId:this.client_.getUserId(),eventType:Zk}),this.addEventInternal(BP,"uplink-connection is connected"))}},{key:"updateSSRC",value:function(e){var t=this;try{wD(e).media.forEach((function(e,n){if(e.type===Tb){var i=e.ssrcs[0];i&&(t.ssrc_.audio=i.id)}else{if(t.sdpSemantics_===gI)return void e.ssrcGroups.forEach((function(e,n){var i=Number(e.ssrcs.split(" ")[0]);0===n?t.ssrc_.video=i:1===n&&(t.ssrc_.small=i)}));var r=e.ssrcs[0];if(!r)return;switch(n){case 1:t.ssrc_.video=r.id;break;case 2:t.ssrc_.small=r.id;break;case 3:t.ssrc_.auxiliary=r.id}}}))}catch(Yq){}}},{key:"getVideoTrackId",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wb;if(this.peerConnection_){var t=this.peerConnection_.getSenders();if(e===wb&&t[1]&&t[1].track)return t[1].track.id;if(e===Rb&&t[2]&&t[2].track)return t[2].track.id;if(e===Ab&&t[3]&&t[3].track)return t[3].track.id}if(this.localStream_&&e===wb){var n=this.localStream_.getVideoTrack();if(n)return n.id}if(this.localAuxStream_&&e===Ab){var i=this.localAuxStream_.getVideoTrack();if(i)return i.id}return""}},{key:"getSSRC",value:function(){return this.ssrc_}},{key:"checkPublishResultCode",value:function(e,t){if(0!==e)throw 1028===e?(this.log_.error(CE.NOT_SUPPORTED_H264ENCODE),new vP({code:_P.NOT_SUPPORTED_H264,message:ZR({key:aE})})):new vP({code:_P.UNKNOWN,message:ZR({key:pE,data:{signalResponse:Qx.PUBLISH_RESULT,code:e,message:t}})})}},{key:"getLocalStream",value:function(){return this.localStream_}},{key:"sendSEI",value:function(e,t){this.sei_.push(e,t)}},{key:"mixAudioTrack",value:function(e,t){this.log_.info("mix audio track"),this.mixedAudioTrack_=function(e){var t=IC(),n=t.createMediaStreamDestination(),i=[];e.forEach((function(e){var r=new MediaStream;r.addTrack(e);var a=t.createMediaStreamSource(r);a.connect(n),i.push(a)}));var r=n.stream.getAudioTracks()[0];return ez.set(r,{destination:n,track:r,mediaStreamSourceList:i}),r}([e,t])}},{key:"destroyMixedAudioTrack",value:function(){this.mixedAudioTrack_&&(this.log_.info("destroy audio track"),function(e){if(ez.has(e)){var t=ez.get(e),n=t.destination,i=t.track,r=t.mediaStreamSourceList;i.stop(),n.disconnect(),r.forEach((function(e){e.disconnect()})),ez.delete(e)}}(this.mixedAudioTrack_),this.mixedAudioTrack_=null)}}]),P}(_G),w(kz.prototype,"publish",[bz],Object.getOwnPropertyDescriptor(kz.prototype,"publish"),kz.prototype),kz),xz=ee,Pz=Bc,Dz=Bo.exports.getWeakData,Oz=fc,Mz=un,Nz=oe,Lz=ye,Uz=lc,Vz=ft,jz=ai.set,Fz=ai.getterFor,Bz=Vd.find,Hz=Vd.findIndex,Wz=xz([].splice),Gz=0,zz=function(e){return e.frozen||(e.frozen=new Jz)},Jz=function(){this.entries=[]},qz=function(e,t){return Bz(e.entries,(function(e){return e[0]===t}))};Jz.prototype={get:function(e){var t=qz(this,e);if(t)return t[1]},has:function(e){return!!qz(this,e)},set:function(e,t){var n=qz(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=Hz(this.entries,(function(t){return t[0]===e}));return~t&&Wz(this.entries,t,1),!!~t}};var Kz,Qz={getConstructor:function(e,t,n,i){var r=e((function(e,r){Oz(e,a),jz(e,{type:t,id:Gz++,frozen:void 0}),Nz(r)||Uz(r,e[i],{that:e,AS_ENTRIES:n})})),a=r.prototype,o=Fz(t),s=function(e,t,n){var i=o(e),r=Dz(Mz(t),!0);return!0===r?zz(i).set(t,n):r[i.id]=n,e};return Pz(a,{delete:function(e){var t=o(this);if(!Lz(e))return!1;var n=Dz(e);return!0===n?zz(t).delete(e):n&&Vz(n,t.id)&&delete n[t.id]},has:function(e){var t=o(this);if(!Lz(e))return!1;var n=Dz(e);return!0===n?zz(t).has(e):n&&Vz(n,t.id)}}),Pz(a,n?{get:function(e){var t=o(this);if(Lz(e)){var n=Dz(e);return!0===n?zz(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),r}},Xz=C,Yz=ee,$z=Bc,Zz=Bo.exports,eJ=jc,tJ=Qz,nJ=ye,iJ=ds,rJ=ai.enforce,aJ=Fn,oJ=!Xz.ActiveXObject&&"ActiveXObject"in Xz,sJ=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},cJ=eJ("WeakMap",sJ,tJ);if(aJ&&oJ){Kz=tJ.getConstructor(sJ,"WeakMap",!0),Zz.enable();var uJ=cJ.prototype,dJ=Yz(uJ.delete),lJ=Yz(uJ.has),hJ=Yz(uJ.get),pJ=Yz(uJ.set);$z(uJ,{delete:function(e){if(nJ(e)&&!iJ(e)){var t=rJ(this);return t.frozen||(t.frozen=new Kz),dJ(this,e)||t.frozen.delete(e)}return dJ(this,e)},has:function(e){if(nJ(e)&&!iJ(e)){var t=rJ(this);return t.frozen||(t.frozen=new Kz),lJ(this,e)||t.frozen.has(e)}return lJ(this,e)},get:function(e){if(nJ(e)&&!iJ(e)){var t=rJ(this);return t.frozen||(t.frozen=new Kz),lJ(this,e)?hJ(this,e):t.frozen.get(e)}return hJ(this,e)},set:function(e,t){if(nJ(e)&&!iJ(e)){var n=rJ(this);n.frozen||(n.frozen=new Kz),lJ(this,e)?pJ(this,e,t):n.frozen.set(e,t)}else pJ(this,e,t);return this}})}var fJ=Tr,mJ=Ay,_J=x,vJ=Ie,gJ=_e,yJ=Tg,SJ=vb,bJ=ki,kJ=mJ&&mJ.prototype;if(fJ({target:"Promise",proto:!0,real:!0,forced:!!mJ&&_J((function(){kJ.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=yJ(this,vJ("Promise")),n=gJ(e);return this.then(n?function(n){return SJ(t,e()).then((function(){return n}))}:e,n?function(n){return SJ(t,e()).then((function(){throw n}))}:e)}}),gJ(mJ)){var IJ=vJ("Promise").prototype.finally;kJ.finally!==IJ&&bJ(kJ,"finally",IJ,{unsafe:!0})}var TJ,wJ,EJ,RJ,CJ,AJ=new WeakMap;function xJ(){return function(e,n,i){var r=i.value,a=function e(n){var i=n.fn,r=n.args,a=n.context,o=n.resolve,s=n.reject;i.apply(a,r).then(o,s).finally((function(){var n=AJ.get(a);n&&(n.shift(),n[0]&&e(t({},n[0])))}))};return i.value=function(){for(var e=this,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];return new Promise((function(t,o){if(AJ.has(e)){var s=AJ.get(e),c=s.length;s.push({fn:r,args:i,context:e,resolve:t,reject:o,name:n}),0===c&&a({fn:r,args:i,context:e,resolve:t,reject:o})}else AJ.set(e,[{fn:r,args:i,context:e,resolve:t,reject:o,name:n}]),a({fn:r,args:i,context:e,resolve:t,reject:o})}))},i}}var PJ=(TJ=xJ(),wJ=LG({retries:1,timeout:0,onRetrying:function(e){this.log_.warn("connection timeout, retrying [".concat(e,"]"))},onError:function(e,t,n){e.message.includes("timeout")?t():n(e)}}),EJ=xJ(),RJ=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return function(t,n,i){var r=i.value;return i.value=function(){for(var t=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return new Promise((function(i,o){var s=setTimeout((function(){return o(new Error("".concat(n," timeout")))}),e);r.apply(t,a).then(i,o).finally((function(){clearTimeout(s)}))}))},i}}(),CJ=function(e){d(g,e);var r,s,u,h,p,f,m,_=v(g);function g(e){var t;return o(this,g),(t=_.call(this,e)).remoteStreams_=new Map,t.autoSubscribe=e.autoSubscribe,t.trackState_={audio:e.trackState.audio,video:e.trackState.video,auxiliary:e.trackState.auxiliary,smallVideo:e.trackState.smallVideo},t.ssrc_={audio:0,video:0,auxiliary:0},t.subscribeState_={audio:e.autoSubscribe,video:e.autoSubscribe,auxiliary:e.autoSubscribe,smallVideo:!1},t.isSDPExchanging_=!1,t.installEvents(),t}return c(g,[{key:"getMixUserList",value:function(){return this.mixUserList_?this.mixUserList_.map((function(e){var t=e.userId,n=e.flag;return{userId:t,hasAudio:!!(8&n),hasVideo:!!(1&n),hasAuxiliary:!!(4&n)}})):void 0}},{key:"setMixUserList",value:function(e){(!this.mixUserList_||pC(this.mixUserList_)&&!function(e,t){if(t.length===e.length){var n,r=T(t);try{var a=function(){var t=n.value,i=e.find((function(e){return e.userId===t.userId}));if(!i||i.flag!==t.flag)return{v:!1}};for(r.s();!(n=r.n()).done;){var o=a();if("object"===i(o))return o.v}}catch(s){r.e(s)}finally{r.f()}return!0}return!1}(this.mixUserList_,e))&&(this.mixUserList_=e,this.emitter_.emit(OO.STREAM_UPDATED,{stream:this.getMainStream()}))}},{key:"isMainStreamSubscribed",get:function(){return(this.subscribeState_.audio||this.subscribeState_.video||this.subscribeState_.smallVideo)&&(this.trackState_.audio||this.trackState_.video||this.trackState_.smallVideo)}},{key:"isAuxStreamSubscribed",get:function(){return this.subscribeState_.auxiliary&&this.trackState_.auxiliary}},{key:"isSmallStreamSubscribed",get:function(){return this.subscribeState_.smallVideo&&this.trackState_.smallVideo}},{key:"isBigStreamSubscribed",get:function(){return this.subscribeState_.video&&this.trackState_.video}},{key:"isStreamUnpublished",value:function(e){return e.getType()===zb?!this.trackState_.audio&&!this.trackState_.video:!this.trackState_.auxiliary}},{key:"initialize",value:function(){y(l(g.prototype),"initialize",this).call(this),this.peerConnection_.ontrack=this.onTrack.bind(this)}},{key:"close",value:function(){var e,t,n,i=this;y(l(g.prototype),"close",this).call(this),this.trackState_.audio=!1,this.trackState_.video=!1,this.trackState_.smallVideo=!1,this.trackState_.auxiliary=!1,this.emitConnectionStateChangedEvent(Pk),e=this,t=function(e){e.fn;var t=e.args,n=e.resolve,r=e.reject,a=e.name;if("subscribe"===a){if(!i.client_.getIsJoined())return r(new vP({code:_P.API_CALL_ABORTED,message:ZR({key:EE,data:{message:"leave room",stream:t[0]}})}));if(i.isStreamUnpublished(t[0]))return r(new vP({code:_P.API_CALL_ABORTED,message:ZR({key:EE,data:{message:"remote user ".concat(i.userId_," unpublished stream"),stream:t[0]}})}))}else if("unsubscribe"===a)return n();n()},null===(n=AJ.get(e))||void 0===n||n.forEach(t),AJ.delete(e),this.remoteStreams_.forEach((function(e){var t=e;t.setConnection(null),t.uninstallEvents(),t.getIsStreamAddedEventEmitted()&&i.emitter_.emit(OO.STREAM_REMOVED,{stream:t})})),this.remoteStreams_.clear(),this.uninstallEvents()}},{key:"installEvents",value:function(){var e=this;OC.on(rA,this.onRemoteStreamUpdate,this),this.emitter_.on(OO.ERROR,(function(t){t.getCode()===_P.ICE_TRANSPORT_ERROR&&(e.isFirstConnection_&&(e.isFirstConnection_=!1,oD.logFailedEvent({userId:e.client_.getUserId(),eventType:tI,error:t})),e.isReconnecting_||e.startReconnection())})),this.emitter_.on(OO.CONNECTION_STATE_CHANGED,(function(t){t.state===Mk&&e.isFirstConnection_&&(e.isFirstConnection_=!1,oD.logSuccessEvent({userId:e.client_.getUserId(),eventType:tI}),e.addEventInternal(HP,"downlink-connection is connected"))}))}},{key:"uninstallEvents",value:function(){OC.removeListener(rA,this.onRemoteStreamUpdate,this)}},{key:"onRemoteStreamUpdate",value:function(e){if(this.hitTest(e.tinyId)&&e.client===this.client_){this.updateTrackState(e.action,e.kind);var t=e.kind===Ab?Ek:wk,n=this.remoteStreams_.get(t);if(!n)return;e.action===RI.ADD?this.handleRemoteAddTrack(e.kind,n):this.handleRemoteRemoveTrack(e.kind,n)}}},{key:"handleRemoteAddTrack",value:function(e,t){this.log_.info("remote add ".concat(e," track")),e===Tb?t.updateAudioPlayingState(this.subscribeState_.audio):t.updateVideoPlayingState(e===Ab?this.subscribeState_.auxiliary:this.subscribeState_.video||this.subscribeState_.smallVideo),t.getIsStreamAddedEventEmitted()?this.emitter_.emit(OO.STREAM_UPDATED,{stream:t}):(this.emitter_.emit(OO.STREAM_ADDED,{stream:t}),this.currentState_===Mk&&t.emitConnectionStateChanged({prevState:Pk,state:Mk}))}},{key:"handleRemoteRemoveTrack",value:function(e,t){t.getIsStreamAddedEventEmitted()&&(this.log_.info("remote remove ".concat(e," track")),e===Ab||!this.trackState_.audio&&!this.trackState_.video?(this.log_.info("remote stream ".concat(t.getType()," removed")),this.currentState_===Mk&&t.emitConnectionStateChanged({prevState:Mk,state:Pk}),this.emitter_.emit(OO.STREAM_REMOVED,{stream:t})):(e===Tb?t.updateAudioPlayingState(!1):(e!==Pb||this.isSmallStreamSubscribed)&&t.updateVideoPlayingState(!1),this.emitter_.emit(OO.STREAM_UPDATED,{stream:t})))}},{key:"updateTrackState",value:function(e,t){var n=e===RI.ADD;switch(t){case Tb:this.trackState_.audio=n;break;case wb:this.trackState_.video=n;break;case Ab:this.trackState_.auxiliary=n;break;case Pb:this.trackState_.smallVideo=n}this.log_.info("trackState updated: ".concat(JSON.stringify(this.trackState_)))}},{key:"onTrack",value:function(e){var t=e.streams[0],n=e.track;if(this.log_.info("ontrack() kind: ".concat(n.kind," id: ").concat(n.id," streamId: ").concat(t.id)),this.sdpSemantics_===vI){var i=function(e){var t=pD.parse(e),n={audio:[],video:[]};return t.media.forEach((function(e){if(e.ssrcs){var t=e.ssrcs[0].id>>16&255;if(e.type===Tb)n.audio.push(wk);else if(e.type==wb){var i=t===Rk?wk:Ek;n.video.push(i)}}})),n}(this.peerConnection_.remoteDescription.sdp);if(n.kind===Tb){if(0===i.audio.length||t.id!==wk)return void this.log_.debug("skip this invalid audio track")}else if(-1===i.video.indexOf(t.id))return void this.log_.debug("skip this invalid video track: ".concat(n.id,"  msid: ").concat(t.id))}oD.logEvent({eventType:"ontrack",kind:n.kind});var r=!1,a=this.remoteStreams_.get(t.id),o=t.id===wk?Ck:Ak;if(cC(a)&&((a=new KG({type:o,userId:this.userId_,client:this.client_})).setConnection(this),this.remoteStreams_.set(t.id,a),r=!0),a.setMediaStream(t),n.kind===Tb?a.updateAudioPlayingState(this.subscribeState_.audio):o===Ck?a.updateVideoPlayingState(this.subscribeState_.video||this.subscribeState_.smallVideo):a.updateVideoPlayingState(this.subscribeState_.auxiliary),(o!==Ak||this.trackState_.auxiliary)&&(o!==Ck||this.trackState_.audio||this.trackState_.video)){var s=this.client_.getSubscriptionManager();s&&s.hasAutoRecoveryFlag(this.userId_,o)||(r?this.emitter_.emit(OO.STREAM_ADDED,{stream:a}):this.emitter_.emit(OO.STREAM_UPDATED,{stream:a}))}}},{key:"addRRTRLine",value:function(e){var t=e.split("\r\n"),n=new Map;t.forEach((function(e,i){/^a=rtcp-fb:/.test(e)&&t[i+1]&&!/^a=rtcp-fb:/.test(t[i+1])&&e.match(/^a=rtcp-fb:\d+/)&&n.set(i+1,e.match(/^a=rtcp-fb:\d+/)[0]+" rrtr")}));for(var i=b(n),r=0;r<i.length;r++){var a=S(i[r],2),o=a[0],s=a[1];t.splice(o+r,0,s)}return t.join("\r\n")}},{key:"addSPSDescription",value:function(e){var t=wD(e);return t.media.forEach((function(e){e.type===wb&&e.fmtp.forEach((function(e){e.config+=";sps-pps-idr-in-keyframe=1"}))})),ED(t)}},{key:"removeSDESDescription",value:function(e){var t=["urn:ietf:params:rtp-hdrext:sdes:mid","urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id","urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"],n=wD(e);return n.media.forEach((function(e){e.ext=e.ext.filter((function(e){return!t.includes(e.uri)}))})),ED(n)}},{key:"isSubscriptionStateNotChanged",value:function(e,t){return e.getType()===Ck?(null==t?void 0:t.audio)===this.subscribeState_.audio&&(null==t?void 0:t.video)===this.subscribeState_.video&&this.isSubscribeSmall(t):e.getType()===Ak?!cC(t.video)&&this.subscribeState_.auxiliary===t.video:void 0}},{key:"isSubscribeSmall",value:function(e){return cC(e.smallVideo)&&!this.subscribeState_.smallVideo}},{key:"subscribe",value:(m=a(n().mark((function e(t,i){var r,a,o,s,c,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,o=i.emitEvent,s=void 0===o||o,c=t.getType(),(null===(r=this.peerConnection_)||void 0===r?void 0:r.connectionState)!==Nk&&(null===(a=this.peerConnection_)||void 0===a?void 0:a.connectionState)!==Lk){e.next=6;break}return e.next=6,this.waitForPeerConnectionConnected();case 6:if(!this.isSubscriptionStateNotChanged(t,i)){e.next=13;break}if(this.peerConnection_){e.next=11;break}return this.initialize(),e.next=11,this.connect();case 11:return s&&cC(i.smallVideo)&&this.emitter_.emit(OO.STREAM_SUBSCRIBED,{stream:t,result:!0}),e.abrupt("return",t);case 13:if(c===zb?(cC(i.audio)||(this.subscribeState_.audio=i.audio),cC(i.video)||(this.subscribeState_.video=i.video),this.subscribeState_.smallVideo=(null==i?void 0:i.smallVideo)||!1,this.addEventInternal(this.subscribeState_.audio?EP:CP,this.subscribeState_.audio?"subscribe audio":"unsubscribe audio"),this.addEventInternal(this.subscribeState_.video?EP:CP,this.subscribeState_.video?"subscribe video":"unsubscribe video"),this.addEventInternal(this.subscribeState_.smallVideo?$P:ZP,this.subscribeState_.smallVideo?"subscribe smallVideo":"unsubscribe smallVideo")):cC(i.video)||(this.subscribeState_.auxiliary=i.video),this.log_.info("subscribe ".concat(c," stream with options ").concat(JSON.stringify(i)," current state: ").concat(JSON.stringify(this.subscribeState_))),!this.peerConnection_&&!this.isSDPExchanging_){e.next=23;break}return u=_I,this.isMainStreamSubscribed||this.isAuxStreamSubscribed||(u=mI),e.next=20,this.sendSubscription(u);case 20:c===zb?(t.updateAudioPlayingState(this.subscribeState_.audio),t.updateVideoPlayingState(this.subscribeState_.video||this.subscribeState_.smallVideo)):t.updateVideoPlayingState(this.subscribeState_.auxiliary),e.next=26;break;case 23:return this.initialize(),e.next=26,this.connect();case 26:return s&&this.emitter_.emit(OO.STREAM_SUBSCRIBED,{stream:t,result:!0}),e.abrupt("return",t);case 30:if(e.prev=30,e.t0=e.catch(0),!this.client_.getIsJoined()||!this.isStreamUnpublished(t)){e.next=35;break}throw this.log_.warn("".concat(e.t0.message," ").concat(JSON.stringify(this.trackState_))),new vP({code:_P.REMOTE_STREAM_NOT_EXIST,message:"remote user ".concat(this.userId_," unpublished stream")});case 35:throw e.t0;case 36:case"end":return e.stop()}}),e,this,[[0,30]])}))),function(e,t){return m.apply(this,arguments)})},{key:"unsubscribe",value:(f=a(n().mark((function e(t){var i,r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((i=t.getType())!==zb){e.next=10;break}if(this.isMainStreamSubscribed){e.next=5;break}return this.log_.info("main stream already unsubscribed"),e.abrupt("return",t);case 5:this.subscribeState_.audio=!1,this.subscribeState_.video=!1,this.subscribeState_.smallVideo=!1,e.next=14;break;case 10:if(this.isAuxStreamSubscribed){e.next=13;break}return this.log_.info("auxiliary stream already unsubscribed"),e.abrupt("return",t);case 13:this.subscribeState_.auxiliary=!1;case 14:return r=mI,(i===Ck&&this.isAuxStreamSubscribed||i===Ak&&this.isMainStreamSubscribed)&&(r=_I),this.log_.info("unsubscribe ".concat(i," stream with ").concat(JSON.stringify(this.subscribeState_))),e.next=19,this.sendSubscription(r);case 19:return t.updateVideoPlayingState(!1),t.updateAudioPlayingState(!1),r===mI&&((a=t.getMediaStream())&&a.getTracks().forEach((function(e){return a.removeTrack(e)})),this.closePeerConnection(),this.emitConnectionStateChangedEvent(Pk)),this.addEventInternal(CP,"unsubscribe audio"),this.addEventInternal(RP,"unsubscribe video"),e.abrupt("return",t);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"sendSubscription",value:function(e){var t=this,n={srcTinyId:this.tinyId_,srcUserId:this.userId_},i=aP,r=Qx.UNSUBSCRIBE_RESULT;return e===_I&&(n={audio:this.subscribeState_.audio,bigVideo:this.subscribeState_.video,auxVideo:this.subscribeState_.auxiliary,smallVideo:this.subscribeState_.smallVideo,srcTinyId:this.tinyId_},i=oP,r=Qx.SUBSCRIBE_CHANGE_RESULT),this.signalChannel_.sendWaitForResponse({command:i,data:n,responseCommand:r,timeout:1e4}).then((function(n){var i=n.data;if(0!==i.code){var r=new vP({code:i.code,message:ZR({key:OT,data:{type:e,message:i.message}})});throw t.log_.error(r),r}}))}},{key:"connect",value:(p=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.exchangeSDP();case 3:return e.next=5,this.waitForPeerConnectionConnected();case 5:e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(0),this.closePeerConnection(!0),e.t0;case 11:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return p.apply(this,arguments)})},{key:"exchangeSDP",value:(h=a(n().mark((function e(){var t,i,r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.isSDPExchanging_=!0,e.next=4,this.createOffer();case 4:return this.log_.info("createOffer success, sending offer to remote server"),t=this.peerConnection_.localDescription,i=t.type,r=t.sdp,a={type:i,sdp:r,srcUserId:this.userId_,srcTinyId:this.tinyId_,audio:this.subscribeState_.audio,bigVideo:this.subscribeState_.video,auxVideo:this.subscribeState_.auxiliary,smallVideo:this.subscribeState_.smallVideo},OC.emit(TA,{client:this.client_,connection:this,userId:this.userId_,tinyId:this.tinyId_,role:bk,subscribeState:this.subscribeState_,trackState:this.trackState_}),e.next=10,this.signalChannel_.sendWaitForResponse({command:rP,commandDesc:"exchange sdp",data:a,responseCommand:Qx.SUBSCRIBE_RESULT,timeout:1e4});case 10:if(o=e.sent,this.peerConnection_){e.next=15;break}throw s=new vP({code:_P.INVALID_OPERATION,message:ZR({key:_E})}),this.log_.warn(s),s;case 15:return e.next=17,this.onSubscribeResult(o);case 17:this.isSDPExchanging_=!1,e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(0),this.isSDPExchanging_=!1,e.t0;case 24:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return h.apply(this,arguments)})},{key:"createOffer",value:(u=a(n().mark((function e(){var t,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={voiceActivityDetection:!1},vO()&&this.sdpSemantics_===vI?(this.peerConnection_.addTransceiver(Tb,{direction:"recvonly"}),this.peerConnection_.addTransceiver(wb,{direction:"recvonly"}),this.peerConnection_.addTransceiver(wb,{direction:"recvonly"})):(t.offerToReceiveAudio=!0,t.offerToReceiveVideo=!0),e.next=4,this.peerConnection_.createOffer(t);case 4:return i=e.sent,e.next=7,cO();case 7:return e.sent.isH264DecodeSupported||(this.log_.warn("remove h264 desc from sdp"),i.sdp=(n=i.sdp,r=void 0,(r=wD(n)).media.forEach((function(e){if(e.type===wb){var t=new Set;e.rtp.forEach((function(e){var n=e.payload;return"H264"===e.codec&&t.add(n)})),e.fmtp.forEach((function(e){var n=e.payload,i=e.config.match(/apt=(\d+)/);i&&i[1]&&t.has(Number(i[1]))&&t.add(n)}));var n=function(e){var n=e.payload;return!t.has(n)};e.rtp=e.rtp.filter(n),e.rtcpFb=e.rtcpFb.filter(n),e.fmtp=e.fmtp.filter(n),e.payloads=e.payloads.split(" ").filter((function(e){return!t.has(Number(e))})).join(" ")}})),ED(r))),i.sdp=this.addRRTRLine(i.sdp),i.sdp=this.addSPSDescription(i.sdp),i.sdp=RD(i.sdp),this.sdpSemantics_===vI&&(i.sdp=this.removeSDESDescription(i.sdp)),e.next=16,this.peerConnection_.setLocalDescription(i);case 16:case"end":return e.stop()}var n,r}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"onSubscribeResult",value:(s=a(n().mark((function e(i){var r,a,o,s,c,u,d,l=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i&&i.data||{},a=r.code,o=r.message,s=void 0===o?"":o,c=i&&i.data&&i.data.data||{},u=c.type,d=c.sdp,77393!==a){e.next=5;break}throw this.log_.error(CE.NOT_SUPPORTED_H264DECODE),new vP({code:_P.NOT_SUPPORTED_H264,message:ZR({key:oE})});case 5:if(e.prev=5,0===a){e.next=8;break}throw new vP({code:a,message:ZR({key:LT,data:{errMsg:s}})});case 8:return this.log_.debug("accept remote answer: "+d),e.next=11,this.peerConnection_.setRemoteDescription({type:u,sdp:d});case 11:this.sei_&&(this.sei_.handleEncodedStreams(),this.sei_.onSEIMessage=function(e){l.emitter_.emit(OO.SEI_MESSAGE,t(t({},e),{},{userId:l.userId_}))}),this.updateSSRC(d),e.next=19;break;case 15:throw e.prev=15,e.t0=e.catch(5),this.log_.error(e.t0),e.t0;case 19:case"end":return e.stop()}}),e,this,[[5,15]])}))),function(e){return s.apply(this,arguments)})},{key:"updateSSRC",value:function(e){var t=this;try{wD(e).media.forEach((function(e){if(e.type===Tb){var n=e.ssrcs.find((function(e){return e.value.includes(wk)}));n&&(t.ssrc_.audio=n.id)}else{var i=e.ssrcs.find((function(e){return e.value.includes(wk)})),r=e.ssrcs.find((function(e){return e.value.includes(Ek)}));i&&(t.ssrc_.video=i.id),r&&(t.ssrc_.auxiliary=r.id)}}))}catch(Yq){}}},{key:"setRemoteStream",value:function(e,t){this.remoteStreams_.set(e,t)}},{key:"getSubscribeState",value:function(){return this.subscribeState_}},{key:"getTrackState",value:function(){return this.trackState_}},{key:"getSSRC",value:function(){return this.ssrc_}},{key:"getMainStream",value:function(){return this.remoteStreams_.get(wk)}},{key:"getAuxStream",value:function(){return this.remoteStreams_.get(Ek)}},{key:"getMainStreamVideoTrackId",value:function(){var e=this.getMainStream();if(e){var t=e.getVideoTrack();if(t)return t.id}return""}},{key:"getAuxStreamVideoTrackId",value:function(){var e=this.getAuxStream();if(e){var t=e.getVideoTrack();if(t)return t.id}return""}},{key:"reconnect",value:(r=a(n().mark((function e(){var t,i,r=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(-1===this.reconnectionTimer_){e.next=3;break}return this.log_.warn("reconnect() downlink is reconnecting, ignore current reconnection"),e.abrupt("return");case 3:if(!(this.reconnectionCount_>=30)){e.next=12;break}return this.log_.warn("SDK has tried reconnect downlink [".concat(this.userId_,"] for ").concat(30," times, but all failed, please check your network")),this.stopReconnection(),t=new vP({code:_P.DOWNLINK_RECONNECTION_FAILED,message:ZR({key:NT})}),oD.logFailedEvent({userId:this.client_.getUserId(),eventType:nI,error:t}),this.addEventInternal(YP,"downlink-connection reconnect fail"),this.emitConnectionStateChangedEvent(Pk),this.emitter_.emit(OO.ERROR,t),e.abrupt("return");case 12:if(this.signalChannel_.getCurrentState()===Jx){e.next=16;break}return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"),this.signalChannel_.once(Bx,this.reconnect,this),e.abrupt("return");case 16:if(this.reconnectionCount_++,this.log_.warn("reconnect() try to reconnect downlink [".concat(this.reconnectionCount_,"/").concat(30,"]")),i=oC(this.reconnectionCount_),this.reconnectionTimer_=setTimeout((function(){r.log_.warn("reconnect() downlink [".concat(r.userId_,"] reconnect timeout(").concat(i/1e3,"s), try again")),r.clearReconnectionTimer(),r.reconnect()}),i),!(this.isSDPExchanging_||this.peerConnection_&&this.peerConnection_.connectionState===Lk)){e.next=22;break}return e.abrupt("return");case 22:return e.prev=22,this.closePeerConnection(),this.initialize(),e.next=27,this.connect();case 27:this.stopReconnection(),this.log_.warn("reconnect() downlink reconnect successfully"),oD.logSuccessEvent({userId:this.client_.getUserId(),eventType:nI}),this.addEventInternal(XP,"downlink-connection reconnect success"),this.recoverSubscription(),e.next=36;break;case 34:e.prev=34,e.t0=e.catch(22);case 36:case"end":return e.stop()}}),e,this,[[22,34]])}))),function(){return r.apply(this,arguments)})},{key:"recoverSubscription",value:function(){var e=this,t=this.client_.getSubscriptionManager();t&&b(this.remoteStreams_.values()).forEach((function(n){t.hasAutoRecoveryFlag(e.userId_,n.getType())&&t.recover(n)}))}},{key:"getIsReconnecting",value:function(){return this.isReconnecting_}},{key:"getSubscribedMainStream",value:function(){var e=null;return this.isMainStreamSubscribed&&(e=this.remoteStreams_.get(wk)),e}},{key:"clearReconnectionTimer",value:function(){-1!==this.reconnectionTimer_&&(clearTimeout(this.reconnectionTimer_),this.reconnectionTimer_=-1)}},{key:"startReconnection",value:function(){var e=this.client_.getSubscriptionManager();if(e){var t,n=T(this.remoteStreams_.values());try{for(n.s();!(t=n.n()).done;){var i=t.value,r=i.getType();(r===Ck&&(this.trackState_.audio||this.trackState_.video)||r===Ak&&this.trackState_.auxiliary)&&e.setAutoRecoveryFlag(this.userId_,i.getType())}}catch(a){n.e(a)}finally{n.f()}}y(l(g.prototype),"startReconnection",this).call(this)}},{key:"getCurrentState",value:function(){return this.currentState_}},{key:"hasMainStream",value:function(){return this.trackState_.video||this.trackState_.audio||this.trackState_.smallVideo}},{key:"hasAuxStream",value:function(){return this.trackState_.auxiliary}}]),g}(_G),w(CJ.prototype,"subscribe",[TJ,wJ],Object.getOwnPropertyDescriptor(CJ.prototype,"subscribe"),CJ.prototype),w(CJ.prototype,"unsubscribe",[EJ],Object.getOwnPropertyDescriptor(CJ.prototype,"unsubscribe"),CJ.prototype),w(CJ.prototype,"exchangeSDP",[RJ],Object.getOwnPropertyDescriptor(CJ.prototype,"exchangeSDP"),CJ.prototype),CJ);var DJ=function(){function e(){o(this,e),this.startTime=0,this.endTime=0,this.start()}return c(e,[{key:"start",value:function(){0===this.startTime&&(this.startTime=vC())}},{key:"stop",value:function(){0===this.endTime&&(this.endTime=vC())}},{key:"getDuration",value:function(){return 0===this.endTime?vC()-this.startTime:this.endTime-this.startTime}}]),e}(),OJ=function(){function e(t){o(this,e),this.client_=t.client,this.intervalId_=-1,this.statsCalculator_=t.stats,this.prevStats_=null,this.renderFreezeMap_=new Map,this.remoteStreamMap_=new Map,this.dataFreezeMap_=new Map,this.monitorFreezeData_=new Map}var t,i,r;return c(e,[{key:"installEvents",value:function(){OC.on(yA,this.handlePlayVideoStart,this),OC.on(mA,this.onVideoTrackMuted,this),OC.on(_A,this.onVideoTrackUnmuted,this),OC.on(dA,this.handleStreamStopped,this),OC.on(cA,this.handleStreamStopped,this),OC.on(nA,this.handleVideoPlaying,this)}},{key:"uninstallEvents",value:function(){OC.off(yA,this.handlePlayVideoStart,this),OC.off(mA,this.onVideoTrackMuted,this),OC.off(_A,this.onVideoTrackUnmuted,this),OC.off(dA,this.handleStreamStopped,this),OC.off(cA,this.handleStreamStopped,this),OC.off(nA,this.handleVideoPlaying,this)}},{key:"start",value:function(){var e=this;-1===this.intervalId_&&(this.installEvents(),this.intervalId_=YD.run(a(n().mark((function t(){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.detectFPS();case 3:t.next=7;break;case 5:t.prev=5,t.t0=t.catch(0);case 7:case"end":return t.stop()}}),t,null,[[0,5]])}))),{delay:1e3}))}},{key:"stop",value:function(){-1!==this.intervalId_&&(this.uninstallEvents(),YD.clearTask(this.intervalId_),this.intervalId_=-1,this.renderFreezeMap_.clear(),this.dataFreezeMap_.clear(),this.remoteStreamMap_.clear())}},{key:"onVideoTrackMuted",value:function(e){var t=e.stream;if(t.getClient()===this.client_&&t.isRemote()){var n=t.userId_,i=t.type_,r="".concat(n,"_").concat(i),a=this.dataFreezeMap_.get(r),o=new DJ;a?a.durationItemList.push(o):this.dataFreezeMap_.set(r,{userId:n,type:i,durationItemList:[o],isFreezing:function(){var e=this.durationItemList[this.durationItemList.length-1];return e&&0===e.endTime}})}}},{key:"onVideoTrackUnmuted",value:function(e){var t=e.stream;if(t.getClient()===this.client_&&t.isRemote()){var n=t.userId_,i=t.type_,r="".concat(n,"_").concat(i);this.stopDataFreeze({key:r,userId:n,type:i})}}},{key:"handleStreamStopped",value:function(e){var t=e.client,n=e.stream;if(t===this.client_){var i=n.getUserId(),r=n.getType(),a="".concat(i,"_").concat(r);this.stopDataFreeze({key:a,userId:i,type:r})}}},{key:"stopDataFreeze",value:function(e){var t=e.key,n=e.userId,i=e.type,r=this.dataFreezeMap_.get(t);if(r&&r.isFreezing()){var a=r.durationItemList[r.durationItemList.length-1];a.stop();var o=a.getDuration();o>500?(oD.logEvent({eventType:"videoFrozenCount",delta:o}),this.monitorFreezeData_.set(t,{userId:n,type:i,duration:o})):r.durationItemList.pop()}}},{key:"getTotalDuration",value:function(e){return e.reduce((function(e,t){var n=t.getDuration();return e+Math.min(n,5e3)}),0)}},{key:"getStats",value:(r=a(n().mark((function e(){var t,i,r,a,o,s,c,u,d,l,h;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.client_.getConnections(),i={},r=T(t),e.prev=3,r.s();case 5:if((a=r.n()).done){e.next=20;break}if(o=S(a.value,2),s=o[0],(c=o[1]).getPeerConnection()){e.next=9;break}return e.abrupt("continue",18);case 9:return u=c.getSubscribeState(),d=c.getTrackState(),e.next=13,this.statsCalculator_.getReceiverStats(c);case 13:l=e.sent,(h={userId:l.userId,tinyId:s,hasVideo:d.video&&u.video,hasAuxiliary:d.auxiliary&&u.auxiliary,video:{framesDecoded:0},auxiliary:{framesDecoded:0}}).hasVideo&&(h.video.framesDecoded=l.video.framesDecoded),h.hasAuxiliary&&(h.auxiliary.framesDecoded=l.auxiliary.framesDecoded),i[l.userId]=h;case 18:e.next=5;break;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(3),r.e(e.t0);case 25:return e.prev=25,r.f(),e.finish(25);case 28:return e.abrupt("return",i);case 29:case"end":return e.stop()}}),e,this,[[3,22,25,28]])}))),function(){return r.apply(this,arguments)})},{key:"detectFPS",value:(i=a(n().mark((function e(){var t,i,r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getStats();case 2:if(t=e.sent,this.prevStats_){e.next=6;break}return this.prevStats_=t,e.abrupt("return");case 6:e.t0=n().keys(t);case 7:if((e.t1=e.t0()).done){e.next=17;break}if(i=e.t1.value,this.prevStats_[i]){e.next=11;break}return e.abrupt("continue",7);case 11:r=t[i].tinyId,a=this.client_.getMutedStates(),t[i].hasVideo&&this.prevStats_[i].hasVideo&&a.has(r)&&!a.get(r).videoMuted&&(o=t[i].video.framesDecoded-this.prevStats_[i].video.framesDecoded,this.handleRenderFreeze({userId:i,type:Ck,fps:o})),t[i].hasAuxiliary&&this.prevStats_[i].hasAuxiliary&&(s=t[i].auxiliary.framesDecoded-this.prevStats_[i].auxiliary.framesDecoded,this.handleRenderFreeze({userId:i,type:Ak,fps:s})),e.next=7;break;case 17:this.prevStats_=t;case 18:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"handleRenderFreeze",value:(t=a(n().mark((function e(t){var i,r,a,o,s,c,u,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=t.userId,r=t.fps,a=t.type,o="".concat(i,"_").concat(a),s=this.renderFreezeMap_.get(o),r<=2?(c=vC(),s&&!s.isFreeze&&(s.freezeTimeline.push({startTime:c,endTime:void 0}),s.isFreeze=!0),s||this.renderFreezeMap_.set(o,{userId:i,type:a,isFreeze:!0,freezeTimeline:[{startTime:c,endTime:void 0}],renderFreezeTotal:0})):s&&s.isFreeze&&(s.isFreeze=!1,(u=s.freezeTimeline.pop()).endTime=vC(),d=u.endTime-u.startTime,s.freezeTimeline.push(u),s.renderFreezeTotal+=Math.min(5e3,d));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"handlePlayVideoStart",value:function(e){var t=e.stream;if(t.getClient()===this.client_&&t.isRemote()&&t.hasVideo()){var n="".concat(t.getUserId(),"_").concat(t.getType());this.remoteStreamMap_.has(n)||this.remoteStreamMap_.set(n,{isPlayingFired:!1})}}},{key:"handleVideoPlaying",value:function(e){var t=e.stream;if(t.isRemote()&&t.getClient()===this.client_){var n="".concat(t.getUserId(),"_").concat(t.getType());if(this.remoteStreamMap_.has(n))this.remoteStreamMap_.get(n).isPlayingFired=!0}}},{key:"getDataFreezeDuration",value:function(e){var t={dataFreeze:0,count:0},n=this.dataFreezeMap_.get(e);if(n){if(n.isFreezing()){var i=n.durationItemList[n.durationItemList.length-1];i.stop(),i.getDuration()<500&&n.durationItemList.pop()}t.dataFreeze=this.getTotalDuration(n.durationItemList),t.count=n.durationItemList.length}return t}},{key:"getRenderFreezeDuration",value:function(e){var t=this.renderFreezeMap_.get(e),n=0,i=0;if(t)if(t.isFreeze){var r=vC()-t.freezeTimeline[t.freezeTimeline.length-1].startTime;n=t.renderFreezeTotal+Math.min(r,5e3),i=t.freezeTimeline.length}else n=t.renderFreezeTotal;return{renderFreeze:n,count:i}}},{key:"getMonitorFreeze",value:function(){return this.monitorFreezeData_}},{key:"isBlackStream",value:function(e){return!!this.remoteStreamMap_.has(e)&&!this.remoteStreamMap_.get(e).isPlayingFired}},{key:"resetMonitor",value:function(){this.monitorFreezeData_.clear()}}]),e}(),MJ=c((function e(t){o(this,e),this.userId=t.userId,this.tinyId=t.tinyId,this.role=t.role===bk?Ik:Tk})),NJ={exports:{}};!function(e){!function(t){function n(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function i(e,t,i,r,a,o){return n((s=n(n(t,e),n(r,o)))<<(c=a)|s>>>32-c,i);var s,c}function r(e,t,n,r,a,o,s){return i(t&n|~t&r,e,t,a,o,s)}function a(e,t,n,r,a,o,s){return i(t&r|n&~r,e,t,a,o,s)}function o(e,t,n,r,a,o,s){return i(t^n^r,e,t,a,o,s)}function s(e,t,n,r,a,o,s){return i(n^(t|~r),e,t,a,o,s)}function c(e,t){var i,c,u,d,l;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var h=1732584193,p=-271733879,f=-1732584194,m=271733878;for(i=0;i<e.length;i+=16)c=h,u=p,d=f,l=m,h=r(h,p,f,m,e[i],7,-680876936),m=r(m,h,p,f,e[i+1],12,-389564586),f=r(f,m,h,p,e[i+2],17,606105819),p=r(p,f,m,h,e[i+3],22,-1044525330),h=r(h,p,f,m,e[i+4],7,-176418897),m=r(m,h,p,f,e[i+5],12,1200080426),f=r(f,m,h,p,e[i+6],17,-1473231341),p=r(p,f,m,h,e[i+7],22,-45705983),h=r(h,p,f,m,e[i+8],7,1770035416),m=r(m,h,p,f,e[i+9],12,-1958414417),f=r(f,m,h,p,e[i+10],17,-42063),p=r(p,f,m,h,e[i+11],22,-1990404162),h=r(h,p,f,m,e[i+12],7,1804603682),m=r(m,h,p,f,e[i+13],12,-40341101),f=r(f,m,h,p,e[i+14],17,-1502002290),h=a(h,p=r(p,f,m,h,e[i+15],22,1236535329),f,m,e[i+1],5,-165796510),m=a(m,h,p,f,e[i+6],9,-1069501632),f=a(f,m,h,p,e[i+11],14,643717713),p=a(p,f,m,h,e[i],20,-373897302),h=a(h,p,f,m,e[i+5],5,-701558691),m=a(m,h,p,f,e[i+10],9,38016083),f=a(f,m,h,p,e[i+15],14,-660478335),p=a(p,f,m,h,e[i+4],20,-405537848),h=a(h,p,f,m,e[i+9],5,568446438),m=a(m,h,p,f,e[i+14],9,-1019803690),f=a(f,m,h,p,e[i+3],14,-187363961),p=a(p,f,m,h,e[i+8],20,1163531501),h=a(h,p,f,m,e[i+13],5,-1444681467),m=a(m,h,p,f,e[i+2],9,-51403784),f=a(f,m,h,p,e[i+7],14,1735328473),h=o(h,p=a(p,f,m,h,e[i+12],20,-1926607734),f,m,e[i+5],4,-378558),m=o(m,h,p,f,e[i+8],11,-2022574463),f=o(f,m,h,p,e[i+11],16,1839030562),p=o(p,f,m,h,e[i+14],23,-35309556),h=o(h,p,f,m,e[i+1],4,-1530992060),m=o(m,h,p,f,e[i+4],11,1272893353),f=o(f,m,h,p,e[i+7],16,-155497632),p=o(p,f,m,h,e[i+10],23,-1094730640),h=o(h,p,f,m,e[i+13],4,681279174),m=o(m,h,p,f,e[i],11,-358537222),f=o(f,m,h,p,e[i+3],16,-722521979),p=o(p,f,m,h,e[i+6],23,76029189),h=o(h,p,f,m,e[i+9],4,-640364487),m=o(m,h,p,f,e[i+12],11,-421815835),f=o(f,m,h,p,e[i+15],16,530742520),h=s(h,p=o(p,f,m,h,e[i+2],23,-995338651),f,m,e[i],6,-198630844),m=s(m,h,p,f,e[i+7],10,1126891415),f=s(f,m,h,p,e[i+14],15,-1416354905),p=s(p,f,m,h,e[i+5],21,-57434055),h=s(h,p,f,m,e[i+12],6,1700485571),m=s(m,h,p,f,e[i+3],10,-1894986606),f=s(f,m,h,p,e[i+10],15,-1051523),p=s(p,f,m,h,e[i+1],21,-2054922799),h=s(h,p,f,m,e[i+8],6,1873313359),m=s(m,h,p,f,e[i+15],10,-30611744),f=s(f,m,h,p,e[i+6],15,-1560198380),p=s(p,f,m,h,e[i+13],21,1309151649),h=s(h,p,f,m,e[i+4],6,-145523070),m=s(m,h,p,f,e[i+11],10,-1120210379),f=s(f,m,h,p,e[i+2],15,718787259),p=s(p,f,m,h,e[i+9],21,-343485551),h=n(h,c),p=n(p,u),f=n(f,d),m=n(m,l);return[h,p,f,m]}function u(e){var t,n="",i=32*e.length;for(t=0;t<i;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function d(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var i=8*e.length;for(t=0;t<i;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function l(e){var t,n,i="0123456789abcdef",r="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),r+=i.charAt(t>>>4&15)+i.charAt(15&t);return r}function h(e){return unescape(encodeURIComponent(e))}function p(e){return function(e){return u(c(d(e),8*e.length))}(h(e))}function f(e,t){return function(e,t){var n,i,r=d(e),a=[],o=[];for(a[15]=o[15]=void 0,r.length>16&&(r=c(r,8*e.length)),n=0;n<16;n+=1)a[n]=909522486^r[n],o[n]=1549556828^r[n];return i=c(a.concat(d(t)),512+8*t.length),u(c(o.concat(i),640))}(h(e),h(t))}function m(e,t,n){return t?n?f(t,e):l(f(t,e)):n?p(e):l(p(e))}e.exports?e.exports=m:t.md5=m}(E)}(NJ);var LJ=NJ.exports,UJ=function(){function e(t){o(this,e),this.client_=t.client,this.signalChannel_=t.signalChannel,this.log_=MA.createLogger({id:"mix|"+this.client_.getUserId(),userId:t.client.getUserId(),sdkAppId:t.client.getSDKAppId()}),this.isMixing_=!1,this.config_=null,this.data_=null,this.remoteStreamMap_=new Map,this.installEvents()}var t,i,r,s;return c(e,[{key:"isPresetLayoutMode",get:function(){return this.config_&&this.config_.mode===yI.PRESET_LAYOUT}},{key:"installEvents",value:function(){OC.on(sA,this.onStreamSubscribed,this),OC.on(cA,this.onStreamUnsubscribed,this),this.client_.on("stream-removed",this.onStreamRemoved,this)}},{key:"uninstallEvents",value:function(){OC.off(sA,this.onStreamSubscribed,this),OC.off(cA,this.onStreamUnsubscribed,this),this.client_.off("stream-removed",this.onStreamRemoved,this)}},{key:"reset",value:function(){this.uninstallEvents(),this.isMixing_=!1,this.config_=null}},{key:"onStreamSubscribed",value:function(e){var t=e.client,n=e.stream;t===this.client_&&(this.remoteStreamMap_.set(n.getId(),{remoteStream:n,isUsed:!1}),this.isMixing_&&this.hasAvailablePlaceHolder()&&this.startMixTranscode(this.config_))}},{key:"onStreamUnsubscribed",value:function(e){var t=e.client,n=e.stream;t===this.client_&&this.onStreamRemoved({stream:n})}},{key:"onStreamRemoved",value:function(e){var t=e.stream;if(this.remoteStreamMap_.has(t.getId())){var n=this.remoteStreamMap_.get(t.getId()).isUsed;this.remoteStreamMap_.delete(t.getId()),this.isMixing_&&this.isPresetLayoutMode&&n&&this.startMixTranscode(this.config_)}}},{key:"startMixTranscode",value:(s=a(n().mark((function e(t){var i,r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.resetIsUsedFlag(),this.config_=t,i=this.getInputParam(t,this.remoteStreamMap_),r=this.getOutputParam(t),a=this.getOutputSessionId({config:t,roomId:this.client_.getRoomId(),userId:this.client_.getUserId()}),!this.isMixing_||!this.data_||a===this.data_.outputSessionId){e.next=10;break}return this.log_.info("startMixTranscode() streamId changed, stop mixing before start"),e.next=10,this.doStopMixTranscode();case 10:return e.next=12,this.doStartMixTranscode({outputSessionId:a,inputParam:i,outputParam:r});case 12:e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(0),this.resetIsUsedFlag(),e.t0;case 18:case"end":return e.stop()}}),e,this,[[0,14]])}))),function(e){return s.apply(this,arguments)})},{key:"doStartMixTranscode",value:(r=a(n().mark((function e(t){var i,r,a,o,s,c,u,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.outputSessionId,r=t.inputParam,a=t.outputParam,o={roomId:String(this.client_.getRoomId()),mcuRequestTime:Date.now(),outputSessionId:i,inputParam:r,outputParam:a},this.data_=o,this.log_.info("startMixTranscode: ".concat(JSON.stringify(o))),this.isMixing_=!0,e.prev=5,e.next=8,this.signalChannel_.sendWaitForResponse({command:lP,data:o,timeout:5e3,responseCommand:Qx.START_MIX_TRANSCODE_RES,commandDesc:"startMixTranscode"});case 8:if(s=e.sent,c=s.data,u=c.code,d=c.message,0===u){e.next=15;break}throw-102083===u&&(d="Please enable relayed-push in ".concat(QI," and try later, refer to ").concat(YI,"tutorial-26-advanced-publish-cdn-stream.html")),this.log_.error("startMixTranscode failed, errCode: ".concat(u," errMsg: ").concat(d)),this.isMixing_=!1,new vP({code:_P.START_MIX_TRANSCODE_FAILED,message:ZR({key:jw,data:{message:d},link:{className:"Client",fnName:"startMixTranscode"}})});case 15:e.next=21;break;case 17:throw e.prev=17,e.t0=e.catch(5),this.isMixing_=!1,e.t0;case 21:case"end":return e.stop()}}),e,this,[[5,17]])}))),function(e){return r.apply(this,arguments)})},{key:"reStartMixTranscode",value:function(){this.isMixing_&&this.startMixTranscode(this.config_)}},{key:"stopMixTranscode",value:(i=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMixing_){e.next=2;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Bw})});case 2:return e.next=4,this.doStopMixTranscode();case 4:this.resetIsUsedFlag();case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"doStopMixTranscode",value:(t=a(n().mark((function e(){var t,i,r,a,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={mcuRequestTime:Date.now(),outputSessionId:this.data_.outputSessionId,streamType:this.data_.outputParam.streamType},this.log_.info("stopMixTranscode: ".concat(JSON.stringify(t))),e.next=4,this.signalChannel_.sendWaitForResponse({command:hP,data:t,timeout:5e3,responseCommand:Qx.STOP_MIX_TRANSCODE_RES,commandDesc:"stopMixTranscode"});case 4:if(i=e.sent,r=i.data,a=r.code,o=r.message,0!==a){e.next=10;break}this.isMixing_=!1,e.next=12;break;case 10:throw this.log_.error("stopMixTranscode failed, errCode: ".concat(a," errMsg: ").concat(o)),new vP({code:_P.STOP_MIX_TRANSCODE_FAILED,message:ZR({key:Fw,data:{message:o},link:{className:"Client",fnName:"stopMixTranscode"}})});case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getOutputSessionId",value:function(e){var t=e.config,n=e.userId,i=e.roomId;return uC(t.streamId)&&t.streamId.length>0?t.streamId:LJ("".concat(i,"_").concat(n,"_main"))}},{key:"getInputParam",value:function(e,t){var n=this,i=e.mixUsers.map((function(e){return{userId:e.userId,roomId:String(e.roomId||n.client_.getRoomId()),width:e.width||0,height:e.height||0,locationX:e.locationX||0,locationY:e.locationY||0,zOrder:e.zOrder,streamType:cC(e.streamType)||e.streamType!==Ak?0:1,inputType:e.pureAudio?bI.IT_PURE_AUDIO:bI.IT_AUDIO_VIDEO,renderMode:e.renderMode||0}}));return e.mode===yI.PRESET_LAYOUT&&(i.forEach((function(e){if(e.userId===SI.REMOTE){var n=b(t.values()).find((function(e){return!e.isUsed}));n&&(e.userId=n.remoteStream.getUserId(),e.streamType=n.remoteStream.getType()===Ak?1:0,n.isUsed=!0)}})),i=i.filter((function(e){return e.userId!==SI.REMOTE}))),i}},{key:"getOutputParam",value:function(e){var t=e.streamId||"";return{streamId:t,streamType:t.length>0?1:0,width:cC(e.videoWidth)?640:e.videoWidth,height:cC(e.videoHeight)?480:e.videoHeight,videoBps:e.videoBitrate||0,fps:e.videoFramerate||15,gop:e.videoGOP||2,audioSampleRate:e.audioSampleRate||48e3,audioBps:e.audioBitrate||64,audioChannels:e.audioChannels||1,backgroundColor:e.backgroundColor||0,backgroundImg:e.backgroundImage||"",extraInfo:"",videoCodec:2,audioCodec:0}}},{key:"hasAvailablePlaceHolder",value:function(){return!!this.isPresetLayoutMode&&this.data_.inputParam.length!==this.config_.mixUsers.length}},{key:"resetIsUsedFlag",value:function(){this.remoteStreamMap_.forEach((function(e){return e.isUsed=!1}))}}]),e}(),VJ=function(){function e(t){o(this,e),this.client_=t.client,this.signalChannel_=t.signalChannel,this.publishTencentMainStreamObj_={params_:null,streamId_:void 0,isPublishing_:!1},this.publishTencentAuxStreamObj_={params_:null,streamId_:void 0,isPublishing_:!1},this.publishGivenCDNData_=null,this.isPublishingGivenCDN_=!1}var t,i,r,s,u,d;return c(e,[{key:"setSignalChannel",value:function(e){this.signalChannel_=e.signalChannel}},{key:"getIsPublishingTencentCDN",value:function(){return this.publishTencentMainStreamObj_.isPublishing_||this.publishTencentAuxStreamObj_.isPublishing_}},{key:"getIsPublishingGivenCDN",value:function(){return this.isPublishingGivenCDN_}},{key:"generatePublishCDNStreamId",value:function(e,t){if(!e){var n="".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_").concat(t);return/^[A-Za-z\d_-]*$/.test(n)||(n=LJ(n)),"".concat(this.client_.getSDKAppId(),"_").concat(n)}return e}},{key:"generatePublishCDNSessionId",value:function(e){return LJ("".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_").concat(e))}},{key:"startPublishTencentCDN",value:(d=a(n().mark((function e(t){var i,r,a,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamType===xb?(this.publishTencentAuxStreamObj_.params_=t,this.publishTencentAuxStreamObj_.isPublishing_=!0):(this.publishTencentMainStreamObj_.params_=t,this.publishTencentMainStreamObj_.isPublishing_=!0),this.client_.isJoined_){e.next=3;break}return e.abrupt("return");case 3:return i=this.generatePublishCDNStreamId(t.streamId,t.streamType),r=this.generatePublishCDNSessionId(t.streamType),a=t.streamType===xb?1:0,o={requestTime:Date.now(),sessionId:r,streamId:i,streamType:a},e.next=9,this.doStartPublishTencentCDN(o,t.streamType);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"doStartPublishTencentCDN",value:(u=a(n().mark((function e(t,i){var r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,MA.info("startPublishTencentCDN: "+JSON.stringify(t)),e.next=4,this.signalChannel_.sendWaitForResponseWithRetry({command:sP,data:t,timeout:2e3,responseCommand:Qx.START_PUBLISH_TENCENT_CDN_RES,commandDesc:"startPublishCDNStream",retries:2});case 4:if(r=e.sent,a=r.data,o=a.code,s=a.message,0!==o){e.next=10;break}i===xb?this.publishTencentAuxStreamObj_.streamId_=t.streamId:this.publishTencentMainStreamObj_.streamId_=t.streamId,e.next=14;break;case 10:throw i===xb?this.publishTencentAuxStreamObj_.isPublishing_=!1:this.publishTencentMainStreamObj_.isPublishing_=!1,-102083===o&&(s="Please enable relayed-push in ".concat(QI," and try later, refer to ").concat(YI,"tutorial-26-advanced-publish-cdn-stream.html")),MA.error("startPublishTencentCDN failed, errCode: ".concat(o,", errMsg: ").concat(s)),new vP({code:_P.START_PUBLISH_CDN_FAILED,message:ZR({key:lw,data:{message:s},link:{className:"Client",fnName:"startPublishCDNStream"}})});case 14:e.next=20;break;case 16:throw e.prev=16,e.t0=e.catch(0),i===xb?this.publishTencentAuxStreamObj_.isPublishing_=!1:this.publishTencentMainStreamObj_.isPublishing_=!1,e.t0;case 20:case"end":return e.stop()}}),e,this,[[0,16]])}))),function(e,t){return u.apply(this,arguments)})},{key:"resetPublishTencentParam",value:function(e){e===zb&&(this.publishTencentMainStreamObj_={params_:null,streamId_:void 0,isPublishing_:!1}),e===xb&&(this.publishTencentAuxStreamObj_={params_:null,streamId_:void 0,isPublishing_:!1})}},{key:"stopPublishTencentCDN",value:(s=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.client_.isJoined_){e.next=4;break}return this.resetPublishTencentParam(zb),this.resetPublishTencentParam(xb),e.abrupt("return");case 4:if(!this.publishTencentMainStreamObj_.isPublishing_){e.next=7;break}return e.next=7,this.doStopPublishTencentCDN(zb);case 7:if(!this.publishTencentAuxStreamObj_.isPublishing_){e.next=10;break}return e.next=10,this.doStopPublishTencentCDN(xb);case 10:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"doStopPublishTencentCDN",value:(r=a(n().mark((function e(t){var i,r,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={requestTime:Date.now(),sessionId:LJ("".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_").concat(t))},MA.info("stopPublishTencentCDN: "+JSON.stringify(i)),e.next=4,this.signalChannel_.sendWaitForResponse({command:cP,data:i,timeout:5e3,responseCommand:Qx.STOP_PUBLISH_TENCENT_CDN_RES,commandDesc:"stopPublishCDNStream"});case 4:if(r=e.sent,a=r.data,o=a.code,s=a.message,0!==o){e.next=10;break}this.resetPublishTencentParam(t),e.next=17;break;case 10:if(-102069!==o){e.next=15;break}MA.warn("stopPublishTencentCDN failed, can not stopPublishTencentCDN in auto relayed-push mode"),this.resetPublishTencentParam(t),e.next=17;break;case 15:throw MA.error("stopPublishTencentCDN failed, errCode: ".concat(o," errMsg: ").concat(s)),new vP({code:_P.STOP_PUBLISH_CDN_FAILED,message:ZR({key:hw,data:{message:s},link:{className:"Client",fnName:"stopPublishCDNStream"}})});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"startPublishGivenCDN",value:(i=a(n().mark((function e(t){var i,r,a,o,s,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.streamType===zb?this.publishTencentMainStreamObj_.streamId_:this.publishTencentAuxStreamObj_.streamId_,r={pushRequestTime:Date.now(),pushAppId:t.appId,pushBizId:t.bizId,pushCdnUrl:t.url,pushStreamType:t.streamType,pushStreamId:i},MA.info("startPublishGivenCDN: "+JSON.stringify(r)),this.publishGivenCDNData_=r,this.isPublishingGivenCDN_=!0,this.client_.isJoined_){e.next=7;break}return e.abrupt("return");case 7:return e.prev=7,e.next=10,this.signalChannel_.sendWaitForResponse({command:uP,data:r,timeout:5e3,responseCommand:Qx.START_PUBLISH_GIVEN_CDN_RES,commandDesc:"startPublishCDNStream"});case 10:if(a=e.sent,o=a.data,s=o.code,c=o.message,0===s){e.next=17;break}throw MA.error("startPublishGivenCDN failed, errCode: ".concat(s,", errMsg: ").concat(c)),this.publishGivenCDNData_=null,this.isPublishingGivenCDN_=!1,new vP({code:_P.START_PUBLISH_CDN_FAILED,message:ZR({key:lw,data:{message:c},link:{className:"Client",fnName:"startPublishCDNStream"}})});case 17:e.next=24;break;case 19:throw e.prev=19,e.t0=e.catch(7),this.publishGivenCDNData_=null,this.isPublishingGivenCDN_=!1,e.t0;case 24:case"end":return e.stop()}}),e,this,[[7,19]])}))),function(e){return i.apply(this,arguments)})},{key:"stopPublishGivenCDN",value:(t=a(n().mark((function e(){var t,i,r,a,o,s,c,u,d,l;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.client_.isJoined_){e.next=4;break}return this.publishGivenCDNData_=null,this.isPublishingGivenCDN_=!1,e.abrupt("return");case 4:return t=this.publishGivenCDNData_,i=t.pushAppId,r=t.pushBizId,a=t.pushCdnUrl,o=t.pushStreamType,s={pushRequestTime:Date.now(),pushAppId:i,pushBizId:r,pushCdnUrl:a,pushStreamType:o},MA.info("stopPublishGivenCDN: "+JSON.stringify(s)),e.next=9,this.signalChannel_.sendWaitForResponse({command:dP,data:s,timeout:5e3,responseCommand:Qx.STOP_PUBLISH_GIVEN_CDN_RES,commandDesc:"stopPublishCDNStream"});case 9:if(c=e.sent,u=c.data,d=u.code,l=u.message,0!==d){e.next=16;break}this.publishGivenCDNData_=null,this.isPublishingGivenCDN_=!1,e.next=18;break;case 16:throw MA.error("stopPublishGivenCDN failed, errCode: ".concat(d," errMsg: ").concat(l)),new vP({code:_P.STOP_PUBLISH_CDN_FAILED,message:ZR({key:hw,data:{message:l},link:{className:"Client",fnName:"stopPublishCDNStream"}})});case 18:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"handleCDNConfigForJoinData",value:function(e){var t,n=e;if(this.publishTencentMainStreamObj_.isPublishing_||this.publishTencentAuxStreamObj_.isPublishing_){var i={};uC(n)&&(i=JSON.parse(n)),i.Str_uc_params||(i.Str_uc_params={}),this.publishTencentMainStreamObj_.isPublishing_&&(this.publishTencentMainStreamObj_.streamId_?i.Str_uc_params.userdefine_streamid_main=this.publishTencentMainStreamObj_.streamId_:this.publishTencentMainStreamObj_.params_&&(i.Str_uc_params.userdefine_streamid_main=this.generatePublishCDNStreamId(this.publishTencentMainStreamObj_.params_.streamId,zb))),this.publishTencentAuxStreamObj_.isPublishing_&&(this.publishTencentAuxStreamObj_.streamId_?i.Str_uc_params.userdefine_streamid_aux=this.publishTencentAuxStreamObj_.streamId_:this.publishTencentAuxStreamObj_.params_&&(i.Str_uc_params.userdefine_streamid_aux=this.generatePublishCDNStreamId(this.publishTencentAuxStreamObj_.params_.streamId,xb))),n=JSON.stringify(i)}if(this.isPublishingGivenCDN_){var r=this.publishGivenCDNData_,a=r.pushAppId,o=r.pushBizId,s=r.pushCdnUrl,c=r.pushStreamType,u=r.pushStreamId;t={pushRequestTime:Date.now(),pushAppId:a,pushBizId:o,pushCdnUrl:s,pushStreamType:c,pushStreamId:u}}return{bussinessInfo:n,pushUserCdnInfo:t}}},{key:"reset",value:function(){this.resetPublishTencentParam(zb),this.resetPublishTencentParam(xb),this.publishGivenCDNData_=null,this.isPublishingGivenCDN_=!1}}]),e}(),jJ=function(){function e(t){o(this,e),this.client_=t.client,this.durationMap_=new Map,this.installEvents()}return c(e,[{key:"installEvents",value:function(){OC.on(sA,this.handleSubscribed,this),OC.on(rA,this.handleStreamTrackUpdated,this),OC.on(cA,this.handleStreamStopped,this),OC.on(dA,this.handleStreamStopped,this)}},{key:"uninstallEvents",value:function(){OC.off(sA,this.handleSubscribed,this),OC.off(rA,this.handleStreamTrackUpdated,this),OC.off(cA,this.handleStreamStopped,this),OC.off(dA,this.handleStreamStopped,this)}},{key:"handleSubscribed",value:function(e){var t=e.client,n=e.stream;if(t===this.client_){var i=n.getUserId(),r=n.getType(),a="".concat(i,"_").concat(r);if(n.hasAudio())if(n.isMainAudioSubscribed){var o=new DJ,s=this.durationMap_.get(a);s?this.isRecording(s.audio)||s.audio.push(o):this.durationMap_.set(a,{userId:i,type:r,audio:[o],video:[]})}else this.stopDurationItem(a,Tb);if(n.hasVideo())if(r===Ck&&n.isMainVideoSubscribed||r===Ak&&n.isAuxVideoSubscribed){var c=new DJ,u=this.durationMap_.get(a);u?this.isRecording(u.video)||u.video.push(c):this.durationMap_.set(a,{userId:i,type:r,audio:[],video:[c]})}else this.stopDurationItem(a,wb)}}},{key:"handleStreamStopped",value:function(e){var t=e.client,n=e.stream;if(this.clientHitTest(t)){var i=n.getUserId(),r=n.getType(),a="".concat(i,"_").concat(r);this.stopDurationItem(a,Tb),this.stopDurationItem(a,wb)}}},{key:"handleStreamTrackUpdated",value:function(e){var t=e.client,n=e.userId,i=e.tinyId,r=e.kind,a=e.action;if(this.clientHitTest(t)&&this.client_.getConnections().has(i)){var o=r===Ab?r:Ck,s="".concat(n,"_").concat(o);if(a===RI.ADD){var c=this.client_.getConnections().get(i).getSubscribeState();if(r===Tb&&!c.audio||r===wb&&!c.video||r===Ab&&!c.auxiliary)return;var u=new DJ,d=this.durationMap_.get(s);d?(r!==Tb||this.isRecording(d.audio)||d.audio.push(u),r===Tb||this.isRecording(d.video)||d.video.push(u)):this.durationMap_.set(s,{userId:n,type:o,audio:r===Tb?[u]:[],video:r===Tb?[]:[u]})}else this.stopDurationItem(s,r===Tb?Tb:wb)}}},{key:"isRecording",value:function(e){return e.findIndex((function(e){return 0===e.endTime}))>=0}},{key:"stopDurationItem",value:function(e,t){if(this.durationMap_.has(e)){var n=this.durationMap_.get(e)[t].find((function(e){return 0===e.endTime}));n&&n.stop()}}},{key:"clientHitTest",value:function(e){return this.client_===e}},{key:"getDuration",value:function(e,t){return this.durationMap_.has(e)?this.durationMap_.get(e)[t].reduce((function(e,t){return e+t.getDuration()}),0):0}},{key:"getDurationMap",value:function(){return this.durationMap_}},{key:"reset",value:function(){this.durationMap_.clear()}},{key:"destroy",value:function(){this.client_=null,this.uninstallEvents()}}]),e}();function FJ(){return function(e,t,i){var r=i.value,o=new Set;return i.value=a(n().mark((function e(){var i,a,s,c,u=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.has(this)){e.next=2;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:TT,data:{name:t}})});case 2:for(e.prev=2,o.add(this),i=u.length,a=new Array(i),s=0;s<i;s++)a[s]=u[s];return e.next=7,r.apply(this,a);case 7:return c=e.sent,o.delete(this),e.abrupt("return",c);case 12:throw e.prev=12,e.t0=e.catch(2),o.delete(this),e.t0;case 16:case"end":return e.stop()}}),e,this,[[2,12]])}))),i}}var BJ=lt,HJ=Vt;Tr({target:"Date",proto:!0,arity:1,forced:x((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=BJ(this),n=HJ(t,"number");return"number"!=typeof n||isFinite(n)?t.toISOString():null}});var WJ=N;Tr({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return WJ(URL.prototype.toString,this)}});var GJ=null,zJ=!0;function JJ(e){lC(e)&&e!==zJ&&(zJ=e,MA.info("setIsNeedToSchedule "+e))}function qJ(e,t){try{if(PerformanceObserver){var n=vC(),i=YJ(e,zb),r=YJ(e,Jb),a=new PerformanceObserver((function(e){e.getEntries().forEach((function(e){if(e.startTime>=n&&(e.name===i||e.name===r)){var o=e.name===i?zb:Jb;if(e.code&&200!==e.code)return void MA.warn("".concat(o," schedule with code ").concat(e.code,", ").concat(JSON.stringify(e.toJSON())));var s=e.responseEnd-e.startTime,c=[e.domainLookupStart-e.startTime,e.domainLookupEnd-e.domainLookupStart,e.requestStart-e.secureConnectionStart,e.secureConnectionStart-e.connectStart,e.responseStart-e.requestStart,e.responseEnd-e.responseStart].map((function(e){return e.toFixed(1)}));a.disconnect(),oD.uploadEvent({log:"stat-schedule-net:".concat(s.toFixed(1),"(").concat(c.join("->"),") ").concat(o),userId:t})}}))}));a.observe({type:"resource",buffered:!0})}}catch(Yq){}}function KJ(e){return QJ.apply(this,arguments)}function QJ(){return QJ=a(n().mark((function e(t){var i,r,a,o,s,c,u,d,l,h,p,f,m;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.userId,r=t.sdkAppId,a=t.useStringRoomId,o=t.roomId,s=t.userSig,zJ||!GJ){e.next=3;break}return e.abrupt("return",{isCached:!0,result:GJ});case 3:return c={delta:0,count:[1,1],msg:[]},e.prev=4,(u=new FormData).append("userId",String(i)),u.append("sdkAppId",String(r)),u.append("isStrGroupId",a),u.append("groupId",String(o)),u.append("sdkVersion",Dr),u.append("userSig",String(s)),jI&&u.append("oversea",!0),qJ(r,i),d=vC(),e.next=17,eq(u,c,r);case 17:return(l=e.sent).config&&(l.config.loggerDomain&&vk(l.config.loggerDomain),lC(l.config.scheduleCache)&&JJ(!l.config.scheduleCache)),c.delta=vC()-d,XJ({stat:c,userId:i}),GJ=l,e.abrupt("return",{isCached:!1,result:l});case 25:throw e.prev=25,e.t0=e.catch(4),h=pC(e.t0)?e.t0[0]:e.t0,p=dC(h.code)?h.code:0,f="schedule failed".concat(h.message?": ".concat(h.message):""),m=new vP({code:_P.SCHEDULE_FAILED,extraCode:p,message:ZR({key:qT,data:{error:f,code:p}})}),MA.error(m),XJ({stat:c,userId:i,roomId:o,error:m}),m;case 34:case"end":return e.stop()}}),e,null,[[4,25]])}))),QJ.apply(this,arguments)}function XJ(e){var t=e.stat,n=e.userId,i=e.error;i?oD.logFailedEvent({eventType:fI,error:i,userId:n}):oD.logSuccessEvent({eventType:fI,delta:t.delta,userId:n}),oD.uploadEvent({log:"stat-schedule:"+JSON.stringify(t),userId:n})}function YJ(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zb;return t=jI||(tC(e)?n===zb?UI:VI:n===zb?NI:LI),"https://".concat(t,"/api/v1/config")}function $J(e,t,n){return new Promise((function(i,r){xC({url:e,body:t,timeout:n.timeout}).then((function(e){0===e.data.code?i(e.data.data):r({code:e.data.code,message:e.data.msg})})).catch(r)}))}OC.on(VC,(function(){return JJ(!0)})),OC.on($C,(function(){return JJ(!0)})),OC.on(ZC,(function(){return JJ(!0)})),OC.on(YC,(function(){return JJ(!0)})),OC.on(IA,(function(e){e.state===Ok&&JJ(!0)}));var ZJ=function(e,t){return AA({retryFunction:$J,settings:{retries:3,timeout:0},onError:t,onRetrying:e})};function eq(e,t,n){return new Promise((function(i,r){var a,o=null;(a=[ZJ((function(e){return t.count[0]=e+1}),(function(e,n){t.msg[0]=e.message,o||n()}))(YJ(n,zb),e,{get timeout(){return 1e3*aC(2+t.count[0])}}),ZJ((function(e){return t.count[1]=e+1}),(function(e,n){t.msg[1]=e.message,o||n()}))(YJ(n,Jb),e,{get timeout(){return 1e3*aC(2+t.count[1])}})],new Promise((function(e,t){var n=[];a.forEach((function(i){i.then(e).catch((function(e){n.push(e),n.length===a.length&&t(n)}))}))}))).then((function(e){i(o=e)})).catch(r)}))}var tq,nq,iq,rq,aq,oq,sq,cq,uq,dq,lq,hq,pq,fq,mq,_q,vq,gq,yq,Sq,bq,kq,Iq,Tq,wq,Eq,Rq,Cq,Aq,xq,Pq,Dq,Oq=function(){function e(){o(this,e)}return c(e,[{key:"call",value:function(e,t){return sC(this[e])?this[e](t):Promise.reject(new vP({code:_P.INVALID_PARAMETER,message:ZR({key:mE,data:{name:e}})}))}},{key:"updatePrivateMapKey",value:function(e){var t=e.privateMapKey;return e.client.setProperty("privateMapKey",t),Promise.resolve()}}]),e}(),Mq=new Oq;var Nq,Lq,Uq,Vq,jq,Fq,Bq,Hq,Wq,Gq,zq,Jq=(tq=FJ(),nq=RG(wG.CLIENT.join),iq=LG({retries:1,timeout:0,onError:function(e,t,n){this.isUsingCachedSchedule_?(this.log_.warn("is using cached schedule, retry join"),JJ(!0),this.reset(),t()):(OC.emit(VC,{client:this,error:e}),oD.logFailedEvent({userId:this.userId_,eventType:Wk,error:e}),this.reset(),this.log_.error(e),n(e))}}),rq=FJ(),aq=LG({retries:3}),oq=FJ(),sq=RG.apply(void 0,b(wG.CLIENT.publish)),cq=JG(HI),uq=FJ(),dq=RG(wG.CLIENT.unpublish),lq=RG.apply(void 0,b(wG.CLIENT.subscribe)),hq=RG(wG.CLIENT.unsubscribe),pq=FJ(),fq=RG(wG.CLIENT.switchRole),mq=JG(HI),_q=RG(wG.CLIENT.startPublishCDNStream),vq=JG(HI),gq=JG(HI),yq=RG(wG.CLIENT.startMixTranscode),Sq=JG(HI),bq=JG(HI),kq=JG(HI),Iq=JG(HI),Tq=JG(HI),wq=JG(HI),Eq=JG(HI),Rq=EG.apply(void 0,b(wG.CLIENT.sendSEIMessage)),Cq=JG(HI),Nq={timesInSecond:30,maxSizeInSecond:8e3,getSize:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t[0].byteLength}},Lq=Nq.timesInSecond,Uq=Nq.maxSizeInSecond,Vq=Nq.getSize,Aq=function(e,t,n){var i=n.value,r=new Map;return OC.on(XC,(function(e){var t=e.client;return r.delete(t)})),n.value=function(){var e=r.get(this);e||(e={callCountInSecond:0,timestamp:0,totalSizeInSecond:0},r.set(this,e)),0===e.timestamp?e.timestamp=Date.now():Date.now()-e.timestamp>1e3&&(e.timestamp=Date.now(),e.callCountInSecond=0,e.totalSizeInSecond=0);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];if(Vq&&(e.totalSizeInSecond+=Vq.apply(void 0,a)),0!==e.timestamp&&Date.now()-e.timestamp<1e3&&(e.callCountInSecond>=Lq||e.totalSizeInSecond>Uq))throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:TE,data:{isTimes:e.callCountInSecond>=Lq,isSize:e.totalSizeInSecond>Uq,name:t,timesInSecond:Lq,maxSizeInSecond:Uq}})});return e.callCountInSecond++,i.apply(this,a)},n},xq=JG(HI),Pq=JG(HI),Dq=function(){function Client(e){var t,n;o(this,Client),this.name_=HI,this.mode_=e.mode,this.sdpSemantics_=gI,cC(e.sdpSemantics)?function(){var e;if(cC(window.RTCRtpTransceiver))return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;var t=null,n=!1;try{(t=new RTCPeerConnection({sdpSemantics:vI})).addTransceiver(Tb),n=!0}catch(Yq){}return null===(e=t)||void 0===e||e.close(),n}()&&(this.sdpSemantics_=vI):this.sdpSemantics_=e.sdpSemantics,this.sdkAppId_=e.sdkAppId,this.userId_=e.userId,this.log_=MA.createLogger({id:"c".concat(e.seq,"|").concat(this.userId_),userId:this.userId_,sdkAppId:this.sdkAppId_}),this.userSig_=e.userSig,this.roomId_=0,this.useStringRoomId_=e.useStringRoomId||!1,this.pureAudioPushMode_=null,this.version_=e.version,this.log_.info("using sdpSemantics: "+this.sdpSemantics_),this.signalChannel_=null,this.role_=Ik,this.privateMapKey_="",this.tinyId_=0,this.env_="",this.proxy_=null,this.unifiedProxy_=null,this.connections_=new Map,this.mutedStates_=new Map,this.userMap_=new Map,this.syncUserListInterval_=-1,this.localStream_=null,this.localAuxStream_=null,this.uplinkConnection_=null,this.emitter_=EC(new DC,this.name_),this.isJoined_=!1,this.heartbeat_=-1,this.lastHeartBeatTime_=-1,this.stats_=new HO(this),this.joinTimeout_=-1,this.changeBigSmallRecords_=new Map,this.networkQuality_=null,this.badCaseDetector_=null,this.networkType_=iC(),this.autoSubscribe_=!!cC(e.autoSubscribe)||e.autoSubscribe,this.joinedTimestamp_=0,this.joinOptions_={},this.basis_=(n={browser:XR().name+"/"+XR().version,os:wO(),displayResolution:EO(),isScreenShareSupported:pO(),isWebRTCSupported:iO(),isGetUserMediaSupported:RO(),isWebAudioSupported:CO(),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING,isWebCodecSupported:(t={AudioDecoder:!1,AudioEncoder:!1,VideoDecoder:!1,VideoEncoder:!1,ImageDecoder:!1},cC(window.AudioDecoder)||(t.AudioDecoder=!0),cC(window.AudioEncoder)||(t.AudioEncoder=!0),cC(window.VideoDecoder)||(t.VideoDecoder=!0),cC(window.VideoEncoder)||(t.VideoEncoder=!0),cC(window.ImageDecoder)||(t.ImageDecoder=!0),t),isMediaSessionSupported:"mediaSession"in navigator&&!cC(navigator.mediaSession.setActionHandler),isWebTransportSupported:!cC(window.WebTransport)},navigator.userAgent.includes("miniProgram")&&(n.browser="mini/".concat(n.browser)),n),this.initBussinessInfo_(e),this.publishedCDN_=!1,this.publishCDNData_=null,this.mixedMCU_=!1,this.mixTranscodeData_=null,this.checkSystemResult_=null,this.enableAudioVolumeEvaluation_=!1,this.audioVolumeIntervalId_=null,this.mixTranscodeManager_=null,this.publishCDNManager_=new VJ({client:this}),this.keyPointManager_=new GG({client:this,frameWorkType:e.frameWorkType,component:e.component}),this.isPublishing_=!1,this.isEnableSmallStream_=!1,this.smallStreamConfig_={bitrate:100,frameRate:15,height:120,width:160},this.turnServers_=[],this.iceTransportPolicy_=e.iceTransportPolicy,this.schedule_={domains:null,iceServers:null,iceTransportPolicy:null,trtcCapability:null},this.isUsingCachedSchedule_=!1,this.enableAutoPlayDialog_=!!cC(e.enableAutoPlayDialog)||e.enableAutoPlayDialog,this.enableMultiAuxStream_=!cC(e.enableMultiAuxStream)&&e.enableMultiAuxStream,this.signalInfo_={},this.enableSEI_=!cC(e.enableSEI)&&e.enableSEI,this.isDestroyed_=!1}var e,i,r,s,u,d,l,h,p,f,m,_,v,g,y,k,I,w,E,R,C,A,x,P,D,O,M;return c(Client,[{key:"initBussinessInfo_",value:function(e){this.bussinessInfo_=e.bussinessInfo;var t={};if(uC(e.bussinessInfo)&&(t=JSON.parse(e.bussinessInfo)),!cC(e.pureAudioPushMode)){if(!Number.isInteger(Number(e.pureAudioPushMode)))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:VT})});this.pureAudioPushMode_=e.pureAudioPushMode,t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.pure_audio_push_mod=this.pureAudioPushMode_}if(!cC(e.streamId)){if(!(uC(e.streamId)&&String(e.streamId)&&String(e.streamId).length<=64))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:jT})});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_streamid_main=e.streamId}if(!cC(e.userDefineRecordId)){if(null===e.userDefineRecordId.match(/^[A-Za-z0-9_-]{1,64}$/gi))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:FT})});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_record_id=e.userDefineRecordId}if(!cC(e.userDefinePushArgs)){if(!(uC(e.userDefinePushArgs)&&String(e.userDefinePushArgs)&&String(e.userDefinePushArgs).length<=256))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:BT})});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_push_args=e.userDefinePushArgs}e.enableServerAudioMix&&(t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.enable_server_audio_mix=1,t.Str_uc_params.uc_biz_type=1e3),rD(t)||(this.bussinessInfo_=JSON.stringify(t))}},{key:"schedule",value:(M=a(n().mark((function e(i){var r,a,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,KJ({userId:this.userId_,sdkAppId:this.sdkAppId_,roomId:i,useStringRoomId:this.useStringRoomId_,version:this.version_,userSig:this.userSig_});case 2:r=e.sent,a=r.result,o=r.isCached,this.isUsingCachedSchedule_=o,a&&(this.log_.info("schedule with cache:".concat(o," : ").concat(JSON.stringify(a))),a.trtcCapability=null==a?void 0:a.trtcAutoConf,this.schedule_=t(t({},this.schedule_),a),OC.emit(KC,this.schedule_));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"getSignalChannelUrl",value:function(){var e={mainUrl:"",backupUrl:""},t=eC();return t?e.mainUrl=e.backupUrl="wss://".concat(t,".rtc.qq.com"):this.proxy_?e.mainUrl=e.backupUrl=this.proxy_:this.unifiedProxy_?e.mainUrl=e.backupUrl="wss://".concat(this.unifiedProxy_):Array.isArray(this.schedule_.domains)&&this.schedule_.domains.length>0&&(e.mainUrl=e.backupUrl="wss://".concat(this.schedule_.domains[0]),this.schedule_.domains[1]&&(e.backupUrl="wss://".concat(this.schedule_.domains[1]))),e}},{key:"getUserId",value:function(){return this.userId_}},{key:"getUserSig",value:function(){return this.userSig_}},{key:"getRole",value:function(){return this.role_}},{key:"getSignalInfo",value:function(){return this.signalInfo_}},{key:"getRoomId",value:function(){return this.roomId_}},{key:"getSDKAppId",value:function(){return this.sdkAppId_}},{key:"getTinyId",value:function(){return this.tinyId_}},{key:"getIceTransportPolicy",value:function(){return this.iceTransportPolicy_||this.schedule_.iceTransportPolicy||"all"}},{key:"initialize",value:function(e){var t=this;this.log_.info("setup signal channel");var n=this.getSignalChannelUrl(),i=n.mainUrl,r=n.backupUrl;return this.signalChannel_=new sD({sdkAppId:this.sdkAppId_,userId:this.userId_,userSig:this.userSig_,roomId:e.roomId,url:i,backupUrl:r,signalDomainWhenUnifiedProxy:this.unifiedProxy_?this.schedule_.domains[0]:void 0,client:this}),this.networkQuality_||(this.networkQuality_=new WO({connections:this.connections_,signalChannel:this.signalChannel_,userId:this.userId_,client:this}),this.networkQuality_.on(MO.NETWORK_QUALITY,(function(e){t.emitter_.emit(MO.NETWORK_QUALITY,e)}))),this.deviceDetector_||(this.deviceDetector_=new GO({client:this})),this.subscriptionManager_||(this.subscriptionManager_=new QG({client:this})),this.badCaseDetector_||(this.badCaseDetector_=new OJ({client:this,stats:this.stats_})),this.callDurationCalculator_||(this.callDurationCalculator_=new jJ({client:this})),this.mixTranscodeManager_||(this.mixTranscodeManager_=new UJ({client:this,signalChannel:this.signalChannel_})),this.publishCDNManager_&&this.publishCDNManager_.setSignalChannel({signalChannel:this.signalChannel_}),this.signalChannel_.on(Fx,(function(e){t.log_.info("SignalChannel state changed from ".concat(e.prevState," to ").concat(e.state)),t.emitter_.emit(MO.CONNECTION_STATE_CHANGED,e)})),this.signalChannel_.on(Hx,(function(e){t.reset(),t.emitter_.emit(MO.ERROR,e)})),this.signalChannel_.once(Vx,(function(e){t.tinyId_=e.signalInfo.tinyId,OC.emit(JC,{client:t})})),this.signalChannel_.on(Qx.PEER_JOIN,this.onPeerJoin,this),this.signalChannel_.on(Qx.PEER_LEAVE,this.onPeerLeave,this),this.signalChannel_.on(Qx.UPDATE_REMOTE_MUTE_STAT,(function(e){Date.now()-t.lastHeartBeatTime_>=1e4&&t.doHeartbeat(),OC.emit(WC,{client:t,data:e.data}),t.onPublishedUserList(e.data),t.onUpdateRemoteMuteStat(e.data)})),this.signalChannel_.on(Qx.CLIENT_BANNED,(function(e){var n,i=e.data.data.reason;if(oD.uploadEvent({log:"stat-banned:".concat(i),userId:t.userId_}),i===qb)n="you got banned by the admin";else if(i===Kb)n="duplicated userId joining the room";else if(i===Xb)n="the room has been disbanded by the admin",i=i.replace("_","-");else if(i===Qb)return t.log_.warn("".concat(i," last heart beat time: ").concat(t.lastHeartBeatTime_," interval: ").concat(Date.now()-t.lastHeartBeatTime_,", visibility: ").concat(document.visibilityState)),void t.reJoin();t.log_["kick"===i?"error":"info"]("user was banned because of [".concat(i,"]")),t.reset(),t.emitter_.emit(MO.CLIENT_BANNED,{reason:i,message:ZR({key:sw,data:{message:n,reason:i}})||i})})),OC.emit(zC,{client:this}),this.signalChannel_.connect()}},{key:"preJoin",value:(O=a(n().mark((function e(t){var i,r,a,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.joinOptions_=t,e.next=3,dO();case 3:if(this.checkSystemResult_=e.sent,this.checkDestroy(),(i=eC())||(i=dk,this.proxy_&&(this.proxy_.startsWith(ck)?i=lk:this.proxy_.startsWith(uk)&&(i=hk))),this.env_=i,oD.setConfig({env:i,sdkAppId:this.sdkAppId_,userId:this.userId_,roomId:t.roomId}),this.uploadTrtcStats(),r=this.checkSystemResult_.detail,a=r.isH264EncodeSupported,o=r.isVp8EncodeSupported,iO()&&(a||o)){e.next=13;break}throw new vP({code:_P.NOT_SUPPORTED,message:ZR({key:iE})});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"join",value:(D=a(n().mark((function e(t){var i,r=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.roomId_=t.roomId,cC(t.role)||(this.role_=t.role),cC(t.privateMapKey)||(this.privateMapKey_=t.privateMapKey),i=vC(),OC.emit(MC,{client:this}),tD(this.userId_,{eventId:UP,eventDesc:"joining room",timestamp:Gm(),userId:this.userId_,tinyId:this.tinyId_}),e.next=8,this.preJoin(t);case 8:return e.abrupt("return",new Promise(function(){var e=a(n().mark((function e(a,o){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.joinReject_=o,e.prev=1,r.proxy_||r.schedule_.domains){e.next=5;break}return e.next=5,r.schedule(t.roomId);case 5:return r.checkDestroy(),e.next=8,r.initialize(t);case 8:return e.next=10,r.doJoin(t);case 10:r.signalInfo_=r.signalChannel_.getSignalInfo(),OC.emit(UC,{client:r}),r.joinedTimestamp_=vC(),oD.logSuccessEvent({userId:r.userId_,eventType:Gk,delta:r.joinedTimestamp_-i}),oD.logSuccessEvent({userId:r.userId_,eventType:Wk}),oD.uploadEvent({log:"stat-autoplay-dialog:".concat(r.enableAutoPlayDialog_),userId:r.userId_}),oD.uploadEvent({log:"stat-conv-".concat(qR,"-").concat(location.hostname),userId:r.userId_}),a(),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(1),o(e.t0);case 23:r.joinReject_=null;case 24:case"end":return e.stop()}}),e,null,[[1,20]])})));return function(t,n){return e.apply(this,arguments)}}()));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"checkDestroy",value:function(){if(this.isDestroyed_)throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:Vw,data:{funName:"join"}})})}},{key:"uploadTrtcStats",value:(P=a(n().mark((function e(){var t,i,r,a,o,s,c,u,d,l,h,p,f;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Xq.getMicrophones();case 3:r=e.sent,t=r&&r.length,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:return e.prev=9,e.next=12,Xq.getCameras();case 12:a=e.sent,i=a&&a.length,e.next=18;break;case 16:e.prev=16,e.t1=e.catch(9);case 18:o={microphone:t,camera:i},s=this.checkSystemResult_.detail,c=s.isH264EncodeSupported,u=s.isVp8EncodeSupported,d=s.isH264DecodeSupported,l=s.isVp8DecodeSupported,h={webRTC:this.basis_.isWebRTCSupported,getUserMedia:this.basis_.isGetUserMediaSupported,webSocket:this.basis_.isWebSocketsSupported,screenShare:this.basis_.isScreenShareSupported,webAudio:this.basis_.isWebAudioSupported,h264Encode:c,h264Decode:d,vp8Encode:u,vp8Decode:l},p={browser:this.basis_.browser,os:this.basis_.os,trtc:h,devices:o},f={isWebCodecSupported:this.basis_.isWebCodecSupported,isMediaSessionSupported:this.basis_.isMediaSessionSupported,isWebTransportSupported:this.basis_.isWebTransportSupported},oD.uploadEvent({log:"trtcstats-"+JSON.stringify(p),userId:this.userId_}),this.log_.info("TrtcStats-"+JSON.stringify(p)),oD.uploadEvent({log:"trtcadvancedstats-"+JSON.stringify(f),userId:this.userId_});case 26:case"end":return e.stop()}}),e,this,[[0,7],[9,16]])}))),function(){return P.apply(this,arguments)})},{key:"doJoin",value:function(e){var t=this;return new Promise((function(e,n){t.log_.info("Join() => joining room: ".concat(t.roomId_," useStringRoomId: ").concat(t.useStringRoomId_," mode: ").concat(t.mode_," role: ").concat(t.role_));var i={roomId:String(t.roomId_),useStringRoomId:t.useStringRoomId_,privateMapKey:t.privateMapKey_,trtcRole:t.role_===Ik?bk:kk,trtcScene:t.mode_===Sk?yk:gk,sdpSemantics:t.sdpSemantics_,version:CC(t.version_),ua:navigator&&navigator.userAgent||"",autoSubscribe:t.autoSubscribe_,terminalType:zE?4:HE?2:FE?3:gR?12:vR?5:yR?13:1,netType:CI[iC()],bussinessInfo:t.bussinessInfo_,receiveMix:!0};if(t.publishCDNManager_){var r=t.publishCDNManager_.handleCDNConfigForJoinData(t.bussinessInfo_),a=r.bussinessInfo,o=r.pushUserCdnInfo;Object.assign(i,{bussinessInfo:a,pushUserCdnInfo:o})}t.log_.debug("join room signal data: ".concat(JSON.stringify(i))),t.joinTimeout_=setTimeout((function(){n(new vP({code:_P.JOIN_ROOM_FAILED,message:ZR({key:JT})}))}),5e3),OC.emit(NC,{client:t}),t.signalChannel_.once(jx,(function(e){t.clearJoinTimeout(),OC.emit(JC,{client:t,error:e}),n(e)})),t.signalChannel_.send($x,i),t.signalChannel_.once(Qx.JOIN_ROOM_RESULT,(function(i){t.clearJoinTimeout();var r=i.data,a=r.code,o=r.message,s=r.data;t.onPublishedUserList({data:{userList:s.publishers}}),OC.emit(LC,{client:t,code:a}),0===a?(t.isJoined_=!0,t.log_.info("Join room success, start heartbeat"),t.startHeartbeat(),t.badCaseDetector_&&t.badCaseDetector_.start(),t.syncUserList(),t.startSyncUserListInterval(),e()):(t.log_.error("Join room failed result: "+a+" error: "+o),n(new vP({code:_P.JOIN_ROOM_FAILED,extraCode:a,message:ZR({key:qT,data:{error:o,code:a}})})))}))}))}},{key:"reJoin",value:(x=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_){e.next=3;break}return this.log_.warn("reJoin abort"),e.abrupt("return");case 3:return this.isJoined_=!1,e.prev=4,this.log_.warn("reJoin pending: ".concat(this.joinOptions_.roomId)),this.subscriptionManager_&&this.subscriptionManager_.markAllStream(),this.signalChannel_.close(),e.next=10,this.signalChannel_.connect();case 10:return e.next=12,this.doJoin(t(t({},this.joinOptions_),{},{role:this.role_,privateMapKey:this.privateMapKey_}));case 12:this.log_.warn("reJoin success"),oD.logSuccessEvent({userId:this.userId_,eventType:zk}),this.checkConnectionsToReconnect(),this.uplinkConnection_&&!this.uplinkConnection_.getIsReconnecting()&&this.uplinkConnection_.startReconnection(),this.mixTranscodeManager_&&this.mixTranscodeManager_.reStartMixTranscode(),e.next=25;break;case 19:e.prev=19,e.t0=e.catch(4),this.log_.warn("reJoin fail "+e.t0),this.reset(),oD.logFailedEvent({userId:this.userId_,eventType:zk,error:e.t0}),this.emitter_.emit(MO.ERROR,new vP({code:_P.JOIN_ROOM_FAILED,message:ZR({key:KT,data:{roomId:this.joinOptions_.roomId}})}));case 25:case"end":return e.stop()}}),e,this,[[4,19]])}))),function(){return x.apply(this,arguments)})},{key:"leave",value:(A=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return OC.emit(jC,{client:this}),tD(this.userId_,{eventId:VP,eventDesc:"leaving room",timestamp:Gm(),userId:this.userId_,tinyId:this.tinyId_}),e.prev=2,e.next=5,this.doHeartbeat();case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:this.doLeave(),OC.emit(BC,{client:this}),oD.logSuccessEvent({userId:this.userId_,eventType:Jk}),t=Math.floor((vC()-this.joinedTimestamp_)/1e3),oD.logSuccessEvent({userId:this.userId_,eventType:qk,delta:t});case 14:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(){return A.apply(this,arguments)})},{key:"doLeave",value:function(){this.isJoined_&&(OC.emit(FC,{client:this}),this.log_.info("leave() => leaving room"),this.signalChannel_.send(Zx),this.reset())}},{key:"clearNetworkQuality",value:function(){this.networkQuality_&&(this.networkQuality_.stop(),this.networkQuality_=null)}},{key:"closeConnections",value:function(){var e=this;this.connections_.forEach((function(t){e.closeDownLink(t.getTinyId())}))}},{key:"clearJoinTimeout",value:function(){clearTimeout(this.joinTimeout_),this.joinTimeout_=-1}},{key:"destroy",value:function(){var e,t,n;if(this.isJoined_)throw this.log_.warn(CE.INVALID_DESTROY),new vP({code:_P.INVALID_OPERATION,message:ZR({key:QT})});this.isDestroyed_||(this.log_.info("destroy client"),this.joinReject_&&(this.joinReject_(new vP({code:_P.INVALID_OPERATION,message:ZR({key:Vw,data:{funName:"join"}})})),this.clearJoinTimeout(),this.reset()),this.off("*"),null===(e=this.callDurationCalculator_)||void 0===e||e.destroy(),null===(t=this.keyPointManager_)||void 0===t||t.destroy(),null===(n=this.deviceDetector_)||void 0===n||n.destroy(),this.callDurationCalculator_=null,this.keyPointManager_=null,this.deviceDetector_=null,this.badCaseDetector_=null,this.publishCDNManager_=null,this.isDestroyed_=!0,OC.emit(XC,{client:this}))}},{key:"reset",value:function(){this.isJoined_=!1,this.schedule_={domains:null,iceServers:null,iceTransportPolicy:null,trtcCapability:null},this.keyPointManager_&&this.keyPointManager_.prepareReport(),this.mixTranscodeManager_&&(this.mixTranscodeManager_.reset(),this.mixTranscodeManager_=null),this.publishCDNManager_&&this.publishCDNManager_.reset(),this.userMap_.clear(),this.stopSyncUserListInterval(),this.stopHeartbeat(),this.closeConnections(),this.mutedStates_.clear(),this.clearNetworkQuality(),this.badCaseDetector_&&this.callDurationCalculator_&&this.uploadAllCallStats(),this.closeUplink(),this.signalChannel_&&(this.log_.info("destroying SignalChannel"),this.signalChannel_.close(),this.signalChannel_=null),this.stats_.reset()}},{key:"startSyncUserListInterval",value:function(){-1===this.syncUserListInterval_&&(this.syncUserListInterval_=YD.run(uT,this.syncUserList.bind(this)))}},{key:"stopSyncUserListInterval",value:function(){YD.clearTask(this.syncUserListInterval_),this.syncUserListInterval_=-1}},{key:"syncUserList",value:(C=a(n().mark((function e(){var t,i=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getUserList();case 3:t=e.sent,0!==this.userMap_.size&&this.userMap_.forEach((function(e){t.findIndex((function(t){return t.userId===e.userId}))<0&&(i.log_.info("peer leave detected: ".concat(e.userId)),i.cleanUser({userId:e.userId,tinyId:e.tinyId}))})),t.forEach((function(e){var t=e.userId;i.userMap_.has(t)||t===i.userId_||(i.userMap_.set(t,e),i.emitter_.emit(MO.PEER_JOIN,{userId:t}))})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.log_.warn("sync user list failed: "+e.t0);case 11:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return C.apply(this,arguments)})},{key:"getUserList",value:function(){return this.signalChannel_?this.signalChannel_.sendWaitForResponse({command:pP,responseCommand:Qx.USER_LIST_RES,enableLog:!1,timeout:2e3}).then((function(e){var t=e.data,n=t.code,i=t.message;if(0===n)return(t.data&&t.data.userList||[]).map((function(e){var t=e.userId,n=e.srcTinyId,i=e.role;return new MJ({userId:t,tinyId:n,role:i})}));throw ZR({key:pE,data:{signalResponse:Qx.USER_LIST_RES,code:n,message:i}})})):[]}},{key:"publish",value:(R=a(n().mark((function e(t){var i,r,a,o,s,c,u,d,l=this,h=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=h.length>1&&void 0!==h[1]?h[1]:{isAuxiliary:!1},t.setPublishState(xI),this.isPublishing_=!0,r=vC(),OC.emit(GC,{client:this,stream:t}),a=i.isAuxiliary,o=a?Ab:zb,s=t.getScreen(),this.log_.info("publish() => publishing ".concat(s?Eb+" ":"").concat(o," stream ").concat(t.getId())),c=this.uplinkConnection_,e.prev=10,c||((c=new Az({userId:this.userId_,tinyId:this.tinyId_,client:this,isUplink:!0,signalChannel:this.signalChannel_,enableSEI:this.enableSEI_})).initialize(),c.on(OO.ERROR,(function(e){var t=e.getCode();t!==_P.ICE_TRANSPORT_ERROR&&(t===_P.UPLINK_RECONNECTION_FAILED&&l.closeUplink(),l.emitter_.emit(MO.ERROR,e))}))),t.setConnection(c),e.next=15,c.publish(t,a);case 15:this.log_.info("local ".concat(s?Eb+" ":"").concat(o," stream is published")),this.isPublishing_=!1,a?this.localAuxStream_=t:(this.localStream_=t,this.deviceDetector_&&this.deviceDetector_.setLocalStream(this.localStream_),this.localStream_.getBeautyStatus()&&this.log_.info("beauty stream is published successfully")),t.setPublishState(PI),t.setClient(this,a),this.uplinkConnection_=c,u=vC(),d=u-r,oD.logSuccessEvent({userId:this.userId_,eventType:Kk}),oD.logSuccessEvent({userId:this.userId_,eventType:Qk,delta:d}),t.hasAudio()&&tD(this.userId_,{eventId:yP,eventDesc:"publish audio track",timestamp:Gm(),userId:this.userId_,tinyId:this.tinyId_}),t.hasVideo()&&tD(this.userId_,{eventId:gP,eventDesc:"publish video track",timestamp:Gm(),userId:this.userId_,tinyId:this.tinyId_}),this.networkQuality_&&this.networkQuality_.setUplinkConnection(this.uplinkConnection_),OC.emit(lA,{localStream:t,isAuxiliary:a,client:this}),this.notPublishWithoutH264Supported_=!1,t.isAIDenoiser&&zG.handleFunctionState({fnName:"AI_DENOISER"}),e.next=42;break;case 33:throw e.prev=33,e.t0=e.catch(10),e.t0 instanceof vP&&e.t0.getCode()===_P.NOT_SUPPORTED_H264&&(this.notPublishWithoutH264Supported_=!0),t.setPublishState(AI),c.close(),this.log_.error("failed to publish stream "+e.t0),this.isPublishing_=!1,oD.logFailedEvent({userId:this.userId_,eventType:Kk,error:e.t0}),e.t0;case 42:case"end":return e.stop()}}),e,this,[[10,33]])}))),function(e){return R.apply(this,arguments)})},{key:"unpublish",value:(E=a(n().mark((function e(t){var i,r;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.uplinkConnection_){e.next=2;break}return e.abrupt("return");case 2:return i=t===this.localAuxStream_,r=t.getScreen(),this.log_.info("unpublish() => unpublishing local ".concat(r?Eb+" ":"").concat(i?Ab:zb," stream")),e.prev=5,e.next=8,this.uplinkConnection_.unpublish(t);case 8:oD.logSuccessEvent({userId:this.userId_,eventType:Xk}),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(5),this.log_.warn("unpublish error ".concat(e.t0)),oD.logFailedEvent({userId:this.userId_,eventType:Xk,error:e.t0});case 15:t.setClient(null),t.setConnection(null),i?this.localAuxStream_=null:(this.localStream_=null,t.hasAudio()&&tD(this.userId_,{eventId:bP,eventDesc:"unpublish audio track",timestamp:Gm(),userId:this.userId_,tinyId:this.tinyId_}),t.hasVideo()&&tD(this.userId_,{eventId:SP,eventDesc:"unpublish video track",timestamp:Gm(),userId:this.userId_,tinyId:this.tinyId_})),this.localStream_||this.localAuxStream_||this.closeUplink();case 19:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(e){return E.apply(this,arguments)})},{key:"closeUplink",value:function(){this.uplinkConnection_&&(this.uplinkConnection_.close(),this.uplinkConnection_=null,this.networkQuality_&&this.networkQuality_.setUplinkConnection(null),this.localStream_&&(this.localStream_.setClient(null),this.localStream_.setConnection(null),this.localStream_=null),this.localAuxStream_&&(this.localAuxStream_.setClient(null),this.localAuxStream_.setConnection(null),this.localAuxStream_=null),this.deviceDetector_&&this.deviceDetector_.setLocalStream(null))}},{key:"closeDownLink",value:function(e){var t=this.connections_.get(e);t&&(t.getIsReconnecting()&&t.stopReconnection(),this.subscriptionManager_&&this.subscriptionManager_.delete(t.getUserId()),t.close(),this.connections_.delete(e),this.mutedStates_.delete(e))}},{key:"subscribe",value:(w=a(n().mark((function e(t,i){var r,a,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.log_.info("subscribe() => subscribe to [".concat(t.getUserId(),"] ").concat(t.getType()," stream with options: ").concat(JSON.stringify(i))),cC(i)&&(i={audio:!0,video:!0}),cC(i.audio)&&(i.audio=!0),cC(i.smallVideo)?cC(i.video)&&(i.video=!0):i.smallVideo?cC(i.video)?(i.video=!1,i.smallVideo=!0):i.video&&(i.video=!0,delete i.smallVideo,this.log_.warn("options.video and options.smallVideo can't be both true")):cC(i.video)&&(i.video=!0,delete i.smallVideo),i.video&&this.changeBigSmallRecords_.delete(t.getUserId()),r=t.getConnection(),i.smallVideo&&(r.getTrackState().smallVideo||(this.setRemoteVideoStreamType(t,"small"),i.video=!0,delete i.smallVideo)),e.prev=7,OC.emit(oA,{client:this,stream:t}),e.next=11,r.subscribe(t,i);case 11:this.subscriptionManager_&&this.subscriptionManager_.addSubscriptionRecord(t.getUserId(),t,i),this.notSubscribeWithoutH264Supported_=!1,oD.logSuccessEvent({userId:this.userId_,eventType:Yk}),e.next=24;break;case 16:throw e.prev=16,e.t0=e.catch(7),(a=e.t0 instanceof vP?e.t0.getCode():_P.UNKNOWN)===_P.NOT_SUPPORTED_H264&&(this.notSubscribeWithoutH264Supported_=!0),(o=new vP(a===_P.REMOTE_STREAM_NOT_EXIST?{code:_P.API_CALL_ABORTED,message:ZR({key:EE,data:{message:e.t0.message,stream:t}})}:{code:a,message:ZR({key:nw,data:{message:e.t0.message,stream:t}})})).getCode()===_P.API_CALL_ABORTED?this.log_.warn(o):this.log_.error(o),oD.logFailedEvent({userId:this.userId_,eventType:Yk,error:o}),o;case 24:case"end":return e.stop()}}),e,this,[[7,16]])}))),function(e,t){return w.apply(this,arguments)})},{key:"unsubscribe",value:(I=a(n().mark((function e(t){var i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.log_.info("unsubscribe() => unsubscribe to [".concat(t.getUserId(),"] ").concat(t.getType()," stream")),e.prev=1,i=t.getConnection(),e.next=5,i.unsubscribe(t);case 5:this.subscriptionManager_&&this.subscriptionManager_.addUnsubscriptionRecord(t.getUserId(),t),OC.emit(cA,{client:this,stream:t}),oD.logSuccessEvent({userId:this.userId_,eventType:$k}),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(1),oD.logFailedEvent({userId:this.userId_,eventType:$k,error:e.t0}),e.t0;case 14:case"end":return e.stop()}}),e,this,[[1,10]])}))),function(e){return I.apply(this,arguments)})},{key:"switchRole",value:(k=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.role_!==t){e.next=2;break}return e.abrupt("return");case 2:return t===Tk&&this.uplinkConnection_&&this.closeUplink(),this.log_.info("switchRole() => switch role to: "+t),e.next=6,this.doSwitchRole(t);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"doSwitchRole",value:function(e){var t,n,i=this,r={command:fP,data:{role:e===Ik?bk:kk,privateMapKey:this.privateMapKey_},responseCommand:Qx.SWITCH_ROLE_RES,retries:(null===(t=this.schedule_.config)||void 0===t||null===(n=t.retries)||void 0===n?void 0:n.switchRole)||1};return this.log_.info("switchRole signal data: "+JSON.stringify(r.data)),this.signalChannel_.sendWaitForResponseWithRetry(r).then((function(t){var n=t.data,r=n.code,a=n.message;if(0!==r)throw new vP({code:_P.SWITCH_ROLE_FAILED,message:ZR({key:ow,data:{errMsg:a,errCode:r}})});i.role_=e})).catch((function(e){throw e instanceof vP&&e.getCode()===_P.API_CALL_TIMEOUT&&(e=new vP({code:_P.SWITCH_ROLE_FAILED,message:ZR({key:aw})})),i.log_.error(e),e}))}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"off",value:function(e,t,n){"*"===e?this.emitter_.removeAllListeners():this.emitter_.off(e,t,n)}},{key:"getRemoteMutedState",value:function(){var e=this,n=[];return this.mutedStates_.forEach((function(i,r,a){var o=e.connections_.get(r);o&&n.push(t({userId:o.getUserId()},i))})),n}},{key:"getTransportStats",value:(y=a(n().mark((function e(){var t,i,r,a,o,s,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={rtt:0,downlinksRTT:{}},!this.uplinkConnection_){e.next=6;break}return e.next=4,this.stats_.getSenderStats(this.uplinkConnection_);case 4:i=e.sent,t.rtt=i.rtt;case 6:r=T(this.connections_),e.prev=7,r.s();case 9:if((a=r.n()).done){e.next=17;break}return(o=S(a.value,2))[0],s=o[1],e.next=13,this.stats_.getReceiverStats(s);case 13:c=e.sent,t.downlinksRTT[c.userId]=c.rtt;case 15:e.next=9;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(7),r.e(e.t0);case 22:return e.prev=22,r.f(),e.finish(22);case 25:return e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,this,[[7,19,22,25]])}))),function(){return y.apply(this,arguments)})},{key:"getLocalAudioStats",value:(g=a(n().mark((function e(){var t,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((t={})[this.userId_]={bytesSent:0,packetsSent:0},!this.uplinkConnection_){e.next=7;break}return e.next=5,this.stats_.getSenderStats(this.uplinkConnection_);case 5:i=e.sent,t[this.userId_]={bytesSent:i.audio.bytesSent,packetsSent:i.audio.packetsSent};case 7:return e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return g.apply(this,arguments)})},{key:"getLocalVideoStats",value:(v=a(n().mark((function e(){var t,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((t={})[this.userId_]={bytesSent:0,packetsSent:0,framesEncoded:0,framesSent:0,frameWidth:0,frameHeight:0},!this.uplinkConnection_){e.next=7;break}return e.next=5,this.stats_.getSenderStats(this.uplinkConnection_);case 5:i=e.sent,t[this.userId_]={bytesSent:i.video.bytesSent,packetsSent:i.video.packetsSent,framesEncoded:i.video.framesEncoded,framesSent:i.video.framesSent,frameWidth:i.video.frameWidth,frameHeight:i.video.frameHeight};case 7:return e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"getRemoteAudioStats",value:(_=a(n().mark((function e(){var t,i,r,a,o,s,c,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t={},i=T(this.connections_),e.prev=2,i.s();case 4:if((r=i.n()).done){e.next=13;break}return(a=S(r.value,2))[0],o=a[1],s=o.getDelay(),c=s.audioDelay,e.next=9,this.stats_.getReceiverStats(o);case 9:(u=e.sent).hasAudio&&(t[u.userId]={bytesReceived:u.audio.bytesReceived,packetsReceived:u.audio.packetsReceived,packetsLost:u.audio.packetsLost,end2EndDelay:c});case 11:e.next=4;break;case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(2),i.e(e.t0);case 18:return e.prev=18,i.f(),e.finish(18);case 21:return e.abrupt("return",t);case 22:case"end":return e.stop()}}),e,this,[[2,15,18,21]])}))),function(){return _.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(m=a(n().mark((function e(){var t,i,r,a,o,s,c,u,d,l=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=l.length>0&&void 0!==l[0]?l[0]:Ck,i={},r=T(this.connections_),e.prev=3,r.s();case 5:if((a=r.n()).done){e.next=15;break}return(o=S(a.value,2))[0],s=o[1],e.next=9,this.stats_.getReceiverStats(s);case 9:c=e.sent,u=s.getDelay(),d=u.videoDelay,t===Ck&&c.hasVideo&&(i[c.userId]={bytesReceived:c.video.bytesReceived,packetsReceived:c.video.packetsReceived,packetsLost:c.video.packetsLost,framesDecoded:c.video.framesDecoded,frameWidth:c.video.frameWidth,frameHeight:c.video.frameHeight,end2EndDelay:d}),t===Ak&&c.hasAuxiliary&&(i[c.userId]={bytesReceived:c.auxiliary.bytesReceived,packetsReceived:c.auxiliary.packetsReceived,packetsLost:c.auxiliary.packetsLost,framesDecoded:c.auxiliary.framesDecoded,frameWidth:c.auxiliary.frameWidth,frameHeight:c.auxiliary.frameHeight,end2EndDelay:d});case 13:e.next=5;break;case 15:e.next=20;break;case 17:e.prev=17,e.t0=e.catch(3),r.e(e.t0);case 20:return e.prev=20,r.f(),e.finish(20);case 23:return e.abrupt("return",i);case 24:case"end":return e.stop()}}),e,this,[[3,17,20,23]])}))),function(){return m.apply(this,arguments)})},{key:"getSdpSemantics",value:function(){return this.sdpSemantics_}},{key:"getIceServers",value:function(){return 0===this.turnServers_.length&&this.schedule_.iceServers?this.schedule_.iceServers:this.turnServers_}},{key:"getConnections",value:function(){return this.connections_}},{key:"getMutedStates",value:function(){return this.mutedStates_}},{key:"startHeartbeat",value:function(){-1===this.heartbeat_&&(this.log_.info("startHeartbeat..."),this.heartbeat_=YD.run(uT,this.doHeartbeat.bind(this),{delay:2e3}))}},{key:"stopHeartbeat",value:function(){-1!==this.heartbeat_&&(this.log_.info("stopHeartbeat"),YD.clearTask(this.heartbeat_),this.heartbeat_=-1,this.lastHeartBeatTime_=-1)}},{key:"doHeartbeat",value:(f=a(n().mark((function e(){var i,r,a,o,s,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.badCaseDetector_.getMonitorFreeze(),e.next=3,this.stats_.getStatsReport({uplinkConnection:this.uplinkConnection_,downlinkConnections:this.connections_,freezeMap:r});case 3:if(a=e.sent,OC.emit(HC,{client:this,stats:a}),null===(i=this.badCaseDetector_)||void 0===i||i.resetMonitor(),this.signalChannel_){e.next=8;break}return e.abrupt("return");case 8:o=this.signalChannel_.isConnected()?nD(this.userId_):[],s=t(t({str_sdk_version:this.version_,uint64_datetime:(new Date).getTime(),msg_user_info:{str_identifier:this.userId_,uint64_tinyid:this.tinyId_},msg_device_info:{uint32_terminal_type:15,str_device_name:navigator.platform,str_os_version:"",uint32_net_type:CI[this.networkType_]}},a),{},{msg_event_msg:o}),this.signalChannel_.send(eP,s),c=Date.now(),this.lastHeartBeatTime_>0&&c-this.lastHeartBeatTime_>1e4&&this.log_.warn("heartbeat took ".concat(c-this.lastHeartBeatTime_)),this.lastHeartBeatTime_=c,!this.isRelayChanged_&&this.isRelayMaybeFailed()&&(this.reJoin(),this.isRelayChanged_=!0);case 15:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"onRemoteStreamAdded",value:function(e){var t=e.content,n=t.userId,i=t.tinyId,r=t.audio,a=t.bigVideo,o=t.auxVideo,s=t.smallVideo;if(null!==n){this.userMap_.has(n)||(this.userMap_.set(n,new MJ({userId:n,tinyId:i,role:Ik})),this.emitter_.emit(MO.PEER_JOIN,{userId:n}));var c=this.connections_.get(i);if(c){if(c.getIsReconnecting())return;this.log_.warn("duplicated stream-added observed, rebuild the connection"),c.close(),this.connections_.delete(i)}var u={audio:r,video:a,auxiliary:o,smallVideo:s};this.log_.info("remote peer [".concat(n,"] published stream. trackState: ").concat(JSON.stringify(u))),this.createDownlinkConnection({userId:n,tinyId:i,trackState:u})}else this.log_.warn("received null userId on stream added")}},{key:"createDownlinkConnection",value:function(e){var t=this,n=e.userId,i=e.tinyId,r=e.trackState,a=new PJ({userId:n,tinyId:i,client:this,isUplink:!1,signalChannel:this.signalChannel_,autoSubscribe:this.autoSubscribe_,trackState:r,enableSEI:this.enableSEI_});this.connections_.set(i,a),this.installDownlinkEvents(a,n,i),this.autoSubscribe_?(a.initialize(),a.connect().catch((function(){!a.getMainStream()&&a.hasMainStream()&&t.initRemoteStream({type:Ck,userId:n,downlinkConnection:a}),!a.getAuxStream()&&a.hasAuxStream()&&t.initRemoteStream({type:Ak,userId:n,downlinkConnection:a})}))):(a.hasMainStream()&&this.initRemoteStream({type:Ck,userId:n,downlinkConnection:a}),a.hasAuxStream()&&this.initRemoteStream({type:Ak,userId:n,downlinkConnection:a}))}},{key:"initRemoteStream",value:function(e){var t=e.type,n=e.userId,i=e.downlinkConnection,r=new KG({type:t,userId:n,client:this});r.setConnection(i),i.setRemoteStream(t===Ck?wk:Ek,r),r.setIsStreamAddedEventEmitted(!0),OC.emit(aA,{client:this,stream:r}),this.emitter_.emit(MO.STREAM_ADDED,{stream:r})}},{key:"installDownlinkEvents",value:function(e,t,n){var i=this;e.on(OO.SEI_MESSAGE,(function(e){i.emitter_.emit(MO.SEI_MESSAGE,e)})),e.on(OO.STREAM_ADDED,(function(e){e.stream.setIsStreamAddedEventEmitted(!0),OC.emit(aA,{client:i,stream:e.stream}),i.emitter_.emit(MO.STREAM_ADDED,{stream:e.stream})})),e.on(OO.STREAM_REMOVED,(function(e){i.changeBigSmallRecords_.delete(e.stream.getUserId()),e.stream.stop(),e.stream.setIsStreamAddedEventEmitted(!1),i.subscriptionManager_&&i.subscriptionManager_.deleteAutoRecoveryFlag(e.stream.getUserId(),e.stream.getType()),OC.emit(dA,{client:i,stream:e.stream}),i.emitter_.emit(MO.STREAM_REMOVED,{stream:e.stream})})),e.on(OO.STREAM_UPDATED,(function(t){OC.emit(uA,{client:i,stream:t.stream});var n=e.getMixUserList();n&&(t.mixUserList=n),i.emitter_.emit(MO.STREAM_UPDATED,t)})),e.on(OO.STREAM_SUBSCRIBED,(function(e){OC.emit(sA,{client:i,stream:e.stream}),i.emitter_.emit(MO.STREAM_SUBSCRIBED,{stream:e.stream})})),e.on(OO.ERROR,(function(e){var t=e.getCode();t!==_P.ICE_TRANSPORT_ERROR&&(t===_P.DOWNLINK_RECONNECTION_FAILED&&i.closeDownLink(n),i.emitter_.emit(MO.ERROR,e))}))}},{key:"onPeerJoin",value:function(e){var t=e.data.data,n=t.srcTinyId,i=t.userId,r=t.role;this.userMap_.has(i)||(this.userMap_.set(i,new MJ({userId:i,tinyId:n,role:r})),this.emitter_.emit(MO.PEER_JOIN,{userId:i}))}},{key:"onPeerLeave",value:function(e){var t=e.data.data,n=t.srcTinyId,i=t.userId,r=t.reason,a=void 0===r?0:r;this.log_.info("peer leave [".concat(i,"]: ").concat(sT[a])),this.cleanUser({userId:i,tinyId:n})}},{key:"cleanUser",value:function(e){var t=e.userId,n=e.tinyId;this.userMap_.delete(t),this.closeDownLink(n),this.emitter_.emit(MO.PEER_LEAVE,{userId:t})}},{key:"onPublishedUserList",value:function(e){var t=this;try{var n=b(e.data.userList);e.data.mixRobotList&&n.push.apply(n,b(e.data.mixRobotList)),e.data.fakeMixUser&&n.push(e.data.fakeMixUser);var i=n.map((function(e){return e.userId}));this.connections_.forEach((function(e){var n=e.getUserId(),r=e.getTinyId();i.findIndex((function(e){return e===n}))<0&&(t.log_.info("peer unpublished detected [".concat(n,"]")),t.closeDownLink(r))})),n.forEach((function(e){var n=e.userId,i=e.srcTinyId,r=e.flag,a=e.mixUserList;if(n!==t.userId_){var o=!!(1&r),s=!!(8&r),c=!!(4&r),u=!!(2&r),d=t.connections_.get(i);if((u||o)&&t.checkSubscribeBigSmallVideo(d,u),d){var l=d.getTrackState(),h=l.audio,p=l.video,f=l.auxiliary,m=l.smallVideo;pC(a)&&d.setMixUserList(a),!p&&o&&OC.emit(rA,{client:t,tinyId:i,userId:n,action:RI.ADD,kind:wb}),!h&&s&&OC.emit(rA,{client:t,tinyId:i,userId:n,action:RI.ADD,kind:Tb}),!f&&c&&OC.emit(rA,{client:t,tinyId:i,userId:n,action:RI.ADD,kind:Ab}),!m&&u&&OC.emit(rA,{client:t,tinyId:i,userId:n,action:RI.ADD,kind:Pb}),p&&!o&&OC.emit(rA,{client:t,tinyId:i,userId:n,action:RI.REMOVE,kind:wb}),h&&!s&&OC.emit(rA,{client:t,tinyId:i,userId:n,action:RI.REMOVE,kind:Tb}),f&&!c&&OC.emit(rA,{client:t,tinyId:i,userId:n,action:RI.REMOVE,kind:Ab}),m&&!u&&OC.emit(rA,{client:t,tinyId:i,userId:n,action:RI.REMOVE,kind:Pb})}else t.log_.info("peer published detected [".concat(n,"]")),t.onRemoteStreamAdded({content:{audio:s,bigVideo:o,auxVideo:c,smallVideo:u,userId:n,tinyId:i}})}}))}catch(Yq){}}},{key:"onUpdateRemoteMuteStat",value:function(e){var t=this,n=e.data;(n&&n.userList||[]).forEach((function(e){var n=e.srcTinyId,i=e.userId;if(0!==n&&n!==t.tinyId_){var r=t.connections_.get(n);if(r){var a=r.getMainStream();if(a&&a.getIsStreamAddedEventEmitted()){var o=!!(1&e.flag),s=!!(8&e.flag),c=!!(2&e.flag),u=!!(64&e.flag),d=!!(16&e.flag),l=t.mutedStates_.get(n);if(void 0===l)return t.mutedStates_.set(n,{hasAudio:s,hasVideo:o,hasSmall:c,audioMuted:u,videoMuted:d}),o?d?t.emitter_.emit(MO.MUTE_VIDEO,{userId:i}):t.emitter_.emit(MO.UNMUTE_VIDEO,{userId:i}):t.emitter_.emit(MO.MUTE_VIDEO,{userId:i}),void(s?u?t.emitter_.emit(MO.MUTE_AUDIO,{userId:i}):t.emitter_.emit(MO.UNMUTE_AUDIO,{userId:i}):t.emitter_.emit(MO.MUTE_AUDIO,{userId:i}));var h=!l.audioMuted&&l.hasAudio,p=!u&&s,f=!l.videoMuted&&l.hasVideo,m=!d&&o;t.mutedStates_.set(n,{hasAudio:s,hasVideo:o,hasSmall:c,audioMuted:u,videoMuted:d}),h!==p&&(p?t.emitter_.emit(MO.UNMUTE_AUDIO,{userId:i}):t.emitter_.emit(MO.MUTE_AUDIO,{userId:i})),f!==m&&(m?t.emitter_.emit(MO.UNMUTE_VIDEO,{userId:i}):t.emitter_.emit(MO.MUTE_VIDEO,{userId:i}))}}else t.mutedStates_.delete(n)}}))}},{key:"getEnv",value:function(){return this.env_}},{key:"getSubscriptionManager",value:function(){return this.subscriptionManager_}},{key:"startPublishCDNStream",value:(p=a(n().mark((function e(){var t,i=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},this.log_.info("startPublishCDNStream with params: ".concat(JSON.stringify(t),"; isJoined: ").concat(this.isJoined_,"; hasMainStream: ").concat(!!this.localStream_,"; hasAuxStream: ").concat(!!this.localAuxStream_,";")),t.streamType=t.streamType||zb,t.streamType===Ab&&(t.streamType=xb),t.streamId=t.streamId||"",!this.isJoined_){e.next=10;break}if(t.streamType!==zb||this.localStream_){e.next=8;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:cw})});case 8:if(t.streamType!==xb||this.localAuxStream_){e.next=10;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:cw})});case 10:return e.next=12,this.publishCDNManager_.startPublishTencentCDN(t);case 12:if(!(t.appId&&t.bizId&&t.url)){e.next=15;break}return e.next=15,this.publishCDNManager_.startPublishGivenCDN(t);case 15:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"stopPublishCDNStream",value:(h=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.publishCDNManager_.getIsPublishingTencentCDN()){e.next=2;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:uw})});case 2:return this.log_.info("stopPublishCDNStream"),e.next=5,this.publishCDNManager_.stopPublishTencentCDN();case 5:if(!this.publishCDNManager_.getIsPublishingGivenCDN()){e.next=8;break}return e.next=8,this.publishCDNManager_.stopPublishGivenCDN();case 8:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"startMixTranscode",value:(l=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_&&this.mixTranscodeManager_){e.next=2;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:pw})});case 2:return cC(t.mode)&&(t.mode=yI.MANUAL),e.prev=3,this.log_.info("startMixTranscode with config ".concat(JSON.stringify(t))),oD.uploadEvent({log:"mix-transcode-mode:".concat(t.mode),userId:this.userId_}),e.next=8,this.mixTranscodeManager_.startMixTranscode(t);case 8:oD.logSuccessEvent({userId:this.userId_,eventType:lI}),e.next=15;break;case 11:throw e.prev=11,e.t0=e.catch(3),oD.logFailedEvent({userId:this.userId_,eventType:lI,error:e.t0}),e.t0;case 15:case"end":return e.stop()}}),e,this,[[3,11]])}))),function(e){return l.apply(this,arguments)})},{key:"stopMixTranscode",value:(d=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_&&this.mixTranscodeManager_){e.next=2;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:fw})});case 2:return e.prev=2,e.next=5,this.mixTranscodeManager_.stopMixTranscode();case 5:oD.logSuccessEvent({userId:this.userId_,eventType:hI}),e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(2),oD.logFailedEvent({userId:this.userId_,eventType:hI,error:e.t0}),e.t0;case 12:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(){return d.apply(this,arguments)})},{key:"getSystemResult",value:function(){return this.checkSystemResult_}},{key:"enableAudioVolumeEvaluation",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!dC(t))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:mw})});if(this.log_.info("enableAudioVolumeEvaluation with interval: "+t),t<=0)return this.enableAudioVolumeEvaluation_=!1,YD.clearTask(this.audioVolumeIntervalId_),void(this.audioVolumeIntervalId_=null);t=Math.floor(Math.max(t,16)),OC.emit(QC,{interval:t}),this.audioVolumeIntervalId_&&(YD.clearTask(this.audioVolumeIntervalId_),this.audioVolumeIntervalId_=null),this.enableAudioVolumeEvaluation_=!0,this.audioVolumeIntervalId_=YD.run(dT,(function(){var t=[];if(e.localStream_){var n=Math.floor(100*e.localStream_.getAudioLevel());t.push({userId:e.userId_,audioVolume:n,stream:e.localStream_})}e.connections_.forEach((function(e){var n=e.getSubscribedMainStream();if(n){var i=Math.floor(100*n.getAudioLevel());t.push({userId:e.getUserId(),audioVolume:i,stream:n})}})),e.emitter_.emit(MO.AUDIO_VOLUME,{result:t})}),{fps:1e3/t,backgroundTask:n})}},{key:"callExperimentalAPI",value:function(e,n){return Mq.call(e,t({client:this},n))}},{key:"setProperty",value:function(e,t){var n="".concat(e,"_");cC(this[n])||(this[n]=t)}},{key:"uploadAllCallStats",value:function(){var e=this;this.callDurationCalculator_.getDurationMap().forEach((function(t,n){var i={userId:t.userId,type:t.type,duration:e.callDurationCalculator_.getDuration(n,wb),dataFreeze:e.badCaseDetector_.getDataFreezeDuration(n).dataFreeze,renderFreeze:e.badCaseDetector_.getRenderFreezeDuration(n).renderFreeze};oD.uploadEvent({log:"callStats-"+JSON.stringify(i),userId:e.userId_})})),this.badCaseDetector_.stop(),this.callDurationCalculator_.reset()}},{key:"enableSmallStream",value:(u=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPublished()&&!this.isPublishing_){e.next=2;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:_w})});case 2:if(!AO()){e.next=7;break}this.setIsEnableSmallStream(!0),this.log_.info("SmallStream successfully enabled"),e.next=8;break;case 7:throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:gw})});case 8:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"disableSmallStream",value:(s=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPublished()&&!this.isPublishing_){e.next=2;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:vw})});case 2:this.setIsEnableSmallStream(!1),this.log_.info("SmallStream successfully disabled");case 4:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"setSmallStreamProfile",value:function(e){var t=this;e&&e.framerate&&(e.frameRate=e.framerate),e.width*e.height>307200&&(e.width=320,e.height=240,this.log_.info("Small stream resolution is beyond limitation, which is invalid. Reset to 320 * 240")),Object.keys(this.smallStreamConfig_).forEach((function(n){e[n]&&(t.smallStreamConfig_[n]=e[n])}));var n=this.smallStreamConfig_,i=n.width,r=n.height,a=n.bitrate,o=n.frameRate;if(this.log_.info("setSmallStreamProfile: bitrate=".concat(a,", frameRate=").concat(o,", height=").concat(r,", width=").concat(i)),i<0||r<0||a<0||o<0)throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:yw})})}},{key:"setRemoteVideoStreamType",value:(r=a(n().mark((function e(t,i){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t instanceof KG){e.next=2;break}throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:Sw})});case 2:if(t.getConnection()){e.next=4;break}throw new vP({code:_P.INVALID_OPERATION,message:ZR({key:tw})});case 4:if(t.getType()!==Ak){e.next=6;break}return e.abrupt("return");case 6:e.t0=i,e.next=e.t0===DI||e.t0===OI?9:12;break;case 9:return e.next=11,this.changeVideoType(t,i);case 11:case 12:return e.abrupt("break",13);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"changeVideoType",value:(i=a(n().mark((function e(t,i){var r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.getUserId(),a={stream:t,options:{video:i===DI,smallVideo:i===OI},isSubscribing:!1,reSubscribeCount:10},this.changeBigSmallRecords_.set(r,a),this.log_.info("set [".concat(r,"] ").concat(t.getType()," stream video prefer type: ").concat(i));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"checkSubscribeBigSmallVideo",value:(e=a(n().mark((function e(t,i){var r,a,o,s,c,u,d,l,h,p,f;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t&&t.isBigStreamSubscribed||null!=t&&t.isSmallStreamSubscribed){e.next=2;break}return e.abrupt("return");case 2:if(r=t.getUserId(),this.changeBigSmallRecords_.has(r)){e.next=5;break}return e.abrupt("return");case 5:if(a=this.changeBigSmallRecords_.get(r),o=t.getSubscribeState(),s=o.video,c=o.smallVideo,u=a.stream,d=a.options,l=a.isSubscribing,h=a.reSubscribeCount,!(d.video&&s||d.smallVideo&&c&&i)){e.next=10;break}return e.abrupt("return");case 10:if(p={video:d.video,smallVideo:d.smallVideo},!(i&&t.isBigStreamSubscribed||t.isSmallStreamSubscribed)){e.next=31;break}if(e.prev=12,!(d&&u&&!l&&h>=1)){e.next=24;break}return a.isSubscribing=!0,a.reSubscribeCount=h-1,f=u.getConnection(),!i&&f.isSmallStreamSubscribed&&(p={video:!0,smallVideo:!1}),p.emitEvent=!1,e.next=21,null==f?void 0:f.subscribe(u,p);case 21:this.log_.info("change [".concat(r,"] to ").concat(p.smallVideo?"small":"big"," video successfully. count ").concat(10-a.reSubscribeCount,".")),a.isSubscribing=!1,a.reSubscribeCount=10;case 24:e.next=31;break;case 26:e.prev=26,e.t0=e.catch(12),this.log_.info("change [".concat(r,"] to ").concat(p.smallVideo?"small":"big"," video failed. count ").concat(10-a.reSubscribeCount,".")),a.isSubscribing=!1,0===h&&this.changeBigSmallRecords_.delete(r);case 31:case"end":return e.stop()}}),e,this,[[12,26]])}))),function(t,n){return e.apply(this,arguments)})},{key:"setIsEnableSmallStream",value:function(e){this.isEnableSmallStream_=e}},{key:"getIsEnableSmallStream",value:function(){return this.isEnableSmallStream_}},{key:"smallStreamConfig",get:function(){return this.smallStreamConfig_}},{key:"isPublished",value:function(){return!!this.localStream_}},{key:"getUplinkConnection",value:function(){return this.uplinkConnection_}},{key:"getLocalStream",value:function(){return this.localStream_}},{key:"getMode",value:function(){return this.mode_}},{key:"getBadCaseDetector",value:function(){return this.badCaseDetector_}},{key:"getCallDurationCalculator",value:function(){return this.callDurationCalculator_}},{key:"getIsJoined",value:function(){return this.isJoined_}},{key:"getAllConnections",value:function(){var e=b(this.connections_.values());return this.uplinkConnection_&&e.push(this.uplinkConnection_),e}},{key:"isRelayMaybeFailed",value:function(){if(!this.signalChannel_.isOnline)return!1;var e=this.getAllConnections();if(0===e.length)return!1;for(var t=0;t<e.length;t++)if(e[t].getReconnectionCount()<6)return!1;return!0}},{key:"getUseStringRoomId",value:function(){return this.useStringRoomId_}},{key:"checkConnectionsToReconnect",value:function(){var e=this;this.getAllConnections().forEach((function(t){if(!t.getIsReconnecting()){var n=t.getPeerConnection();n&&n.connectionState===Vk&&(e.log_.warn("[".concat(t.getUserId(),"] pc is closed but not reconnect")),t.startReconnection())}}))}},{key:"getEnableAutoPlayDialog",value:function(){return this.enableAutoPlayDialog_}},{key:"sendSEIMessage",value:function(e,t){this.uplinkConnection_.sendSEI(e,t)}},{key:"setProxyServer",value:function(e){if(this.log_.info("set proxy server: ".concat(JSON.stringify(e))),uC(e)){if(!e.startsWith("wss://"))throw new vP({code:_P.INVALID_PARAMETER,message:ZR({key:HT})});this.proxy_=e}else if(rC(e)){var t=e.websocketProxy,n=e.loggerProxy,i=e.scheduleProxy,r=e.unifiedProxy;t&&(this.proxy_=t),n&&vk(n),i&&FI(i),r&&(this.unifiedProxy_=r,vk("https://".concat(r)),FI(r))}}},{key:"setTurnServer",value:function(e){this.log_.info("set turn server: "+JSON.stringify(e));var t=[];Array.isArray(e)?e.forEach((function(e){return t.push(_C(e))})):rC(e)&&t.push(_C(e)),this.turnServers_=t}},{key:"get2k4kFlag",value:function(){var e,t;return(null===(e=this.schedule_)||void 0===e||null===(t=e.trtcCapability)||void 0===t?void 0:t["2k4k"])||2}}]),Client}(),w(Dq.prototype,"join",[tq,nq,iq],Object.getOwnPropertyDescriptor(Dq.prototype,"join"),Dq.prototype),w(Dq.prototype,"leave",[rq],Object.getOwnPropertyDescriptor(Dq.prototype,"leave"),Dq.prototype),w(Dq.prototype,"getUserList",[aq],Object.getOwnPropertyDescriptor(Dq.prototype,"getUserList"),Dq.prototype),w(Dq.prototype,"publish",[oq,sq,cq],Object.getOwnPropertyDescriptor(Dq.prototype,"publish"),Dq.prototype),w(Dq.prototype,"unpublish",[uq,dq],Object.getOwnPropertyDescriptor(Dq.prototype,"unpublish"),Dq.prototype),w(Dq.prototype,"subscribe",[lq],Object.getOwnPropertyDescriptor(Dq.prototype,"subscribe"),Dq.prototype),w(Dq.prototype,"unsubscribe",[hq],Object.getOwnPropertyDescriptor(Dq.prototype,"unsubscribe"),Dq.prototype),w(Dq.prototype,"switchRole",[pq,fq,mq],Object.getOwnPropertyDescriptor(Dq.prototype,"switchRole"),Dq.prototype),w(Dq.prototype,"startPublishCDNStream",[_q,vq],Object.getOwnPropertyDescriptor(Dq.prototype,"startPublishCDNStream"),Dq.prototype),w(Dq.prototype,"stopPublishCDNStream",[gq],Object.getOwnPropertyDescriptor(Dq.prototype,"stopPublishCDNStream"),Dq.prototype),w(Dq.prototype,"startMixTranscode",[yq,Sq],Object.getOwnPropertyDescriptor(Dq.prototype,"startMixTranscode"),Dq.prototype),w(Dq.prototype,"stopMixTranscode",[bq],Object.getOwnPropertyDescriptor(Dq.prototype,"stopMixTranscode"),Dq.prototype),w(Dq.prototype,"enableAudioVolumeEvaluation",[kq],Object.getOwnPropertyDescriptor(Dq.prototype,"enableAudioVolumeEvaluation"),Dq.prototype),w(Dq.prototype,"enableSmallStream",[Iq],Object.getOwnPropertyDescriptor(Dq.prototype,"enableSmallStream"),Dq.prototype),w(Dq.prototype,"disableSmallStream",[Tq],Object.getOwnPropertyDescriptor(Dq.prototype,"disableSmallStream"),Dq.prototype),w(Dq.prototype,"setSmallStreamProfile",[wq],Object.getOwnPropertyDescriptor(Dq.prototype,"setSmallStreamProfile"),Dq.prototype),w(Dq.prototype,"setRemoteVideoStreamType",[Eq],Object.getOwnPropertyDescriptor(Dq.prototype,"setRemoteVideoStreamType"),Dq.prototype),w(Dq.prototype,"sendSEIMessage",[Rq,Cq,Aq],Object.getOwnPropertyDescriptor(Dq.prototype,"sendSEIMessage"),Dq.prototype),w(Dq.prototype,"setProxyServer",[xq],Object.getOwnPropertyDescriptor(Dq.prototype,"setProxyServer"),Dq.prototype),w(Dq.prototype,"setTurnServer",[Pq],Object.getOwnPropertyDescriptor(Dq.prototype,"setTurnServer"),Dq.prototype),Dq),qq=0,Kq=0,Qq=(jq=JG(BI),Fq=JG(BI),Bq=JG(BI),Hq=EG(wG.TRTC.createClient),Wq=JG(BI),Gq=EG(wG.TRTC.createStream),zq=function(){function e(){o(this,e),this.name_=BI,this.VERSION=Dr,this.Logger={loggerManager:MA,LogLevel:tT,setLogLevel:function(e){MA.setLogLevel(e),e<=1&&$R()},enableUploadLog:function(){zG.handleFunctionState({fnName:"TRTC.enableUploadLog"}),MA.enableUploadLog()},disableUploadLog:function(){MA.warn("disableUploadLog"),zG.handleFunctionState({fnName:"TRTC.disableUploadLog"}),MA.disableUploadLog()}}}var i;return c(e,[{key:"checkSystemRequirements",value:(i=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dO();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),function(){return i.apply(this,arguments)})},{key:"isScreenShareSupported",value:function(){return pO()}},{key:"isSmallStreamSupported",value:function(){return AO()}},{key:"getDevices",value:function(){return QO()}},{key:"getCameras",value:function(){return function(){return zO.apply(this,arguments)}()}},{key:"getMicrophones",value:function(){return YO()}},{key:"getSpeakers",value:function(){return ZO()}},{key:"createClient",value:function(e){!function(){if(NA&&(NA=!1,MA.getLogLevel()!=Xq.Logger.LogLevel.NONE&&(console.info("******************************************************************************"),console.info("*   TRTC Web SDK"),console.info("*   API Document: "+"".concat(YI,"index.html")),console.info("*   Changelog: https://cloud.tencent.com/document/product/647/38958"),console.info("*   Report issues: https://github.com/LiteAVSDK/TRTC_Web/issues"),console.info("******************************************************************************")),MA.info("TRTC Web SDK Version: 4.15.19"),MA.info("UserAgent: "+navigator.userAgent),MA.info("URL of current page: "+location.href),navigator.userAgentData&&sC(navigator.userAgentData.getHighEntropyValues)))try{navigator.userAgentData.getHighEntropyValues(["architecture","bitness","model","platformVersion","fullVersionList"]).then((function(e){var t="UAData: ".concat(e.platform,"/").concat(e.platformVersion);e.architecture&&e.bitness&&(t+=" ".concat(e.architecture,"/").concat(e.bitness)),e.mobile&&(t+=" mobile"),e.model&&(t+=" model: ".concat(e.model)),e.fullVersionList&&(t+=" ".concat(e.fullVersionList.filter((function(e){return"Not/A)Brand"!==e.brand})).map((function(e){return"".concat(e.brand,"/").concat(e.version)})).join(","))),MA.info(t)})).catch((function(){}))}catch(Yq){}}();var n={version:this.VERSION},i=new Jq(t(t(t({},n),e),{},{seq:++qq}));return OC.emit(qC,{client:i}),i}},{key:"createStream",value:function(e){return new Rz(t(t({},e),{},{seq:++Kq}))}}]),e}(),w(zq.prototype,"checkSystemRequirements",[jq],Object.getOwnPropertyDescriptor(zq.prototype,"checkSystemRequirements"),zq.prototype),w(zq.prototype,"isScreenShareSupported",[Fq],Object.getOwnPropertyDescriptor(zq.prototype,"isScreenShareSupported"),zq.prototype),w(zq.prototype,"isSmallStreamSupported",[Bq],Object.getOwnPropertyDescriptor(zq.prototype,"isSmallStreamSupported"),zq.prototype),w(zq.prototype,"createClient",[Hq,Wq],Object.getOwnPropertyDescriptor(zq.prototype,"createClient"),zq.prototype),w(zq.prototype,"createStream",[Gq],Object.getOwnPropertyDescriptor(zq.prototype,"createStream"),zq.prototype),zq),Xq=new Qq;return Xq}));

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))

/***/ })

}]);