cnhis-design-vue 0.2.35-beta → 0.2.39-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cui.umd.js CHANGED
@@ -38844,17 +38844,6 @@ icon_Icon.install = function (Vue) {
38844
38844
 
38845
38845
  /* harmony default export */ var es_icon = __webpack_exports__["a"] = (icon_Icon);
38846
38846
 
38847
- /***/ }),
38848
-
38849
- /***/ "0c81":
38850
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
38851
-
38852
- "use strict";
38853
- /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Classification_com_vue_vue_type_style_index_1_id_2cc2be68_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("b23a");
38854
- /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Classification_com_vue_vue_type_style_index_1_id_2cc2be68_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Classification_com_vue_vue_type_style_index_1_id_2cc2be68_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
38855
- /* unused harmony reexport * */
38856
-
38857
-
38858
38847
  /***/ }),
38859
38848
 
38860
38849
  /***/ "0c8f":
@@ -44050,6 +44039,17 @@ module.exports = basePick;
44050
44039
  /* unused harmony reexport * */
44051
44040
 
44052
44041
 
44042
+ /***/ }),
44043
+
44044
+ /***/ "15fe":
44045
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
44046
+
44047
+ "use strict";
44048
+ /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Classification_com_vue_vue_type_style_index_1_id_6f434f44_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("e1c7");
44049
+ /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Classification_com_vue_vue_type_style_index_1_id_6f434f44_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Classification_com_vue_vue_type_style_index_1_id_6f434f44_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
44050
+ /* unused harmony reexport * */
44051
+
44052
+
44053
44053
  /***/ }),
44054
44054
 
44055
44055
  /***/ "1609":
@@ -50223,6 +50223,20 @@ exports.push([module.i, ".ant-upload{box-sizing:border-box;margin:0;padding:0;co
50223
50223
  module.exports = exports;
50224
50224
 
50225
50225
 
50226
+ /***/ }),
50227
+
50228
+ /***/ "1fee":
50229
+ /***/ (function(module, exports, __webpack_require__) {
50230
+
50231
+ // Imports
50232
+ var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("24fb");
50233
+ exports = ___CSS_LOADER_API_IMPORT___(false);
50234
+ // Module
50235
+ exports.push([module.i, ".edit-label-content .edit-content .ant-tag-checkable span[data-v-0d391bef]{max-width:84px}.edit-content[data-v-0d391bef]{width:100%;margin-bottom:10px}.label-disable-wrap[data-v-0d391bef]{width:100%;font-size:14px;line-height:20px;display:flex;align-items:center;flex-direction:column}.label-disable-wrap .label-disable-img[data-v-0d391bef]{width:320px;height:248px}.tag-label[data-v-0d391bef] .ant-tag{margin-bottom:4px;border:1px solid #f1f1f1}.tag-label[data-v-0d391bef] .ant-tag .anticon-close{color:#fff}.common-label[data-v-0d391bef]{padding:8px 12px 4px;margin-top:8px;border-radius:4px;border:1px solid rgba(0,0,0,.1)}.common-label>span[data-v-0d391bef]{margin-right:16px;color:rgba(0,0,0,.9)}.common-label .ant-tag-checkable[data-v-0d391bef]{cursor:pointer;box-sizing:border-box}.common-label[data-v-0d391bef] .ant-tag{margin-bottom:4px}.form-add-icon-label[data-v-0d391bef]{margin-bottom:4px;color:#2d7aff;cursor:pointer}.anticon+.anticon[data-v-0d391bef]{margin-left:16px}", ""]);
50236
+ // Exports
50237
+ module.exports = exports;
50238
+
50239
+
50226
50240
  /***/ }),
50227
50241
 
50228
50242
  /***/ 2:
@@ -87666,17 +87680,6 @@ var staticStrUndefined = 'undefined'
87666
87680
  module.exports = staticStrUndefined
87667
87681
 
87668
87682
 
87669
- /***/ }),
87670
-
87671
- /***/ "39bc9":
87672
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
87673
-
87674
- "use strict";
87675
- /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_QuickSearch_vue_vue_type_style_index_0_id_e5efab7c_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("88bb");
87676
- /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_QuickSearch_vue_vue_type_style_index_0_id_e5efab7c_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_QuickSearch_vue_vue_type_style_index_0_id_e5efab7c_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
87677
- /* unused harmony reexport * */
87678
-
87679
-
87680
87683
  /***/ }),
87681
87684
 
87682
87685
  /***/ "39bd":
@@ -185934,8 +185937,10 @@ var variable = __webpack_require__("2871");
185934
185937
  var arr = [];
185935
185938
 
185936
185939
  var _loop = function _loop(key) {
185940
+ // v[this.primaryKey] 可能为数字
185941
+ // key 为字符串 用全等匹配不到 改为 ==
185937
185942
  var matchItem = _this12.oldtableData.find(function (v) {
185938
- return v[_this12.primaryKey] === key;
185943
+ return v[_this12.primaryKey] == key;
185939
185944
  });
185940
185945
 
185941
185946
  var obj = batchFormData[key];
@@ -199022,8 +199027,8 @@ FabricChart.install = function (Vue) {
199022
199027
 
199023
199028
 
199024
199029
  /* harmony default export */ var fabric_chart = (FabricChart);
199025
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"50a0e4c2-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-filter/src/quick-search/QuickSearch.vue?vue&type=template&id=e5efab7c&scoped=true&
199026
- var QuickSearchvue_type_template_id_e5efab7c_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"form-box",class:{ 'quick-search-table': _vm.source === 'editTable' }},[(_vm.source === 'editTable' && _vm.hasRelationQuickSearch)?_c('p',{staticClass:"module-title"},[_vm._v("高级筛选")]):_vm._e(),_vm._l((_vm.quickSearch),function(item){return _c('div',{key:item.sid,staticClass:"quick-item",class:{
199030
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"50a0e4c2-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-filter/src/quick-search/QuickSearch.vue?vue&type=template&id=4fb614c6&scoped=true&
199031
+ var QuickSearchvue_type_template_id_4fb614c6_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"form-box",class:{ 'quick-search-table': _vm.source === 'editTable' }},[(_vm.source === 'editTable' && _vm.hasRelationQuickSearch)?_c('p',{staticClass:"module-title"},[_vm._v("高级筛选")]):_vm._e(),_vm._l((_vm.quickSearch),function(item){return _c('div',{key:item.sid,staticClass:"quick-item",class:{
199027
199032
  'quick-block':
199028
199033
  item.con == 'DATE' || item.con == 'BIRTHDAY' || item.con == 'CONVERT' || item.LABELAttr
199029
199034
  }},[_c('div',{staticClass:"quick-row"},[_c('div',{staticClass:"quick-item-title",class:{ 'quick-item-title-default': _vm.source !== 'editTable' }},[_c('span',[_vm._v(_vm._s(_vm.handleName(item, "title"))+"  ")]),(_vm.searchFieldLimit[item.columnName] && _vm.searchFieldLimit[item.columnName].tips)?_c('a-tooltip',{attrs:{"title":_vm.searchFieldLimit[item.columnName].tips}},[_c('svg-icon',{attrs:{"icon-class":"xitongtubiaodaohangtubiaowenti"}}),_vm._v("    ")],1):_vm._e()],1),_c('div',{staticClass:"quick-item-col",class:{ 'quick-item-col-default': _vm.source !== 'editTable' }},[(item.AGEAttr)?_c('div',{staticClass:"age-container"},[_c('range-age',{ref:((item.columnName) + "_AGEAttr"),refInFor:true,attrs:{"format":item.format},on:{"change":function($event){return _vm.ageRangeOnChange($event, item)}}})],1):(item.LABELAttr)?_c('div',{staticClass:"label-attr-container"},[(item.labelObj && Object.keys(item.labelObj || {}).length > 0)?_vm._t("default",function(){return _vm._l((item.labelObj),function(v,k){return _c('div',{key:k,staticClass:"edit-label-content"},[_c('div',{staticClass:"edit-label"},[_vm._v(_vm._s(k)+":")]),_c('div',{staticClass:"edit-content quickSearch_label-container",class:{
@@ -199034,7 +199039,7 @@ var QuickSearchvue_type_template_id_e5efab7c_scoped_true_render = function () {v
199034
199039
  }),attrs:{"allowClear":""},model:{value:(item.CL),callback:function ($$v) {_vm.$set(item, "CL", $$v)},expression:"item.CL"}},[(item.comAttr == 'PASSWORD')?_c('template',{slot:"suffix"},[_c('svg-icon',{staticClass:"psw-icon",staticStyle:{"font-size":"1em"},attrs:{"icon-class":item.PASSWORDTYPE ? 'anniuyincang' : 'chakan'},on:{"click":function($event){item.PASSWORDTYPE = !item.PASSWORDTYPE}}})],1):_vm._e()],2)]]:_vm._e(),(item.con == 'EQ')?[(_vm.showPercent(item))?[_c('a-input-number',{staticClass:"EQ-input",staticStyle:{"width":"200px"},attrs:{"min":0,"max":100,"allowClear":""},model:{value:(item.EQ),callback:function ($$v) {_vm.$set(item, "EQ", $$v)},expression:"item.EQ"}})]:[_c('a-input',{staticClass:"EQ-input",class:{ 'psw-icon': item.comAttr == 'PASSWORD' },style:({
199035
199040
  width: '200px',
199036
199041
  'font-family': item.PASSWORDTYPE ? 'text-security-disc' : 'inherit'
199037
- }),attrs:{"placeholder":item.isPreciseSearch ? '' : _vm.getI18nText('1.9.6', '区间搜素用~分割'),"allowClear":""},model:{value:(item.EQ),callback:function ($$v) {_vm.$set(item, "EQ", $$v)},expression:"item.EQ"}},[(item.comAttr == 'PASSWORD')?_c('template',{slot:"suffix"},[_c('svg-icon',{staticClass:"psw-icon",staticStyle:{"font-size":"1em"},attrs:{"icon-class":item.PASSWORDTYPE ? 'anniuyincang' : 'chakan'},on:{"click":function($event){item.PASSWORDTYPE = !item.PASSWORDTYPE}}})],1):_vm._e()],2)]]:_vm._e(),(_vm.showPercent(item))?[_vm._v(" %")]:_vm._e(),(item.con == 'DATE')?_c('div',[_c('a-radio-group',{attrs:{"buttonStyle":"solid"},model:{value:(item.DATE.con),callback:function ($$v) {_vm.$set(item.DATE, "con", $$v)},expression:"item.DATE.con"}},[_vm._l((_vm.dateTeam),function(date){return _c('a-radio-button',{directives:[{name:"show",rawName:"v-show",value:(!item.showDate),expression:"!item.showDate"}],key:date.con,attrs:{"value":date.con},on:{"click":function($event){return _vm.clickRadioGroup(item.DATE, date.con)}}},[_vm._v(_vm._s(_vm.getI18nText(date.title, date.name))+" ")])}),_c('span',{class:['check-date-btn', item.marginx],on:{"click":function($event){return _vm.checkDate(item)}}},[_vm._v(_vm._s(_vm.getI18nText('1.1.4.52', '选择时间')))]),_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.showDate),expression:"item.showDate"}],staticClass:"check-date"},[_c('a-date-picker',{staticStyle:{"width":"120px"},attrs:{"format":"YYYY-MM-DD HH:mm:ss","show-time":{
199042
+ }),attrs:{"placeholder":item.isPreciseSearch || item.fieldType == 'JSONB' ? '' : _vm.getI18nText('1.9.6', '区间搜素用~分割'),"allowClear":""},model:{value:(item.EQ),callback:function ($$v) {_vm.$set(item, "EQ", $$v)},expression:"item.EQ"}},[(item.comAttr == 'PASSWORD')?_c('template',{slot:"suffix"},[_c('svg-icon',{staticClass:"psw-icon",staticStyle:{"font-size":"1em"},attrs:{"icon-class":item.PASSWORDTYPE ? 'anniuyincang' : 'chakan'},on:{"click":function($event){item.PASSWORDTYPE = !item.PASSWORDTYPE}}})],1):_vm._e()],2)]]:_vm._e(),(_vm.showPercent(item))?[_vm._v(" %")]:_vm._e(),(item.con == 'DATE')?_c('div',[_c('a-radio-group',{attrs:{"buttonStyle":"solid"},model:{value:(item.DATE.con),callback:function ($$v) {_vm.$set(item.DATE, "con", $$v)},expression:"item.DATE.con"}},[_vm._l((_vm.dateTeam),function(date){return _c('a-radio-button',{directives:[{name:"show",rawName:"v-show",value:(!item.showDate),expression:"!item.showDate"}],key:date.con,attrs:{"value":date.con},on:{"click":function($event){return _vm.clickRadioGroup(item.DATE, date.con)}}},[_vm._v(_vm._s(_vm.getI18nText(date.title, date.name))+" ")])}),_c('span',{class:['check-date-btn', item.marginx],on:{"click":function($event){return _vm.checkDate(item)}}},[_vm._v(_vm._s(_vm.getI18nText('1.1.4.52', '选择时间')))]),_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.showDate),expression:"item.showDate"}],staticClass:"check-date"},[_c('a-date-picker',{staticStyle:{"width":"120px"},attrs:{"format":"YYYY-MM-DD HH:mm:ss","show-time":{
199038
199043
  defaultValue: _vm.$moment('00:00:00', 'HH:mm:ss')
199039
199044
  },"placeholder":_vm.getI18nText('1.1.4.53', '开始时间'),"allowClear":""},model:{value:(item.DATE.start_val),callback:function ($$v) {_vm.$set(item.DATE, "start_val", $$v)},expression:"item.DATE.start_val"}}),_vm._v("   "),_c('a-date-picker',{staticStyle:{"width":"120px"},attrs:{"format":"YYYY-MM-DD HH:mm:ss","show-time":{
199040
199045
  defaultValue: _vm.$moment('23:59:59', 'HH:mm:ss')
@@ -199044,7 +199049,7 @@ var QuickSearchvue_type_template_id_e5efab7c_scoped_true_render = function () {v
199044
199049
  item.con == 'BIRTHDAY' ||
199045
199050
  item.con == 'CONVERT' ||
199046
199051
  item.LABELAttr
199047
- }},[_c('div',{staticClass:"quick-row"},[_c('div',{staticClass:"quick-item-title",class:{ 'quick-item-title-default': _vm.source !== 'editTable' }},[_c('span',[_vm._v(_vm._s(_vm.handleName(item, "title"))+"  ")])]),_c('div',{staticClass:"quick-item-col",class:{ 'quick-item-col-default': _vm.source !== 'editTable' }},[(item.LABELAttr)?_c('div',[(item.labelObj && Object.keys(item.labelObj || {}).length > 0)?_vm._t("default",function(){return _vm._l((item.labelObj),function(v,k){return _c('div',{key:k,staticClass:"edit-label-content"},[_c('div',{staticClass:"edit-label"},[_vm._v(_vm._s(k)+":")]),_c('div',{staticClass:"edit-content"},[_c('div',{staticClass:"label-content"},_vm._l((v.itemList),function(v,i){return _c('a-checkable-tag',{key:i,class:['label-tag-' + _vm.handleLabelColorClass(v)],on:{"change":function($event){return _vm.handleLabelChange($event, v, item)}},model:{value:(v.isSelect),callback:function ($$v) {_vm.$set(v, "isSelect", $$v)},expression:"v.isSelect"}},[_c('a-tooltip',{attrs:{"placement":"topLeft"}},[_c('template',{slot:"title"},[_c('span',[_vm._v(_vm._s(v.labelName))])]),_vm._v(" "+_vm._s(v.labelName)+" ")],2)],1)}),1)])])})}):_c('a-input',{staticStyle:{"width":"200px"},model:{value:(item.inputVal),callback:function ($$v) {_vm.$set(item, "inputVal", $$v)},expression:"item.inputVal"}})],2):(item.EVALUATEAttr)?_c('div',[_vm._l((_vm.EVALUATEList),function(tag){return [_c('a-checkable-tag',{key:tag.value,attrs:{"checked":item.selecteds.indexOf(tag.value) > -1},on:{"change":function (checked) { return _vm.handleEvaluateOnChange(tag, checked, item); }}},[_vm._v(" "+_vm._s(tag.label)+" ")])]})],2):(item.NUMBERFiled)?_c('div',{staticClass:"ant-calendar-picker",staticStyle:{"width":"300px"}},[_c('span',{staticClass:"ant-calendar-picker-input ant-input num-picker",class:{ 'num-picker-unit': item.inputUnit }},[_c('input',{directives:[{name:"model",rawName:"v-model",value:(item.lessValue),expression:"item.lessValue"}],staticClass:"ant-calendar-range-picker-input",attrs:{"title":("起始" + (item.alias || item.title)),"placeholder":("起始" + (item.alias || item.title))},domProps:{"value":(item.lessValue)},on:{"keyup":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return (function () { return _vm.changeFilterNumber(item); }).apply(null, arguments)},"input":function($event){if($event.target.composing){ return; }_vm.$set(item, "lessValue", $event.target.value)}}}),_c('span',{staticClass:"ant-calendar-range-picker-separator"},[_vm._v(" ~  ")]),_c('input',{directives:[{name:"model",rawName:"v-model",value:(item.bigValue),expression:"item.bigValue"}],staticClass:"ant-calendar-range-picker-input",attrs:{"title":("截止" + (item.alias || item.title)),"placeholder":("截止" + (item.alias || item.title))},domProps:{"value":(item.bigValue)},on:{"keyup":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return (function () { return _vm.changeFilterNumber(item); }).apply(null, arguments)},"input":function($event){if($event.target.composing){ return; }_vm.$set(item, "bigValue", $event.target.value)}}}),(item.inputUnit)?[_vm._v(" "+_vm._s(item.inputUnit))]:_vm._e(),(item.lessValue || item.bigValue)?_c('span',{staticClass:"ant-input-suffix clear-number-icon",on:{"click":function($event){return _vm.clearFilterNumber(item)}}},[_c('i',{staticClass:"anticon anticon-close-circle ant-input-clear-icon",attrs:{"aria-label":"图标: close-circle","tabindex":"-1"}},[_c('svg',{attrs:{"viewBox":"64 64 896 896","data-icon":"close-circle","width":"1em","height":"1em","fill":"currentColor","aria-hidden":"true","focusable":"false"}},[_c('path',{attrs:{"d":"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"}})])])]):_vm._e(),_c('span',{staticClass:"ant-calendar-picker-icon"})],2)]):_vm._t("default",function(){return [(item.con == 'CL')?[(_vm.showPercent(item))?[_c('a-input-number',{staticClass:"CL-input",staticStyle:{"width":"200px"},attrs:{"min":0,"max":100,"allowClear":""},model:{value:(item.CL),callback:function ($$v) {_vm.$set(item, "CL", $$v)},expression:"item.CL"}})]:[_c('a-input',{staticClass:"CL-input",staticStyle:{"width":"200px"},attrs:{"allowClear":""},model:{value:(item.CL),callback:function ($$v) {_vm.$set(item, "CL", $$v)},expression:"item.CL"}})]]:_vm._e(),(item.con == 'EQ')?[(_vm.showPercent(item))?[_c('a-input-number',{staticClass:"EQ-input",staticStyle:{"width":"200px"},attrs:{"min":0,"max":100,"allowClear":""},model:{value:(item.EQ),callback:function ($$v) {_vm.$set(item, "EQ", $$v)},expression:"item.EQ"}})]:[_c('a-input',{staticClass:"EQ-input",staticStyle:{"width":"200px"},attrs:{"placeholder":item.isPreciseSearch ? '' : _vm.getI18nText('1.9.6', '区间搜素用~分割'),"allowClear":""},model:{value:(item.EQ),callback:function ($$v) {_vm.$set(item, "EQ", $$v)},expression:"item.EQ"}})]]:_vm._e(),(_vm.showPercent(item))?[_vm._v(" %")]:_vm._e(),(item.con == 'DATE')?_c('div',[_c('a-radio-group',{attrs:{"buttonStyle":"solid"},model:{value:(item.DATE.con),callback:function ($$v) {_vm.$set(item.DATE, "con", $$v)},expression:"item.DATE.con"}},[_vm._l((_vm.dateTeam),function(date){return _c('a-radio-button',{directives:[{name:"show",rawName:"v-show",value:(!item.showDate),expression:"!item.showDate"}],key:date.con,attrs:{"value":date.con},on:{"click":function($event){return _vm.clickRadioGroup(item.DATE, date.con)}}},[_vm._v(_vm._s(_vm.getI18nText(date.title, date.name))+" ")])}),_c('span',{class:['check-date-btn', item.marginx],on:{"click":function($event){return _vm.checkDate(item)}}},[_vm._v(_vm._s(_vm.getI18nText('1.1.4.53', '开始时间')))]),_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.showDate),expression:"item.showDate"}],staticClass:"check-date"},[_c('a-date-picker',{staticStyle:{"width":"120px"},attrs:{"format":"YYYY-MM-DD HH:mm:ss","show-time":{
199052
+ }},[_c('div',{staticClass:"quick-row"},[_c('div',{staticClass:"quick-item-title",class:{ 'quick-item-title-default': _vm.source !== 'editTable' }},[_c('span',[_vm._v(_vm._s(_vm.handleName(item, "title"))+"  ")])]),_c('div',{staticClass:"quick-item-col",class:{ 'quick-item-col-default': _vm.source !== 'editTable' }},[(item.LABELAttr)?_c('div',[(item.labelObj && Object.keys(item.labelObj || {}).length > 0)?_vm._t("default",function(){return _vm._l((item.labelObj),function(v,k){return _c('div',{key:k,staticClass:"edit-label-content"},[_c('div',{staticClass:"edit-label"},[_vm._v(_vm._s(k)+":")]),_c('div',{staticClass:"edit-content"},[_c('div',{staticClass:"label-content"},_vm._l((v.itemList),function(v,i){return _c('a-checkable-tag',{key:i,class:['label-tag-' + _vm.handleLabelColorClass(v)],on:{"change":function($event){return _vm.handleLabelChange($event, v, item)}},model:{value:(v.isSelect),callback:function ($$v) {_vm.$set(v, "isSelect", $$v)},expression:"v.isSelect"}},[_c('a-tooltip',{attrs:{"placement":"topLeft"}},[_c('template',{slot:"title"},[_c('span',[_vm._v(_vm._s(v.labelName))])]),_vm._v(" "+_vm._s(v.labelName)+" ")],2)],1)}),1)])])})}):_c('a-input',{staticStyle:{"width":"200px"},model:{value:(item.inputVal),callback:function ($$v) {_vm.$set(item, "inputVal", $$v)},expression:"item.inputVal"}})],2):(item.EVALUATEAttr)?_c('div',[_vm._l((_vm.EVALUATEList),function(tag){return [_c('a-checkable-tag',{key:tag.value,attrs:{"checked":item.selecteds.indexOf(tag.value) > -1},on:{"change":function (checked) { return _vm.handleEvaluateOnChange(tag, checked, item); }}},[_vm._v(" "+_vm._s(tag.label)+" ")])]})],2):(item.NUMBERFiled)?_c('div',{staticClass:"ant-calendar-picker",staticStyle:{"width":"300px"}},[_c('span',{staticClass:"ant-calendar-picker-input ant-input num-picker",class:{ 'num-picker-unit': item.inputUnit }},[_c('input',{directives:[{name:"model",rawName:"v-model",value:(item.lessValue),expression:"item.lessValue"}],staticClass:"ant-calendar-range-picker-input",attrs:{"title":("起始" + (item.alias || item.title)),"placeholder":("起始" + (item.alias || item.title))},domProps:{"value":(item.lessValue)},on:{"keyup":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return (function () { return _vm.changeFilterNumber(item); }).apply(null, arguments)},"input":function($event){if($event.target.composing){ return; }_vm.$set(item, "lessValue", $event.target.value)}}}),_c('span',{staticClass:"ant-calendar-range-picker-separator"},[_vm._v(" ~  ")]),_c('input',{directives:[{name:"model",rawName:"v-model",value:(item.bigValue),expression:"item.bigValue"}],staticClass:"ant-calendar-range-picker-input",attrs:{"title":("截止" + (item.alias || item.title)),"placeholder":("截止" + (item.alias || item.title))},domProps:{"value":(item.bigValue)},on:{"keyup":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return (function () { return _vm.changeFilterNumber(item); }).apply(null, arguments)},"input":function($event){if($event.target.composing){ return; }_vm.$set(item, "bigValue", $event.target.value)}}}),(item.inputUnit)?[_vm._v(" "+_vm._s(item.inputUnit))]:_vm._e(),(item.lessValue || item.bigValue)?_c('span',{staticClass:"ant-input-suffix clear-number-icon",on:{"click":function($event){return _vm.clearFilterNumber(item)}}},[_c('i',{staticClass:"anticon anticon-close-circle ant-input-clear-icon",attrs:{"aria-label":"图标: close-circle","tabindex":"-1"}},[_c('svg',{attrs:{"viewBox":"64 64 896 896","data-icon":"close-circle","width":"1em","height":"1em","fill":"currentColor","aria-hidden":"true","focusable":"false"}},[_c('path',{attrs:{"d":"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"}})])])]):_vm._e(),_c('span',{staticClass:"ant-calendar-picker-icon"})],2)]):_vm._t("default",function(){return [(item.con == 'CL')?[(_vm.showPercent(item))?[_c('a-input-number',{staticClass:"CL-input",staticStyle:{"width":"200px"},attrs:{"min":0,"max":100,"allowClear":""},model:{value:(item.CL),callback:function ($$v) {_vm.$set(item, "CL", $$v)},expression:"item.CL"}})]:[_c('a-input',{staticClass:"CL-input",staticStyle:{"width":"200px"},attrs:{"allowClear":""},model:{value:(item.CL),callback:function ($$v) {_vm.$set(item, "CL", $$v)},expression:"item.CL"}})]]:_vm._e(),(item.con == 'EQ')?[(_vm.showPercent(item))?[_c('a-input-number',{staticClass:"EQ-input",staticStyle:{"width":"200px"},attrs:{"min":0,"max":100,"allowClear":""},model:{value:(item.EQ),callback:function ($$v) {_vm.$set(item, "EQ", $$v)},expression:"item.EQ"}})]:[_c('a-input',{staticClass:"EQ-input",staticStyle:{"width":"200px"},attrs:{"placeholder":item.isPreciseSearch || item.fieldType == 'JSONB' ? '' : _vm.getI18nText('1.9.6', '区间搜素用~分割'),"allowClear":""},model:{value:(item.EQ),callback:function ($$v) {_vm.$set(item, "EQ", $$v)},expression:"item.EQ"}})]]:_vm._e(),(_vm.showPercent(item))?[_vm._v(" %")]:_vm._e(),(item.con == 'DATE')?_c('div',[_c('a-radio-group',{attrs:{"buttonStyle":"solid"},model:{value:(item.DATE.con),callback:function ($$v) {_vm.$set(item.DATE, "con", $$v)},expression:"item.DATE.con"}},[_vm._l((_vm.dateTeam),function(date){return _c('a-radio-button',{directives:[{name:"show",rawName:"v-show",value:(!item.showDate),expression:"!item.showDate"}],key:date.con,attrs:{"value":date.con},on:{"click":function($event){return _vm.clickRadioGroup(item.DATE, date.con)}}},[_vm._v(_vm._s(_vm.getI18nText(date.title, date.name))+" ")])}),_c('span',{class:['check-date-btn', item.marginx],on:{"click":function($event){return _vm.checkDate(item)}}},[_vm._v(_vm._s(_vm.getI18nText('1.1.4.53', '开始时间')))]),_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.showDate),expression:"item.showDate"}],staticClass:"check-date"},[_c('a-date-picker',{staticStyle:{"width":"120px"},attrs:{"format":"YYYY-MM-DD HH:mm:ss","show-time":{
199048
199053
  defaultValue: _vm.$moment('00:00:00', 'HH:mm:ss')
199049
199054
  },"placeholder":'起始日期',"allowClear":""},model:{value:(item.DATE.start_val),callback:function ($$v) {_vm.$set(item.DATE, "start_val", $$v)},expression:"item.DATE.start_val"}}),_vm._v("   "),_c('a-date-picker',{staticStyle:{"width":"120px"},attrs:{"format":"YYYY-MM-DD HH:mm:ss","placeholder":'截止日期',"show-time":{
199050
199055
  defaultValue: _vm.$moment('23:59:59', 'HH:mm:ss')
@@ -199054,10 +199059,10 @@ var QuickSearchvue_type_template_id_e5efab7c_scoped_true_render = function () {v
199054
199059
  rules: [{ required: true, message: _vm.getI18nText('1.1.6.6', '请输入分类名称') }]
199055
199060
  }
199056
199061
  ]),expression:"[\n 'classname',\n {\n rules: [{ required: true, message: getI18nText('1.1.6.6', '请输入分类名称') }]\n }\n ]"}]})],1)],1),_c('a-row',[_c('a-col',{staticStyle:{"text-align":"right","color":"rgba(0, 0, 0, 0.85)"},attrs:{"span":5}},[_vm._v(" 父类名称: ")]),_c('a-col',{attrs:{"span":18}},[_vm._l((_vm.parentNames),function(item,index){return _c('div',{key:index,staticClass:"edit-tag",class:{ 'edit-tag-select': item.selected && item.disabled },on:{"dblclick":function (e) { return _vm.editParentName(e, item); },"click":function($event){return _vm.handleParentNameSelect(item, index)}}},[_c('a-input',{staticStyle:{"width":"100px"},attrs:{"value":item,"disabled":item.disabled},on:{"blur":function () { return (item.disabled = true); }},model:{value:(item.value),callback:function ($$v) {_vm.$set(item, "value", $$v)},expression:"item.value"}}),_c('a-icon',{attrs:{"slot":"suffix","type":"close"},on:{"click":function($event){return _vm.handleParentNamesRemove(index, item)}},slot:"suffix"})],1)}),(!_vm.parentNamesHasAdd)?[_c('a-button',{directives:[{name:"show",rawName:"v-show",value:(!_vm.showAdd),expression:"!showAdd"}],staticClass:"add-parent",attrs:{"icon":"plus","type":"dashed"},on:{"click":_vm.handleParentNamesAdd}},[_vm._v(" "+_vm._s(_vm.getI18nText('1.9.363', '添加分类'))+" ")]),_c('a-input',{directives:[{name:"show",rawName:"v-show",value:(_vm.showAdd),expression:"showAdd"}],staticClass:"edit-tag",staticStyle:{"width":"100px"},on:{"blur":_vm.hanldeBlur},model:{value:(_vm.addVal),callback:function ($$v) {_vm.addVal=(typeof $$v === 'string'? $$v.trim(): $$v)},expression:"addVal"}})]:_vm._e()],2)],1)],1)],1)}
199057
- var QuickSearchvue_type_template_id_e5efab7c_scoped_true_staticRenderFns = []
199062
+ var QuickSearchvue_type_template_id_4fb614c6_scoped_true_staticRenderFns = []
199058
199063
 
199059
199064
 
199060
- // CONCATENATED MODULE: ./packages/table-filter/src/quick-search/QuickSearch.vue?vue&type=template&id=e5efab7c&scoped=true&
199065
+ // CONCATENATED MODULE: ./packages/table-filter/src/quick-search/QuickSearch.vue?vue&type=template&id=4fb614c6&scoped=true&
199061
199066
 
199062
199067
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.entries.js
199063
199068
  var es_object_entries = __webpack_require__("4fad");
@@ -202083,8 +202088,8 @@ var AGEOPTIONS = [{
202083
202088
  }));
202084
202089
  // CONCATENATED MODULE: ./packages/table-filter/src/quick-search/QuickSearch.vue?vue&type=script&lang=js&
202085
202090
  /* harmony default export */ var quick_search_QuickSearchvue_type_script_lang_js_ = (QuickSearchvue_type_script_lang_js_);
202086
- // EXTERNAL MODULE: ./packages/table-filter/src/quick-search/QuickSearch.vue?vue&type=style&index=0&id=e5efab7c&lang=less&scoped=true&
202087
- var QuickSearchvue_type_style_index_0_id_e5efab7c_lang_less_scoped_true_ = __webpack_require__("39bc9");
202091
+ // EXTERNAL MODULE: ./packages/table-filter/src/quick-search/QuickSearch.vue?vue&type=style&index=0&id=4fb614c6&lang=less&scoped=true&
202092
+ var QuickSearchvue_type_style_index_0_id_4fb614c6_lang_less_scoped_true_ = __webpack_require__("c23b");
202088
202093
 
202089
202094
  // EXTERNAL MODULE: ./packages/table-filter/src/quick-search/QuickSearch.vue?vue&type=style&index=1&lang=less&
202090
202095
  var QuickSearchvue_type_style_index_1_lang_less_ = __webpack_require__("0015");
@@ -202101,18 +202106,18 @@ var QuickSearchvue_type_style_index_1_lang_less_ = __webpack_require__("0015");
202101
202106
 
202102
202107
  var QuickSearch_component = Object(componentNormalizer["a" /* default */])(
202103
202108
  quick_search_QuickSearchvue_type_script_lang_js_,
202104
- QuickSearchvue_type_template_id_e5efab7c_scoped_true_render,
202105
- QuickSearchvue_type_template_id_e5efab7c_scoped_true_staticRenderFns,
202109
+ QuickSearchvue_type_template_id_4fb614c6_scoped_true_render,
202110
+ QuickSearchvue_type_template_id_4fb614c6_scoped_true_staticRenderFns,
202106
202111
  false,
202107
202112
  null,
202108
- "e5efab7c",
202113
+ "4fb614c6",
202109
202114
  null
202110
202115
 
202111
202116
  )
202112
202117
 
202113
202118
  /* harmony default export */ var QuickSearch = (QuickSearch_component.exports);
202114
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"50a0e4c2-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-filter/src/classification/Classification-com.vue?vue&type=template&id=2cc2be68&scoped=true&
202115
- var Classification_comvue_type_template_id_2cc2be68_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['classification', 'classificationIndex-' + _vm.classificationIndex, _vm.isPackUp ? 'upack-up-wrap' : ''],style:(_vm.dynamicStyle)},[(_vm.classificationIndex === 0)?[_c('div',{directives:[{name:"flexible-resize",rawName:"v-flexible-resize",value:({
202119
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"50a0e4c2-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-filter/src/classification/Classification-com.vue?vue&type=template&id=6f434f44&scoped=true&
202120
+ var Classification_comvue_type_template_id_6f434f44_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['classification', 'classificationIndex-' + _vm.classificationIndex, _vm.isPackUp ? 'upack-up-wrap' : ''],style:(_vm.dynamicStyle)},[(_vm.classificationIndex === 0)?[_c('div',{directives:[{name:"flexible-resize",rawName:"v-flexible-resize",value:({
202116
202121
  mode: 'VR',
202117
202122
  onMove: _vm.changeWidth,
202118
202123
  onEnd: _vm.saveWidth
@@ -202137,10 +202142,10 @@ var Classification_comvue_type_template_id_2cc2be68_scoped_true_render = functio
202137
202142
  },on:{"click":function($event){return _vm.handleItemClick(child, cIndex, item, index)}}},[_c('span',[_vm._v(" "+_vm._s(_vm._f("fmtChildName")(child.name,child.isPublic))+" "),(_vm.visibleDigital(child))?_c('span',{staticClass:"digital-span"},[_vm._v(" ("+_vm._s(child.digital || 0)+") ")]):_vm._e()]),(child.selected)?_c('a-icon',{attrs:{"type":"check"}}):_vm._e()],1)],2):_vm._e()],1)}):_vm._e()]],2):_vm._e()]})],2),(_vm.conditionType === 'keyword' && _vm.hideClearConditionChange != 1)?_c('div',{staticClass:"select-type-footer"},[_c('div',{staticClass:"selected-num"},[_vm._v("已选择"+_vm._s(_vm.conditionSid.filter(function (item) { return item !== 'all_data'; }).length)+"项")]),_c('div',{staticClass:"selected-item-del",on:{"click":function($event){return _vm.handleItemClick({ sid: 'all_data', name: '全部数据', digital: _vm.allObj.digital })}}},[_c('svg-icon',{attrs:{"class-name":"svg-icon-btn","icon-class":"xitongtubiaoliebiaocaozuoanniushanchu"}}),_vm._v(" 清空筛选 ")],1)]):_vm._e()]):_vm._e()])]:_vm._e(),(_vm.classificationIndex === 3)?[(_vm.hideConditionChangeBtn != 1 || _vm.hideConditionChangeSetting != 1 || _vm.hideConditionChangeSetting != 1 || _vm.originConditionList.filter(function (item) { return item.isShow; }).length > 0)?_c('div',{staticClass:"group-type classify-3"},[(_vm.hideConditionChangeBtn != 1 || _vm.hideConditionChangeSetting != 1)?_c('div',{staticClass:"header"},[_c('span',{staticClass:"all-data",class:{ selected: _vm.conditionSid.indexOf('all_data') !== -1 },on:{"click":function($event){return _vm.handleItemClick({ sid: 'all_data', name: '全部数据', digital: _vm.allObj.digital })}}},[_vm._v(" 全部数据 "),(_vm.allObj.digital || _vm.allObj.digital === 0)?[_vm._v(" ("+_vm._s(_vm.allObj.digital || 0)+") ")]:_vm._e()],2),_c('div',{staticClass:"right-setting"},[(_vm.hideConditionChangeBtn != 1)?_c('span',{staticStyle:{"margin-right":"30px"},on:{"click":_vm.handleModeChange}},[_c('a-icon',{attrs:{"type":"swap"}}),_vm._v(" "+_vm._s('切换')+" ")],1):_vm._e(),(_vm.hideConditionChangeSetting != 1)?_c('span',{on:{"click":_vm.handleSettingShow}},[_c('a-icon',{attrs:{"type":"setting"}}),_vm._v(" "+_vm._s('设置')+" ")],1):_vm._e()])]):_vm._e(),_c('div',{staticClass:"group",style:({
202138
202143
  borderBottom: _vm.conditionType === 'keyword' && _vm.hideClearConditionChange != 1 ? '1px solid #d5d5d5' : 0
202139
202144
  })},[_vm._l((_vm.treeData.slice(1)),function(item,index){return [(!item.children || item.children.length === 0)?[_c('span',{key:item.sid,staticClass:"child-item",class:{ selected: item.selected },staticStyle:{"padding-left":"17px"},on:{"click":function($event){return _vm.handleItemClick(item)}}},[_vm._v(_vm._s(item.name)+" "+_vm._s(item.digital)+" "),(_vm.visibleDigital(item))?_c('span',{staticClass:"digital-span"},[_vm._v(" ("+_vm._s(item.digital || 0)+") ")]):_vm._e()])]:[(item.children.filter(function (i) { return i.isShow; }).length !== 0)?_c('a-select',{key:item.sid,attrs:{"placeholder":item.name + (_vm.countCondition == 1 && (item.digital || item.digital === 0) ? ' (' + (item.digital || 0) + ')' : ''),"allowClear":"","value":_vm.groupSelect(index),"option-label-prop":"label"},on:{"change":function (value, option) { return _vm.handleChange(value, option, item, index); }}},[_c('a-select-option',{staticClass:"classiffication-select-hide",attrs:{"value":0,"label":item.name + (_vm.countCondition == 1 && (item.digital || item.digital === 0) ? ' (' + (item.digital || 0) + ')' : '')}},[_vm._v(" "+_vm._s(item.name)+" "),(_vm.visibleDigital(item))?_c('span',{staticClass:"digital-span"},[_vm._v(" ("+_vm._s(item.digital || 0)+") ")]):_vm._e()]),_vm._l((item.children.filter(function (i) { return i.isShow; })),function(child,cIndex){return _c('a-select-option',{key:child.sid,staticClass:"group-select-option",attrs:{"value":child.sid,"label":child.name + (_vm.countCondition == 1 && _vm.visibleDigital(child) ? ' (' + (child.digital || 0) + ')' : ''),"child":child,"cIndex":cIndex,"index":index,"item":item,"disabled":!child.digital && _vm.getCondiTionDigital},on:{"click":function (value, option) { return _vm.conditionSid.indexOf(child.sid) !== -1 && _vm.handleItemClick(child, cIndex, item, index); }}},[_c('span',[_vm._v(" "+_vm._s(child.name)+" "),(_vm.visibleDigital(child))?_c('span',{staticClass:"digital-span"},[_vm._v(" ("+_vm._s(child.digital || 0)+") ")]):_vm._e()]),(child.selected)?_c('a-icon',{attrs:{"type":"check"}}):_vm._e()],1)})],2):_vm._e()]]})],2),(_vm.conditionType === 'keyword' && _vm.hideClearConditionChange != 1)?_c('div',{staticClass:"selected-list"},[_c('div',{staticClass:"selected-num"},[_vm._v("已选择"+_vm._s(_vm.conditionSid.filter(function (item) { return item !== 'all_data'; }).length)+"项")]),_vm._l((_vm.treeData.slice(1)),function(item,index){return [(!item.children || item.children.length === 0)?_c('div',{key:item.sid,staticClass:"selected-item"},[_vm._v(" "+_vm._s(item.name)+" "),(_vm.visibleDigital(item))?_c('span',{staticClass:"digital-span"},[_vm._v(" ("+_vm._s(item.digital || 0)+") ")]):_vm._e(),_c('a-icon',{attrs:{"type":"close"},on:{"click":function($event){return _vm.handleItemClick(item)}}})],1):[_vm._l((item.children),function(child,cIndex){return [(child.selected)?_c('div',{key:child.sid,staticClass:"selected-item"},[_vm._v(" "+_vm._s(child.name)+" "),(_vm.visibleDigital(child))?_c('span',{staticClass:"digital-span"},[_vm._v(" ("+_vm._s(child.digital || 0)+") ")]):_vm._e(),_c('a-icon',{attrs:{"type":"close"},on:{"click":function($event){return _vm.handleItemClick(child, cIndex, item, index)}}})],1):_vm._e()]})]]}),_c('div',{staticClass:"selected-item-del",on:{"click":function($event){return _vm.handleItemClick({ sid: 'all_data', name: '全部数据', digital: _vm.allObj.digital })}}},[_c('svg-icon',{attrs:{"class-name":"svg-icon-btn","icon-class":"xitongtubiaoliebiaocaozuoanniushanchu"}}),_vm._v(" 清空筛选 ")],1)],2):_vm._e()]):_vm._e()]:_vm._e(),(_vm.classificationIndex === 4)?[(_vm.showIconBtn || _vm.hasConditionList)?_c('div',{staticClass:"group-type classify-3 classify-4"},[(_vm.showIconBtn)?_c('div',{staticClass:"header"},[_c('span',{staticClass:"all-data",class:{ selected: _vm.conditionSid.indexOf('all_data') !== -1 }},[_vm._v(" "+_vm._s(_vm.showTitleName)+" "),(_vm.allObj.digital || _vm.allObj.digital === 0)?[_vm._v(" ("+_vm._s(_vm.allObj.digital || 0)+") ")]:_vm._e()],2),_c('div',{staticClass:"right-setting"},[_c('span',{staticClass:"upack-up-btn",staticStyle:{"margin-right":"30px"},on:{"click":function($event){_vm.isPackUp = !_vm.isPackUp}}},[_vm._v(" "+_vm._s(_vm.isPackUp ? '展开' : '收起')+" "),_c('a-icon',{staticStyle:{"color":"#2d7aff"},attrs:{"type":_vm.isPackUp ? 'down' : 'up'}})],1),(_vm.hideConditionChangeBtn != 1)?_c('span',{staticStyle:{"margin-right":"30px"},on:{"click":_vm.handleModeChange}},[_c('a-icon',{attrs:{"type":"swap"}}),_vm._v(" 切换 ")],1):_vm._e(),(_vm.hideConditionChangeSetting != 1)?_c('span',{on:{"click":_vm.handleSettingShow}},[_c('a-icon',{attrs:{"type":"setting"}}),_vm._v(" 设置 ")],1):_vm._e()])]):_vm._e()]):_vm._e(),_c('div',{staticClass:"classify-4-container",style:({ height: _vm.isPackUp ? 0 : 'auto' })},[_c('search-professional-model',_vm._g(_vm._b({ref:"professional",attrs:{"originConditionList":_vm.originConditionList,"displayCategoryList":_vm.displayCategoryList,"treeData":_vm.treeData,"tableId":_vm.tableId,"searchFieldList":_vm.searchFieldList},on:{"handleItemClick":_vm.handleItemClick,"changeShowName":_vm.changeShowName}},'search-professional-model',_vm.$attrs,false),_vm.$listeners))],1)]:_vm._e(),_c('set-classification',_vm._g(_vm._b({ref:"search",attrs:{"searchFieldList":_vm.searchFieldList,"conditionList":_vm.searchConditionList,"displayCategoryList":_vm.displayCategoryList,"settingId":_vm.settingId,"searchDefName":_vm.searchDefName,"tableId":_vm.tableId,"classifyModal":_vm.classifyModal,"filterApiConfig":_vm.filterApiConfig},on:{"changeSearch":_vm.changeSearch,"saveGetTableCondiTionList":_vm.saveGetTableCondiTionList,"CondiTionListInit":_vm.updateTableCondiTion,"setClassifyModal":_vm.setClassifyModal}},'set-classification',_vm.$attrs,false),_vm.$listeners))],2)}
202140
- var Classification_comvue_type_template_id_2cc2be68_scoped_true_staticRenderFns = []
202145
+ var Classification_comvue_type_template_id_6f434f44_scoped_true_staticRenderFns = []
202141
202146
 
202142
202147
 
202143
- // CONCATENATED MODULE: ./packages/table-filter/src/classification/Classification-com.vue?vue&type=template&id=2cc2be68&scoped=true&
202148
+ // CONCATENATED MODULE: ./packages/table-filter/src/classification/Classification-com.vue?vue&type=template&id=6f434f44&scoped=true&
202144
202149
 
202145
202150
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
202146
202151
  var esm_classCallCheck = __webpack_require__("d4ec");
@@ -202344,12 +202349,12 @@ var set_classificationvue_type_template_id_19bd6af7_scoped_true_staticRenderFns
202344
202349
 
202345
202350
  // CONCATENATED MODULE: ./packages/table-filter/src/components/search-modal/set-classification.vue?vue&type=template&id=19bd6af7&scoped=true&
202346
202351
 
202347
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"50a0e4c2-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-filter/src/components/table-modal/TableModal.vue?vue&type=template&id=47bef686&scoped=true&
202348
- var TableModalvue_type_template_id_47bef686_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('a-modal',{staticClass:"modal-wrap standard-modal standard-modal-white",class:{ 'modal-screen': _vm.isChangeWindow },attrs:{"bodyStyle":{ height: _vm.modalHeight, overflowY: 'auto' },"width":_vm.modalWidth,"maskClosable":false,"closable":false,"centered":"","transitionName":_vm.transitionName,"getContainer":_vm.getContainer},on:{"cancel":_vm.close,"ok":_vm.handleOk},scopedSlots:_vm._u([(_vm.type == 'search')?{key:"footer",fn:function(){return [_c('a-popconfirm',{staticClass:"btn-reset",attrs:{"title":"确认要恢复系统默认设置吗?","ok-text":"确认","cancel-text":"取消"},on:{"confirm":_vm.popconfirm}},[_c('a-button',[_vm._v("恢复默认设置")])],1),_c('a-button',{on:{"click":_vm.close}},[_vm._v("取消")]),_vm._t("add"),_c('a-button',{attrs:{"type":"primary"},on:{"click":_vm.handleOk}},[_vm._v("保存")])]},proxy:true}:null],null,true),model:{value:(_vm.visible),callback:function ($$v) {_vm.visible=$$v},expression:"visible"}},[_vm._t("title",function(){return [_c('div',[_c('a-icon',{staticStyle:{"font-size":"14px"},attrs:{"type":"setting"}}),_vm._v(" 设置分类 ")],1),_c('div',{staticClass:"svg-wrap"},[_c('svg-icon',{attrs:{"icon-class":_vm.isChangeWindow ? 'xitongtubiaodaohangtubiaozuixiaohua' : 'xitongtubiaodaohangtubiaozuidahua'},on:{"click":_vm.changeModalWindow}}),_c('svg-icon',{attrs:{"icon-class":'xitongtubiaodaohangtubiaoguanbi'},on:{"click":_vm.close}})],1)]},{"slot":"title","isChangeWindow":_vm.isChangeWindow,"changeModalWindow":_vm.changeModalWindow,"close":_vm.close}),(_vm.isAdmin && _vm.type == 'mananger')?_c('p',[_c('a-icon',{attrs:{"type":"plus-circle"}}),_vm._v("  "),_c('a',{on:{"click":_vm.rinkTo}},[_vm._v(" 添加首页 ")])],1):_vm._e(),_c('div',{staticClass:"list"},[_c('div',{staticClass:"list-title"},[_c('span',{staticClass:"list-title-item",staticStyle:{"width":"6%"}}),_c('span',{staticClass:"list-title-item"},[_vm._v(" 名称 ")]),_c('span',{staticClass:"list-title-item"},[_vm._v(" 父类名称 ")]),_c('span',{staticClass:"list-title-item"},[_vm._v(" 是否显示 ")]),_c('span',{staticClass:"list-title-item"},[_vm._v(" 设置为默认 ")]),_c('span',{directives:[{name:"show",rawName:"v-show",value:(_vm.isAdmin),expression:"isAdmin"}],staticClass:"list-title-item"},[_vm._v(" 设置公共首页 ")]),_c('span',{staticClass:"list-title-item"},[_vm._v(" 操作 ")])]),_c('draggable',{staticClass:"list-content",attrs:{"tag":"ul","animation":"300"},on:{"end":_vm.dragEnd},model:{value:(_vm.homeList),callback:function ($$v) {_vm.homeList=$$v},expression:"homeList"}},[_vm._l((_vm.homeList),function(item){return [_c('li',{directives:[{name:"show",rawName:"v-show",value:(item.type != 'line'),expression:"item.type != 'line'"}],key:item.sid,class:{ checked: item.checked },on:{"click":function($event){return _vm.clickli(item)}}},[_c('span',{staticClass:"list-content-item",staticStyle:{"width":"6%","text-align":"center","overflow":"initial"}},[_c('a-tooltip',{attrs:{"mouseEnterDelay":1}},[_c('template',{slot:"title"},[_vm._v(" 拖拽调整顺序 ")]),_c('a-icon',{attrs:{"type":"pause","rotate":90}})],2)],1),_c('span',{staticClass:"list-content-item",attrs:{"title":item.displayCategory}},[_vm._v(" "+_vm._s(item.name)+" ")]),_c('span',{staticClass:"list-content-item",attrs:{"title":item.name}},[_vm._v(" "+_vm._s(item.displayCategory)+" ")]),_c('span',{staticClass:"list-content-item list-content-switch"},[_c('a-switch',{attrs:{"checked":item.isShow},on:{"change":function($event){return _vm.changeSwitch(item, '是否展示')}}})],1),_c('span',{staticClass:"list-content-item list-content-radio"},[_c('a-switch',{attrs:{"checked":item.isDefault},on:{"change":function($event){return _vm.clickChecked(item, '设置默认值')}}})],1),_c('span',{directives:[{name:"show",rawName:"v-show",value:(_vm.isAdmin),expression:"isAdmin"}],staticClass:"list-content-item"},[_c('a-switch',{attrs:{"checked":item.isCommon},on:{"change":function($event){return _vm.changecommonSwitch(item)}}})],1),_c('span',{staticClass:"list-content-item"},[_c('a-popconfirm',{directives:[{name:"show",rawName:"v-show",value:(_vm.type == 'mananger' && _vm.isAdmin),expression:"type == 'mananger' && isAdmin"}],attrs:{"title":'是否确认删除?'},on:{"confirm":function($event){return _vm.confirm(item)}}},[_c('a-tooltip',{attrs:{"title":'删除',"destroyTooltipOnHide":""}},[_c('a-icon',{attrs:{"type":"delete"}})],1)],1),_c('a-tooltip',{directives:[{name:"show",rawName:"v-show",value:(_vm.type == 'other' || (_vm.type == 'search' && item.isEdit) || (_vm.type == 'mananger' && _vm.isAdmin)),expression:"type == 'other' || (type == 'search' && item.isEdit) || (type == 'mananger' && isAdmin)"}],attrs:{"title":'编辑',"destroyTooltipOnHide":""}},[_c('a-icon',{attrs:{"type":"edit"},on:{"click":function($event){$event.preventDefault();$event.stopPropagation();return _vm.edit(item, '编辑')}}})],1),_c('a-tooltip',{directives:[{name:"show",rawName:"v-show",value:(_vm.type == 'search' || _vm.type == 'other'),expression:"type == 'search' || type == 'other'"}],attrs:{"title":'复制',"destroyTooltipOnHide":""}},[_c('a-icon',{attrs:{"type":"copy"},on:{"click":function($event){$event.preventDefault();$event.stopPropagation();return _vm.copy(item, '复制')}}})],1),_c('a-popconfirm',{directives:[{name:"show",rawName:"v-show",value:(item.isEdit),expression:"item.isEdit"}],attrs:{"title":'是否确认删除?'},on:{"confirm":function($event){return _vm.delItem(item, '删除')}}},[_c('a-tooltip',{attrs:{"title":'删除',"destroyTooltipOnHide":""}},[_c('a-icon',{attrs:{"type":"delete"}})],1)],1)],1)])]})],2)],1),_vm._t("footer",null,{"slot":"footer"})],2)}
202349
- var TableModalvue_type_template_id_47bef686_scoped_true_staticRenderFns = []
202352
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"50a0e4c2-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-filter/src/components/table-modal/TableModal.vue?vue&type=template&id=4592973c&scoped=true&
202353
+ var TableModalvue_type_template_id_4592973c_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('a-modal',{staticClass:"modal-wrap standard-modal standard-modal-white",class:{ 'modal-screen': _vm.isChangeWindow },attrs:{"bodyStyle":{ height: _vm.modalHeight, overflowY: 'auto' },"width":_vm.modalWidth,"maskClosable":false,"closable":false,"centered":"","transitionName":_vm.transitionName,"getContainer":_vm.getContainer},on:{"cancel":_vm.close,"ok":_vm.handleOk},scopedSlots:_vm._u([(_vm.type == 'search')?{key:"footer",fn:function(){return [(_vm.isShowResetButton)?_c('a-popconfirm',{staticClass:"btn-reset",attrs:{"title":"确认要恢复系统默认设置吗?","ok-text":"确认","cancel-text":"取消"},on:{"confirm":_vm.popconfirm}},[_c('a-button',[_vm._v("恢复默认设置")])],1):_vm._e(),_c('a-button',{on:{"click":_vm.close}},[_vm._v("取消")]),_vm._t("add"),_c('a-button',{attrs:{"type":"primary"},on:{"click":_vm.handleOk}},[_vm._v("保存")])]},proxy:true}:null],null,true),model:{value:(_vm.visible),callback:function ($$v) {_vm.visible=$$v},expression:"visible"}},[_vm._t("title",function(){return [_c('div',[_c('a-icon',{staticStyle:{"font-size":"14px"},attrs:{"type":"setting"}}),_vm._v(" 设置分类 ")],1),_c('div',{staticClass:"svg-wrap"},[_c('svg-icon',{attrs:{"icon-class":_vm.isChangeWindow ? 'xitongtubiaodaohangtubiaozuixiaohua' : 'xitongtubiaodaohangtubiaozuidahua'},on:{"click":_vm.changeModalWindow}}),_c('svg-icon',{attrs:{"icon-class":'xitongtubiaodaohangtubiaoguanbi'},on:{"click":_vm.close}})],1)]},{"slot":"title","isChangeWindow":_vm.isChangeWindow,"changeModalWindow":_vm.changeModalWindow,"close":_vm.close}),(_vm.isAdmin && _vm.type == 'mananger')?_c('p',[_c('a-icon',{attrs:{"type":"plus-circle"}}),_vm._v("  "),_c('a',{on:{"click":_vm.rinkTo}},[_vm._v(" 添加首页 ")])],1):_vm._e(),_c('div',{staticClass:"list"},[_c('div',{staticClass:"list-title"},[_c('span',{staticClass:"list-title-item",staticStyle:{"width":"6%"}}),_c('span',{staticClass:"list-title-item"},[_vm._v(" 名称 ")]),_c('span',{staticClass:"list-title-item"},[_vm._v(" 父类名称 ")]),_c('span',{staticClass:"list-title-item"},[_vm._v(" 是否显示 ")]),_c('span',{staticClass:"list-title-item"},[_vm._v(" 设置为默认 ")]),_c('span',{directives:[{name:"show",rawName:"v-show",value:(_vm.isAdmin),expression:"isAdmin"}],staticClass:"list-title-item"},[_vm._v(" 设置公共首页 ")]),_c('span',{staticClass:"list-title-item"},[_vm._v(" 操作 ")])]),_c('draggable',{staticClass:"list-content",attrs:{"tag":"ul","animation":"300"},on:{"end":_vm.dragEnd},model:{value:(_vm.homeList),callback:function ($$v) {_vm.homeList=$$v},expression:"homeList"}},[_vm._l((_vm.homeList),function(item){return [_c('li',{directives:[{name:"show",rawName:"v-show",value:(item.type != 'line'),expression:"item.type != 'line'"}],key:item.sid,class:{ checked: item.checked },on:{"click":function($event){return _vm.clickli(item)}}},[_c('span',{staticClass:"list-content-item",staticStyle:{"width":"6%","text-align":"center","overflow":"initial"}},[_c('a-tooltip',{attrs:{"mouseEnterDelay":1}},[_c('template',{slot:"title"},[_vm._v(" 拖拽调整顺序 ")]),_c('a-icon',{attrs:{"type":"pause","rotate":90}})],2)],1),_c('span',{staticClass:"list-content-item",attrs:{"title":item.displayCategory}},[_vm._v(" "+_vm._s(item.name)+" ")]),_c('span',{staticClass:"list-content-item",attrs:{"title":item.name}},[_vm._v(" "+_vm._s(item.displayCategory)+" ")]),_c('span',{staticClass:"list-content-item list-content-switch"},[_c('a-switch',{attrs:{"checked":item.isShow},on:{"change":function($event){return _vm.changeSwitch(item, '是否展示')}}})],1),_c('span',{staticClass:"list-content-item list-content-radio"},[_c('a-switch',{attrs:{"checked":item.isDefault},on:{"change":function($event){return _vm.clickChecked(item, '设置默认值')}}})],1),_c('span',{directives:[{name:"show",rawName:"v-show",value:(_vm.isAdmin),expression:"isAdmin"}],staticClass:"list-content-item"},[_c('a-switch',{attrs:{"checked":item.isCommon},on:{"change":function($event){return _vm.changecommonSwitch(item)}}})],1),_c('span',{staticClass:"list-content-item"},[_c('a-popconfirm',{directives:[{name:"show",rawName:"v-show",value:(_vm.type == 'mananger' && _vm.isAdmin),expression:"type == 'mananger' && isAdmin"}],attrs:{"title":'是否确认删除?'},on:{"confirm":function($event){return _vm.confirm(item)}}},[_c('a-tooltip',{attrs:{"title":'删除',"destroyTooltipOnHide":""}},[_c('a-icon',{attrs:{"type":"delete"}})],1)],1),_c('a-tooltip',{directives:[{name:"show",rawName:"v-show",value:(_vm.type == 'other' || (_vm.type == 'search' && item.isEdit) || (_vm.type == 'mananger' && _vm.isAdmin)),expression:"type == 'other' || (type == 'search' && item.isEdit) || (type == 'mananger' && isAdmin)"}],attrs:{"title":'编辑',"destroyTooltipOnHide":""}},[_c('a-icon',{attrs:{"type":"edit"},on:{"click":function($event){$event.preventDefault();$event.stopPropagation();return _vm.edit(item, '编辑')}}})],1),_c('a-tooltip',{directives:[{name:"show",rawName:"v-show",value:(_vm.type == 'search' || _vm.type == 'other'),expression:"type == 'search' || type == 'other'"}],attrs:{"title":'复制',"destroyTooltipOnHide":""}},[_c('a-icon',{attrs:{"type":"copy"},on:{"click":function($event){$event.preventDefault();$event.stopPropagation();return _vm.copy(item, '复制')}}})],1),_c('a-popconfirm',{directives:[{name:"show",rawName:"v-show",value:(item.isEdit),expression:"item.isEdit"}],attrs:{"title":'是否确认删除?'},on:{"confirm":function($event){return _vm.delItem(item, '删除')}}},[_c('a-tooltip',{attrs:{"title":'删除',"destroyTooltipOnHide":""}},[_c('a-icon',{attrs:{"type":"delete"}})],1)],1)],1)])]})],2)],1),_vm._t("footer",null,{"slot":"footer"})],2)}
202354
+ var TableModalvue_type_template_id_4592973c_scoped_true_staticRenderFns = []
202350
202355
 
202351
202356
 
202352
- // CONCATENATED MODULE: ./packages/table-filter/src/components/table-modal/TableModal.vue?vue&type=template&id=47bef686&scoped=true&
202357
+ // CONCATENATED MODULE: ./packages/table-filter/src/components/table-modal/TableModal.vue?vue&type=template&id=4592973c&scoped=true&
202353
202358
 
202354
202359
  // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-filter/src/components/table-modal/TableModal.vue?vue&type=script&lang=js&
202355
202360
 
@@ -202376,6 +202381,11 @@ var TableModalvue_type_script_lang_js_components;
202376
202381
 
202377
202382
  /* harmony default export */ var TableModalvue_type_script_lang_js_ = ({
202378
202383
  mixins: [mixins_mixins["c" /* filterApiFn */]],
202384
+ inject: {
202385
+ isShowResetButton: {
202386
+ from: 'root_isShowResetButton'
202387
+ }
202388
+ },
202379
202389
  props: {
202380
202390
  visibleIn: Boolean,
202381
202391
  loading: Boolean,
@@ -202607,8 +202617,8 @@ var TableModalvue_type_script_lang_js_components;
202607
202617
  });
202608
202618
  // CONCATENATED MODULE: ./packages/table-filter/src/components/table-modal/TableModal.vue?vue&type=script&lang=js&
202609
202619
  /* harmony default export */ var table_modal_TableModalvue_type_script_lang_js_ = (TableModalvue_type_script_lang_js_);
202610
- // EXTERNAL MODULE: ./packages/table-filter/src/components/table-modal/TableModal.vue?vue&type=style&index=0&id=47bef686&lang=less&scoped=true&
202611
- var TableModalvue_type_style_index_0_id_47bef686_lang_less_scoped_true_ = __webpack_require__("e282");
202620
+ // EXTERNAL MODULE: ./packages/table-filter/src/components/table-modal/TableModal.vue?vue&type=style&index=0&id=4592973c&lang=less&scoped=true&
202621
+ var TableModalvue_type_style_index_0_id_4592973c_lang_less_scoped_true_ = __webpack_require__("7649");
202612
202622
 
202613
202623
  // CONCATENATED MODULE: ./packages/table-filter/src/components/table-modal/TableModal.vue
202614
202624
 
@@ -202621,11 +202631,11 @@ var TableModalvue_type_style_index_0_id_47bef686_lang_less_scoped_true_ = __webp
202621
202631
 
202622
202632
  var TableModal_component = Object(componentNormalizer["a" /* default */])(
202623
202633
  table_modal_TableModalvue_type_script_lang_js_,
202624
- TableModalvue_type_template_id_47bef686_scoped_true_render,
202625
- TableModalvue_type_template_id_47bef686_scoped_true_staticRenderFns,
202634
+ TableModalvue_type_template_id_4592973c_scoped_true_render,
202635
+ TableModalvue_type_template_id_4592973c_scoped_true_staticRenderFns,
202626
202636
  false,
202627
202637
  null,
202628
- "47bef686",
202638
+ "4592973c",
202629
202639
  null
202630
202640
 
202631
202641
  )
@@ -204500,6 +204510,11 @@ var Classification_comvue_type_script_lang_js_components;
204500
204510
  /* harmony default export */ var Classification_comvue_type_script_lang_js_ = (Object(core_create["a" /* default */])({
204501
204511
  name: 'Classification',
204502
204512
  mixins: [mixins_mixins["c" /* filterApiFn */]],
204513
+ provide: function provide() {
204514
+ return {
204515
+ root_isShowResetButton: this.isShowResetButton
204516
+ };
204517
+ },
204503
204518
  components: (Classification_comvue_type_script_lang_js_components = {}, Object(esm_defineProperty["a" /* default */])(Classification_comvue_type_script_lang_js_components, es_icon["a" /* default */].name, es_icon["a" /* default */]), Object(esm_defineProperty["a" /* default */])(Classification_comvue_type_script_lang_js_components, tooltip["a" /* default */].name, tooltip["a" /* default */]), Object(esm_defineProperty["a" /* default */])(Classification_comvue_type_script_lang_js_components, es_select["d" /* default */].name, es_select["d" /* default */]), Object(esm_defineProperty["a" /* default */])(Classification_comvue_type_script_lang_js_components, es_select["d" /* default */].Option.name, es_select["d" /* default */].Option), Object(esm_defineProperty["a" /* default */])(Classification_comvue_type_script_lang_js_components, "svgIcon", svg["a" /* default */]), Object(esm_defineProperty["a" /* default */])(Classification_comvue_type_script_lang_js_components, "setClassification", set_classification), Object(esm_defineProperty["a" /* default */])(Classification_comvue_type_script_lang_js_components, "searchProfessionalModel", search_professional_model), Classification_comvue_type_script_lang_js_components),
204504
204519
  data: function data() {
204505
204520
  return {
@@ -204581,6 +204596,11 @@ var Classification_comvue_type_script_lang_js_components;
204581
204596
  keyword: {
204582
204597
  type: String
204583
204598
  },
204599
+ isShowResetButton: {
204600
+ type: Boolean,
204601
+ default: true
204602
+ },
204603
+ // 是否显示 恢复默认设置 按钮
204584
204604
  fieldKeys: {
204585
204605
  type: Array,
204586
204606
  default: function _default() {
@@ -205455,8 +205475,8 @@ var Classification_comvue_type_script_lang_js_components;
205455
205475
  // EXTERNAL MODULE: ./packages/table-filter/src/classification/Classification-com.vue?vue&type=style&index=0&lang=less&
205456
205476
  var Classification_comvue_type_style_index_0_lang_less_ = __webpack_require__("01a9");
205457
205477
 
205458
- // EXTERNAL MODULE: ./packages/table-filter/src/classification/Classification-com.vue?vue&type=style&index=1&id=2cc2be68&lang=less&scoped=true&
205459
- var Classification_comvue_type_style_index_1_id_2cc2be68_lang_less_scoped_true_ = __webpack_require__("0c81");
205478
+ // EXTERNAL MODULE: ./packages/table-filter/src/classification/Classification-com.vue?vue&type=style&index=1&id=6f434f44&lang=less&scoped=true&
205479
+ var Classification_comvue_type_style_index_1_id_6f434f44_lang_less_scoped_true_ = __webpack_require__("15fe");
205460
205480
 
205461
205481
  // CONCATENATED MODULE: ./packages/table-filter/src/classification/Classification-com.vue
205462
205482
 
@@ -205470,11 +205490,11 @@ var Classification_comvue_type_style_index_1_id_2cc2be68_lang_less_scoped_true_
205470
205490
 
205471
205491
  var Classification_com_component = Object(componentNormalizer["a" /* default */])(
205472
205492
  classification_Classification_comvue_type_script_lang_js_,
205473
- Classification_comvue_type_template_id_2cc2be68_scoped_true_render,
205474
- Classification_comvue_type_template_id_2cc2be68_scoped_true_staticRenderFns,
205493
+ Classification_comvue_type_template_id_6f434f44_scoped_true_render,
205494
+ Classification_comvue_type_template_id_6f434f44_scoped_true_staticRenderFns,
205475
205495
  false,
205476
205496
  null,
205477
- "2cc2be68",
205497
+ "6f434f44",
205478
205498
  null
205479
205499
 
205480
205500
  )
@@ -217866,18 +217886,18 @@ var popup_map_component = Object(componentNormalizer["a" /* default */])(
217866
217886
  )
217867
217887
 
217868
217888
  /* harmony default export */ var popup_map = (popup_map_component.exports);
217869
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"50a0e4c2-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/select-label/select-label.vue?vue&type=template&id=9bef0184&scoped=true&
217870
- var select_labelvue_type_template_id_9bef0184_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"label-page"},[_c('div',{staticClass:"tag-label"},[_vm._l((_vm.labelSelectedList),function(v){return _c('a-tag',{key:v.labelId,style:(_vm.handleLabelColor(v, true)),attrs:{"closable":_vm.item_is_edit},on:{"close":function($event){return _vm.closeTag(v)}}},[_vm._v(" "+_vm._s(v.labelName)+" ")])}),(!_vm.explicit)?_c('span',{directives:[{name:"show",rawName:"v-show",value:(_vm.item_is_edit),expression:"item_is_edit"}],staticClass:"form-add-icon form-add-icon-label",class:{ disable: _vm.isLock },on:{"click":_vm.handleEditLabel}},[_c('a-icon',{staticClass:"add-icon",attrs:{"type":"plus-circle"}}),_vm._v(" 新增 ")],1):_vm._e()],2),(_vm.sourceType == 'form' && _vm.commonLabelList.length && _vm.item_is_edit && !_vm.explicit)?_c('div',{staticClass:"common-label"},[_c('span',[_vm._v("常用")]),_vm._l((_vm.commonLabelList),function(item,i){return _c('a-checkable-tag',{key:i,style:(_vm.handleLabelColor(item)),on:{"change":function($event){return _vm.handleCommonLabelChange($event, item)}},model:{value:(item.isSelect),callback:function ($$v) {_vm.$set(item, "isSelect", $$v)},expression:"item.isSelect"}},[_vm._v(" "+_vm._s(item.labelName)+" ")])})],2):_vm._e(),(_vm.explicit && _vm.item_is_edit)?_c('div',[_c('labelFormContent',_vm._b({ref:"labelFormContent",attrs:{"explicit":_vm.explicit,"labelVisible":_vm.labelVisible,"item":_vm.item,"isEdit":_vm.isEdit,"isLock":_vm.isLock,"labelSelectedList":_vm.labelSelectedList,"isChangeWindow":_vm.isChangeWindow,"labelOptions":_vm.editLabelItem.labelObj,"sourceType":_vm.sourceType},on:{"updateLabelData":_vm.updateLabelData,"explicitOnChange":_vm.explicitOnChange}},'labelFormContent',_vm.$attrs,false))],1):_vm._e(),_c('a-modal',{staticClass:"label-form-modal-wrap modal-wrap standard-modal standard-modal-white",class:{ 'modal-screen': _vm.isChangeWindow },attrs:{"maskClosable":false,"destroyOnClose":true,"width":_vm.modalWidth,"cancelText":'取消',"okText":'确定',"bodyStyle":{
217889
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"50a0e4c2-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/select-label/select-label.vue?vue&type=template&id=0d391bef&scoped=true&
217890
+ var select_labelvue_type_template_id_0d391bef_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"label-page"},[_c('div',{staticClass:"tag-label"},[_vm._l((_vm.labelSelectedList),function(v){return _c('a-tag',{key:v.labelId,style:(_vm.handleLabelColor(v, true)),attrs:{"closable":_vm.item_is_edit},on:{"close":function($event){return _vm.closeTag(v)}}},[_vm._v(" "+_vm._s(v.labelName)+" ")])}),(!_vm.explicit)?_c('span',{directives:[{name:"show",rawName:"v-show",value:(_vm.item_is_edit),expression:"item_is_edit"}],staticClass:"form-add-icon form-add-icon-label",class:{ disable: _vm.isLock },on:{"click":_vm.handleEditLabel}},[_c('a-icon',{staticClass:"add-icon",attrs:{"type":"plus-circle"}}),_vm._v(" 新增 ")],1):_vm._e()],2),(_vm.sourceType == 'form' && _vm.commonLabelList.length && _vm.item_is_edit && !_vm.explicit)?_c('div',{staticClass:"common-label"},[_c('span',[_vm._v("常用")]),_vm._l((_vm.commonLabelList),function(item,i){return _c('a-checkable-tag',{key:i,style:(_vm.handleLabelColor(item)),on:{"change":function($event){return _vm.handleCommonLabelChange($event, item)}},model:{value:(item.isSelect),callback:function ($$v) {_vm.$set(item, "isSelect", $$v)},expression:"item.isSelect"}},[_vm._v(" "+_vm._s(item.labelName)+" ")])})],2):_vm._e(),(_vm.explicit && _vm.item_is_edit)?_c('div',[_c('labelFormContent',_vm._b({ref:"labelFormContent",attrs:{"explicit":_vm.explicit,"labelVisible":_vm.labelVisible,"item":_vm.item,"isEdit":_vm.isEdit,"isLock":_vm.isLock,"labelSelectedList":_vm.labelSelectedList,"isChangeWindow":_vm.isChangeWindow,"labelOptions":_vm.editLabelItem.labelObj,"sourceType":_vm.sourceType},on:{"updateLabelData":_vm.updateLabelData,"explicitOnChange":_vm.explicitOnChange}},'labelFormContent',_vm.$attrs,false))],1):_vm._e(),_c('a-modal',{staticClass:"label-form-modal-wrap modal-wrap standard-modal standard-modal-white",class:{ 'modal-screen': _vm.isChangeWindow },attrs:{"maskClosable":false,"destroyOnClose":true,"width":_vm.modalWidth,"cancelText":'取消',"okText":'确定',"bodyStyle":{
217871
217891
  height: _vm.modalHeight,
217872
217892
  maxHeight: _vm.maxHeight,
217873
217893
  position: 'relative'
217874
217894
  },"closable":false,"centered":"","wrapClassName":"crm-form-label-modal"},on:{"ok":_vm.handleSaveLabel,"cancel":_vm.handleLabelCancel},model:{value:(_vm.labelVisible),callback:function ($$v) {_vm.labelVisible=$$v},expression:"labelVisible"}},[_c('template',{slot:"title"},[_c('div',[_vm._v(" 选择标签 ")]),_c('div',{staticClass:"svg-wrap"},[_c('svg-icon',{attrs:{"icon-class":_vm.isChangeWindow
217875
217895
  ? 'xitongtubiaodaohangtubiaozuixiaohua'
217876
217896
  : 'xitongtubiaodaohangtubiaozuidahua'},on:{"click":_vm.changeModalWindow}}),_c('svg-icon',{attrs:{"icon-class":'xitongtubiaodaohangtubiaoguanbi'},on:{"click":_vm.handleLabelCancel}})],1)]),_c('labelFormContent',_vm._b({ref:"labelFormContent",attrs:{"explicit":_vm.explicit,"labelVisible":_vm.labelVisible,"item":_vm.item,"isEdit":_vm.isEdit,"isLock":_vm.isLock,"labelSelectedList":_vm.labelSelectedList,"isChangeWindow":_vm.isChangeWindow,"labelOptions":_vm.editLabelItem.labelObj,"sourceType":_vm.sourceType},on:{"updateLabelData":_vm.updateLabelData}},'labelFormContent',_vm.$attrs,false))],2)],1)}
217877
- var select_labelvue_type_template_id_9bef0184_scoped_true_staticRenderFns = []
217897
+ var select_labelvue_type_template_id_0d391bef_scoped_true_staticRenderFns = []
217878
217898
 
217879
217899
 
217880
- // CONCATENATED MODULE: ./packages/select-label/select-label.vue?vue&type=template&id=9bef0184&scoped=true&
217900
+ // CONCATENATED MODULE: ./packages/select-label/select-label.vue?vue&type=template&id=0d391bef&scoped=true&
217881
217901
 
217882
217902
  // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"50a0e4c2-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/select-label/labelFormContent.vue?vue&type=template&id=3b3d070c&scoped=true&
217883
217903
  var labelFormContentvue_type_template_id_3b3d070c_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"labelFormContent-page"},[(_vm.allDisable)?_c('div',{staticClass:"label-disable-wrap"},[_c('p',{staticClass:"label-disable-title"},[_vm._v("无可选标签")]),_c('p',{staticClass:"label-disable-desc"},[_vm._v("请联系管理员进行标签管理设置")])]):_vm._e(),_c('div',{directives:[{name:"show",rawName:"v-show",value:(!_vm.allDisable),expression:"!allDisable"}],staticStyle:{"height":"100%"}},[_c('div',{staticClass:"label-wrap"},[(_vm.explicit)?_c('div',{staticClass:"explicit-continer"},[_c('a-tabs',{attrs:{"hideAdd":"","activeKey":_vm.labelAnchorKey,"type":"card","tab-position":"top"},on:{"change":_vm.labelAnchorTabsOnChange}},[_vm._l((_vm.labelConfig),function(v,i){return [_c('a-tab-pane',{key:v.curKey},[_c('span',{attrs:{"slot":"tab"},slot:"tab"},[_vm._v(" "+_vm._s(i)+" "),_c('span',{staticClass:"edit-label-type"},[_vm._v("("+_vm._s(v.multipleChoice == 2 ? '单' : '多')+"选)")])]),_c('div',{staticClass:"explicit-label-wrap left-label-wrap"},[_c('div',{staticClass:"edit-label-content"},[_c('labelClassify',{attrs:{"classifyItem":v,"handleLabelChange":_vm.handleLabelChange,"handleLabelColor":_vm.handleLabelColor,"handleDelLabel":_vm.handleDelLabel,"hanldeBlur":_vm.hanldeBlur,"handleAddLabel":_vm.handleAddLabel,"clearaddVal":_vm.clearaddVal,"isEdit":_vm.isEdit,"sourceType":_vm.sourceType}})],1)])])]})],2)],1):_c('div',{staticClass:"left-label-wrap",class:{
@@ -219307,7 +219327,8 @@ var select_labelvue_type_script_lang_js_components;
219307
219327
  showAdd: false,
219308
219328
  itemList: [],
219309
219329
  typeId: item.typeId,
219310
- typeName: item.typeName
219330
+ typeName: item.typeName,
219331
+ allowCreateByPersonal: item.allowCreateByPersonal
219311
219332
  }, choiceTypes[item.typeName] || {}));
219312
219333
  });
219313
219334
  return;
@@ -219316,33 +219337,36 @@ var select_labelvue_type_script_lang_js_components;
219316
219337
  if (utils_map["a" /* default */].isPlainObject(results[key])) {
219317
219338
  // 空,不允许
219318
219339
  if (!_this5.editLabelItem.labelObj[key]) {
219340
+ var _choiceTypes$key;
219341
+
219319
219342
  _this5.$set(_this5.editLabelItem.labelObj, key, Object.assign({
219320
219343
  addVal: '',
219321
219344
  showAdd: false,
219322
219345
  itemList: false,
219323
219346
  typeId: '',
219324
- typeName: key
219347
+ typeName: key,
219348
+ allowCreateByPersonal: (_choiceTypes$key = choiceTypes[key]) === null || _choiceTypes$key === void 0 ? void 0 : _choiceTypes$key.allowCreateByPersonal
219325
219349
  }, Object(objectSpread2["a" /* default */])({}, choiceTypes[key] || {})));
219326
219350
  } else {
219327
- var _choiceTypes$key, _choiceTypes$key2, _choiceTypes$key3;
219351
+ var _choiceTypes$key2, _choiceTypes$key3, _choiceTypes$key4;
219328
219352
 
219329
219353
  // 非空,不允许
219330
219354
  _this5.$set(_this5.editLabelItem.labelObj[key], 'isNoAdd', true);
219331
219355
 
219332
- _this5.$set(_this5.editLabelItem.labelObj[key], 'multipleChoice', (_choiceTypes$key = choiceTypes[key]) === null || _choiceTypes$key === void 0 ? void 0 : _choiceTypes$key.multipleChoice);
219356
+ _this5.$set(_this5.editLabelItem.labelObj[key], 'multipleChoice', (_choiceTypes$key2 = choiceTypes[key]) === null || _choiceTypes$key2 === void 0 ? void 0 : _choiceTypes$key2.multipleChoice);
219333
219357
 
219334
- _this5.$set(_this5.editLabelItem.labelObj[key], 'allowCreateByPersonal', (_choiceTypes$key2 = choiceTypes[key]) === null || _choiceTypes$key2 === void 0 ? void 0 : _choiceTypes$key2.allowCreateByPersonal);
219358
+ _this5.$set(_this5.editLabelItem.labelObj[key], 'allowCreateByPersonal', (_choiceTypes$key3 = choiceTypes[key]) === null || _choiceTypes$key3 === void 0 ? void 0 : _choiceTypes$key3.allowCreateByPersonal);
219335
219359
 
219336
- _this5.$set(_this5.editLabelItem.labelObj[key], 'parentColor', (_choiceTypes$key3 = choiceTypes[key]) === null || _choiceTypes$key3 === void 0 ? void 0 : _choiceTypes$key3.parentColor);
219360
+ _this5.$set(_this5.editLabelItem.labelObj[key], 'parentColor', (_choiceTypes$key4 = choiceTypes[key]) === null || _choiceTypes$key4 === void 0 ? void 0 : _choiceTypes$key4.parentColor);
219337
219361
  }
219338
219362
  } else {
219339
- var _choiceTypes$key4, _choiceTypes$key5, _choiceTypes$key6;
219363
+ var _choiceTypes$key5, _choiceTypes$key6, _choiceTypes$key7;
219340
219364
 
219341
- _this5.$set(_this5.editLabelItem.labelObj[key], 'multipleChoice', (_choiceTypes$key4 = choiceTypes[key]) === null || _choiceTypes$key4 === void 0 ? void 0 : _choiceTypes$key4.multipleChoice);
219365
+ _this5.$set(_this5.editLabelItem.labelObj[key], 'multipleChoice', (_choiceTypes$key5 = choiceTypes[key]) === null || _choiceTypes$key5 === void 0 ? void 0 : _choiceTypes$key5.multipleChoice);
219342
219366
 
219343
- _this5.$set(_this5.editLabelItem.labelObj[key], 'allowCreateByPersonal', (_choiceTypes$key5 = choiceTypes[key]) === null || _choiceTypes$key5 === void 0 ? void 0 : _choiceTypes$key5.allowCreateByPersonal);
219367
+ _this5.$set(_this5.editLabelItem.labelObj[key], 'allowCreateByPersonal', (_choiceTypes$key6 = choiceTypes[key]) === null || _choiceTypes$key6 === void 0 ? void 0 : _choiceTypes$key6.allowCreateByPersonal);
219344
219368
 
219345
- _this5.$set(_this5.editLabelItem.labelObj[key], 'parentColor', (_choiceTypes$key6 = choiceTypes[key]) === null || _choiceTypes$key6 === void 0 ? void 0 : _choiceTypes$key6.parentColor);
219369
+ _this5.$set(_this5.editLabelItem.labelObj[key], 'parentColor', (_choiceTypes$key7 = choiceTypes[key]) === null || _choiceTypes$key7 === void 0 ? void 0 : _choiceTypes$key7.parentColor);
219346
219370
  }
219347
219371
  });
219348
219372
  },
@@ -219431,8 +219455,8 @@ var select_labelvue_type_script_lang_js_components;
219431
219455
  }));
219432
219456
  // CONCATENATED MODULE: ./packages/select-label/select-label.vue?vue&type=script&lang=js&
219433
219457
  /* harmony default export */ var select_label_select_labelvue_type_script_lang_js_ = (select_labelvue_type_script_lang_js_);
219434
- // EXTERNAL MODULE: ./packages/select-label/select-label.vue?vue&type=style&index=0&id=9bef0184&lang=less&scoped=true&
219435
- var select_labelvue_type_style_index_0_id_9bef0184_lang_less_scoped_true_ = __webpack_require__("d1ca");
219458
+ // EXTERNAL MODULE: ./packages/select-label/select-label.vue?vue&type=style&index=0&id=0d391bef&lang=less&scoped=true&
219459
+ var select_labelvue_type_style_index_0_id_0d391bef_lang_less_scoped_true_ = __webpack_require__("cb08");
219436
219460
 
219437
219461
  // EXTERNAL MODULE: ./packages/select-label/select-label.vue?vue&type=style&index=1&lang=less&
219438
219462
  var select_labelvue_type_style_index_1_lang_less_ = __webpack_require__("646a");
@@ -219449,11 +219473,11 @@ var select_labelvue_type_style_index_1_lang_less_ = __webpack_require__("646a");
219449
219473
 
219450
219474
  var select_label_component = Object(componentNormalizer["a" /* default */])(
219451
219475
  select_label_select_labelvue_type_script_lang_js_,
219452
- select_labelvue_type_template_id_9bef0184_scoped_true_render,
219453
- select_labelvue_type_template_id_9bef0184_scoped_true_staticRenderFns,
219476
+ select_labelvue_type_template_id_0d391bef_scoped_true_render,
219477
+ select_labelvue_type_template_id_0d391bef_scoped_true_staticRenderFns,
219454
219478
  false,
219455
219479
  null,
219456
- "9bef0184",
219480
+ "0d391bef",
219457
219481
  null
219458
219482
 
219459
219483
  )
@@ -231912,7 +231936,10 @@ var scrollListvue_type_script_lang_js_components;
231912
231936
  }
231913
231937
 
231914
231938
  if (value.mapping) {
231915
- param = _this.getMappingHTML(value.mapping[param]);
231939
+ // param = this.getMappingHTML(value.mapping[param]);
231940
+ param = _this.getMappingHTML(value.mapping.find(function (v) {
231941
+ return v.value == param;
231942
+ }) || {});
231916
231943
  }
231917
231944
 
231918
231945
  return param || '';
@@ -273944,7 +273971,7 @@ module.exports = function (argument) {
273944
273971
  /***/ "5781":
273945
273972
  /***/ (function(module, exports, __webpack_require__) {
273946
273973
 
273947
- /* 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 r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,n,r,i,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(r,i)}function i(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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(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}}),t&&l(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(){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 p(e,t,n){return(p=h()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&l(i,n.prototype),i}).apply(null,arguments)}function f(e){var t="function"==typeof Map?new Map:void 0;return(f=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,r)}function r(){return p(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)})(e)}function m(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _(e){var t=h();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return m(this,n)}}function v(e,t,n){return(v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function g(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 r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(c){s=!0,i=c}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||y(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 S(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(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 y(e,t){if(e){if("string"==typeof e)return b(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)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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}}}}var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function R(e,t){return e(t={exports:{}},t.exports),t.exports}var E,w,I=function(e){return e&&e.Math==Math&&e},C=I("object"==typeof globalThis&&globalThis)||I("object"==typeof window&&window)||I("object"==typeof self&&self)||I("object"==typeof T&&T)||function(){return this}()||Function("return this")(),x=function(e){try{return!!e()}catch(t){return!0}},A=!x((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),P={}.propertyIsEnumerable,D=Object.getOwnPropertyDescriptor,M={f:D&&!P.call({1:2},1)?function(e){var t=D(this,e);return!!t&&t.enumerable}:P},O=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},L={}.toString,N=function(e){return L.call(e).slice(8,-1)},U="".split,V=x((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==N(e)?U.call(e,""):Object(e)}:Object,F=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},j=function(e){return V(F(e))},B=function(e){return"object"==typeof e?null!==e:"function"==typeof e},H=function(e){return"function"==typeof e?e:void 0},J=function(e,t){return arguments.length<2?H(C[e]):C[e]&&C[e][t]},z=J("navigator","userAgent")||"",G=C.process,W=C.Deno,q=G&&G.versions||W&&W.version,K=q&&q.v8;K?w=(E=K.split("."))[0]<4?1:E[0]+E[1]:z&&(!(E=z.match(/Edge\/(\d+)/))||E[1]>=74)&&(E=z.match(/Chrome\/(\d+)/))&&(w=E[1]);var Q=w&&+w,Y=!!Object.getOwnPropertySymbols&&!x((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Q&&Q<41})),$=Y&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,X=$?function(e){return"symbol"==typeof e}:function(e){var t=J("Symbol");return"function"==typeof t&&Object(e)instanceof t},Z=function(e,t){try{Object.defineProperty(C,e,{value:t,configurable:!0,writable:!0})}catch(n){C[e]=t}return t},ee=C["__core-js_shared__"]||Z("__core-js_shared__",{}),te=R((function(e){(e.exports=function(e,t){return ee[e]||(ee[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.16.0",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),ne=function(e){return Object(F(e))},re={}.hasOwnProperty,ie=Object.hasOwn||function(e,t){return re.call(ne(e),t)},ae=0,oe=Math.random(),se=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++ae+oe).toString(36)},ce=te("wks"),ue=C.Symbol,de=$?ue:ue&&ue.withoutSetter||se,le=function(e){return ie(ce,e)&&(Y||"string"==typeof ce[e])||(Y&&ie(ue,e)?ce[e]=ue[e]:ce[e]=de("Symbol."+e)),ce[e]},he=le("toPrimitive"),pe=function(e,t){if(!B(e)||X(e))return e;var n,r=e[he];if(void 0!==r){if(void 0===t&&(t="default"),n=r.call(e,t),!B(n)||X(n))return n;throw TypeError("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var n,r;if("string"===t&&"function"==typeof(n=e.toString)&&!B(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!B(r=n.call(e)))return r;if("string"!==t&&"function"==typeof(n=e.toString)&&!B(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}(e,t)},fe=function(e){var t=pe(e,"string");return X(t)?t:String(t)},me=C.document,_e=B(me)&&B(me.createElement),ve=function(e){return _e?me.createElement(e):{}},ge=!A&&!x((function(){return 7!=Object.defineProperty(ve("div"),"a",{get:function(){return 7}}).a})),Se=Object.getOwnPropertyDescriptor,ye={f:A?Se:function(e,t){if(e=j(e),t=fe(t),ge)try{return Se(e,t)}catch(n){}if(ie(e,t))return O(!M.f.call(e,t),e[t])}},be=function(e){if(!B(e))throw TypeError(String(e)+" is not an object");return e},ke=Object.defineProperty,Te={f:A?ke:function(e,t,n){if(be(e),t=fe(t),be(n),ge)try{return ke(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},Re=A?function(e,t,n){return Te.f(e,t,O(1,n))}:function(e,t,n){return e[t]=n,e},Ee=Function.toString;"function"!=typeof ee.inspectSource&&(ee.inspectSource=function(e){return Ee.call(e)});var we,Ie,Ce,xe=ee.inspectSource,Ae=C.WeakMap,Pe="function"==typeof Ae&&/native code/.test(xe(Ae)),De=te("keys"),Me=function(e){return De[e]||(De[e]=se(e))},Oe={},Le=C.WeakMap;if(Pe||ee.state){var Ne=ee.state||(ee.state=new Le),Ue=Ne.get,Ve=Ne.has,Fe=Ne.set;we=function(e,t){if(Ve.call(Ne,e))throw new TypeError("Object already initialized");return t.facade=e,Fe.call(Ne,e,t),t},Ie=function(e){return Ue.call(Ne,e)||{}},Ce=function(e){return Ve.call(Ne,e)}}else{var je=Me("state");Oe[je]=!0,we=function(e,t){if(ie(e,je))throw new TypeError("Object already initialized");return t.facade=e,Re(e,je,t),t},Ie=function(e){return ie(e,je)?e[je]:{}},Ce=function(e){return ie(e,je)}}var Be={set:we,get:Ie,has:Ce,enforce:function(e){return Ce(e)?Ie(e):we(e,{})},getterFor:function(e){return function(t){var n;if(!B(t)||(n=Ie(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},He=R((function(e){var t=Be.get,n=Be.enforce,r=String(String).split("String");(e.exports=function(e,t,i,a){var o,s=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof t||ie(i,"name")||Re(i,"name",t),(o=n(i)).source||(o.source=r.join("string"==typeof t?t:""))),e!==C?(s?!u&&e[t]&&(c=!0):delete e[t],c?e[t]=i:Re(e,t,i)):c?e[t]=i:Z(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||xe(this)}))})),Je=Math.ceil,ze=Math.floor,Ge=function(e){return isNaN(e=+e)?0:(e>0?ze:Je)(e)},We=Math.min,qe=function(e){return e>0?We(Ge(e),9007199254740991):0},Ke=Math.max,Qe=Math.min,Ye=function(e,t){var n=Ge(e);return n<0?Ke(n+t,0):Qe(n,t)},$e=function(e){return function(t,n,r){var i,a=j(t),o=qe(a.length),s=Ye(r,o);if(e&&n!=n){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===n)return e||s||0;return!e&&-1}},Xe={includes:$e(!0),indexOf:$e(!1)},Ze=Xe.indexOf,et=function(e,t){var n,r=j(e),i=0,a=[];for(n in r)!ie(Oe,n)&&ie(r,n)&&a.push(n);for(;t.length>i;)ie(r,n=t[i++])&&(~Ze(a,n)||a.push(n));return a},tt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],nt=tt.concat("length","prototype"),rt={f:Object.getOwnPropertyNames||function(e){return et(e,nt)}},it={f:Object.getOwnPropertySymbols},at=J("Reflect","ownKeys")||function(e){var t=rt.f(be(e)),n=it.f;return n?t.concat(n(e)):t},ot=function(e,t){for(var n=at(t),r=Te.f,i=ye.f,a=0;a<n.length;a++){var o=n[a];ie(e,o)||r(e,o,i(t,o))}},st=/#|\.prototype\./,ct=function(e,t){var n=dt[ut(e)];return n==ht||n!=lt&&("function"==typeof t?x(t):!!t)},ut=ct.normalize=function(e){return String(e).replace(st,".").toLowerCase()},dt=ct.data={},lt=ct.NATIVE="N",ht=ct.POLYFILL="P",pt=ct,ft=ye.f,mt=function(e,t){var n,r,i,a,o,s=e.target,c=e.global,u=e.stat;if(n=c?C:u?C[s]||Z(s,{}):(C[s]||{}).prototype)for(r in t){if(a=t[r],i=e.noTargetGet?(o=ft(n,r))&&o.value:n[r],!pt(c?r:s+(u?".":"#")+r,e.forced)&&void 0!==i){if(typeof a==typeof i)continue;ot(a,i)}(e.sham||i&&i.sham)&&Re(a,"sham",!0),He(n,r,a,e)}},_t=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},vt=function(e,t,n){if(_t(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},gt=Array.isArray||function(e){return"Array"==N(e)},St=le("species"),yt=function(e,t){return new(function(e){var t;return gt(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!gt(t.prototype)?B(t)&&null===(t=t[St])&&(t=void 0):t=void 0),void 0===t?Array:t}(e))(0===t?0:t)},bt=[].push,kt=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,a=6==e,o=7==e,s=5==e||a;return function(c,u,d,l){for(var h,p,f=ne(c),m=V(f),_=vt(u,d,3),v=qe(m.length),g=0,S=l||yt,y=t?S(c,v):n||o?S(c,0):void 0;v>g;g++)if((s||g in m)&&(p=_(h=m[g],g,f),e))if(t)y[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:bt.call(y,h)}else switch(e){case 4:return!1;case 7:bt.call(y,h)}return a?-1:r||i?i:y}},Tt={forEach:kt(0),map:kt(1),filter:kt(2),some:kt(3),every:kt(4),find:kt(5),findIndex:kt(6),filterReject:kt(7)},Rt=le("species"),Et=function(e){return Q>=51||!x((function(){var t=[];return(t.constructor={})[Rt]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},wt=Tt.map,It=Et("map");mt({target:"Array",proto:!0,forced:!It},{map:function(e){return wt(this,e,arguments.length>1?arguments[1]:void 0)}});var Ct=Tt.filter,xt=Et("filter");mt({target:"Array",proto:!0,forced:!xt},{filter:function(e){return Ct(this,e,arguments.length>1?arguments[1]:void 0)}});var At=function(e){if(X(e))throw TypeError("Cannot convert a Symbol value to a string");return String(e)},Pt="\t\n\v\f\r                 \u2028\u2029\ufeff",Dt="["+Pt+"]",Mt=RegExp("^"+Dt+Dt+"*"),Ot=RegExp(Dt+Dt+"*$"),Lt=function(e){return function(t){var n=At(F(t));return 1&e&&(n=n.replace(Mt,"")),2&e&&(n=n.replace(Ot,"")),n}},Nt={start:Lt(1),end:Lt(2),trim:Lt(3)},Ut=Nt.trim;mt({target:"String",proto:!0,forced:function(e){return x((function(){return!!Pt[e]()||"​…᠎"!="​…᠎"[e]()||Pt[e].name!==e}))}("trim")},{trim:function(){return Ut(this)}});R((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(w){s=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof l?t:l,a=Object.create(i.prototype),o=new T(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return E()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=y(o,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,o),a}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(w){return{type:"throw",arg:w}}}e.wrap=c;var d={};function l(){}function h(){}function p(){}var f={};s(f,i,(function(){return this}));var m=Object.getPrototypeOf,_=m&&m(m(R([])));_&&_!==t&&n.call(_,i)&&(f=_);var v=p.prototype=l.prototype=Object.create(f);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){var r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,s){var c=u(e[i],e,a);if("throw"!==c.type){var d=c.arg,l=d.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,o,s)}),(function(e){r("throw",e,o,s)})):t.resolve(l).then((function(e){d.value=e,o(d)}),(function(e){return r("throw",e,o,s)}))}s(c.arg)}(i,a,r,o)}))}return r=r?r.then(o,o):o()}}function y(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,y(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function b(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function R(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:E}}function E(){return{value:void 0,done:!0}}return h.prototype=p,s(v,"constructor",p),s(p,"constructor",h),h.displayName=s(p,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(S.prototype),s(S.prototype,a,(function(){return this})),e.AsyncIterator=S,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new S(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},g(v),s(v,o,"Generator"),s(v,i,(function(){return this})),s(v,"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 r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=R,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;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,d):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),d},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),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:R(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}(e.exports);try{regeneratorRuntime=t}catch(n){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));let Vt=!0,Ft=!0;function jt(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function Bt(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);const a=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};const a=r.removeEventListener;r.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);const r=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,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(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 Ht(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Vt=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Jt(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Ft=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function zt(){if("object"==typeof window){if(Vt)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Gt(e,t){Ft&&console.warn(e+" is deprecated, please use "+t+" instead.")}function Wt(e){return"[object Object]"===Object.prototype.toString.call(e)}function qt(e){return Wt(e)?Object.keys(e).reduce((function(t,n){const r=Wt(e[n]),i=r?qt(e[n]):e[n],a=r&&!Object.keys(i).length;return void 0===i||a?t:Object.assign(t,{[n]:i})}),{}):e}function Kt(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const a=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&function e(t,n,r){n&&!r.has(n.id)&&(r.set(n.id,n),Object.keys(n).forEach(i=>{i.endsWith("Id")?e(t,t.get(n[i]),r):i.endsWith("Ids")&&n[i].forEach(n=>{e(t,t.get(n),r)})}))}(e,n,i)})}),i}const Qt=zt;function Yt(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),e={},e[i("max",n)]=r.ideal,t.optional.push(e)):(e[i("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let a=e.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});const o=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||o)){let t;if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?t=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then(n=>{let o=(n=n.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes("back")&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),Qt("chrome: "+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return Qt("chrome: "+JSON.stringify(e)),i(e)},a=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(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(a(e))))}}}function $t(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Xt(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Bt(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function Zt(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const 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()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function en(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach(e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{n[t]=e.stat(t)}),t[n.id]=n}),t},a=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const r=function(e){n(a(i(e)))};return t.apply(this,[r,e])}return new Promise((e,n)=>{t.apply(this,[function(t){e(a(i(t)))},n])}).then(n,r)}}function tn(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>Kt(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Bt(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>Kt(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function nn(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function rn(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return nn(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.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){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const i=this.getSenders().find(e=>e.track===t);if(i)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const a=this._streams[n.id];if(a)a.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=o(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=c.get.apply(this);return""===e.type?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){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");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function an(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function on(e,t){Bt(e,"negotiationneeded",e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e})}var sn=Object.freeze({__proto__:null,shimMediaStream:$t,shimOnTrack:Xt,shimGetSendersWithDtmf:Zt,shimGetStats:en,shimSenderReceiverGetStats:tn,shimAddTrackRemoveTrackWithNative:nn,shimAddTrackRemoveTrack:rn,shimPeerConnection:an,fixNegotiationNeeded:on,shimGetUserMedia:Yt,shimGetDisplayMedia:function(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(t=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,a=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:a||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var cn=R((function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){var n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((function(e){return 0===e.indexOf(n)}))},t.parseCandidate=function(e){for(var t,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;case"ufrag":n.ufrag=t[r+1],n.usernameFragment=t[r+1];break;default:n[t[r]]=t[r+1]}return n},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.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"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},t.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.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},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.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},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(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}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){var r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),i=3;i<r.length;i++){var a=r[i],o=t.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(o){var s=t.parseRtpMap(o),c=t.matchPrefix(e,"a=fmtp:"+a+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(t.parseRtcpFb),n.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){n.headerExtensions.push(t.parseExtmap(e))})),n},t.writeRtpDescription=function(e,n){var r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));var i=0;return n.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),r+="a=rtcp-mux\r\n",n.headerExtensions&&n.headerExtensions.forEach((function(e){r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){var n,r=[],i=t.parseRtpParameters(e),a=-1!==i.fecMechanisms.indexOf("RED"),o=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(n=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&n&&(t.rtx={ssrc:n}),r.push(t),a&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&c&&r.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){var n={},r=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;var a=t.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},t.parseMsid=function(e){var n,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(n=i[0].value.split(" "))[0],track:n[1]}:void 0},t.parseSctpDescription=function(e){var n,r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(n=parseInt(i[0].substr(19),10)),isNaN(n)&&(n=65536);var a=t.matchPrefix(e,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substr(12),10),protocol:r.fmt,maxMessageSize:n};if(t.matchPrefix(e,"a=sctpmap:").length>0){var o=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(o[0],10),protocol:o[1],maxMessageSize:n}}},t.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("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,n,r){var i=void 0!==n?n:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,n,r,i){var a=t.writeRtpDescription(e.kind,n);if(a+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),a+="a=mid:"+e.mid+"\r\n",e.direction?a+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var o="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";a+="a="+o,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+o,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+o,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),a},t.getDirection=function(e,n){for(var r=t.splitLines(e),i=0;i<r.length;i++)switch(r[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[i].substr(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var n=t.splitLines(e)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){var n=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var n=t.splitLines(e),r=0;r<n.length;r++)if(n[r].length<2||"="!==n[r].charAt(1))return!1;return!0},e.exports=t}));function un(e,t,n,r,i){var a=cn.writeRtpDescription(e.kind,t);if(a+=cn.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=cn.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":i||"active"),a+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var o=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=o;var s="msid:"+(r?r.id:"-")+" "+o+"\r\n";a+="a="+s,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+cn.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+cn.localCName+"\r\n"),a}function dn(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]},i=function(e,t,n,i){var a=r(e.parameters.apt,n),o=r(t.parameters.apt,i);return a&&o&&a.name.toLowerCase()===o.name.toLowerCase()};return e.codecs.forEach((function(r){for(var a=0;a<t.codecs.length;a++){var o=t.codecs[a];if(r.name.toLowerCase()===o.name.toLowerCase()&&r.clockRate===o.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&o.parameters.apt&&!i(r,o,e.codecs,t.codecs))continue;(o=JSON.parse(JSON.stringify(o))).numChannels=Math.min(r.numChannels,o.numChannels),n.codecs.push(o),o.rtcpFeedback=o.rtcpFeedback.filter((function(e){for(var t=0;t<r.rtcpFeedback.length;t++)if(r.rtcpFeedback[t].type===e.type&&r.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}})),n}function ln(e,t,n){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(n)}function hn(e,t){var n=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return n||e.addRemoteCandidate(t),!n}function pn(e,t){var n=new Error(t);return n.name=e,n.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],n}var fn=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function r(t,n,r,i){var a=new Event("track");a.track=n,a.receiver=r,a.transceiver={receiver:r},a.streams=i,e.setTimeout((function(){t._dispatchEvent("track",a)}))}var i=function(n){var r=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){r[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw pn("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter((function(e){return 0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")&&-1===e.indexOf("turn:[")&&!n?(n=!0,!0):0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp")})),delete e.url,e.urls=i?r[0]:r,!!r.length}}))}(n.iceServers||[],t),this._iceGatherers=[],n.iceCandidatePoolSize)for(var a=n.iceCandidatePoolSize;a>0;a--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=cn.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var n=this.transceivers.length>0,r={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&n)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();r.iceTransport=i.iceTransport,r.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(r),r},i.prototype.addTrack=function(t,n){if(this._isClosed)throw pn("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find((function(e){return e.track===t})))throw pn("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(r=this.transceivers[i]);return r||(r=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(n)&&this.localStreams.push(n),r.track=t,r.stream=n,r.rtpSender=new e.RTCRtpSender(t,r.dtlsTransport),r.rtpSender},i.prototype.addStream=function(e){var n=this;if(t>=15025)e.getTracks().forEach((function(t){n.addTrack(t,e)}));else{var r=e.clone();e.getTracks().forEach((function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",(function(e){n.enabled=e.enabled}))})),r.getTracks().forEach((function(e){n.addTrack(e,r)}))}},i.prototype.removeTrack=function(t){if(this._isClosed)throw pn("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find((function(e){return e.rtpSender===t}));if(!n)throw pn("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var n=t.getSenders().find((function(t){return t.track===e}));n&&t.removeTrack(n)}))},i.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},i.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},i.prototype._createIceGatherer=function(t,n){var r=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var n=!e.candidate||0===Object.keys(e.candidate).length;i.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,n){var r=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var a=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var a=new Event("icecandidate");a.candidate={sdpMid:t,sdpMLineIndex:n};var o=e.candidate,s=!o||0===Object.keys(o).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),o.component=1,o.ufrag=i.getLocalParameters().usernameFragment;var c=cn.writeCandidate(o);a.candidate=Object.assign(a.candidate,cn.parseCandidate(c)),a.candidate.candidate=c,a.candidate.toJSON=function(){return{candidate:a.candidate.candidate,sdpMid:a.candidate.sdpMid,sdpMLineIndex:a.candidate.sdpMLineIndex,usernameFragment:a.candidate.usernameFragment}}}var u=cn.getMediaSections(r._localDescription.sdp);u[a.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+a.candidate.candidate+"\r\n",r._localDescription.sdp=cn.getDescription(r._localDescription.sdp)+u.join("");var d=r.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),s||r._dispatchEvent("icecandidate",a),d&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout((function(){a.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var r=new e.RTCDtlsTransport(n);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:r}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,n,r){var i=dn(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:cn.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),r&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,n,r=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(pn("TypeError",'Unsupported type "'+e.type+'"'));if(!ln("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(pn("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=cn.splitSections(e.sdp),n=t.shift(),t.forEach((function(e,t){var n=cn.parseRtpParameters(e);r.transceivers[t].localCapabilities=n})),r.transceivers.forEach((function(e,t){r._gather(e.mid,t)}));else if("answer"===e.type){t=cn.splitSections(r._remoteDescription.sdp),n=t.shift();var i=cn.matchPrefix(n,"a=ice-lite").length>0;t.forEach((function(e,t){var a=r.transceivers[t],o=a.iceGatherer,s=a.iceTransport,c=a.dtlsTransport,u=a.localCapabilities,d=a.remoteCapabilities;if(!(cn.isRejected(e)&&0===cn.matchPrefix(e,"a=bundle-only").length)&&!a.rejected){var l=cn.getIceParameters(e,n),h=cn.getDtlsParameters(e,n);i&&(h.role="server"),r.usingBundle&&0!==t||(r._gather(a.mid,t),"new"===s.state&&s.start(o,l,i?"controlling":"controlled"),"new"===c.state&&c.start(h));var p=dn(u,d);r._transceive(a,p.codecs.length>0,!1)}}))}return r._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?r._updateSignalingState("have-local-offer"):r._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var a=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(pn("TypeError",'Unsupported type "'+i.type+'"'));if(!ln("setRemoteDescription",i.type,a.signalingState)||a._isClosed)return Promise.reject(pn("InvalidStateError","Can not set remote "+i.type+" in state "+a.signalingState));var o={};a.remoteStreams.forEach((function(e){o[e.id]=e}));var s=[],c=cn.splitSections(i.sdp),u=c.shift(),d=cn.matchPrefix(u,"a=ice-lite").length>0,l=cn.matchPrefix(u,"a=group:BUNDLE ").length>0;a.usingBundle=l;var h=cn.matchPrefix(u,"a=ice-options:")[0];return a.canTrickleIceCandidates=!!h&&h.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(r,c){var h=cn.splitLines(r),p=cn.getKind(r),f=cn.isRejected(r)&&0===cn.matchPrefix(r,"a=bundle-only").length,m=h[0].substr(2).split(" ")[2],_=cn.getDirection(r,u),v=cn.parseMsid(r),g=cn.getMid(r)||cn.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===m||"UDP/DTLS/SCTP"===m))a.transceivers[c]={mid:g,kind:p,protocol:m,rejected:!0};else{var S,y,b,k,T,R,E,w,I;!f&&a.transceivers[c]&&a.transceivers[c].rejected&&(a.transceivers[c]=a._createTransceiver(p,!0));var C,x,A=cn.parseRtpParameters(r);f||(C=cn.getIceParameters(r,u),(x=cn.getDtlsParameters(r,u)).role="client"),E=cn.parseRtpEncodingParameters(r);var P=cn.parseRtcpParameters(r),D=cn.matchPrefix(r,"a=end-of-candidates",u).length>0,M=cn.matchPrefix(r,"a=candidate:").map((function(e){return cn.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!f&&l&&c>0&&a.transceivers[c]&&(a._disposeIceAndDtlsTransports(c),a.transceivers[c].iceGatherer=a.transceivers[0].iceGatherer,a.transceivers[c].iceTransport=a.transceivers[0].iceTransport,a.transceivers[c].dtlsTransport=a.transceivers[0].dtlsTransport,a.transceivers[c].rtpSender&&a.transceivers[c].rtpSender.setTransport(a.transceivers[0].dtlsTransport),a.transceivers[c].rtpReceiver&&a.transceivers[c].rtpReceiver.setTransport(a.transceivers[0].dtlsTransport)),"offer"!==i.type||f){if("answer"===i.type&&!f){y=(S=a.transceivers[c]).iceGatherer,b=S.iceTransport,k=S.dtlsTransport,T=S.rtpReceiver,R=S.sendEncodingParameters,w=S.localCapabilities,a.transceivers[c].recvEncodingParameters=E,a.transceivers[c].remoteCapabilities=A,a.transceivers[c].rtcpParameters=P,M.length&&"new"===b.state&&(!d&&!D||l&&0!==c?M.forEach((function(e){hn(S.iceTransport,e)})):b.setRemoteCandidates(M)),l&&0!==c||("new"===b.state&&b.start(y,C,"controlling"),"new"===k.state&&k.start(x)),!dn(S.localCapabilities,S.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&S.sendEncodingParameters[0].rtx&&delete S.sendEncodingParameters[0].rtx,a._transceive(S,"sendrecv"===_||"recvonly"===_,"sendrecv"===_||"sendonly"===_),!T||"sendrecv"!==_&&"sendonly"!==_?delete S.rtpReceiver:(I=T.track,v?(o[v.stream]||(o[v.stream]=new e.MediaStream),n(I,o[v.stream]),s.push([I,T,o[v.stream]])):(o.default||(o.default=new e.MediaStream),n(I,o.default),s.push([I,T,o.default])))}}else{(S=a.transceivers[c]||a._createTransceiver(p)).mid=g,S.iceGatherer||(S.iceGatherer=a._createIceGatherer(c,l)),M.length&&"new"===S.iceTransport.state&&(!D||l&&0!==c?M.forEach((function(e){hn(S.iceTransport,e)})):S.iceTransport.setRemoteCandidates(M)),w=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(w.codecs=w.codecs.filter((function(e){return"rtx"!==e.name}))),R=S.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var O,L=!1;if("sendrecv"===_||"sendonly"===_){if(L=!S.rtpReceiver,T=S.rtpReceiver||new e.RTCRtpReceiver(S.dtlsTransport,p),L)I=T.track,v&&"-"===v.stream||(v?(o[v.stream]||(o[v.stream]=new e.MediaStream,Object.defineProperty(o[v.stream],"id",{get:function(){return v.stream}})),Object.defineProperty(I,"id",{get:function(){return v.track}}),O=o[v.stream]):(o.default||(o.default=new e.MediaStream),O=o.default)),O&&(n(I,O),S.associatedRemoteMediaStreams.push(O)),s.push([I,T,O])}else S.rtpReceiver&&S.rtpReceiver.track&&(S.associatedRemoteMediaStreams.forEach((function(t){var n=t.getTracks().find((function(e){return e.id===S.rtpReceiver.track.id}));n&&function(t,n){n.removeTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(n,t)})),S.associatedRemoteMediaStreams=[]);S.localCapabilities=w,S.remoteCapabilities=A,S.rtpReceiver=T,S.rtcpParameters=P,S.sendEncodingParameters=R,S.recvEncodingParameters=E,a._transceive(a.transceivers[c],!1,L)}}})),void 0===a._dtlsRole&&(a._dtlsRole="offer"===i.type?"active":"passive"),a._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?a._updateSignalingState("have-remote-offer"):a._updateSignalingState("stable"),Object.keys(o).forEach((function(t){var n=o[t];if(n.getTracks().length){if(-1===a.remoteStreams.indexOf(n)){a.remoteStreams.push(n);var i=new Event("addstream");i.stream=n,e.setTimeout((function(){a._dispatchEvent("addstream",i)}))}s.forEach((function(e){var t=e[0],i=e[1];n.id===e[2].id&&r(a,t,i,[n])}))}})),s.forEach((function(e){e[2]||r(a,e[0],e[1],[])})),e.setTimeout((function(){a&&a.transceivers&&a.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var n=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",n)}},i.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(pn("InvalidStateError","Can not call createOffer after close"));var r=n.transceivers.filter((function(e){return"audio"===e.kind})).length,i=n.transceivers.filter((function(e){return"video"===e.kind})).length,a=arguments[0];if(a){if(a.mandatory||a.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==a.offerToReceiveAudio&&(r=!0===a.offerToReceiveAudio?1:!1===a.offerToReceiveAudio?0:a.offerToReceiveAudio),void 0!==a.offerToReceiveVideo&&(i=!0===a.offerToReceiveVideo?1:!1===a.offerToReceiveVideo?0:a.offerToReceiveVideo)}for(n.transceivers.forEach((function(e){"audio"===e.kind?--r<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)}));r>0||i>0;)r>0&&(n._createTransceiver("audio"),r--),i>0&&(n._createTransceiver("video"),i--);var o=cn.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach((function(r,i){var a=r.track,o=r.kind,s=r.mid||cn.generateIdentifier();r.mid=s,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.usingBundle));var c=e.RTCRtpSender.getCapabilities(o);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),r.remoteCapabilities&&r.remoteCapabilities.codecs&&r.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(r.remoteCapabilities&&r.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=r.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];a&&t>=15019&&"video"===o&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,o)),r.localCapabilities=c,r.sendEncodingParameters=u})),"max-compat"!==n._config.bundlePolicy&&(o+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),o+="a=ice-options:trickle\r\n",n.transceivers.forEach((function(e,t){o+=un(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),o+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,o+="a="+cn.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(o+="a=end-of-candidates\r\n"))}));var s=new e.RTCSessionDescription({type:"offer",sdp:o});return Promise.resolve(s)},i.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(pn("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(pn("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var r=cn.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(r+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),r+="a=ice-options:trickle\r\n";var i=cn.getMediaSections(n._remoteDescription.sdp).length;n.transceivers.forEach((function(e,a){if(!(a+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?r+="m=application 0 DTLS/SCTP 5000\r\n":r+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?r+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(r+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(r+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var o;if(e.stream)"audio"===e.kind?o=e.stream.getAudioTracks()[0]:"video"===e.kind&&(o=e.stream.getVideoTracks()[0]),o&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var s=dn(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,r+=un(e,s,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(r+="a=rtcp-rsize\r\n")}}));var a=new e.RTCSessionDescription({type:"answer",sdp:r});return Promise.resolve(a)},i.prototype.addIceCandidate=function(e){var t,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(r,i){if(!n._remoteDescription)return i(pn("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var a=e.sdpMLineIndex;if(e.sdpMid)for(var o=0;o<n.transceivers.length;o++)if(n.transceivers[o].mid===e.sdpMid){a=o;break}var s=n.transceivers[a];if(!s)return i(pn("OperationError","Can not add ICE candidate"));if(s.rejected)return r();var c=Object.keys(e.candidate).length>0?cn.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return r();if(c.component&&1!==c.component)return r();if((0===a||a>0&&s.iceTransport!==n.transceivers[0].iceTransport)&&!hn(s.iceTransport,c))return i(pn("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=cn.getMediaSections(n._remoteDescription.sdp))[a]+="a="+(c.type?u:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=cn.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var d=0;d<n.transceivers.length&&(n.transceivers[d].rejected||(n.transceivers[d].iceTransport.addRemoteCandidate({}),(t=cn.getMediaSections(n._remoteDescription.sdp))[d]+="a=end-of-candidates\r\n",n._remoteDescription.sdp=cn.getDescription(n._remoteDescription.sdp)+t.join(""),!n.usingBundle));d++);r()}))},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var n=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?n=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(n=e.rtpReceiver)})),!n)throw pn("InvalidAccessError","Invalid selector.");return n.getStats()}var r=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&r.push(e[t].getStats())}))})),Promise.all(r).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var n=e[t];if(n&&n.prototype&&n.prototype.getStats){var r=n.prototype.getStats;n.prototype.getStats=function(){return r.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(n){var r;e[n].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(r=e[n]).type]||r.type,t.set(n,e[n])})),t}))}}}));var a=["createOffer","createAnswer"];return a.forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(a=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),i};function mn(e){const t=e&&e.navigator,n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(e).catch(e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e)))}}function _n(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function vn(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const n=new Event("enabled");n.enabled=e,this.dispatchEvent(n)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const n=fn(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e,t){let n=!1;return(e=JSON.parse(JSON.stringify(e))).filter(e=>{if(e&&(e.urls||e.url)){let t=e.urls||e.url;e.url&&!e.urls&&Gt("RTCIceServer.url","RTCIceServer.urls");const r="string"==typeof t;return r&&(t=[t]),t=t.filter(e=>{if(0===e.indexOf("stun:"))return!1;const t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!n?(n=!0,!0):t&&!n}),delete e.url,e.urls=r?t[0]:t,!!t.length}})}(e.iceServers,t.version),zt("ICE servers after filtering:",e.iceServers)),new n(e)},e.RTCPeerConnection.prototype=n.prototype}function gn(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var Sn=Object.freeze({__proto__:null,shimPeerConnection:vn,shimReplaceTrack:gn,shimGetUserMedia:mn,shimGetDisplayMedia:_n});function yn(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){Gt("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function bn(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function kn(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(r){if("TypeError"!==r.name)throw r;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function Tn(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const 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 Rn(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Bt(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function En(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){Gt("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function wn(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function In(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],n=e&&"sendEncodings"in e;n&&e.sendEncodings.forEach(e=>{if("rid"in e){if(!/^[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")});const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function Cn(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function xn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function An(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Pn=Object.freeze({__proto__:null,shimOnTrack:bn,shimPeerConnection:kn,shimSenderGetStats:Tn,shimReceiverGetStats:Rn,shimRemoveStream:En,shimRTCDataChannel:wn,shimAddTransceiver:In,shimGetParameters:Cn,shimCreateOffer:xn,shimCreateAnswer:An,shimGetUserMedia:yn,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}});function Dn(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function Mn(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function On(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){const r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Ln(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Nn(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function Nn(e){return e&&void 0!==e.video?Object.assign({},e,{video:qt(e.video)}):e}function Un(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(Gt("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Vn(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Fn(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&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.offerToReceiveVideo||n||this.addTransceiver("video")}return t.apply(this,arguments)}}function jn(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Bn=Object.freeze({__proto__:null,shimLocalStreamsAPI:Dn,shimRemoteStreamsAPI:Mn,shimCallbacksAPI:On,shimGetUserMedia:Ln,shimConstraints:Nn,shimRTCIceServerUrls:Un,shimTrackEventTransceiver:Vn,shimCreateOfferLegacy:Fn,shimAudioContext:jn});function Hn(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const n=new t(e),r=cn.parseCandidate(e.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Bt(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Jn(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=function(e){if(!e||!e.sdp)return!1;const t=cn.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=cn.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})},r=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n},i=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n},a=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const i=cn.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r},o=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const e=r(arguments[0]),t=i(e),n=a(arguments[0],e);let o;o=0===t&&0===n?Number.POSITIVE_INFINITY:0===t||0===n?Math.max(t,n):Math.min(t,n);const s={};Object.defineProperty(s,"maxMessageSize",{get:()=>o}),this._sctp=s}return o.apply(this,arguments)}}function zn(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},Bt(e,"datachannel",e=>(t(e.channel,e.target),e))}function Gn(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(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(e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function Wn(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function qn(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const 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())})}var Kn=Object.freeze({__proto__:null,shimRTCIceCandidate:Hn,shimMaxMessageSize:Jn,shimSendThrowTypeError:zn,shimConnectionState:Gn,removeExtmapAllowMixed:Wn,shimAddIceCandidateNullOrEmpty:qn});!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const n=zt,r=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=jt(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=jt(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=jt(n.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=jt(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:r,commonShim:Kn,extractVersion:jt,disableLog:Ht,disableWarnings:Jt};switch(r.browser){case"chrome":if(!sn||!an||!t.shimChrome)return n("Chrome shim is not included in this adapter release."),i;if(null===r.version)return n("Chrome shim can not determine version, not shimming."),i;n("adapter.js shimming chrome."),i.browserShim=sn,qn(e,r),Yt(e,r),$t(e),an(e,r),Xt(e),rn(e,r),Zt(e),en(e),tn(e),on(e,r),Hn(e),Gn(e),Jn(e,r),zn(e),Wn(e,r);break;case"firefox":if(!Pn||!kn||!t.shimFirefox)return n("Firefox shim is not included in this adapter release."),i;n("adapter.js shimming firefox."),i.browserShim=Pn,qn(e,r),yn(e,r),kn(e,r),bn(e),En(e),Tn(e),Rn(e),wn(e),In(e),Cn(e),xn(e),An(e),Hn(e),Gn(e),Jn(e,r),zn(e);break;case"edge":if(!Sn||!vn||!t.shimEdge)return n("MS edge shim is not included in this adapter release."),i;n("adapter.js shimming edge."),i.browserShim=Sn,mn(e),_n(e),vn(e,r),gn(e),Jn(e,r),zn(e);break;case"safari":if(!Bn||!t.shimSafari)return n("Safari shim is not included in this adapter release."),i;n("adapter.js shimming safari."),i.browserShim=Bn,qn(e,r),Un(e),Fn(e),On(e),Dn(e),Mn(e),Vn(e),Ln(e),jn(e),Hn(e),Jn(e,r),zn(e),Wn(e,r);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var Qn=[].slice,Yn={},$n=function(e,t,n){if(!(t in Yn)){for(var r=[],i=0;i<t;i++)r[i]="a["+i+"]";Yn[t]=Function("C,a","return new C("+r.join(",")+")")}return Yn[t](e,n)},Xn=Function.bind||function(e){var t=_t(this),n=Qn.call(arguments,1),r=function(){var i=n.concat(Qn.call(arguments));return this instanceof r?$n(t,i.length,i):t.apply(e,i)};return B(t.prototype)&&(r.prototype=t.prototype),r};mt({target:"Function",proto:!0},{bind:Xn});var Zn=Te.f,er=Function.prototype,tr=er.toString,nr=/^\s*function ([^ (]*)/;A&&!("name"in er)&&Zn(er,"name",{configurable:!0,get:function(){try{return tr.call(this).match(nr)[1]}catch(e){return""}}});var rr,ir=function(){var e=be(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},ar=function(e,t){return RegExp(e,t)},or={UNSUPPORTED_Y:x((function(){var e=ar("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:x((function(){var e=ar("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},sr=Object.keys||function(e){return et(e,tt)},cr=A?Object.defineProperties:function(e,t){be(e);for(var n,r=sr(t),i=r.length,a=0;i>a;)Te.f(e,n=r[a++],t[n]);return e},ur=J("document","documentElement"),dr=Me("IE_PROTO"),lr=function(){},hr=function(e){return"<script>"+e+"<\/script>"},pr=function(e){e.write(hr("")),e.close();var t=e.parentWindow.Object;return e=null,t},fr=function(){try{rr=new ActiveXObject("htmlfile")}catch(t){}fr=document.domain&&rr?pr(rr):function(){var e,t=ve("iframe");if(t.style)return t.style.display="none",ur.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(hr("document.F=Object")),e.close(),e.F}()||pr(rr);for(var e=tt.length;e--;)delete fr.prototype[tt[e]];return fr()};Oe[dr]=!0;var mr=Object.create||function(e,t){var n;return null!==e?(lr.prototype=be(e),n=new lr,lr.prototype=null,n[dr]=e):n=fr(),void 0===t?n:cr(n,t)},_r=x((function(){var e=RegExp(".","string".charAt(0));return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),vr=x((function(){var e=RegExp("(?<a>b)","string".charAt(5));return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),gr=Be.get,Sr=RegExp.prototype.exec,yr=te("native-string-replace",String.prototype.replace),br=Sr,kr=function(){var e=/a/,t=/b*/g;return Sr.call(e,"a"),Sr.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Tr=or.UNSUPPORTED_Y||or.BROKEN_CARET,Rr=void 0!==/()??/.exec("")[1];(kr||Rr||Tr||_r||vr)&&(br=function(e){var t,n,r,i,a,o,s,c=this,u=gr(c),d=At(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=br.call(l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=Tr&&c.sticky,f=ir.call(c),m=c.source,_=0,v=d;if(p&&(-1===(f=f.replace("y","")).indexOf("g")&&(f+="g"),v=d.slice(c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==d.charAt(c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,_++),n=new RegExp("^(?:"+m+")",f)),Rr&&(n=new RegExp("^"+m+"$(?!\\s)",f)),kr&&(r=c.lastIndex),i=Sr.call(p?n:c,v),p?i?(i.input=i.input.slice(_),i[0]=i[0].slice(_),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:kr&&i&&(c.lastIndex=c.global?i.index+i[0].length:r),Rr&&i&&i.length>1&&yr.call(i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&h)for(i.groups=o=mr(null),a=0;a<h.length;a++)o[(s=h[a])[0]]=i[s[1]];return i});var Er=br;mt({target:"RegExp",proto:!0,forced:/./.exec!==Er},{exec:Er});var wr=Nt.trim,Ir=C.parseFloat,Cr=1/Ir(Pt+"-0")!=-Infinity?function(e){var t=wr(At(e)),n=Ir(t);return 0===n&&"-"==t.charAt(0)?-0:n}:Ir;mt({global:!0,forced:parseFloat!=Cr},{parseFloat:Cr});var xr=le("species"),Ar=RegExp.prototype,Pr=function(e,t,n,r){var i=le(e),a=!x((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),o=a&&!x((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[xr]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!a||!o||n){var s=/./[i],c=t(i,""[e],(function(e,t,n,r,i){var o=t.exec;return o===Er||o===Ar.exec?a&&!i?{done:!0,value:s.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}));He(String.prototype,e,c[0]),He(Ar,i,c[1])}r&&Re(Ar[i],"sham",!0)},Dr=function(e){return function(t,n){var r,i,a=At(F(t)),o=Ge(n),s=a.length;return o<0||o>=s?e?"":void 0:(r=a.charCodeAt(o))<55296||r>56319||o+1===s||(i=a.charCodeAt(o+1))<56320||i>57343?e?a.charAt(o):r:e?a.slice(o,o+2):i-56320+(r-55296<<10)+65536}},Mr={codeAt:Dr(!1),charAt:Dr(!0)},Or=Mr.charAt,Lr=function(e,t,n){return t+(n?Or(e,t).length:1)},Nr=function(e,t){var n=e.exec;if("function"==typeof n){var r=n.call(e,t);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==N(e))throw TypeError("RegExp#exec called on incompatible receiver");return Er.call(e,t)};Pr("match",(function(e,t,n){return[function(t){var n=F(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](At(n))},function(e){var r=be(this),i=At(e),a=n(t,r,i);if(a.done)return a.value;if(!r.global)return Nr(r,i);var o=r.unicode;r.lastIndex=0;for(var s,c=[],u=0;null!==(s=Nr(r,i));){var d=At(s[0]);c[u]=d,""===d&&(r.lastIndex=Lr(i,qe(r.lastIndex),o)),u++}return 0===u?null:c}]}));var Ur=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};Pr("search",(function(e,t,n){return[function(t){var n=F(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](At(n))},function(e){var r=be(this),i=At(e),a=n(t,r,i);if(a.done)return a.value;var o=r.lastIndex;Ur(o,0)||(r.lastIndex=0);var s=Nr(r,i);return Ur(r.lastIndex,o)||(r.lastIndex=o),null===s?-1:s.index}]}));var Vr=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(r){}return function(n,r){return be(n),function(e){if(!B(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),Fr=function(e,t,n){var r,i;return Vr&&"function"==typeof(r=t.constructor)&&r!==n&&B(i=r.prototype)&&i!==n.prototype&&Vr(e,i),e},jr=le("match"),Br=function(e){var t;return B(e)&&(void 0!==(t=e[jr])?!!t:"RegExp"==N(e))},Hr=le("species"),Jr=function(e){var t=J(e),n=Te.f;A&&t&&!t[Hr]&&n(t,Hr,{configurable:!0,get:function(){return this}})},zr=Te.f,Gr=rt.f,Wr=Be.enforce,qr=le("match"),Kr=C.RegExp,Qr=Kr.prototype,Yr=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,$r=/a/g,Xr=/a/g,Zr=new Kr($r)!==$r,ei=or.UNSUPPORTED_Y,ti=A&&(!Zr||ei||_r||vr||x((function(){return Xr[qr]=!1,Kr($r)!=$r||Kr(Xr)==Xr||"/a/i"!=Kr($r,"i")})));if(pt("RegExp",ti)){for(var ni=function(e,t){var n,r,i,a,o,s,c=this instanceof ni,u=Br(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===ni)return e;if((u||e instanceof ni)&&(e=e.source,d&&(t="flags"in h?h.flags:ir.call(h))),e=void 0===e?"":At(e),t=void 0===t?"":At(t),h=e,_r&&"dotAll"in $r&&(r=!!t&&t.indexOf("s")>-1)&&(t=t.replace(/s/g,"")),n=t,ei&&"sticky"in $r&&(i=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,"")),vr&&(e=(a=function(e){for(var t,n=e.length,r=0,i="",a=[],o={},s=!1,c=!1,u=0,d="";r<=n;r++){if("\\"===(t=e.charAt(r)))t+=e.charAt(++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Yr.test(e.slice(r+1))&&(r+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||ie(o,d))throw new SyntaxError("Invalid capture group name");o[d]=!0,a.push([d,u]),c=!1,d="";continue}c?d+=t:i+=t}return[i,a]}(e))[0],l=a[1]),o=Fr(Kr(e,t),c?this:Qr,ni),(r||i||l.length)&&(s=Wr(o),r&&(s.dotAll=!0,s.raw=ni(function(e){for(var t,n=e.length,r=0,i="",a=!1;r<=n;r++)"\\"!==(t=e.charAt(r))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),i+=t):i+="[\\s\\S]":i+=t+e.charAt(++r);return i}(e),n)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Re(o,"source",""===h?"(?:)":h)}catch(p){}return o},ri=function(e){e in ni||zr(ni,e,{configurable:!0,get:function(){return Kr[e]},set:function(t){Kr[e]=t}})},ii=Gr(Kr),ai=0;ii.length>ai;)ri(ii[ai++]);Qr.constructor=ni,ni.prototype=Qr,He(C,"RegExp",ni)}Jr("RegExp");var oi=RegExp.prototype,si=oi.toString,ci=x((function(){return"/a/b"!=si.call({source:"a",flags:"b"})})),ui="toString"!=si.name;(ci||ui)&&He(RegExp.prototype,"toString",(function(){var e=be(this),t=At(e.source),n=e.flags;return"/"+t+"/"+At(void 0===n&&e instanceof RegExp&&!("flags"in oi)?ir.call(e):n)}),{unsafe:!0});var di=function(e,t){var n=[][e];return!!n&&x((function(){n.call(null,t||function(){throw 1},1)}))},li=Xe.indexOf,hi=[].indexOf,pi=!!hi&&1/[1].indexOf(1,-0)<0,fi=di("indexOf");mt({target:"Array",proto:!0,forced:pi||!fi},{indexOf:function(e){return pi?hi.apply(this,arguments)||0:li(this,e,arguments.length>1?arguments[1]:void 0)}});var mi=Math.floor,_i="".replace,vi=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,gi=/\$([$&'`]|\d{1,2})/g,Si=function(e,t,n,r,i,a){var o=n+e.length,s=r.length,c=gi;return void 0!==i&&(i=ne(i),c=vi),_i.call(a,c,(function(a,c){var u;switch(c.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(o);case"<":u=i[c.slice(1,-1)];break;default:var d=+c;if(0===d)return a;if(d>s){var l=mi(d/10);return 0===l?a:l<=s?void 0===r[l-1]?c.charAt(1):r[l-1]+c.charAt(1):a}u=r[d-1]}return void 0===u?"":u}))},yi=le("replace"),bi=Math.max,ki=Math.min,Ti="$0"==="a".replace(/./,"$0"),Ri=!!/./[yi]&&""===/./[yi]("a","$0");Pr("replace",(function(e,t,n){var r=Ri?"$":"$0";return[function(e,n){var r=F(this),i=null==e?void 0:e[yi];return void 0!==i?i.call(e,r,n):t.call(At(r),e,n)},function(e,i){var a=be(this),o=At(e);if("string"==typeof i&&-1===i.indexOf(r)&&-1===i.indexOf("$<")){var s=n(t,a,o,i);if(s.done)return s.value}var c="function"==typeof i;c||(i=At(i));var u=a.global;if(u){var d=a.unicode;a.lastIndex=0}for(var l=[];;){var h=Nr(a,o);if(null===h)break;if(l.push(h),!u)break;""===At(h[0])&&(a.lastIndex=Lr(o,qe(a.lastIndex),d))}for(var p,f="",m=0,_=0;_<l.length;_++){h=l[_];for(var v=At(h[0]),g=bi(ki(Ge(h.index),o.length),0),S=[],y=1;y<h.length;y++)S.push(void 0===(p=h[y])?p:String(p));var b=h.groups;if(c){var k=[v].concat(S,g,o);void 0!==b&&k.push(b);var T=At(i.apply(void 0,k))}else T=Si(v,o,g,S,b,i);g>=m&&(f+=o.slice(m,g)+T,m=g+v.length)}return f+o.slice(m)}]}),!!x((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!Ti||Ri);var Ei={};Ei[le("toStringTag")]="z";var wi="[object z]"===String(Ei),Ii=le("toStringTag"),Ci="Arguments"==N(function(){return arguments}()),xi=wi?N:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(n){}}(t=Object(e),Ii))?n:Ci?N(t):"Object"==(r=N(t))&&"function"==typeof t.callee?"Arguments":r},Ai=wi?{}.toString:function(){return"[object "+xi(this)+"]"};wi||He(Object.prototype,"toString",Ai,{unsafe:!0});var Pi=!x((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Di=Me("IE_PROTO"),Mi=Object.prototype,Oi=Pi?Object.getPrototypeOf:function(e){return e=ne(e),ie(e,Di)?e[Di]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Mi:null},Li=x((function(){Oi(1)}));mt({target:"Object",stat:!0,forced:Li,sham:!Pi},{getPrototypeOf:function(e){return Oi(ne(e))}});var Ni=J("Reflect","apply"),Ui=Function.apply,Vi=!x((function(){Ni((function(){}))}));mt({target:"Reflect",stat:!0,forced:Vi},{apply:function(e,t,n){return _t(e),be(n),Ni?Ni(e,t,n):Ui.call(e,t,n)}});var Fi=function(e,t,n){var r=fe(t);r in e?Te.f(e,r,O(0,n)):e[r]=n},ji=le("isConcatSpreadable"),Bi=Q>=51||!x((function(){var e=[];return e[ji]=!1,e.concat()[0]!==e})),Hi=Et("concat"),Ji=function(e){if(!B(e))return!1;var t=e[ji];return void 0!==t?!!t:gt(e)};mt({target:"Array",proto:!0,forced:!Bi||!Hi},{concat:function(e){var t,n,r,i,a,o=ne(this),s=yt(o,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(Ji(a=-1===t?o:arguments[t])){if(c+(i=qe(a.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<i;n++,c++)n in a&&Fi(s,c,a[n])}else{if(c>=9007199254740991)throw TypeError("Maximum allowed index exceeded");Fi(s,c++,a)}return s.length=c,s}});var zi=le("species"),Gi=function(e,t){var n,r=be(e).constructor;return void 0===r||null==(n=be(r)[zi])?t:_t(n)},Wi=or.UNSUPPORTED_Y,qi=[].push,Ki=Math.min;Pr("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=At(F(this)),i=void 0===n?4294967295:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!Br(e))return t.call(r,e,i);for(var a,o,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(a=Er.call(l,r))&&!((o=l.lastIndex)>d&&(c.push(r.slice(d,a.index)),a.length>1&&a.index<r.length&&qi.apply(c,a.slice(1)),s=a[0].length,d=o,c.length>=i));)l.lastIndex===a.index&&l.lastIndex++;return d===r.length?!s&&l.test("")||c.push(""):c.push(r.slice(d)),c.length>i?c.slice(0,i):c}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=F(this),a=null==t?void 0:t[e];return void 0!==a?a.call(t,i,n):r.call(At(i),t,n)},function(e,i){var a=be(this),o=At(e),s=n(r,a,o,i,r!==t);if(s.done)return s.value;var c=Gi(a,RegExp),u=a.unicode,d=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(Wi?"g":"y"),l=new c(Wi?"^(?:"+a.source+")":a,d),h=void 0===i?4294967295:i>>>0;if(0===h)return[];if(0===o.length)return null===Nr(l,o)?[o]:[];for(var p=0,f=0,m=[];f<o.length;){l.lastIndex=Wi?0:f;var _,v=Nr(l,Wi?o.slice(f):o);if(null===v||(_=Ki(qe(l.lastIndex+(Wi?f:0)),o.length))===p)f=Lr(o,f,u);else{if(m.push(o.slice(p,f)),m.length===h)return m;for(var g=1;g<=v.length-1;g++)if(m.push(v[g]),m.length===h)return m;f=p=_}}return m.push(o.slice(p)),m}]}),!!x((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),Wi);var Qi=rt.f,Yi=ye.f,$i=Te.f,Xi=Nt.trim,Zi=C.Number,ea=Zi.prototype,ta="Number"==N(mr(ea)),na=function(e){if(X(e))throw TypeError("Cannot convert a Symbol value to a number");var t,n,r,i,a,o,s,c,u=pe(e,"number");if("string"==typeof u&&u.length>2)if(43===(t=(u=Xi(u)).charCodeAt(0))||45===t){if(88===(n=u.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(u.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+u}for(o=(a=u.slice(2)).length,s=0;s<o;s++)if((c=a.charCodeAt(s))<48||c>i)return NaN;return parseInt(a,r)}return+u};if(pt("Number",!Zi(" 0o1")||!Zi("0b1")||Zi("+0x1"))){for(var ra,ia=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof ia&&(ta?x((function(){ea.valueOf.call(n)})):"Number"!=N(n))?Fr(new Zi(na(t)),n,ia):na(t)},aa=A?Qi(Zi):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),oa=0;aa.length>oa;oa++)ie(Zi,ra=aa[oa])&&!ie(ia,ra)&&$i(ia,ra,Yi(Zi,ra));ia.prototype=ea,ea.constructor=ia,He(C,"Number",ia)}var sa="wss://bk.rtc.qq.com",ca="wss://trtc.rtc.qq.com",ua="wss://webrtc.qq.com",da="".concat("wss://qcloud.rtc.qq.com",":443"),la="".concat(sa,":443"),ha="",pa=function(e){return ha=e},fa=1,ma=2,_a=20,va=21,ga="5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV",Sa="224d130c-7b5c-415b-aaa2-79c2eb5a6df2",ya=2,ba="DISCONNECTED",ka="CONNECTING",Ta="RECONNECTING",Ra="CONNECTED",Ea="join",wa="delta-join",Ia="rejoin",Ca="leave",xa="delta-leave",Aa="publish",Pa="delta-publish",Da="unpublish",Ma="subscribe",Oa="unsubscribe",La="uplink-connection",Na="uplink-reconnection",Ua="downlink-connection",Va="downlink-reconnection",Fa="setLocalDescription",ja="setRemoteDescription",Ba="iceConnectionState",Ha="stream-initialize",Ja="websocketConnectionState",za="websocketReconnectionState",Ga="update-stream",Wa="recover-subscription",qa="start-mix-transcode",Ka="stop-mix-transcode",Qa="player-error",Ya="unsubscribe",$a="subscribe_change",Xa={MANUAL:"manual",PRESET_LAYOUT:"preset-layout"},Za={REMOTE:"$PLACE_HOLDER_REMOTE$"},eo={IT_AUDIO_VIDEO:0,IT_PICTURE:2,IT_CANVAS:3,IT_PURE_AUDIO:4,IT_PURE_VIDEO:5},to="String",no="Number",ro="Boolean",io="Array",ao="audio",oo="video",so="auxiliary",co="add",uo="remove",lo={unknown:0,wifi:1,"3g":2,"2g":3,"4g":4,wired:5},ho=-1,po=0,fo=1,mo=Date.prototype,_o=mo.toString,vo=mo.getTime;"Invalid Date"!=String(new Date(NaN))&&He(mo,"toString",(function(){var e=vo.call(this);return e==e?_o.call(this):"Invalid Date"}));var go={INVALID_PARAMETER:4096,INVALID_OPERATION:4097,NOT_SUPPORTED:4098,DEVICE_NOT_FOUND:4099,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,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,UNKNOWN:65535},So=function(e){u(n,e);var t=_(n);function n(e){var r,i=e.message,o=e.code,s=void 0===o?go.UNKNOWN:o,c=e.extraCode,u=void 0===c?0:c;return a(this,n),(r=t.call(this,i+" <".concat(function(e){for(var t in go)if(go[t]===e)return t;return"UNKNOWN"}(s)," 0x").concat(s.toString(16),"> https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/module-ErrorCode.html"))).code_=s,r.extraCode_=u,r.name="RtcError",r.message_=i,r}return s(n,[{key:"getCode",value:function(){return this.code_}},{key:"getExtraCode",value:function(){return this.extraCode_}}]),n}(f(Error)),yo=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},bo=Object.prototype.toString;function ko(e){return"[object Array]"===bo.call(e)}function To(e){return void 0===e}function Ro(e){return null!==e&&"object"==typeof e}function Eo(e){return"[object Function]"===bo.call(e)}function wo(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),ko(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var Io={isArray:ko,isArrayBuffer:function(e){return"[object ArrayBuffer]"===bo.call(e)},isBuffer:function(e){return null!==e&&!To(e)&&null!==e.constructor&&!To(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Ro,isUndefined:To,isDate:function(e){return"[object Date]"===bo.call(e)},isFile:function(e){return"[object File]"===bo.call(e)},isBlob:function(e){return"[object Blob]"===bo.call(e)},isFunction:Eo,isStream:function(e){return Ro(e)&&Eo(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:wo,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,i=arguments.length;r<i;r++)wo(arguments[r],n);return t},deepMerge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]="object"==typeof n?e({},n):n}for(var r=0,i=arguments.length;r<i;r++)wo(arguments[r],n);return t},extend:function(e,t,n){return wo(t,(function(t,r){e[r]=n&&"function"==typeof t?yo(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}};function Co(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var xo=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(Io.isURLSearchParams(t))r=t.toString();else{var i=[];Io.forEach(t,(function(e,t){null!=e&&(Io.isArray(e)?t+="[]":e=[e],Io.forEach(e,(function(e){Io.isDate(e)?e=e.toISOString():Io.isObject(e)&&(e=JSON.stringify(e)),i.push(Co(t)+"="+Co(e))})))})),r=i.join("&")}if(r){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function Ao(){this.handlers=[]}Ao.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},Ao.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},Ao.prototype.forEach=function(e){Io.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var Po=Ao,Do=function(e,t,n){return Io.forEach(n,(function(n){e=n(e,t)})),e},Mo=function(e){return!(!e||!e.__CANCEL__)},Oo="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Lo(){throw new Error("setTimeout has not been defined")}function No(){throw new Error("clearTimeout has not been defined")}var Uo=Lo,Vo=No;function Fo(e){if(Uo===setTimeout)return setTimeout(e,0);if((Uo===Lo||!Uo)&&setTimeout)return Uo=setTimeout,setTimeout(e,0);try{return Uo(e,0)}catch(t){try{return Uo.call(null,e,0)}catch(t){return Uo.call(this,e,0)}}}"function"==typeof Oo.setTimeout&&(Uo=setTimeout),"function"==typeof Oo.clearTimeout&&(Vo=clearTimeout);var jo,Bo=[],Ho=!1,Jo=-1;function zo(){Ho&&jo&&(Ho=!1,jo.length?Bo=jo.concat(Bo):Jo=-1,Bo.length&&Go())}function Go(){if(!Ho){var e=Fo(zo);Ho=!0;for(var t=Bo.length;t;){for(jo=Bo,Bo=[];++Jo<t;)jo&&jo[Jo].run();Jo=-1,t=Bo.length}jo=null,Ho=!1,function(e){if(Vo===clearTimeout)return clearTimeout(e);if((Vo===No||!Vo)&&clearTimeout)return Vo=clearTimeout,clearTimeout(e);try{Vo(e)}catch(t){try{return Vo.call(null,e)}catch(t){return Vo.call(this,e)}}}(e)}}function Wo(e,t){this.fun=e,this.array=t}Wo.prototype.run=function(){this.fun.apply(null,this.array)};function qo(){}var Ko=qo,Qo=qo,Yo=qo,$o=qo,Xo=qo,Zo=qo,es=qo;var ts=Oo.performance||{},ns=ts.now||ts.mozNow||ts.msNow||ts.oNow||ts.webkitNow||function(){return(new Date).getTime()};var rs=new Date;var is={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Bo.push(new Wo(e,t)),1!==Bo.length||Ho||Fo(Go)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Ko,addListener:Qo,once:Yo,off:$o,removeListener:Xo,removeAllListeners:Zo,emit:es,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*ns.call(ts),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-rs)/1e3}},as=function(e,t){Io.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},os=function(e,t,n,r,i){return function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,r,i)},ss=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],cs=Io.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=Io.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},us=Io.isStandardBrowserEnv()?{write:function(e,t,n,r,i,a){var o=[];o.push(e+"="+encodeURIComponent(t)),Io.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),Io.isString(r)&&o.push("path="+r),Io.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},ds=function(e){return new Promise((function(t,n){var r=e.data,i=e.headers;Io.isFormData(r)&&delete i["Content-Type"];var a=new XMLHttpRequest;if(e.auth){var o=e.auth.username||"",s=e.auth.password||"";i.Authorization="Basic "+btoa(o+":"+s)}var c,u,d=(c=e.baseURL,u=e.url,c&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(u)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(c,u):u);if(a.open(e.method.toUpperCase(),xo(d,e.params,e.paramsSerializer),!0),a.timeout=e.timeout,a.onreadystatechange=function(){if(a&&4===a.readyState&&(0!==a.status||a.responseURL&&0===a.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in a?function(e){var t,n,r,i={};return e?(Io.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=Io.trim(e.substr(0,r)).toLowerCase(),n=Io.trim(e.substr(r+1)),t){if(i[t]&&ss.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([n]):i[t]?i[t]+", "+n:n}})),i):i}(a.getAllResponseHeaders()):null,i={data:e.responseType&&"text"!==e.responseType?a.response:a.responseText,status:a.status,statusText:a.statusText,headers:r,config:e,request:a};!function(e,t,n){var r=n.config.validateStatus;!r||r(n.status)?e(n):t(os("Request failed with status code "+n.status,n.config,null,n.request,n))}(t,n,i),a=null}},a.onabort=function(){a&&(n(os("Request aborted",e,"ECONNABORTED",a)),a=null)},a.onerror=function(){n(os("Network Error",e,null,a)),a=null},a.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(os(t,e,"ECONNABORTED",a)),a=null},Io.isStandardBrowserEnv()){var l=us,h=(e.withCredentials||cs(d))&&e.xsrfCookieName?l.read(e.xsrfCookieName):void 0;h&&(i[e.xsrfHeaderName]=h)}if("setRequestHeader"in a&&Io.forEach(i,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete i[t]:a.setRequestHeader(t,e)})),Io.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),e.responseType)try{a.responseType=e.responseType}catch(p){if("json"!==e.responseType)throw p}"function"==typeof e.onDownloadProgress&&a.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&a.upload&&a.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){a&&(a.abort(),n(e),a=null)})),void 0===r&&(r=null),a.send(r)}))},ls={"Content-Type":"application/x-www-form-urlencoded"};function hs(e,t){!Io.isUndefined(e)&&Io.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var ps={adapter:function(){var e;return("undefined"!=typeof XMLHttpRequest||void 0!==is&&"[object process]"===Object.prototype.toString.call(is))&&(e=ds),e}(),transformRequest:[function(e,t){return as(t,"Accept"),as(t,"Content-Type"),Io.isFormData(e)||Io.isArrayBuffer(e)||Io.isBuffer(e)||Io.isStream(e)||Io.isFile(e)||Io.isBlob(e)?e:Io.isArrayBufferView(e)?e.buffer:Io.isURLSearchParams(e)?(hs(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Io.isObject(e)?(hs(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Io.forEach(["delete","get","head"],(function(e){ps.headers[e]={}})),Io.forEach(["post","put","patch"],(function(e){ps.headers[e]=Io.merge(ls)}));var fs=ps;function ms(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var _s=function(e){return ms(e),e.headers=e.headers||{},e.data=Do(e.data,e.headers,e.transformRequest),e.headers=Io.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Io.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||fs.adapter)(e).then((function(t){return ms(e),t.data=Do(t.data,t.headers,e.transformResponse),t}),(function(t){return Mo(t)||(ms(e),t&&t.response&&(t.response.data=Do(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},vs=function(e,t){t=t||{};var n={},r=["url","method","params","data"],i=["headers","auth","proxy"],a=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];Io.forEach(r,(function(e){void 0!==t[e]&&(n[e]=t[e])})),Io.forEach(i,(function(r){Io.isObject(t[r])?n[r]=Io.deepMerge(e[r],t[r]):void 0!==t[r]?n[r]=t[r]:Io.isObject(e[r])?n[r]=Io.deepMerge(e[r]):void 0!==e[r]&&(n[r]=e[r])})),Io.forEach(a,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}));var o=r.concat(i).concat(a),s=Object.keys(t).filter((function(e){return-1===o.indexOf(e)}));return Io.forEach(s,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])})),n};function gs(e){this.defaults=e,this.interceptors={request:new Po,response:new Po}}gs.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=vs(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[_s,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},gs.prototype.getUri=function(e){return e=vs(this.defaults,e),xo(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Io.forEach(["delete","get","head","options"],(function(e){gs.prototype[e]=function(t,n){return this.request(Io.merge(n||{},{method:e,url:t}))}})),Io.forEach(["post","put","patch"],(function(e){gs.prototype[e]=function(t,n,r){return this.request(Io.merge(r||{},{method:e,url:t,data:n}))}}));var Ss=gs;function ys(e){this.message=e}ys.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},ys.prototype.__CANCEL__=!0;var bs=ys;function ks(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new bs(e),t(n.reason))}))}ks.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},ks.source=function(){var e;return{token:new ks((function(t){e=t})),cancel:e}};var Ts=ks;function Rs(e){var t=new Ss(e),n=yo(Ss.prototype.request,t);return Io.extend(n,Ss.prototype,t),Io.extend(n,t),n}var Es=Rs(fs);Es.Axios=Ss,Es.create=function(e){return Rs(vs(Es.defaults,e))},Es.Cancel=bs,Es.CancelToken=Ts,Es.isCancel=Mo,Es.all=function(e){return Promise.all(e)},Es.spread=function(e){return function(t){return e.apply(null,t)}};var ws=Es,Is=Es;ws.default=Is;var Cs=ws,xs=((new Date).getTime(),0),As=function(){return(new Date).getTime()+xs},Ps=function(){var e=new Date;return e.setTime(As()),e.toLocaleString()},Ds={sdkAppId:"",userId:"",version:"",env:"qcloud",browserVersion:"",ua:""},Ms=function(e){Ds.sdkAppId="".concat(e.sdkAppId),Ds.version="".concat(e.version),Ds.env=e.env,Ds.userId=e.userId,Ds.browserVersion=e.browserVersion,Ds.ua=e.ua},Os=function(e,t){var n={timestamp:Ps(),sdkAppId:Ds.sdkAppId,userId:Ds.userId,version:Ds.version,log:e};t&&(n.errorInfo=t.message),Cs.post(Hs(),JSON.stringify(n)).catch((function(){}))},Ls=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)),Os(t),"failed"===e.result&&(t="stat-".concat(e.eventType,"-").concat(e.result,"-").concat(e.code),Os(t,e.error))},Ns=function(e){if(!au){var n=t(t({},e),Ds);Ks(n.code)&&(n.code="failed"===n.result?go.UNKNOWN:0),Cs.post(Js(),JSON.stringify(n)).catch((function(){}))}},Us=function(e){au||(Ns(t(t({},e),{},{result:"success"})),"qcloud"===Ds.env&&Ls(t(t({},e),{},{result:"success"})))},Vs=function(e){if(!au){var n=e.eventType,r=e.code,i=e.error,a={eventType:n,result:"failed",code:r||(i instanceof So?i.getExtraCode()||i.getCode():go.UNKNOWN)};Ns(a),"qcloud"===Ds.env&&Ls(t(t({},a),{},{error:i}))}},Fs=function(e){var t=window.location.search.match(new RegExp("(\\?|&)"+e+"=([^&]*)(&|$)"));return t?decodeURIComponent(t[2]):""},js=function(){return Fs("trtc_env")},Bs=function(e){var t=e,n=Fs("trtc_env");return n&&(t="wss://"+n+".rtc.qq.com:443"),t},Hs=function(){return"".concat(ha||"https://yun.tim.qq.com","/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_log")},Js=function(){return"".concat(ha||"https://yun.tim.qq.com","/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_event")};function zs(){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 r=t&&t.type&&t.type.toLowerCase(),i=t&&t.effectiveType&&t.effectiveType.toLowerCase();"slow-2"===i&&(i="2g");var a=n||"unknown";if(r)switch(r){case"cellular":case"wimax":a=i||"unknown";break;case"wifi":a="wifi";break;case"ethernet":a="wired";break;case"none":case"other":case"unknown":a="unknown"}return su.info("networkType:",a),a}var Gs=function(e){if(!e||"object"!==n(e)||"[object Object]"!=Object.prototype.toString.call(e))return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Function.prototype.toString.call(r)===Function.prototype.toString.call(Object)};function Ws(e){var t=Math.round(e/2)+1;return t>6?13e3:1e3*function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return t<=1?r:e(t-1,r,n+r)}(t)}var qs=function(e){return"function"==typeof e},Ks=function(e){return void 0===e},Qs=function(e){return"string"==typeof e},Ys=function(e){return"number"==typeof e};function $s(e){return Reflect.apply(Object.prototype.toString,e,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}function Xs(e,t){for(var n in e)if(t[n]&&"undefined"!==$s(e[n])&&$s(e[n])!==t[n].toLowerCase())return{ret:!1,message:"".concat(n," should be ").concat(t[n])};return{ret:!0}}function Zs(e){var t={};return t.urls="turn:".concat(e.url),Ks(e.username)||Ks(e.credential)||(t.username=e.username,t.credential=e.credential,t.credentialType="password",Ks(e.credentialType)||(t.credentialType=e.credentialType)),t}function ec(){return Math.floor(performance.now())}function tc(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"big";if(!Qs(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}function nc(){return(nc=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,"https://schedule.rtc.qq.com/api/v1/config",n={userId:String(t.userId),sdkAppId:String(t.sdkAppId),isStrGroupId:t.useStringRoomId,groupId:String(t.roomId),sdkVersion:"4.11.4",userSig:String(t.userSig)},r=ec(),e.next=6,Cs.post("https://schedule.rtc.qq.com/api/v1/config",n,{timeout:3e3});case 6:if(i=e.sent,a=ec()-r,Os("stat-schedule-delta:"+a),0!==i.data.code){e.next=11;break}return e.abrupt("return",i.data);case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(0),su.error(e.t0);case 16:case"end":return e.stop()}}),e,null,[[0,13]])})))).apply(this,arguments)}var rc,ic=window.navigator&&window.navigator.userAgent||"",ac=/AppleWebKit\/([\d.]+)/i.exec(ic),oc=(ac&&parseFloat(ac.pop()),/iPad/i.test(ic)),sc=/iPhone/i.test(ic)&&!oc,cc=/iPod/i.test(ic),uc=sc||oc||cc,dc=(uc&&function(){var e=ic.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),/Android/i.test(ic)),lc=dc&&function(){var e=ic.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),hc=(dc&&/webkit/i.test(ic),/Firefox/i.test(ic)),pc=hc&&function(){var e=ic.match(/Firefox\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),fc=/Edge\//i.test(ic),mc=fc&&function(){var e=ic.match(/Edge\/(\d+)/i);if(e&&e[1])return e[1]}(),_c=/Edg\//i.test(ic),vc=_c&&function(){var e=ic.match(/Edg\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),gc=/SogouMobileBrowser\//i.test(ic),Sc=gc&&function(){var e=ic.match(/SogouMobileBrowser\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),yc=/MetaSr\s/i.test(ic),bc=yc&&function(){var e=ic.match(/MetaSr(\s\d+(\.\d+)+)/);return e&&e[1]?parseFloat(e[1]):null}(),kc=/TBS\/\d+/i.test(ic),Tc=kc&&function(){var e=ic.match(/TBS\/(\d+)/i);if(e&&e[1])return e[1]}(),Rc=/XWEB\/\d+/i.test(ic),Ec=Rc&&function(){var e=ic.match(/XWEB\/(\d+)/i);if(e&&e[1])return e[1]}(),wc=(/MSIE\s8\.0/.test(ic),/MSIE\/\d+/i.test(ic)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(ic),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(ic)&&/rv:11.0/.test(ic)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(ic)),Ic=wc&&function(){var e=ic.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])return e[1]}(),Cc=!kc&&/MQQBrowser\/\d+/i.test(ic)&&/COVC\/\d+/i.test(ic),xc=!kc&&/MQQBrowser\/\d+/i.test(ic)&&!/COVC\/\d+/i.test(ic),Ac=(xc||Cc)&&function(){var e=ic.match(/ MQQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Pc=!kc&&/ QQBrowser\/\d+/i.test(ic),Dc=Pc&&function(){var e=ic.match(/ QQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Mc=!kc&&/QQBrowserLite\/\d+/i.test(ic),Oc=Mc&&function(){var e=ic.match(/QQBrowserLite\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Lc=!kc&&/MQBHD\/\d+/i.test(ic),Nc=Lc&&function(){var e=ic.match(/MQBHD\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Uc=/Windows/i.test(ic),Vc=!uc&&/MAC OS X/i.test(ic),Fc=!dc&&/Linux/i.test(ic),jc=(/MicroMessenger/i.test(ic),/UCBrowser/i.test(ic)),Bc=(/Electron/i.test(ic),/MiuiBrowser/i.test(ic)),Hc=Bc&&function(){var e=ic.match(/MiuiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Jc=/HuaweiBrowser/i.test(ic),zc=/Huawei/i.test(ic),Gc=Jc&&function(){var e=ic.match(/HuaweiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Wc=/SamsungBrowser/i.test(ic),qc=Wc&&function(){var e=ic.match(/SamsungBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Kc=/HeyTapBrowser/i.test(ic),Qc=Kc&&function(){var e=ic.match(/HeyTapBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Yc=/VivoBrowser/i.test(ic),$c=Yc&&function(){var e=ic.match(/VivoBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Xc=/Chrome/i.test(ic),Zc=!fc&&!yc&&!gc&&!kc&&!Rc&&!_c&&!Pc&&!Bc&&!Jc&&!Wc&&!Kc&&!Yc&&/Chrome/i.test(ic),eu=Zc&&function(){var e=ic.match(/Chrome\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),tu=Zc&&function(){var e=ic.match(/Chrome\/([\d.]+)/);return e&&e[1]?e[1]:null}(),nu=!Xc&&!xc&&!Cc&&!Mc&&!Lc&&/Safari/i.test(ic),ru=nu&&function(){var e=ic.match(/Version\/([\d.]+)/);return e&&e[1]?e[1]:null}(),iu=Zc?"Chrome/"+tu:nu?"Safari/"+ru:"NotSupportedBrowser",au="file:"===location.protocol||"localhost"===location.hostname||/^\d+\.\d+\.\d+\.\d+$/.test(location.hostname),ou=function(){if(Ks(rc))try{rc=window.localStorage}catch(e){su.warn(e),rc=!1}return rc},su=function(){var e=function(){},t=["trace","debug","info","warn","error"];function r(e,t){var n=e[t];if(qs(n.bind))return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(r){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function i(t){return"debug"===t&&(t="log"),"undefined"!==("undefined"==typeof console?"undefined":n(console))&&(void 0!==console[t]?r(console,t):void 0!==console.log?r(console,"log"):e)}function a(e,n){for(var r=0;r<t.length;r++){var i=t[r];this[i]=this.methodFactory(i,e,n)}this.log=this.debug}function o(e,t,r){return function(){"undefined"!==("undefined"==typeof console?"undefined":n(console))&&(a.call(this,t,r),this[e].apply(this,arguments))}}function s(e,t,n){return i(e)||o.apply(this,arguments)}function c(e,r,i){var o,c=this,u="loglevel";function d(){var e;if("undefined"!==("undefined"==typeof window?"undefined":n(window))){try{ou()&&(e=window.localStorage[u])}catch(t){}return void 0===c.levels[e]&&(e=void 0),e}}e&&(u+=":"+e),c.name=e,c.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},c.methodFactory=i||s,c.getLevel=function(){return o},c.setLevel=function(r,i){if(Qs(r)&&void 0!==c.levels[r.toUpperCase()]&&(r=c.levels[r.toUpperCase()]),!(Ys(r)&&r>=0&&r<=c.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(o=r,!1!==i&&function(e){var r=(t[e]||"silent").toUpperCase();if("undefined"!==("undefined"==typeof window?"undefined":n(window)))try{ou()&&(window.localStorage[u]=r)}catch(i){}}(r),a.call(c,r,e),"undefined"===("undefined"==typeof console?"undefined":n(console))&&r<c.levels.SILENT)return"No console available for logging"},c.setDefaultLevel=function(e){d()||c.setLevel(e,!1)},c.enableAll=function(e){c.setLevel(c.levels.TRACE,e)},c.disableAll=function(e){c.setLevel(c.levels.SILENT,e)};var l=d();null==l&&(l=null==r?"WARN":r),c.setLevel(l,!1)}var u=new c,d={};u.getLogger=function(e){if(!Qs(e)||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=d[e];return t||(t=d[e]=new c(e,u.getLevel(),u.methodFactory)),t};var l="undefined"!==("undefined"==typeof window?"undefined":n(window))?window.log:void 0;return u.noConflict=function(){return"undefined"!==("undefined"==typeof window?"undefined":n(window))&&window.log===u&&(window.log=l),u},u.getLoggers=function(){return d},u}(),cu=ye.f,uu=x((function(){cu(1)}));mt({target:"Object",stat:!0,forced:!A||uu,sham:!A},{getOwnPropertyDescriptor:function(e,t){return cu(j(e),t)}});var du=Et("slice"),lu=le("species"),hu=[].slice,pu=Math.max;mt({target:"Array",proto:!0,forced:!du},{slice:function(e,t){var n,r,i,a=j(this),o=qe(a.length),s=Ye(e,o),c=Ye(void 0===t?o:t,o);if(gt(a)&&("function"!=typeof(n=a.constructor)||n!==Array&&!gt(n.prototype)?B(n)&&null===(n=n[lu])&&(n=void 0):n=void 0,n===Array||void 0===n))return hu.call(a,s,c);for(r=new(void 0===n?Array:n)(pu(c-s,0)),i=0;s<c;s++,i++)s in a&&Fi(r,i,a[s]);return r.length=i,r}});var fu=[].join,mu=V!=Object,_u=di("join",",");mt({target:"Array",proto:!0,forced:mu||!_u},{join:function(e){return fu.call(j(this),void 0===e?",":e)}}),mt({target:"Array",stat:!0},{isArray:gt});var vu=Et("splice"),gu=Math.max,Su=Math.min;mt({target:"Array",proto:!0,forced:!vu},{splice:function(e,t){var n,r,i,a,o,s,c=ne(this),u=qe(c.length),d=Ye(e,u),l=arguments.length;if(0===l?n=r=0:1===l?(n=0,r=u-d):(n=l-2,r=Su(gu(Ge(t),0),u-d)),u+n-r>9007199254740991)throw TypeError("Maximum allowed length exceeded");for(i=yt(c,r),a=0;a<r;a++)(o=d+a)in c&&Fi(i,a,c[o]);if(i.length=r,n<r){for(a=d;a<u-r;a++)s=a+n,(o=a+r)in c?c[s]=c[o]:delete c[s];for(a=u;a>u-r+n;a--)delete c[a-1]}else if(n>r)for(a=u-r;a>d;a--)s=a+n-1,(o=a+r-1)in c?c[s]=c[o]:delete c[s];for(a=0;a<n;a++)c[a+d]=arguments[a+2];return c.length=u-r+n,i}});var yu=function(e){var t=At(F(this)),n="",r=Ge(e);if(r<0||Infinity==r)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},bu=Math.ceil,ku=function(e){return function(t,n,r){var i,a,o=At(F(t)),s=o.length,c=void 0===r?" ":At(r),u=qe(n);return u<=s||""==c?o:((a=yu.call(c,bu((i=u-s)/c.length))).length>i&&(a=a.slice(0,i)),e?o+a:a+o)}},Tu={start:ku(!1),end:ku(!0)}.start,Ru=Math.abs,Eu=Date.prototype,wu=Eu.getTime,Iu=Eu.toISOString,Cu=x((function(){return"0385-07-25T07:06:39.999Z"!=Iu.call(new Date(-50000000000001))}))||!x((function(){Iu.call(new Date(NaN))}))?function(){if(!isFinite(wu.call(this)))throw RangeError("Invalid time value");var e=this.getUTCFullYear(),t=this.getUTCMilliseconds(),n=e<0?"-":e>9999?"+":"";return n+Tu(Ru(e),n?6:4,0)+"-"+Tu(this.getUTCMonth()+1,2,0)+"-"+Tu(this.getUTCDate(),2,0)+"T"+Tu(this.getUTCHours(),2,0)+":"+Tu(this.getUTCMinutes(),2,0)+":"+Tu(this.getUTCSeconds(),2,0)+"."+Tu(t,3,0)+"Z"}:Iu;mt({target:"Date",proto:!0,forced:Date.prototype.toISOString!==Cu},{toISOString:Cu});var xu=Tt.some,Au=di("some");mt({target:"Array",proto:!0,forced:!Au},{some:function(e){return xu(this,e,arguments.length>1?arguments[1]:void 0)}});var Pu=le("unscopables"),Du=Array.prototype;null==Du[Pu]&&Te.f(Du,Pu,{configurable:!0,value:mr(null)});var Mu,Ou,Lu,Nu=function(e){Du[Pu][e]=!0},Uu={},Vu=le("iterator"),Fu=!1;[].keys&&("next"in(Lu=[].keys())?(Ou=Oi(Oi(Lu)))!==Object.prototype&&(Mu=Ou):Fu=!0),(null==Mu||x((function(){var e={};return Mu[Vu].call(e)!==e})))&&(Mu={}),ie(Mu,Vu)||Re(Mu,Vu,(function(){return this}));var ju={IteratorPrototype:Mu,BUGGY_SAFARI_ITERATORS:Fu},Bu=Te.f,Hu=le("toStringTag"),Ju=function(e,t,n){e&&!ie(e=n?e:e.prototype,Hu)&&Bu(e,Hu,{configurable:!0,value:t})},zu=ju.IteratorPrototype,Gu=function(){return this},Wu=ju.IteratorPrototype,qu=ju.BUGGY_SAFARI_ITERATORS,Ku=le("iterator"),Qu=function(){return this},Yu=function(e,t,n,r,i,a,o){!function(e,t,n){var r=t+" Iterator";e.prototype=mr(zu,{next:O(1,n)}),Ju(e,r,!1),Uu[r]=Gu}(n,t,r);var s,c,u,d=function(e){if(e===i&&m)return m;if(!qu&&e in p)return p[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Ku]||p["@@iterator"]||i&&p[i],m=!qu&&f||d(i),_="Array"==t&&p.entries||f;if(_&&(s=Oi(_.call(new e)),Wu!==Object.prototype&&s.next&&(Oi(s)!==Wu&&(Vr?Vr(s,Wu):"function"!=typeof s[Ku]&&Re(s,Ku,Qu)),Ju(s,l,!0))),"values"==i&&f&&"values"!==f.name&&(h=!0,m=function(){return f.call(this)}),p[Ku]!==m&&Re(p,Ku,m),Uu[t]=m,i)if(c={values:d("values"),keys:a?m:d("keys"),entries:d("entries")},o)for(u in c)(qu||h||!(u in p))&&He(p,u,c[u]);else mt({target:t,proto:!0,forced:qu||h},c);return c},$u=Be.set,Xu=Be.getterFor("Array Iterator"),Zu=Yu(Array,"Array",(function(e,t){$u(this,{type:"Array Iterator",target:j(e),index:0,kind:t})}),(function(){var e=Xu(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");Uu.Arguments=Uu.Array,Nu("keys"),Nu("values"),Nu("entries");var ed=rt.f,td={}.toString,nd="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],rd={f:function(e){return nd&&"[object Window]"==td.call(e)?function(e){try{return ed(e)}catch(t){return nd.slice()}}(e):ed(j(e))}},id=!x((function(){return Object.isExtensible(Object.preventExtensions({}))})),ad=R((function(e){var t=Te.f,n=!1,r=se("meta"),i=0,a=Object.isExtensible||function(){return!0},o=function(e){t(e,r,{value:{objectID:"O"+i++,weakData:{}}})},s=e.exports={enable:function(){s.enable=function(){},n=!0;var e=rt.f,t=[].splice,i={};i[r]=1,e(i).length&&(rt.f=function(n){for(var i=e(n),a=0,o=i.length;a<o;a++)if(i[a]===r){t.call(i,a,1);break}return i},mt({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:rd.f}))},fastKey:function(e,t){if(!B(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!ie(e,r)){if(!a(e))return"F";if(!t)return"E";o(e)}return e[r].objectID},getWeakData:function(e,t){if(!ie(e,r)){if(!a(e))return!0;if(!t)return!1;o(e)}return e[r].weakData},onFreeze:function(e){return id&&n&&a(e)&&!ie(e,r)&&o(e),e}};Oe[r]=!0})),od=(ad.enable,ad.fastKey,ad.getWeakData,ad.onFreeze,le("iterator")),sd=Array.prototype,cd=le("iterator"),ud=function(e){var t=e.return;if(void 0!==t)return be(t.call(e)).value},dd=function(e,t){this.stopped=e,this.result=t},ld=function(e,t,n){var r,i,a,o,s,c,u,d,l=n&&n.that,h=!(!n||!n.AS_ENTRIES),p=!(!n||!n.IS_ITERATOR),f=!(!n||!n.INTERRUPTED),m=vt(t,l,1+h+f),_=function(e){return r&&ud(r),new dd(!0,e)},v=function(e){return h?(be(e),f?m(e[0],e[1],_):m(e[0],e[1])):f?m(e,_):m(e)};if(p)r=e;else{if("function"!=typeof(i=function(e){if(null!=e)return e[cd]||e["@@iterator"]||Uu[xi(e)]}(e)))throw TypeError("Target is not iterable");if(void 0!==(d=i)&&(Uu.Array===d||sd[od]===d)){for(a=0,o=qe(e.length);o>a;a++)if((s=v(e[a]))&&s instanceof dd)return s;return new dd(!1)}r=i.call(e)}for(c=r.next;!(u=c.call(r)).done;){try{s=v(u.value)}catch(g){throw ud(r),g}if("object"==typeof s&&s&&s instanceof dd)return s}return new dd(!1)},hd=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},pd=le("iterator"),fd=!1;try{var md=0,_d={next:function(){return{done:!!md++}},return:function(){fd=!0}};_d[pd]=function(){return this},Array.from(_d,(function(){throw 2}))}catch(O_){}var vd=function(e,t){if(!t&&!fd)return!1;var n=!1;try{var r={};r[pd]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(O_){}return n},gd=function(e,t,n){for(var r in t)He(e,r,t[r],n);return e},Sd=Te.f,yd=ad.fastKey,bd=Be.set,kd=Be.getterFor,Td=(function(e,t,n){var r=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),a=r?"set":"add",o=C[e],s=o&&o.prototype,c=o,u={},d=function(e){var t=s[e];He(s,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!B(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return i&&!B(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!B(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(pt(e,"function"!=typeof o||!(i||s.forEach&&!x((function(){(new o).entries().next()})))))c=n.getConstructor(t,e,r,a),ad.enable();else if(pt(e,!0)){var l=new c,h=l[a](i?{}:-0,1)!=l,p=x((function(){l.has(1)})),f=vd((function(e){new o(e)})),m=!i&&x((function(){for(var e=new o,t=5;t--;)e[a](t,t);return!e.has(-0)}));f||((c=t((function(t,n){hd(t,c,e);var i=Fr(new o,t,c);return null!=n&&ld(n,i[a],{that:i,AS_ENTRIES:r}),i}))).prototype=s,s.constructor=c),(p||m)&&(d("delete"),d("has"),r&&d("get")),(m||h)&&d(a),i&&s.clear&&delete s.clear}u[e]=c,mt({global:!0,forced:c!=o},u),Ju(c,e),i||n.setStrong(c,e,r)}("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(e,t,n,r){var i=e((function(e,a){hd(e,i,t),bd(e,{type:t,index:mr(null),first:void 0,last:void 0,size:0}),A||(e.size=0),null!=a&&ld(a,e[r],{that:e,AS_ENTRIES:n})})),a=kd(t),o=function(e,t,n){var r,i,o=a(e),c=s(e,t);return c?c.value=n:(o.last=c={index:i=yd(t,!0),key:t,value:n,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=c),r&&(r.next=c),A?o.size++:e.size++,"F"!==i&&(o.index[i]=c)),e},s=function(e,t){var n,r=a(e),i=yd(t);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==t)return n};return gd(i.prototype,{clear:function(){for(var e=a(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,A?e.size=0:this.size=0},delete:function(e){var t=a(this),n=s(this,e);if(n){var r=n.next,i=n.previous;delete t.index[n.index],n.removed=!0,i&&(i.next=r),r&&(r.previous=i),t.first==n&&(t.first=r),t.last==n&&(t.last=i),A?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=a(this),r=vt(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!s(this,e)}}),gd(i.prototype,n?{get:function(e){var t=s(this,e);return t&&t.value},set:function(e,t){return o(this,0===e?0:e,t)}}:{add:function(e){return o(this,e=0===e?0:e,e)}}),A&&Sd(i.prototype,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,n){var r=t+" Iterator",i=kd(t),a=kd(r);Yu(e,t,(function(e,t){bd(this,{type:r,target:e,state:i(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)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),Jr(t)}}),Mr.charAt),Rd=Be.set,Ed=Be.getterFor("String Iterator");Yu(String,"String",(function(e){Rd(this,{type:"String Iterator",string:At(e),index:0})}),(function(){var e,t=Ed(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=Td(n,r),t.index+=e.length,{value:e,done:!1})}));var wd={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},Id=le("iterator"),Cd=le("toStringTag"),xd=Zu.values;for(var Ad in wd){var Pd=C[Ad],Dd=Pd&&Pd.prototype;if(Dd){if(Dd[Id]!==xd)try{Re(Dd,Id,xd)}catch(O_){Dd[Id]=xd}if(Dd[Cd]||Re(Dd,Cd,Ad),wd[Ad])for(var Md in Zu)if(Dd[Md]!==Zu[Md])try{Re(Dd,Md,Zu[Md])}catch(O_){Dd[Md]=Zu[Md]}}}var Od=[].slice,Ld=/MSIE .\./.test(z),Nd=function(e){return function(t,n){var r=arguments.length>2,i=r?Od.call(arguments,2):void 0;return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,i)}:t,n)}};mt({global:!0,bind:!0,forced:Ld},{setTimeout:Nd(C.setTimeout),setInterval:Nd(C.setInterval)});var Ud,Vd=function(){return"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)}))},Fd=new(function(){function e(){a(this,e),this.intervalMap_=new Map}return s(e,[{key:"setInterval",value:function(e,t){var n=this,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=Vd(),a=ec(),o=a;this.intervalMap_.set(i,{rafId:null,timeoutId:null,onVisibilityChange:null});var s=function s(){if(r&&document.hidden){e();var c=setTimeout(s,t);n.setTimeoutId(i,c),a=ec(),o=a}else{(o=ec())-a>=t&&(a=o,e());var u=requestAnimationFrame(s);n.setRafId(i,u)}},c=requestAnimationFrame(s);if(this.setRafId(i,c),r){var u=function(){if(document.hidden){var e=ec()-a;if(e>=t)s();else{var r=setTimeout(s,t-e);n.setTimeoutId(i,r)}}};document.addEventListener("visibilitychange",u),this.setOnVisibilityChange(i,u)}return i}},{key:"clearInterval",value:function(e){if(this.intervalMap_.has(e)){var t=this.intervalMap_.get(e),n=t.rafId,r=t.timeoutId,i=t.onVisibilityChange;cancelAnimationFrame(n),clearTimeout(r),document.removeEventListener("visibilitychange",i),this.intervalMap_.delete(e)}}},{key:"setTimeoutId",value:function(e,t){if(this.intervalMap_.has(e)){var n=this.intervalMap_.get(e);n.timeoutId&&clearTimeout(n.timeoutId),n.timeoutId=t}}},{key:"setRafId",value:function(e,t){if(this.intervalMap_.has(e)){var n=this.intervalMap_.get(e);n.rafId&&cancelAnimationFrame(n.rafId),n.rafId=t}}},{key:"setOnVisibilityChange",value:function(e,t){this.intervalMap_.has(e)&&(this.intervalMap_.get(e).onVisibilityChange=t)}}]),e}());function jd(e){try{return JSON.stringify(e)}catch(O_){if(!Ud)try{var t={};t.a=t,JSON.stringify(t)}catch(n){Ud=n.message}if(O_.message===Ud)return"[Circular]";throw O_}}function Bd(e){var t="",n=0;return e.length>1&&Qs(e[0])&&(t=(t=e[0].replace(/(%?)(%([sdjo]))/g,(function(t,r,i,a){if(!r){var o=e[n+=1],s="";switch(a){case"s":s+=o;break;case"d":s+=+o;break;case"j":s=jd(o);break;case"o":var c=jd(o);"{"!==c[0]&&"["!==c[0]&&(c="<".concat(c,">")),s=function(e){if(!Object.getOwnPropertyDescriptor||!Object.getPrototypeOf)return Object.prototype.toString.call(e).slice(8,-1);for(;e;){var t=Object.getOwnPropertyDescriptor(e,"constructor");if(void 0!==t&&qs(t.value)&&""!==t.value.name)return t.value.name;e=Object.getPrototypeOf(e)}return""}(o)+c}return s}return t}))).replace(/%{2,2}/g,"%"),n+=1),e.length>n&&(t&&(t+=" "),t+=e.slice(n).join(" ")),t}var Hd=Object.prototype.hasOwnProperty;function Jd(){try{throw new Error}catch(e){return e.stack}}function zd(e){var t=this,n=[],r=[];this.length=function(){return n.length},this.sent=function(){return r.length},this.push=function(t){n.push(t),n.length>e&&n.shift()},this.send=function(){return r.length||(r=n,n=[]),r},this.confirm=function(){r=[],t.content=""},this.fail=function(){n=r.concat(n),t.confirm();var i=1+n.length+r.length-e;i>0&&(r.splice(0,i),n=r.concat(n),t.confirm())}}var Gd,Wd,qd,Kd=!!Jd();function Qd(e){return"[".concat(e.timestamp,"] <").concat(e.level.label.toUpperCase(),">").concat(e.logger?" (".concat(e.logger,")"):"",": ").concat(e.message).concat(e.stacktrace?"\n".concat(e.stacktrace):"")}var Yd={interval:1e3,level:"trace",capacity:0,stacktrace:{levels:["trace","warn","error"],depth:3,excess:0},timestamp:function(){return(new Date).toISOString()},format:Qd},$d=-1,Xd=!1,Zd="",el="",tl="",nl=function(e){Xd||(Zd="".concat(e.sdkAppId),el="".concat(e.userId),tl="".concat(e.version),Xd=!0)},rl=function(e,t){if(!e||!e.getLogger)throw new TypeError("Argument is not a root loglevel object");if(Gd)throw new Error("You can assign a plugin only one time");Gd=e;var r=function e(){for(var t={},r=0;r<arguments.length;r+=1){var i=Object(arguments[r]);for(var a in i)Hd.call(i,a)&&(t[a]="object"!==n(i[a])||Array.isArray(i[a])?i[a]:e(t[a],i[a]))}return t}(Yd,t);r.capacity=r.capacity||500;var i,a=r.interval;$d=Fd.setInterval((function(){if(!Xd)return;if(!o.sent()){if(!o.length())return;var e=o.send();o.content=i?'{"logs":['.concat(e.join(","),"]}"):e.join("\n"),function(e){if(!Xd)return;var t=JSON.stringify({timestamp:Ps(),sdkAppId:Zd,userId:el,version:tl,log:e});Cs.post(Hs(),t).then((function(){o.confirm()})).catch((function(){o.fail()}))}(o.content)}}),a);var o=new zd(r.capacity);return Wd=e.methodFactory,qd=function(e,t,n){var a=Wd(e,t,n),s=Kd&&r.stacktrace.levels.some((function(t){return t===e})),c=Gd.levels[e.toUpperCase()];return function(){for(var u=arguments.length,d=new Array(u),l=0;l<u;l++)d[l]=arguments[l];var h=Bd(d),p=c>=t;if(p){var f=new Date;f.setTime(As());var m=f.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")+":".concat(f.getMilliseconds()),_="["+m+"] <"+e.toUpperCase()+"> "+h;a.apply(void 0,[_])}var v=Ps(),g=s?Jd():"";if(g){var S=g.split("\n");S.splice(0,r.stacktrace.excess+3);var y=r.stacktrace.depth;if(y&&S.length!==y+1){var b=S.splice(0,y);g=b.join("\n"),S.length&&(g+="\n and ".concat(S.length," more"))}else g=S.join("\n")}var k=r.format({message:h,level:{label:e,value:c},logger:n||"",timestamp:v,stacktrace:g});void 0===i&&(i=!Qs(k));var T="";if(i)try{T+=JSON.stringify(k)}catch(O_){return a.apply(void 0,d),void Gd.getLogger("logger").error(O_)}else T+=k;o.push(T)}},e.methodFactory=qd,e.setLevel(e.getLevel()),e},il=function(){if(!Gd)throw new Error("You can't disable a not appled plugin");if(qd!==Gd.methodFactory)throw new Error("You can't disable a plugin after appling another plugin");Gd.methodFactory=Wd,Gd.setLevel(Gd.getLevel()),Gd=void 0,Fd.clearInterval($d)},al=!1;su.setConfig=function(e){nl(e)},su.setLogLevel=function(e){su.setLevel(e)},su.getLogLevel=function(e){return su.getLevel(e)},su.enableUploadLog=function(){al||(rl(su),al=!0)},su.disableUploadLog=function(){al&&(su.warn("disable upload log! Without log we are difficult to help you triage the issue you might run into!"),il(),al=!1)},su.enableUploadLog(),su.setLevel("INFO");var ol=!0,sl=Math.floor;mt({target:"Number",stat:!0},{isInteger:function(e){return!B(e)&&isFinite(e)&&sl(e)===e}});var cl=Tt.forEach,ul=di("forEach")?[].forEach:function(e){return cl(this,e,arguments.length>1?arguments[1]:void 0)};mt({target:"Array",proto:!0,forced:[].forEach!=ul},{forEach:ul});var dl,ll=function(e){if(Br(e))throw TypeError("The method doesn't accept regular expressions");return e},hl=le("match"),pl=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[hl]=!1,"/./"[e](t)}catch(r){}}return!1},fl=ye.f,ml="".startsWith,_l=Math.min,vl=pl("startsWith"),gl=!(vl||(dl=fl(String.prototype,"startsWith"),!dl||dl.writable));for(var Sl in mt({target:"String",proto:!0,forced:!gl&&!vl},{startsWith:function(e){var t=At(F(this));ll(e);var n=qe(_l(arguments.length>1?arguments[1]:void 0,t.length)),r=At(e);return ml?ml.call(t,r,n):t.slice(n,n+r.length)===r}}),wd){var yl=C[Sl],bl=yl&&yl.prototype;if(bl&&bl.forEach!==ul)try{Re(bl,"forEach",ul)}catch(O_){bl.forEach=ul}}var kl,Tl,Rl,El,wl=C.Promise,Il=/(?:iphone|ipod|ipad).*applewebkit/i.test(z),Cl="process"==N(C.process),xl=C.setImmediate,Al=C.clearImmediate,Pl=C.process,Dl=C.MessageChannel,Ml=C.Dispatch,Ol=0,Ll={};try{kl=C.location}catch(O_){}var Nl=function(e){if(Ll.hasOwnProperty(e)){var t=Ll[e];delete Ll[e],t()}},Ul=function(e){return function(){Nl(e)}},Vl=function(e){Nl(e.data)},Fl=function(e){C.postMessage(String(e),kl.protocol+"//"+kl.host)};xl&&Al||(xl=function(e){for(var t=[],n=arguments.length,r=1;n>r;)t.push(arguments[r++]);return Ll[++Ol]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},Tl(Ol),Ol},Al=function(e){delete Ll[e]},Cl?Tl=function(e){Pl.nextTick(Ul(e))}:Ml&&Ml.now?Tl=function(e){Ml.now(Ul(e))}:Dl&&!Il?(El=(Rl=new Dl).port2,Rl.port1.onmessage=Vl,Tl=vt(El.postMessage,El,1)):C.addEventListener&&"function"==typeof postMessage&&!C.importScripts&&kl&&"file:"!==kl.protocol&&!x(Fl)?(Tl=Fl,C.addEventListener("message",Vl,!1)):Tl="onreadystatechange"in ve("script")?function(e){ur.appendChild(ve("script")).onreadystatechange=function(){ur.removeChild(this),Nl(e)}}:function(e){setTimeout(Ul(e),0)});var jl,Bl,Hl,Jl,zl,Gl,Wl,ql,Kl={set:xl,clear:Al},Ql=/web0s(?!.*chrome)/i.test(z),Yl=ye.f,$l=Kl.set,Xl=C.MutationObserver||C.WebKitMutationObserver,Zl=C.document,eh=C.process,th=C.Promise,nh=Yl(C,"queueMicrotask"),rh=nh&&nh.value;rh||(jl=function(){var e,t;for(Cl&&(e=eh.domain)&&e.exit();Bl;){t=Bl.fn,Bl=Bl.next;try{t()}catch(O_){throw Bl?Jl():Hl=void 0,O_}}Hl=void 0,e&&e.enter()},Il||Cl||Ql||!Xl||!Zl?th&&th.resolve?((Wl=th.resolve(void 0)).constructor=th,ql=Wl.then,Jl=function(){ql.call(Wl,jl)}):Jl=Cl?function(){eh.nextTick(jl)}:function(){$l.call(C,jl)}:(zl=!0,Gl=Zl.createTextNode(""),new Xl(jl).observe(Gl,{characterData:!0}),Jl=function(){Gl.data=zl=!zl}));var ih,ah,oh,sh,ch=rh||function(e){var t={fn:e,next:void 0};Hl&&(Hl.next=t),Bl||(Bl=t,Jl()),Hl=t},uh=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=_t(t),this.reject=_t(n)},dh={f:function(e){return new uh(e)}},lh=function(e){try{return{error:!1,value:e()}}catch(O_){return{error:!0,value:O_}}},hh="object"==typeof window,ph=Kl.set,fh=le("species"),mh="Promise",_h=Be.get,vh=Be.set,gh=Be.getterFor(mh),Sh=wl&&wl.prototype,yh=wl,bh=Sh,kh=C.TypeError,Th=C.document,Rh=C.process,Eh=dh.f,wh=Eh,Ih=!!(Th&&Th.createEvent&&C.dispatchEvent),Ch="function"==typeof PromiseRejectionEvent,xh=!1,Ah=pt(mh,(function(){var e=xe(yh),t=e!==String(yh);if(!t&&66===Q)return!0;if(Q>=51&&/native code/.test(e))return!1;var n=new yh((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(n.constructor={})[fh]=r,!(xh=n.then((function(){}))instanceof r)||!t&&hh&&!Ch})),Ph=Ah||!vd((function(e){yh.all(e).catch((function(){}))})),Dh=function(e){var t;return!(!B(e)||"function"!=typeof(t=e.then))&&t},Mh=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;ch((function(){for(var r=e.value,i=1==e.state,a=0;n.length>a;){var o,s,c,u=n[a++],d=i?u.ok:u.fail,l=u.resolve,h=u.reject,p=u.domain;try{d?(i||(2===e.rejection&&Uh(e),e.rejection=1),!0===d?o=r:(p&&p.enter(),o=d(r),p&&(p.exit(),c=!0)),o===u.promise?h(kh("Promise-chain cycle")):(s=Dh(o))?s.call(o,l,h):l(o)):h(r)}catch(O_){p&&!c&&p.exit(),h(O_)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&Lh(e)}))}},Oh=function(e,t,n){var r,i;Ih?((r=Th.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),C.dispatchEvent(r)):r={promise:t,reason:n},!Ch&&(i=C["on"+e])?i(r):"unhandledrejection"===e&&function(e,t){var n=C.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},Lh=function(e){ph.call(C,(function(){var t,n=e.facade,r=e.value;if(Nh(e)&&(t=lh((function(){Cl?Rh.emit("unhandledRejection",r,n):Oh("unhandledrejection",n,r)})),e.rejection=Cl||Nh(e)?2:1,t.error))throw t.value}))},Nh=function(e){return 1!==e.rejection&&!e.parent},Uh=function(e){ph.call(C,(function(){var t=e.facade;Cl?Rh.emit("rejectionHandled",t):Oh("rejectionhandled",t,e.value)}))},Vh=function(e,t,n){return function(r){e(t,r,n)}},Fh=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Mh(e,!0))},jh=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw kh("Promise can't be resolved itself");var r=Dh(t);r?ch((function(){var n={done:!1};try{r.call(t,Vh(jh,n,e),Vh(Fh,n,e))}catch(O_){Fh(n,O_,e)}})):(e.value=t,e.state=1,Mh(e,!1))}catch(O_){Fh({done:!1},O_,e)}}};if(Ah&&(bh=(yh=function(e){hd(this,yh,mh),_t(e),ih.call(this);var t=_h(this);try{e(Vh(jh,t),Vh(Fh,t))}catch(O_){Fh(t,O_)}}).prototype,(ih=function(e){vh(this,{type:mh,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=gd(bh,{then:function(e,t){var n=gh(this),r=Eh(Gi(this,yh));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=Cl?Rh.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Mh(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),ah=function(){var e=new ih,t=_h(e);this.promise=e,this.resolve=Vh(jh,t),this.reject=Vh(Fh,t)},dh.f=Eh=function(e){return e===yh||e===oh?new ah(e):wh(e)},"function"==typeof wl&&Sh!==Object.prototype)){sh=Sh.then,xh||(He(Sh,"then",(function(e,t){var n=this;return new yh((function(e,t){sh.call(n,e,t)})).then(e,t)}),{unsafe:!0}),He(Sh,"catch",bh.catch,{unsafe:!0}));try{delete Sh.constructor}catch(O_){}Vr&&Vr(Sh,bh)}mt({global:!0,wrap:!0,forced:Ah},{Promise:yh}),Ju(yh,mh,!1),Jr(mh),oh=J(mh),mt({target:mh,stat:!0,forced:Ah},{reject:function(e){var t=Eh(this);return t.reject.call(void 0,e),t.promise}}),mt({target:mh,stat:!0,forced:Ah},{resolve:function(e){return function(e,t){if(be(e),B(t)&&t.constructor===e)return t;var n=dh.f(e);return(0,n.resolve)(t),n.promise}(this,e)}}),mt({target:mh,stat:!0,forced:Ph},{all:function(e){var t=this,n=Eh(t),r=n.resolve,i=n.reject,a=lh((function(){var n=_t(t.resolve),a=[],o=0,s=1;ld(e,(function(e){var c=o++,u=!1;a.push(void 0),s++,n.call(t,e).then((function(e){u||(u=!0,a[c]=e,--s||r(a))}),i)})),--s||r(a)}));return a.error&&i(a.value),n.promise},race:function(e){var t=this,n=Eh(t),r=n.reject,i=lh((function(){var i=_t(t.resolve);ld(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}}),mt({target:"Date",stat:!0},{now:function(){return(new Date).getTime()}});var Bh=Nt.trim,Hh=C.parseInt,Jh=/^[+-]?0[Xx]/,zh=8!==Hh(Pt+"08")||22!==Hh(Pt+"0x16")?function(e,t){var n=Bh(At(e));return Hh(n,t>>>0||(Jh.test(n)?16:10))}:Hh;mt({global:!0,forced:parseInt!=zh},{parseInt:zh});var Gh=Tt.findIndex,Wh=!0;"findIndex"in[]&&Array(1).findIndex((function(){Wh=!1})),mt({target:"Array",proto:!0,forced:Wh},{findIndex:function(e){return Gh(this,e,arguments.length>1?arguments[1]:void 0)}}),Nu("findIndex");var qh=x((function(){sr(1)}));mt({target:"Object",stat:!0,forced:qh},{keys:function(e){return sr(ne(e))}});var Kh=M.f,Qh=function(e){return function(t){for(var n,r=j(t),i=sr(r),a=i.length,o=0,s=[];a>o;)n=i[o++],A&&!Kh.call(r,n)||s.push(e?[n,r[n]]:r[n]);return s}},Yh={entries:Qh(!0),values:Qh(!1)}.values;mt({target:"Object",stat:!0},{values:function(e){return Yh(e)}});var $h=Xe.includes;mt({target:"Array",proto:!0},{includes:function(e){return $h(this,e,arguments.length>1?arguments[1]:void 0)}}),Nu("includes"),mt({target:"String",proto:!0,forced:!pl("includes")},{includes:function(e){return!!~At(F(this)).indexOf(At(ll(e)),arguments.length>1?arguments[1]:void 0)}});var Xh=R((function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,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 r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,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,r),!0;case 4:return d.fn.call(d.context,t,r,i),!0;case 5:return d.fn.call(d.context,t,r,i,a),!0;case 6:return d.fn.call(d.context,t,r,i,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,r);break;case 4:d[u].fn.call(d[u].context,t,r,i);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,r,i){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||i&&!s.once||r&&s.context!==r||o(this,a);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&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 r,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})),Zh="connection-state-changed",ep="connected",tp="error",np="DISCONNECTED",rp="CONNECTING",ip="RECONNECTING",ap="CONNECTED",op={ON_PUBLISH_RESPONSE:2,NEW_ICE_CANDIDATE:4,CLINET_BANNED:8,CHANNEL_SETUP_SUCCESS:19,CHANNEL_SETUP_FAILED:80,REBUILD_SESSION_RESULT:514,JOIN_ROOM_RESULT:20,PEER_JOIN:4134,PEER_LEAVE:4135,STREAM_ADDED:16,STREAM_REMOVED:18,UPDATE_REMOTE_SDP:48,UPDATE_AUDIO_SSRC:50,UPDATE_VIDEO_SSRC:52,UPLINK_NETWORK_STATS:22,UPDATE_REMOTE_MUTE_STAT:23,CLOSE_PEER_ACK:10,SUBSCRIBE_ACK:26,PONG:775,PUBLISH_RESULT:4098,UNPUBLISH_RESULT:4100,SUBSCRIBE_RESULT:4102,UNSUBSCRIBE_RESULT:4104,SUBSCRIBE_CHANGE_RESULT:4106,UPDATE_OFFER_RESULT:4128,REMOTE_STREAM_UPDATE:4130,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},sp=[op.UPDATE_REMOTE_MUTE_STAT,op.UPLINK_NETWORK_STATS,op.PONG,op.REMOTE_STREAM_UPDATE,op.USER_LIST_RES],cp={ON_PUBLISH_RESPONSE:"on-publish-response",NEW_ICE_CANDIDATE:"new-ice-candidate",CLINET_BANNED:"client-banned",CHANNEL_SETUP_SUCCESS:"channel-setup-success",CHANNEL_SETUP_FAILED:"channel-setup-failed",REBUILD_SESSION_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",UPDATE_REMOTE_SDP:"update-remote-sdp",UPDATE_AUDIO_SSRC:"update-audio-ssrc",UPDATE_VIDEO_SSRC:"update-video-ssrc",UPLINK_NETWORK_STATS:"uplink-network-stats",UPDATE_REMOTE_MUTE_STAT:"update-remote-mute-stat",CLOSE_PEER_ACK:"close-peer-ack",SUBSCRIBE_ACK:"subscribe-ack",REQUEST_REBUILD_SESSION:"request-rebuild-session",CLIENT_REJOIN:"client-rejoin",PONG:"pong",PUBLISH_RESULT:"publish-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",REMOTE_STREAM_UPDATE:"remote-stream-update",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"},up="on_update_track",dp="on_create_room",lp="on_quit_room",hp="on_quality_report",pp="on_rebuild_session",fp="on_mute_uplink",mp="on_constraints_config",_p="ping",vp="on_publish",gp="on_unpublish",Sp="on_sub",yp="on_unsub",bp="on_sub_change",kp="on_start_publishing",Tp="on_stop_publishing",Rp="on_start_push_user_cdn",Ep="on_stop_push_user_cdn",wp="on_start_mcu_mix",Ip="on_stop_mcu_mix",Cp="on_get_user_list",xp="on_switch_role",Ap="on_change_video_type",Pp=32768,Dp=32769,Mp=32770,Op=32771,Lp=32772,Np=32773,Up=32774,Vp=32775,Fp=32777,jp=32778,Bp=32779,Hp=32780,Jp=32781,zp=32782,Gp=32783,Wp=32784,qp=32785,Kp=32786,Qp=32787,Yp=32788,$p=32789,Xp=32790,Zp=32791,ef=32792,tf=32793,nf=32794,rf=32795,af=32796,of=32797,sf=32798,cf=32799,uf=32800,df=32801,lf=32802,hf=new Map,pf=function(e,t){var n=hf.get(e);n||(hf.set(e,[]),n=hf.get(e)),n.push(t)},ff=function(e){var t=hf.get(e);return t?hf.delete(e):t=[],t},mf=Object.prototype.hasOwnProperty;function _f(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(Gs(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(mf.call(e,t))return!1;return!0}return!1}var vf=function(){function e(t){a(this,e),this.sdkAppId_=t.sdkAppId,this.userId_=t.userId,this.userSig_=t.userSig,this.url_=t.url,this.backupUrl_=t.backupUrl,this.version_=t.version,this.urlWithParam_="".concat(this.url_,"?sdkAppid=").concat(this.sdkAppId_,"&identifier=").concat(this.userId_,"&userSig=").concat(this.userSig_),this.backupUrlWithParam_="".concat(this.backupUrl_,"?sdkAppid=").concat(this.sdkAppId_,"&identifier=").concat(this.userId_,"&userSig=").concat(this.userSig_),this.isConnected_=!1,this.isConnecting_=!1,this.socketInUse_=null,this.socket_=null,this.backupSocket_=null,this.backupTimer_=-1,this.signalInfo_={},this.currentState_=np,this.reconnectionCount_=0,this.reconnectionTimer_=-1,this.pingPongTimeoutId_=-1,this.pingTimeoutId_=-1,this.emitter_=new Xh}var t;return s(e,[{key:"connect",value:function(){var e=this;su.info("connect to url: ".concat(this.urlWithParam_)),this.emitter_.emit(Zh,{prevState:this.currentState_,state:rp}),this.currentState_=rp,this.socket_=new WebSocket(this.urlWithParam_),this.bindSocket(this.socket_),this.backupTimer_=setTimeout((function(){e.isConnected_||(su.info("trying to connect to backupUrl"),e.tryConnectBackup())}),5e3)}},{key:"tryConnectBackup",value:function(){this.backupSocket_||(this.unbindAndCloseSocket("main"),su.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("main"===e){if(this.socket_){this.unbindSocket(this.socket_);try{this.socket_.close(1e3)}catch(O_){}this.socket_=null}}else if(this.backupSocket_){this.unbindSocket(this.backupSocket_);try{this.backupSocket_.close(1e3)}catch(O_){}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.clearBackupTimer(),e.target===this.socket_?(this.unbindAndCloseSocket("backup"),this.socketInUse_=this.socket_):(this.unbindAndCloseSocket("main"),this.socketInUse_=this.backupSocket_);var t=e.target.url;su.info("[".concat(this.userId_,"] websocket[").concat(t,"] is connected")),this.emitter_.emit(Zh,{prevState:this.currentState_,state:ap}),this.currentState_===rp?this.addSignalEvent(Zp,"signal channel is connected"):this.currentState_===ip&&this.addSignalEvent(rf,"signal channel reconnect success"),this.currentState_=ap,this.emitter_.emit(ep)}}},{key:"onclose",value:function(e){var t=e.target.url,n=e.target===this.socketInUse_;su.info("[".concat(this.userId_,"] websocket[").concat(t," InUse: ").concat(n,"] is closed with code: ").concat(e.code)),e.target===this.socketInUse_&&(this.isConnected_=!1,e.wasClean&&1e3===e.code?(this.emitter_.emit(Zh,{prevState:this.currentState_,state:np}),this.currentState_=np,this.addSignalEvent(Xp,"signal channel is disconnected")):(su.warn("[".concat(this.userId_,"] onclose code:").concat(e.code," reason:").concat(e.reason)),su.warn("close current websocket and schedule a reconnect timeout"),this.socketInUse_.onclose=function(){},this.socketInUse_.close(4011),this.socket_=this.backupSocket_=this.socketInUse_=null,this.reconnect("main")))}},{key:"onerror",value:function(e){var t=e.target.url;su.debug("[".concat(this.userId_,"] websocket[").concat(t,"] error observed")),this.isConnected_?e.target===this.socketInUse_&&(this.isConnected_=!1,this.unbindAndCloseSocket("main"),this.unbindAndCloseSocket("backup"),this.socketInUse_=null,this.reconnect("main")):(this.isReconnecting_||Vs({eventType:Ja,code:go.UNKNOWN}),e.target==this.socket_?(this.unbindAndCloseSocket("main"),this.reconnect("backup")):(this.unbindAndCloseSocket("backup"),this.reconnect("main"))),this.isConnecting_=!1,this.isConnected_=!1}},{key:"onmessage",value:function(e){var t=this;if(this.isConnected_){var n=JSON.parse(e.data),r=n.cmd,i=n.content,a=Object.values(op),o=Object.keys(op)[a.indexOf(r)],s=cp[o];if(!sp.includes(r)){var c=e.target==this.socket_?this.url_:this.backupUrl_;if(su.debug("[".concat(this.userId_,"] websocket[").concat(c,"] received message: ").concat(e.data)),su.info("[".concat(this.userId_,"] Received event: [ ").concat(s||"unknown cmd: "+r," ]")),(s===cp.UPDATE_REMOTE_SDP||s===cp.UPDATE_AUDIO_SSRC||s===cp.UPDATE_VIDEO_SSRC)&&i.offersdp)try{var u=JSON.parse(i.offersdp),d=u.audiossrc,l=u.videossrc,h=u.rtxssrc;su.info("[".concat(this.userId_,"] ssrc info in offersdp: [ audiossrc: ").concat(d," videossrc: ").concat(l," rtxssrc: ").concat(h," ]"))}catch(m){}}switch(r){case op.CHANNEL_SETUP_SUCCESS:this.signalInfo_.relayIp=i.relayip,this.signalInfo_.relayInnerIp=i.innerip,this.signalInfo_.signalIp=i.signalip,this.signalInfo_.localIp=i.localip,this.signalInfo_.dataPort=i.dataport,this.signalInfo_.stunPort=i.stunport,this.signalInfo_.checkSigSeq=i.checkSigSeq,this.signalInfo_.socketId=i.socketid,this.signalInfo_.tinyId=i.tinyid,this.signalInfo_.openId=i.openid,this.signalInfo_.stunPortList=i.stunportList,!i.stunportList||i.stunportList.length<=0?this.signalInfo_.stunServers="stun:"+i.relayip+":"+i.stunport:(this.signalInfo_.stunServers=[],i.stunportList.forEach((function(e){var n="stun:"+i.relayip+":"+e;t.signalInfo_.stunServers.push(n)}))),i.cgiurl&&(this.signalInfo_.logCgiUrl=i.cgiurl),i.svrTime&&function(e){xs=e-(new Date).getTime();var t=new Date;t.setTime(e),su.info("baseTime from server: "+t+" offset: "+xs)}(i.svrTime),su.info("ChannelSetup Success: signalIp:".concat(i.signalip," relayIp:").concat(i.relayip," clientIp:").concat(i.localip," checkSigSeq:").concat(i.checkSigSeq)),su.info("start ping pong"),this.startPingPong(),this.isReconnecting_&&(this.reconnectionCount_=0,this.clearReconnectionTimer(),1===i.rc&&this.emitter_.emit(cp.REQUEST_REBUILD_SESSION,{signalInfo:this.signalInfo_})),this.emitter_.emit(s,{signalInfo:this.signalInfo_});break;case op.REBUILD_SESSION_RESULT:0===i.result?su.info("reconnect - rebuild session succeeded"):(this.emitter_.emit(cp.CLIENT_REJOIN),su.error("reconnect - rebuild session failed: ".concat(JSON.stringify(i))));break;case op.CHANNEL_SETUP_FAILED:if(!this.isReconnecting_){var p="sdkAppId invalid",f="";Ks(i.errorCode)||(p=i.errorCode,f=i.errorMsg);var m=new So({code:go.SIGNAL_CHANNEL_SETUP_FAILED,extraCode:p,message:"SignalChannel setup failure: ('errorCode': ".concat(p,", 'errorMsg': ").concat(f," })")});this.close(),Vs({eventType:Ja,error:m}),this.emitter_.emit(tp,m)}break;default:this.emitter_.emit(s,{data:n})}}}},{key:"addSignalEvent",value:function(e,t){pf(this.userId_,{eventId:e,eventDesc:t,timestamp:As(),userId:this.userId_,tinyId:this.signalInfo_.tinyId})}},{key:"reconnect",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"main";if(this.isConnecting_||-1!==this.reconnectionTimer_)su.info("signal channel is reconnecting, ignoring current reconnection");else{if(this.reconnectionCount_>=30){su.warn("SDK has tried reconnect signal channel for ".concat(30," times, but all failed. please check your network"));var n=new So({code:go.SIGNAL_CHANNEL_RECONNECTION_FAILED,message:"signal channel reconnection failed, please check your network"});return Vs({eventType:za,error:n}),this.addSignalEvent(af,"signal channel reconnect fail"),void this.emitter_.emit(tp,n)}this.isConnecting_=!0,this.reconnectionCount_++,this.currentState_!==ip&&(this.emitter_.emit(Zh,{prevState:this.currentState_,state:ip}),this.currentState_=ip,this.addSignalEvent(nf,"signal channel is reconnecting")),su.warn("reconnecting to ".concat(t," signal channel [").concat(this.reconnectionCount_,"/").concat(30,"]"));var r=this.getReconnectionUrl(t);"main"===t?(this.socket_=new WebSocket(r),this.bindSocket(this.socket_)):(this.backupSocket_=new WebSocket(r),this.bindSocket(this.backupSocket_));var i=Ws(this.reconnectionCount_);this.reconnectionTimer_=setTimeout((function(){su.warn("reconnect ".concat(t," signal channel timeout(").concat(i/1e3,"s), close and try again")),e.isConnecting_=!1,e.clearReconnectionTimer(),e.unbindAndCloseSocket(t),e.reconnect("main"===t?"backup":"main")}),i)}}},{key:"isConnected",value:function(){return this.isConnected_}},{key:"isReconnecting_",get:function(){return-1!==this.reconnectionTimer_}},{key:"getReconnectionUrl",value:function(e){var t="main"===e?this.urlWithParam_:this.backupUrlWithParam_;return _f(this.signalInfo_)||-1!==t.indexOf("&rc=1")||(t+="&iip="+this.signalInfo_.relayInnerIp+"&dp="+this.signalInfo_.dataPort+"&oip="+this.signalInfo_.relayIp+"&sp="+this.signalInfo_.stunPort+"&rc=1"),t}},{key:"send",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(this.isConnected_){var r=this.createSendMessage(e);r.data=t,void 0!==n&&(r.srctinyid=n),this.socketInUse_.send(JSON.stringify(r))}}},{key:"sendWithoutUA",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;if(this.isConnected_){var r=this.createSendMessage(e,!1);r.data=t,void 0!==n&&(r.srctinyid=n),this.socketInUse_.send(JSON.stringify(r))}}},{key:"sendWithReport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;if(this.isConnected_){var r=this.createSendMessage(e);r.data=t,r.report=n,this.socketInUse_.send(JSON.stringify(r))}}},{key:"startPingPong",value:(t=i(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,-1===this.pingPongTimeoutId_){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.ping();case 5:this.pingPongTimeoutId_=setTimeout((function(){t.pingPongTimeoutId_=-1,t.startPingPong()}),1e4),e.next=13;break;case 8:e.prev=8,e.t0=e.catch(0),su.warn("ping-pong failed, start signal reconnection"),this.close(),this.reconnect("main");case 13:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return t.apply(this,arguments)})},{key:"stopPingPong",value:function(){su.info("stop ping pong"),clearTimeout(this.pingTimeoutId_),clearTimeout(this.pingPongTimeoutId_),this.pingTimeoutId_=-1,this.pingPongTimeoutId_=-1}},{key:"ping",value:function(){var e=this;return new Promise((function(t,n){if(-1!==e.pingTimeoutId_)return t();e.sendWithoutUA(_p),e.once(cp.PONG,(function(){clearTimeout(e.pingTimeoutId_),e.pingTimeoutId_=-1,t()})),e.pingTimeoutId_=setTimeout((function(){e.pingTimeoutId_=-1,n()}),1e4)}))}},{key:"createSendMessage",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n={tag_key:e,data:"",openid:this.userId_,tinyid:this.signalInfo_.tinyId,version:this.version_};return t&&(n.ua=navigator.userAgent),n}},{key:"getCurrentState",value:function(){return this.currentState_}},{key:"getSocketId",value:function(){return this.signalInfo_.socketId}},{key:"close",value:function(){su.info("close SignalChannel"),this.clearBackupTimer(),this.clearReconnectionTimer(),this.stopPingPong(),this.isConnecting_=!1,this.isConnected_=!1,this.socketInUse_=null,this.unbindAndCloseSocket("main"),this.unbindAndCloseSocket("backup")}},{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)}}]),e}(),gf="not supported in http protocol, please make sure your page is running on https or file:// protocol, or localhost.\n refer to: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#privacy_and_security",Sf="remoteStream doesn't exist because it has been unpublished by remote peer",yf=Tt.find,bf=!0;"find"in[]&&Array(1).find((function(){bf=!1})),mt({target:"Array",proto:!0,forced:bf},{find:function(e){return yf(this,e,arguments.length>1?arguments[1]:void 0)}}),Nu("find");var kf=R((function(e){var t=e.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%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(t).forEach((function(e){t[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))})),Tf=(kf.v,kf.o,kf.s,kf.i,kf.u,kf.e,kf.p,kf.z,kf.r,kf.t,kf.c,kf.b,kf.m,kf.a,R((function(e,t){var n=function(e){return String(Number(e))===e?Number(e):e},r=function(e,t,r){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var a=e.push?{}:i?t[e.name]:t;!function(e,t,r,i){if(i&&!r)t[i]=n(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(t[r[a]]=n(e[a+1]))}(r.match(e.reg),a,e.names,e.name),e.push&&t[e.push].push(a)},i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},n=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),a=n[n.length-1]);for(var o=0;o<(kf[t]||[]).length;o+=1){var s=kf[t][o];if(s.reg.test(i))return r(s,a,i)}})),t.media=n,t};var a=function(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=n(r[1]):1===r.length&&t.length>1&&(e[r[0]]=void 0),e};t.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(n),i=0;i<r.length;i+=3)t.push({component:r[i],ip:r[i+1],port:r[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,r=!1;return"~"!==e[0]?t=n(e):(t=n(e.substring(1,e.length)),r=!0),{scid:t,paused:r}}))}))}}))),Rf=(Tf.parse,Tf.parseParams,Tf.parseFmtpConfig,Tf.parsePayloads,Tf.parseRemoteCandidates,Tf.parseImageAttributes,Tf.parseSimulcastStreamList,/%[sdv%]/g),Ef=function(e){var t=1,n=arguments,r=n.length;return e.replace(Rf,(function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},wf=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var a=t.names[i];t.name?r.push(n[t.name][a]):r.push(n[t.names[i]])}else r.push(n[t.name]);return Ef.apply(null,r)},If=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Cf=["i","c","b","a"],xf={write: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||If,r=t.innerOrder||Cf,i=[];return n.forEach((function(t){kf[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(wf(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(wf(t,n,e))}))}))})),e.media.forEach((function(e){i.push(wf("m",kf.m[0],e)),r.forEach((function(t){kf[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(wf(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(wf(t,n,e))}))}))}))})),i.join("\r\n")+"\r\n"},parse:Tf.parse,parseParams:Tf.parseParams,parseFmtpConfig:Tf.parseFmtpConfig,parsePayloads:Tf.parsePayloads,parseRemoteCandidates:Tf.parseRemoteCandidates,parseImageAttributes:Tf.parseImageAttributes,parseSimulcastStreamList:Tf.parseSimulcastStreamList},Af=function(e){return xf.parse(e)},Pf=function(e){return xf.write(e)},Df=function(e){var t=Af(e);return t.media.forEach((function(e){"audio"===e.type&&e.fmtp.forEach((function(e){e.config+=";sprop-stereo=1;stereo=1"}))})),Pf(t)},Mf={result:!1,detail:{isBrowserSupported:!1,isWebRTCSupported:!1,isMediaDevicesSupported:!1,isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH264DecodeSupported:!1,isVp8DecodeSupported:!1}},Of=new Map([[hc,["Firefox",pc]],[_c,["Edg",vc]],[Zc,["Chrome",tu]],[nu,["Safari",ru]],[kc,["TBS",Tc]],[Rc,["XWEB",Ec]],[wc&&sc,["WeChat",Ic]],[Pc,["QQ(Win)",Dc]],[xc,["QQ(Mobile)",Ac]],[Cc,["QQ(Mobile X5)",Ac]],[Mc,["QQ(Mac)",Oc]],[Lc,["QQ(iPad)",Nc]],[Bc,["MI",Hc]],[Jc,["HW",Gc]],[Wc,["Samsung",qc]],[Kc,["OPPO",Qc]],[Yc,["VIVO",$c]],[fc,["EDGE",mc]],[gc,["SogouMobile",Sc]],[yc,["Sogou",bc]]]);function Lf(){var e="unknown",t="unknown";return Of.get(!0)&&(e=Of.get(!0)[0],t=Of.get(!0)[1]),{browserName:e,browserVersion:t}}var Nf=function(){return!jc&&!fc&&(!(_c&&vc<80)&&!(hc&&pc<56))},Uf=function(){return["RTCPeerConnection","webkitRTCPeerConnection","RTCIceGatherer"].filter((function(e){return e in window})).length>0},Vf=function(){if(!navigator.mediaDevices)return!1;var e=["getUserMedia","enumerateDevices"];return e.filter((function(e){return e in navigator.mediaDevices})).length===e.length},Ff=function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Mf.detail.isH264EncodeSupported&&!Mf.detail.isVp8EncodeSupported){e.next=2;break}return e.abrupt("return",{isH264EncodeSupported:Mf.detail.isH264EncodeSupported,isVp8EncodeSupported:Mf.detail.isVp8EncodeSupported});case 2:return t="",n=!1,r=!1,e.prev=5,i=new RTCPeerConnection,(a=document.createElement("canvas")).getContext("2d"),o=a.captureStream(0),i.addTrack(o.getVideoTracks()[0],o),e.next=13,i.createOffer();case 13:return-1!==(t=e.sent).sdp.toLowerCase().indexOf("h264")&&(n=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0),i.close(),Mf.detail.isH264EncodeSupported=n,Mf.detail.isVp8EncodeSupported=r,e.abrupt("return",{isH264EncodeSupported:Mf.detail.isH264EncodeSupported,isVp8EncodeSupported:Mf.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 jf(){return Bf.apply(this,arguments)}function Bf(){return(Bf=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=i(regeneratorRuntime.mark((function e(t){var n,r,a,o,s,c,u,d,l,h,p,f,m,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={encode:!1,decode:!1},r=null,e.prev=2,a=document.createElement("canvas"),o=a.getContext("2d"),a.width=640,a.height=480,s=setInterval((function(){o.fillText("test",Math.floor(640*Math.random()),Math.floor(480*Math.random()))}),33),c=-1,u=-1,r=function(){clearInterval(c),clearInterval(s),clearTimeout(u),l.close(),h.close(),d.getTracks().forEach((function(e){return e.stop()}))},u=setTimeout((function(){r(),t(n)}),3e3),d=a.captureStream(),l=new RTCPeerConnection({}),h=new RTCPeerConnection({offerToReceiveAudio:!0,offerToReceiveVideo:!0}),l.addEventListener("icecandidate",(function(e){return h.addIceCandidate(e.candidate)})),h.addEventListener("icecandidate",(function(e){return l.addIceCandidate(e.candidate)})),l.addTrack(d.getVideoTracks()[0],d),e.next=20,l.createOffer();case 20:return p=e.sent,e.next=23,l.setLocalDescription(p);case 23:return e.next=25,h.setRemoteDescription(p);case 25:return e.next=27,h.createAnswer();case 27:return f=e.sent,m=Af(f.sdp),_=m.media[0].rtp.findIndex((function(e){return"H264"===e.codec})),m.media[0].rtp=[m.media[0].rtp[_]],m.media[0].fmtp=m.media[0].fmtp.filter((function(e){return e.payload===m.media[0].rtp[0].payload})),m.media[0].rtcpFb=m.media[0].rtcpFb.filter((function(e){return e.payload===m.media[0].rtp[0].payload})),f.sdp=Pf(m),e.next=36,h.setLocalDescription(f);case 36:return e.next=38,l.setRemoteDescription(f);case 38:c=setInterval(i(regeneratorRuntime.mark((function e(){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.encode&&n.decode&&(r(),t(n)),e.next=3,l.getStats();case 3:return i=e.sent,e.next=6,h.getStats();case 6:a=e.sent,n.encode||i.forEach((function(e){"outbound-rtp"===e.type&&e.mediaType===oo&&e.framesEncoded>0&&(n.encode=!0)})),n.decode||a.forEach((function(e){"inbound-rtp"===e.type&&e.mediaType===oo&&e.framesDecoded>0&&(n.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(),su.warn(e.t0),t(n);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)})))).apply(this,arguments)}var Hf=function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Mf.detail.isH264DecodeSupported&&!Mf.detail.isVp8DecodeSupported){e.next=2;break}return e.abrupt("return",{isH264DecodeSupported:Mf.detail.isH264DecodeSupported,isVp8DecodeSupported:Mf.detail.isVp8DecodeSupported});case 2:return t="",n=!1,r=!1,e.prev=5,i=new RTCPeerConnection,e.next=9,i.createOffer({offerToReceiveAudio:1,offerToReceiveVideo:1});case 9:return-1!==(t=e.sent).sdp.toLowerCase().indexOf("h264")&&(n=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0),i.close(),e.abrupt("return",{isH264DecodeSupported:n,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)}}(),Jf=function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Mf.result){e.next=2;break}return e.abrupt("return",Mf);case 2:return t=Nf(),n=Uf(),r=Vf(),e.next=7,Ff();case 7:return i=e.sent,a=i.isH264EncodeSupported,o=i.isVp8EncodeSupported,e.next=12,Hf();case 12:if(s=e.sent,c=s.isH264DecodeSupported,u=s.isVp8DecodeSupported,Mf.result=t&&n&&r&&(a||o)&&(c||u),Mf.detail.isBrowserSupported=t,Mf.detail.isWebRTCSupported=n,Mf.detail.isMediaDevicesSupported=r,Mf.detail.isH264EncodeSupported=a,Mf.detail.isVp8EncodeSupported=o,Mf.detail.isH264DecodeSupported=c,Mf.detail.isVp8DecodeSupported=u,!a||!c||!Kc&&!Yc){e.next=32;break}return e.next=26,jf();case 26:d=e.sent,l=d.encode,h=d.decode,Mf.detail.isH264EncodeSupported=l,Mf.detail.isH264DecodeSupported=h,l&&h||su.error("".concat(navigator.userAgent," isH264EncodeSupported: ").concat(l," isH264DecodeSupported: ").concat(h));case 32:return Mf.result||su.error("".concat(navigator.userAgent," isBrowserSupported: ").concat(t," ")+"isWebRTCSupported: ".concat(n," isMediaSupported: ").concat(r," ")+"isH264EncodeSupported: ".concat(Mf.detail.isH264EncodeSupported," isVp8EncodeSupported: ").concat(o," ")+"isH264DecodeSupported: ".concat(Mf.detail.isH264DecodeSupported," isVp8DecodeSupported: ").concat(u," ")),e.abrupt("return",Mf);case 34:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),zf=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},Gf=function(){return"RTCPeerConnection"in window&&"getReceivers"in window.RTCPeerConnection.prototype},Wf=function(){return"RTCPeerConnection"in window&&"getSenders"in window.RTCPeerConnection.prototype},qf=function(){return"RTCRtpTransceiver"in window&&"stop"in window.RTCRtpTransceiver.prototype},Kf=function(){return"RTCRtpSender"in window&&"setParameters"in window.RTCRtpSender.prototype&&Wf()},Qf=function(){return!!Ks(navigator.mediaDevices)&&(su.error("navigator.mediaDevices is not supported on your browser"),!0)},Yf=function(){return"http:"===location.protocol&&!au&&(su.error(gf),!0)},$f=function(e){return!("candidate-pair"!==e.type||!e.nominated||"in-progress"!==e.state&&"succeeded"!==e.state)&&!("boolean"==typeof e.selected&&!e.selected)},Xf=new Map([[dc,"Android"],[uc,"iOS"],[Uc,"Windows"],[Vc,"MacOS"],[Fc,"Linux"]]),Zf=function(){var e="unknown";return Xf.get(!0)&&(e=Xf.get(!0)),e};function em(){var e="";screen.width&&(e+=(screen.width?screen.width*window.devicePixelRatio:"")+" * "+(screen.height?screen.height*window.devicePixelRatio:""));return e}function tm(){var e=!1;return(navigator.getUserMedia||navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)&&(e=!0),e}function nm(){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 rm(){return!wc&&!uc&&!(!Nf()||!("captureStream"in HTMLCanvasElement.prototype))}Jf();var im="stream-added",am="stream-removed",om="stream-updated",sm="stream-subscribed",cm="error",um="connection-state-changed",dm="stream-added",lm="stream-removed",hm="stream-updated",pm="stream-subscribed",fm="connection-state-changed",mm="peer-join",_m="peer-leave",vm="mute-audio",gm="mute-video",Sm="unmute-audio",ym="unmute-video",bm="client-banned",km="network-quality",Tm="audio-volume",Rm="error",Em="player-state-changed",wm="screen-sharing-stopped",Im="connection-state-changed",Cm="error",xm="player-state-changed",Am=function(){function e(t){a(this,e),this.prevReport_={},this.prevEncoderImplementation_="",this.prevQualityLimitationReason_=""}var t,n,r,o;return s(e,[{key:"getSenderStats",value:(o=i(regeneratorRuntime.mark((function e(t){var n,r,i,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={audio:{bytesSent:0,packetsSent:0,audioLevel:0,totalAudioEnergy:0},video:{bytesSent:0,packetsSent:0,framesEncoded:0,frameWidth:0,frameHeight:0,framesSent:0,fpsCapture:0,smallFramesEncoded:0,smallFPSCapture:0,smallFramesSent:0},rtt:0},r=t.getPeerConnection(),i=t.getSSRC(),!r){e.next=14;break}return e.prev=4,e.next=7,r.getStats();case 7:e.sent.forEach((function(e){if("outbound-rtp"===e.type)if("video"===e.mediaType){if(!hc&&Ks(e.trackId))return;e.ssrc!==i.video||Ks(e.encoderImplementation)||a.prevEncoderImplementation_===e.encoderImplementation||(su.debug("[".concat(t.getUserId(),"] encoderImplementation change to ").concat(e.encoderImplementation)),a.prevEncoderImplementation_=e.encoderImplementation),e.ssrc!==i.video||Ks(e.qualityLimitationReason)||a.prevQualityLimitationReason_===e.qualityLimitationReason||(su.debug("[".concat(t.getUserId(),"] qualityLimitationReason change to ").concat(e.qualityLimitationReason)),a.prevQualityLimitationReason_=e.qualityLimitationReason);var r=t.getSSRC();e.ssrc===r.video?(n.video.bytesSent=e.bytesSent,n.video.packetsSent=e.packetsSent,n.video.framesEncoded=e.framesEncoded):(n.video.smallBytesSent=e.bytesSent,n.video.smallFramesEncoded=e.framesEncoded)}else"audio"===e.mediaType&&(n.audio.bytesSent=e.bytesSent,n.audio.packetsSent=e.packetsSent);else"candidate-pair"===e.type?$f(e)&&Ys(e.currentRoundTripTime)&&(n.rtt=Math.floor(1e3*e.currentRoundTripTime)):"track"===e.type?(Ks(e.frameWidth)||(e.trackIdentifier===t.getLocalStreamVideoTrackId()?(n.video.frameWidth=e.frameWidth,n.video.frameHeight=e.frameHeight,n.video.framesSent=e.framesSent):(n.video.smallFrameWidth=e.frameWidth,n.video.smallFrameHeight=e.frameHeight,n.video.smallFramesSent=e.framesSent)),Ks(e.audioLevel)||(n.audio.audioLevel=e.audioLevel||0)):"media-source"===e.type&&("audio"===e.kind?(n.audio.audioLevel=e.audioLevel||0,n.audio.totalAudioEnergy=e.totalAudioEnergy||0):"video"===e.kind&&(e.trackIdentifier===t.getLocalStreamVideoTrackId()?n.video.fpsCapture=e.framesPerSecond:n.video.smallFPSCapture=e.framesPerSecond))})),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),su.warn("failed to getStats on sender connection");case 14:return e.abrupt("return",n);case 15:case"end":return e.stop()}}),e,null,[[4,11]])}))),function(e){return o.apply(this,arguments)})},{key:"getReceiverStats",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={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=13;break}return e.prev=3,e.next=6,r.getStats();case 6:e.sent.forEach((function(e){if("inbound-rtp"===e.type){if("audio"===e.mediaType)n.audio.packetsReceived=e.packetsReceived,n.audio.bytesReceived=e.bytesReceived,n.audio.packetsLost=e.packetsLost,n.audio.jitter=e.jitter,n.hasAudio=!0;else if("video"===e.mediaType){if(hc&&0===e.bytesReceived)return;var r=t.getSSRC();e.ssrc===r.video&&(n.video.packetsReceived=e.packetsReceived,n.video.bytesReceived=e.bytesReceived,n.video.packetsLost=e.packetsLost,n.video.framesReceived=e.framesReceived,n.video.framesDecoded=e.framesDecoded,n.video.fpsDecoded=e.framesPerSecond,n.hasVideo=!0),e.ssrc===r.auxiliary&&(n.auxiliary.packetsReceived=e.packetsReceived,n.auxiliary.bytesReceived=e.bytesReceived,n.auxiliary.packetsLost=e.packetsLost,n.auxiliary.framesReceived=e.framesReceived,n.auxiliary.framesDecoded=e.framesDecoded,n.auxiliary.fpsDecoded=e.framesPerSecond,n.hasAuxiliary=!0)}}else"track"===e.type?(Ks(e.frameWidth)||(e.trackIdentifier===t.getMainStreamVideoTrackId()&&(n.video.frameWidth=e.frameWidth,n.video.frameHeight=e.frameHeight),e.trackIdentifier===t.getAuxStreamVideoTrackId()&&(n.auxiliary.frameWidth=e.frameWidth,n.auxiliary.frameHeight=e.frameHeight)),"audio"===e.kind&&(n.audio.audioLevel=e.audioLevel||0,n.audio.totalAudioEnergy=e.totalAudioEnergy||0)):"candidate-pair"===e.type&&$f(e)&&Ys(e.currentRoundTripTime)&&(n.rtt=Math.floor(1e3*e.currentRoundTripTime))})),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),su.warn("failed to getStats on receiver connection");case 13:return e.abrupt("return",n);case 14:case"end":return e.stop()}}),e,null,[[3,10]])}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(n=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,c,u;return regeneratorRuntime.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:i=[],a=k(n),e.prev=7,a.s();case 9:if((o=a.n()).done){e.next=17;break}return(s=g(o.value,2))[0],c=s[1],e.next=13,this.getReceiverStats(c);case 13:u=e.sent,i.push(u);case 15:e.next=9;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(7),a.e(e.t0);case 22:return e.prev=22,a.f(),e.finish(22);case 25:return e.abrupt("return",{senderStats:r,receiverStats:i});case 26:case"end":return e.stop()}}),e,this,[[7,19,22,25]])}))),function(e,t){return n.apply(this,arguments)})},{key:"prepareReport",value:function(e){var t=e.stats,n=e.report,r=e.freezeMap;if(!_f(t.senderStats)&&(n.uint32_delay=t.senderStats.rtt,n.RTTReportState.uint32_delay=t.senderStats.rtt,n.AudioReportState.sentAudioLevel=t.senderStats.audio.audioLevel,n.AudioReportState.sentAudioEnergy=t.senderStats.audio.totalAudioEnergy,n.AudioReportState.uint32_audio_enc_pkg_br=t.senderStats.audio.bytesSent,n.VideoReportState.uint32_video_snd_br=t.senderStats.video.bytesSent,n.VideoReportState.uint32_send_total_pkg=t.senderStats.video.packetsSent,n.VideoReportState.VideoEncState[0].uint32_enc_width=t.senderStats.video.frameWidth,n.VideoReportState.VideoEncState[0].uint32_enc_height=t.senderStats.video.frameHeight,n.VideoReportState.VideoEncState[0].uint32_enc_fps=t.senderStats.video.framesEncoded,n.VideoReportState.VideoEncState[0].uint32_capture_fps=t.senderStats.video.fpsCapture,n.VideoReportState.VideoEncState[0].uint32_send_fps=t.senderStats.video.framesSent,t.senderStats.video.smallBytesSent)){n.VideoReportState.uint32_small_video_snd_br=t.senderStats.video.smallBytesSent;var i={uint32_enc_width:t.senderStats.video.smallFrameWidth||0,uint32_enc_height:t.senderStats.video.smallFrameHeight||0,uint32_enc_fps:t.senderStats.video.smallFramesEncoded||0,uint32_capture_fps:t.senderStats.video.smallFPSCapture||0,uint32_send_fps:t.senderStats.video.smallFramesSent||0};n.VideoReportState.VideoEncState.push(i)}t.receiverStats.forEach((function(e){var t=e.userId;if(n.RTTReportState.RTTDecState.push({uint32_delay:e.rtt,uint64_sender_uin:e.tinyId}),e.hasAudio&&(n.AudioReportState.AudioDecState.push({uint32_audio_delay:0,uint32_audio_jitter:e.audio.jitter,uint32_audio_real_recv_pkg:e.audio.packetsReceived,uint32_audio_flow:e.audio.bytesReceived,uint32_audio_real_recv_br:0,uint64_sender_uin:e.tinyId,userId:e.userId,packetsLost:e.audio.packetsLost,totalPacketsLost:e.audio.packetsLost,audioLevel:e.audio.audioLevel,audioEnergy:e.audio.totalAudioEnergy}),n.AudioReportState.uint32_audio_real_recv_pkg+=e.audio.packetsReceived,n.AudioReportState.uint32_audio_flow+=e.audio.bytesReceived,n.uint32_real_num+=e.audio.packetsReceived),e.hasVideo){var i=r.get(t+"_main"),a=i?i.duration:0;n.VideoReportState.VideoDecState.push({uint32_video_recv_fps:e.video.framesReceived,uint32_video_dec_fps:e.video.fpsDecoded,uint32_video_recv_br:e.video.bytesReceived,uint32_video_real_recv_pkg:e.video.packetsReceived,uint32_dec_height:e.video.frameHeight,uint32_dec_width:e.video.frameWidth,uint32_video_jitter:0,uint64_sender_uin:e.tinyId,userId:e.userId,packetsLost:e.video.packetsLost,totalPacketsLost:e.video.packetsLost,uint32_video_strtype:0,int32_video_freeze_ms:a}),n.VideoReportState.uint32_video_total_real_recv_pkg+=e.video.packetsReceived,n.VideoReportState.uint32_video_rcv_br+=e.video.bytesReceived}if(e.hasAuxiliary){var o=r.get(t+"_auxiliary"),s=o?o.duration:0;n.VideoReportState.VideoDecState.push({uint32_video_recv_fps:e.auxiliary.framesReceived,uint32_video_dec_fps:e.auxiliary.fpsDecoded,uint32_video_recv_br:e.auxiliary.bytesReceived,uint32_video_real_recv_pkg:e.auxiliary.packetsReceived,uint32_dec_height:e.auxiliary.frameHeight,uint32_dec_width:e.auxiliary.frameWidth,uint32_video_jitter:0,uint64_sender_uin:e.tinyId,userId:e.userId,packetsLost:e.auxiliary.packetsLost,totalPacketsLost:e.auxiliary.packetsLost,uint32_video_strtype:2,int32_video_freeze_ms:s})}})),n.uint64_end_utime=(new Date).getTime();var a=this.prevReport_;if(this.prevReport_=JSON.parse(JSON.stringify(n)),_f(a))n.AudioReportState.uint32_audio_enc_pkg_br=8*n.AudioReportState.uint32_audio_enc_pkg_br/2,n.VideoReportState.uint32_video_rcv_br=8*n.VideoReportState.uint32_video_rcv_br/2,n.VideoReportState.uint32_video_snd_br=8*n.VideoReportState.uint32_video_snd_br/2,n.VideoReportState.uint32_small_video_snd_br&&(n.VideoReportState.uint32_small_video_snd_br=8*n.VideoReportState.uint32_small_video_snd_br/2),n.VideoReportState.VideoDecState.forEach((function(e){e.uint32_video_recv_br=8*e.uint32_video_recv_br/2,n.uint32_total_send_bps=n.AudioReportState.uint32_audio_enc_pkg_br+n.VideoReportState.uint32_video_snd_br}));else{if(n.uint64_begine_utime=a.uint64_end_utime,n.uint32_real_num-=a.uint32_real_num,n.uint32_real_num<=0&&(n.uint32_real_num=0),n.AudioReportState.uint32_audio_real_recv_pkg-=a.AudioReportState.uint32_audio_real_recv_pkg,n.AudioReportState.uint32_audio_real_recv_pkg<=0&&(n.AudioReportState.uint32_audio_real_recv_pkg=0),n.AudioReportState.uint32_audio_enc_pkg_br-=a.AudioReportState.uint32_audio_enc_pkg_br,n.AudioReportState.uint32_audio_enc_pkg_br<=0&&(n.AudioReportState.uint32_audio_enc_pkg_br=0),n.AudioReportState.uint32_audio_enc_pkg_br=8*n.AudioReportState.uint32_audio_enc_pkg_br/2,n.VideoReportState.uint32_video_snd_br-=a.VideoReportState.uint32_video_snd_br,n.VideoReportState.uint32_video_snd_br<=0&&(n.VideoReportState.uint32_video_snd_br=0),n.VideoReportState.uint32_video_snd_br=8*n.VideoReportState.uint32_video_snd_br/2,n.VideoReportState.uint32_small_video_snd_br&&(n.VideoReportState.uint32_small_video_snd_br-=a.VideoReportState.uint32_small_video_snd_br,n.VideoReportState.uint32_small_video_snd_br<=0&&(n.VideoReportState.uint32_small_video_snd_br=0),n.VideoReportState.uint32_small_video_snd_br=8*n.VideoReportState.uint32_small_video_snd_br/2),n.AudioReportState.uint32_audio_flow-=a.AudioReportState.uint32_audio_flow,n.AudioReportState.uint32_audio_flow<=0&&(n.AudioReportState.uint32_audio_flow=0),n.VideoReportState.uint32_send_total_pkg-=a.VideoReportState.uint32_send_total_pkg,n.VideoReportState.uint32_send_total_pkg<=0&&(n.VideoReportState.uint32_send_total_pkg=0),n.VideoReportState.uint32_video_rcv_br-=a.VideoReportState.uint32_video_rcv_br,n.VideoReportState.uint32_video_rcv_br<=0&&(n.VideoReportState.uint32_video_rcv_br=0),n.VideoReportState.uint32_video_rcv_br=8*n.VideoReportState.uint32_video_rcv_br/2,n.VideoReportState.uint32_video_total_real_recv_pkg-=a.VideoReportState.uint32_video_total_real_recv_pkg,n.VideoReportState.uint32_video_total_real_recv_pkg<=0&&(n.VideoReportState.uint32_video_total_real_recv_pkg=0),n.VideoReportState.VideoEncState[0].uint32_enc_fps-=a.VideoReportState.VideoEncState[0].uint32_enc_fps,n.VideoReportState.VideoEncState[0].uint32_enc_fps<0&&(n.VideoReportState.VideoEncState[0].uint32_enc_fps=0),n.VideoReportState.VideoEncState[0].uint32_enc_fps=n.VideoReportState.VideoEncState[0].uint32_enc_fps/2,n.VideoReportState.VideoEncState[0].uint32_send_fps-=a.VideoReportState.VideoEncState[0].uint32_send_fps,n.VideoReportState.VideoEncState[0].uint32_send_fps<0&&(n.VideoReportState.VideoEncState[0].uint32_send_fps=0),n.VideoReportState.VideoEncState[0].uint32_send_fps=n.VideoReportState.VideoEncState[0].uint32_send_fps/2,n.VideoReportState.VideoEncState[1]){var o=0,s=0;a.VideoReportState.VideoEncState[1]&&(o=a.VideoReportState.VideoEncState[1].uint32_enc_fps,s=a.VideoReportState.VideoEncState[1].uint32_enc_fps),n.VideoReportState.VideoEncState[1].uint32_enc_fps-=o,n.VideoReportState.VideoEncState[1].uint32_enc_fps<0&&(n.VideoReportState.VideoEncState[1].uint32_enc_fps=0),n.VideoReportState.VideoEncState[1].uint32_enc_fps=n.VideoReportState.VideoEncState[1].uint32_enc_fps/2,n.VideoReportState.VideoEncState[1].uint32_send_fps-=s,n.VideoReportState.VideoEncState[1].uint32_send_fps<0&&(n.VideoReportState.VideoEncState[1].uint32_send_fps=0),n.VideoReportState.VideoEncState[1].uint32_send_fps=n.VideoReportState.VideoEncState[1].uint32_send_fps/2}for(var c=n.VideoReportState.VideoDecState.length,u=0;u<c;u++){for(var d=n.VideoReportState.VideoDecState[u],l=d.uint64_sender_uin,h=d.uint32_video_strtype,p=d.uint32_video_real_recv_pkg,f=d.uint32_video_recv_br,m=d.uint32_video_recv_fps,_=0;_<a.VideoReportState.VideoDecState.length;_++){var v=a.VideoReportState.VideoDecState[_];if(v.uint64_sender_uin===l&&v.uint32_video_strtype===h){d.packetsLost=d.totalPacketsLost-v.totalPacketsLost,(p-=v.uint32_video_real_recv_pkg)<=0&&(p=0),(f-=v.uint32_video_recv_br)<=0&&(f=0),(m-=v.uint32_video_recv_fps)<0&&(m=0);break}}n.VideoReportState.VideoDecState[u].uint32_video_real_recv_pkg=p,n.VideoReportState.VideoDecState[u].uint32_video_recv_br=8*f/2,n.VideoReportState.VideoDecState[u].uint32_video_recv_fps=m/2}c=n.AudioReportState.AudioDecState.length;for(var g=0;g<c;g++){for(var S=n.AudioReportState.AudioDecState[g],y=S.uint32_audio_real_recv_pkg,b=S.uint32_audio_flow,k=S.uint64_sender_uin,T=0;T<a.AudioReportState.AudioDecState.length;T++){var R=a.AudioReportState.AudioDecState[T];if(R.uint64_sender_uin===k){S.packetsLost=S.totalPacketsLost-R.totalPacketsLost,(y-=R.uint32_audio_real_recv_pkg)<=0&&(y=0),(b-=R.uint32_audio_flow)<=0&&(b=0);break}}n.AudioReportState.AudioDecState[g].uint32_audio_real_recv_pkg=y,n.AudioReportState.AudioDecState[g].uint32_audio_flow=b,n.AudioReportState.AudioDecState[g].uint32_audio_real_recv_br=8*b/2}n.AudioReportState.uint32_audio_real_recv_br=8*n.AudioReportState.uint32_audio_flow/2,n.uint32_real_num=n.AudioReportState.uint32_audio_real_recv_pkg+n.VideoReportState.uint32_video_total_real_recv_pkg,n.uint32_total_send_bps=n.AudioReportState.uint32_audio_enc_pkg_br+n.VideoReportState.uint32_video_snd_br,n.uint32_total_recv_bps=n.AudioReportState.uint32_audio_real_recv_br+n.VideoReportState.uint32_video_rcv_br}return n}},{key:"getStatsReport",value:(t=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.uplinkConnection,r=t.downlinkConnections,i=t.freezeMap,a={uint64_begine_utime:(new Date).getTime(),uint64_end_utime:0,uint32_real_num:0,uint32_delay:0,uint32_CPU_curfreq:0,uint32_total_send_bps:0,uint32_total_recv_bps:0,AudioReportState:{uint32_audio_enc_pkg_br:0,uint32_audio_real_recv_pkg:0,uint32_audio_flow:0,uint32_audio_real_recv_br:0,uint32_audio_delay:0,uint32_audio_jitter:0,uint32_microphone_status:1,sentAudioLevel:0,sentAudioEnergy:0,AudioDecState:[]},VideoReportState:{uint32_video_delay:0,uint32_video_snd_br:0,uint32_video_total_real_recv_pkg:0,uint32_video_rcv_br:0,uint32_send_total_pkg:0,VideoEncState:[{uint32_enc_width:0,uint32_enc_height:0,uint32_capture_fps:0,uint32_enc_fps:0,uint32_send_fps:0}],VideoDecState:[]},RTTReportState:{uint32_delay:0,RTTDecState:[]}},e.next=4,this.getStats(n,r);case 4:return o=e.sent,this.prepareReport({stats:o,report:a,freezeMap:i}),e.abrupt("return",a);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}(),Pm=function(){function e(t){a(this,e),this.id_=t.id,this.direction_=t.direction,this.type_=t.type,this.directionPrefix_="local"===this.direction_?"":"*"}return s(e,[{key:"log",value:function(e,t){su[e]("[".concat(this.directionPrefix_).concat(this.id_,"] ").concat(this.type_," ").concat(t))}},{key:"info",value:function(e){this.log("info",e)}},{key:"debug",value:function(e){this.log("debug",e)}},{key:"warn",value:function(e){this.log("warn",e)}},{key:"error",value:function(e){this.log("error",e)}}]),e}(),Dm=new Xh,Mm={JOIN_START:1,JOIN_SEND_CMD:2,JOIN_RECEIVED_CMD_RES:3,JOIN_SUCCESS:4,JOIN_FAILED:5,LEAVE_START:20,LEAVE_SEND_CMD:21,LEAVE_SUCCESS:22,HEARTBEAT_STATS:23,RECEIVED_PUBLISHED_USER_LIST:24,CALL_STATS:25,PUBLISH_START:27,STREAM_PLAY_SUCCESS:100,PLAYER_STATE_CHANGED:101,VIDEO_PLAYING:102,AUDIO_PLAYING:103,REMOTE_STREAM_TRACK_UPDATED:110,REMOTE_STREAM_ADDED:111,REMOTE_STREAM_SUBSCRIBE_START:112,REMOTE_STREAM_SUBSCRIBED:113,REMOTE_STREAM_UNSUBSCRIBED:114,REMOTE_STREAM_UPDATED:115,REMOTE_STREAM_REMOVED:116,LOCAL_STREAM_PUBLISHED:120,LOCAL_STREAM_INITIALIZE_START:121,LOCAL_STREAM_INITIALIZE_END:122,LOCAL_STREAM_INITIALIZE_FAILED:123,VIDEO_TRACK_MUTED:130,VIDEO_TRACK_UNMUTED:131,PLAY_STREAM_START:132,VIDEO_LOADED_DATA:133,PLAY_VIDEO_START:134,VIDEO_TRACK_ENDED:135,AUDIO_TRACK_MUTED:136,AUDIO_TRACK_ENDED:137,CONNECTION_STATE_CHANGED:200,CONNECTION_SEND_SUBSCRIBE_CMD:201,NETWORK_QUALITY:300},Om=function(){function e(t){var n=t.signalChannel,r=t.connections,i=t.userId,o=t.client;a(this,e),this.client_=o,this.signalChannel_=n,this.connections_=r,this.log_=new Pm({id:"q|"+i,direction:"local",type:""}),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 Xh,this.initialize()}var t,n;return s(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(S(this.downlinkLossAndRTTMap_.values())),n=t.rtt,r=t.loss;this.log_.info("downlink network quality change ".concat(this.downlinkNetworkQuality," -> ").concat(e,", rtt: ").concat(n,", loss: ").concat(r))}this.downlinkNetworkQuality_=e}},{key:"initialize",value:function(){var e=this;this.signalChannel_.on(cp.UPLINK_NETWORK_STATS,(function(t){e.handleUplinkNetworkQuality(t)})),this.signalChannel_.on(Zh,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);var n=e.data.content;if(0===n.result){var r=n.expectAudPkg+n.expectVidPkg,i=n.recvAudPkg+n.recvVidPkg,a=r-i;if(0===r&&0===i)return;this.uplinkLoss_=a<=0?0:Math.round(a/r*100),this.uplinkRTT_=n.rtt,this.uplinkNetworkQuality=this.getNetworkQuality(this.uplinkLoss_,this.uplinkRTT_)}}},{key:"handleDownlinkNetworkQuality",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h,p,f,m,_=this;return regeneratorRuntime.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=S(this.connections_.values()),n=t.filter((function(e){return e.getPeerConnection()&&"connected"===e.getPeerConnection().connectionState})),t.filter((function(e){return e.getPeerConnection()&&_.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<n.length)){e.next=31;break}return i=n[r].getPeerConnection(),e.next=14,this.getStat(i);case 14:if(a=e.sent,o=a.rtt,s=a.totalPacketsLost,c=a.totalPacketsReceived,this.downlinkPrevStatMap_.has(i)){e.next=21;break}return this.downlinkPrevStatMap_.set(i,{totalPacketsLost:s,totalPacketsReceived:c}),e.abrupt("continue",28);case 21:u=0,d=this.downlinkPrevStatMap_.get(i),l=s-d.totalPacketsLost,h=c-d.totalPacketsReceived,u=l<=0||h<0?0:Math.round(l/(l+h)*100),this.downlinkPrevStatMap_.set(i,{totalPacketsLost:s,totalPacketsReceived:c}),this.downlinkLossAndRTTMap_.set(i,{rtt:o,loss:u,userId:n[r].getUserId()});case 28:r++,e.next=10;break;case 31:if(S(this.downlinkPrevStatMap_.keys()).forEach((function(e){_.isPeerConnectionDisconnected(e)&&(_.downlinkPrevStatMap_.delete(e),_.downlinkLossAndRTTMap_.delete(e))})),0!==this.downlinkLossAndRTTMap_.size){e.next=34;break}return e.abrupt("return");case 34:p=this.getAverageLossAndRTT(S(this.downlinkLossAndRTTMap_.values())),f=p.rtt,m=p.loss,this.downlinkRTT_=f,this.downlinkLoss_=m,this.downlinkNetworkQuality=this.getNetworkQuality(m,f);case 38:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getStat",value:(t=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={rtt:0,totalPacketsLost:0,totalPacketsReceived:0},t&&Gf()){e.next=3;break}return e.abrupt("return",n);case 3:r=t.getReceivers(),e.prev=4,i=0;case 6:if(!(i<r.length)){e.next=15;break}return a=r[i],e.next=10,a.getStats();case 10:e.sent.forEach((function(e){"candidate-pair"===e.type&&Ys(e.currentRoundTripTime)&&(n.rtt=Math.round(1e3*e.currentRoundTripTime)),"inbound-rtp"!==e.type||"audio"!==e.mediaType&&"video"!==e.mediaType||(n.totalPacketsLost+=e.packetsLost,n.totalPacketsReceived+=e.packetsReceived)}));case 12:i++,e.next=6;break;case 15:return e.abrupt("return",n);case 18:return e.prev=18,e.t0=e.catch(4),e.abrupt("return",n);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===np?(this.uplinkRTT_=0,this.uplinkLoss_=0,this.uplinkNetworkQuality=6):e.state===ap&&6===this.uplinkNetworkQuality&&(this.uplinkNetworkQuality=5)}},{key:"handleUplinkConnectionStateChange",value:function(e){var t=e.state;t===ba?(this.uplinkLoss_=0,this.uplinkRTT_=0,this.uplinkNetworkQuality=6):t===Ra&&6===this.uplinkNetworkQuality&&(this.uplinkNetworkQuality=5)}},{key:"isPeerConnectionDisconnected",value:function(e){return!(!e||"disconnected"!==e.connectionState&&"failed"!==e.connectionState&&"closed"!==e.connectionState)}},{key:"setUplinkConnection",value:function(e){this.uplinkConnection_=e,this.uplinkConnection_?this.uplinkConnection_.on(um,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_=Fd.setInterval((function(){e.handleDownlinkNetworkQuality(),Dm.emit(Mm.NETWORK_QUALITY,{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(km,{uplinkNetworkQuality:e.uplinkNetworkQuality,downlinkNetworkQuality:e.downlinkNetworkQuality,uplinkRTT:e.uplinkRTT_,uplinkLoss:e.uplinkLoss_,downlinkRTT:e.downlinkRTT_,downlinkLoss:e.downlinkLoss_})}),2e3)):this.log_.info("network quality calculating is already started")}},{key:"stop",value:function(){this.log_.info("stop network quality calculating"),-1!==this.interval_&&(Fd.clearInterval(this.interval_),this.interval_=-1)}},{key:"on",value:function(e,t){this.emitter_.on(e,t)}}]),e}(),Lm=function(){function e(){a(this,e),this.log_=su,this.localStream_=null,this.prevDevices_=[],this.initialize()}var t,n,r;return s(e,[{key:"initialize",value:(r=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:navigator.mediaDevices&&navigator.mediaDevices.addEventListener("devicechange",this.onDeviceChange.bind(this));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onDeviceChange",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r,i=this;return regeneratorRuntime.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,M_.getDevices();case 4:t=e.sent,n=t.filter((function(e){return i.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})),n.length>0&&this.handleDeviceAdded(this.prevDevices_,n),r.length>0&&this.handleDeviceRemoved(t,r),this.prevDevices_=t;case 10:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setLocalStream",value:(t=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return e.next=3,M_.getDevices();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){this.log_.warn("devicesAdded: ".concat(JSON.stringify(t))),this.localStream_.updateDeviceIdInUse();var n=t.filter((function(e){return"videoinput"===e.kind})),r=t.filter((function(e){return"audioinput"===e.kind})),i=e.filter((function(e){return"videoinput"===e.kind})),a=e.filter((function(e){return"audioinput"===e.kind})),o=n.length>0&&0===i.length&&this.localStream_.getVideo(),s=r.length>0&&0===a.length&&this.localStream_.getAudio();if(s&&o)return this.log_.info("new microphone and camera detected, but there was no device before."),void this.localStream_.updateStream({audio:!0,video:!0,cameraId:n[0].deviceId,microphoneId:r[0].deviceId});o&&(this.log_.info("new camera detected, but there was no camera before."),this.localStream_.updateStream({audio:!1,video:!0,cameraId:n[0].deviceId})),s&&(this.log_.info("new microphone detected, but there was no microphone before."),this.localStream_.updateStream({audio:!0,video:!1,microphoneId:r[0].deviceId}))}},{key:"handleDeviceRemoved",value:function(e,t){this.log_.warn("devicesRemoved: ".concat(JSON.stringify(t))),this.localStream_.updateDeviceIdInUse();var n=!1,r=!1,i=this.localStream_.getCameraId(),a=this.localStream_.getMicrophoneId();if("default"===a){var o=this.localStream_.getMicrophoneGroupId(),s=e.filter((function(e){return"default"===e.deviceId&&"audioinput"===e.kind}))[0];s&&s.groupId!==o&&(r=!0)}if(t.forEach((function(e){var t=e.deviceId;i.length>0&&t===i?n=!0:a.length>0&&t===a&&(r=!0)})),n&&r)return this.log_.warn("current camera and microphone in use is lost, cameraId: ".concat(i,", microphoneId: ").concat(a)),void((this.localStream_.getAudio()||this.localStream_.getVideo())&&this.localStream_.updateStream({video:!0,audio:!0}));n&&(this.log_.warn("current camera in use is lost, deviceId: ".concat(i)),this.localStream_.getVideo()&&this.localStream_.updateStream({video:!0,audio:!1})),r&&(this.log_.warn("current microphone in use is lost, deviceId: ".concat(a)),this.localStream_.getAudio()&&this.localStream_.updateStream({video:!1,audio:!0}))}}]),e}(),Nm=1..toFixed,Um=Math.floor,Vm=function(e,t,n){return 0===t?n:t%2==1?Vm(e,t-1,n*e):Vm(e*e,t/2,n)},Fm=function(e,t,n){for(var r=-1,i=n;++r<6;)i+=t*e[r],e[r]=i%1e7,i=Um(i/1e7)},jm=function(e,t){for(var n=6,r=0;--n>=0;)r+=e[n],e[n]=Um(r/t),r=r%t*1e7},Bm=function(e){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==e[t]){var r=String(e[t]);n=""===n?r:n+yu.call("0",7-r.length)+r}return n},Hm=Nm&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!x((function(){Nm.call({})}));mt({target:"Number",proto:!0,forced:Hm},{toFixed:function(e){var t,n,r,i,a=function(e){if("number"!=typeof e&&"Number"!=N(e))throw TypeError("Incorrect invocation");return+e}(this),o=Ge(e),s=[0,0,0,0,0,0],c="",u="0";if(o<0||o>20)throw RangeError("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return String(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*Vm(2,69,1))-69)<0?a*Vm(2,-t,1):a/Vm(2,t,1),n*=4503599627370496,(t=52-t)>0){for(Fm(s,0,n),r=o;r>=7;)Fm(s,1e7,0),r-=7;for(Fm(s,Vm(10,r,1),0),r=t-1;r>=23;)jm(s,1<<23),r-=23;jm(s,1<<r),Fm(s,1,1),jm(s,2),u=Bm(s)}else Fm(s,0,n),Fm(s,1<<-t,0),u=Bm(s)+yu.call("0",o);return u=o>0?c+((i=u.length)<=o?"0."+yu.call("0",o-i)+u:u.slice(0,i-o)+"."+u.slice(i-o)):c+u}});var Jm=window.AudioContext||window.webkitAudioContext,zm=null,Gm=function(){function e(){var t=this;a(this,e),zm||(zm=new Jm),this.context_=zm,this.instant_=0,this.slow_=0,this.clip_=0,this.script_=this.context_.createScriptProcessor(2048,1,1),this.script_.onaudioprocess=function(e){var n,r=e.inputBuffer.getChannelData(0),i=0,a=0;for(n=0;n<r.length;++n)i+=r[n]*r[n],Math.abs(r[n])>.99&&(a+=1);t.instant_=Math.sqrt(i/r.length),t.slow_=.95*t.slow_+.05*t.instant_,t.clip_=a/r.length}}return s(e,[{key:"connectToSource",value:function(e,t){try{var n=new MediaStream;n.addTrack(e),this.mic_=this.context_.createMediaStreamSource(n),this.mic_.connect(this.script_),this.script_.connect(this.context_.destination),Ks(t)||t(null)}catch(O_){su.error("soundMeter connectToSource error: "+O_),Ks(t)||t(O_)}}},{key:"stop",value:function(){this.mic_.disconnect(),this.script_.disconnect()}},{key:"resume",value:function(){this.context_&&this.context_.resume()}},{key:"getVolume",value:function(){return this.instant_.toFixed(2)}}]),e}(),Wm=function(){function e(t){a(this,e),this.stream_=t.stream,this.userId_=t.stream.getUserId(),this.log_=this.stream_.getIDLogger(),this.track_=t.track,this.div_=t.div,this.muted_=t.muted,this.outputDeviceId_=t.outputDeviceId,this.volume_=t.volume,this.emitter_=new Xh,this.initializeElement(),this.state_="NONE",this.soundMeter_=null}var t,n,r,o;return s(e,[{key:"initializeElement",value:function(){var e=new MediaStream;e.addTrack(this.track_);var t=document.createElement("audio");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:"play",value:(o=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.outputDeviceId_){e.next=3;break}return e.next=3,this.element_.setSinkId(this.outputDeviceId_);case 3:return this.setVolume(this.volume_),e.prev=4,e.next=7,this.element_.play();case 7:e.next=15;break;case 9:if(e.prev=9,e.t0=e.catch(4),this.log_.warn("<audio> play() error: "+e.t0),!(t=e.t0.toString()+" <audio>").startsWith("NotAllowedError")){e.next=15;break}throw new So({code:go.PLAY_NOT_ALLOWED,message:t});case 15:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(){return o.apply(this,arguments)})},{key:"handleEvents",value:function(){this.handleElementEvent=this.handleElementEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.element_.addEventListener("playing",this.handleElementEvent),this.element_.addEventListener("ended",this.handleElementEvent),this.element_.addEventListener("pause",this.handleElementEvent),this.element_.addEventListener("error",this.handleElementEvent),this.track_.addEventListener("ended",this.handleTrackEvent),this.track_.addEventListener("mute",this.handleTrackEvent),this.track_.addEventListener("unmute",this.handleTrackEvent)}},{key:"handleElementEvent",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.type,e.t0=n,e.next="playing"===e.t0?4:"ended"===e.t0?9:"pause"===e.t0?12:"error"===e.t0?16:27;break;case 4:return this.log_.info("stream - audio player is starting playing"),this.state_="PLAYING",Dm.emit(Mm.AUDIO_PLAYING,{stream:this.stream_}),this.emitter_.emit(xm,{state:this.state_,reason:"playing"}),e.abrupt("break",27);case 9:return this.log_.info("stream - audio player is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(xm,{state:this.state_,reason:"ended"})),e.abrupt("break",27);case 12:return this.log_.info("stream - audio player is paused"),this.state_="PAUSED",this.emitter_.emit(xm,{state:this.state_,reason:"pause"}),e.abrupt("break",27);case 16:if(!this.element_||!this.element_.error){e.next=26;break}return r="".concat(Zf(),"/").concat(Lf().browserName,"/").concat(Lf().browserVersion),e.next=20,M_.getSpeakers();case 20:i=e.sent,a=i[0].label,(o=i.find((function(e){return e.deviceId===s.outputDeviceId_})))&&(a=o.label),this.log_.error("stream - audio player error observed. code: ".concat(this.element_.error.code," message: ").concat(this.element_.error.message," deviceInfo: ").concat(r," speaker: ").concat(a)),Os("stat-".concat(this.stream_.getType(),"-audio-").concat(Qa,"-").concat(this.element_.error.code,"-").concat(r,"-").concat(a),this.element_.error);case 26:return e.abrupt("break",27);case 27: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"ended":this.log_.info("stream - audio player track is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(xm,{state:this.state_,reason:"ended"}),Dm.emit(Mm.AUDIO_TRACK_ENDED,{stream:this.stream_,type:t}));break;case"mute":this.log_.info("stream - audio track is unable to provide media output"),"PAUSED"!==this.state_&&(this.state_="PAUSED",this.emitter_.emit(xm,{state:this.state_,reason:"mute"}),Dm.emit(Mm.AUDIO_TRACK_MUTED,{stream:this.stream_,type:t}));break;case"unmute":this.log_.info("stream - audio track is able to provide media output"),"PAUSED"===this.state_&&(this.state_="PLAYING",this.emitter_.emit(xm,{state:this.state_,reason:"unmute"}))}}},{key:"unbindEvents",value:function(){this.element_&&(this.element_.removeEventListener("playing",this.handleElementEvent),this.element_.removeEventListener("ended",this.handleElementEvent),this.element_.removeEventListener("pause",this.handleElementEvent),this.element_.removeEventListener("error",this.handleElementEvent)),this.track_&&(this.track_.removeEventListener("ended",this.handleTrackEvent),this.track_.removeEventListener("mute",this.handleTrackEvent),this.track_.removeEventListener("unmute",this.handleTrackEvent))}},{key:"setSinkId",value:(n=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.outputDeviceId_===t){e.next=4;break}return e.next=3,this.element_.setSinkId(t);case 3:this.outputDeviceId_=t;case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setVolume",value:function(e){this.log_.info("stream - audioElement setVolume to : ".concat(e)),this.element_.volume=e}},{key:"getAudioLevel",value:function(){return this.soundMeter_||(this.soundMeter_=new Gm,this.soundMeter_.connectToSource(this.track_)),this.soundMeter_.getVolume()}},{key:"stop",value:function(){this.unbindEvents(),this.div_.removeChild(this.element_),this.element_.srcObject=null,this.soundMeter_&&(this.soundMeter_.stop(),this.soundMeter_=null),this.element_=null}},{key:"resume",value:(t=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.soundMeter_&&this.soundMeter_.resume(),e.next=4,this.element_.play();case 4:e.next=12;break;case 6:if(e.prev=6,e.t0=e.catch(0),this.log_.warn("<audio> play() error: "+e.t0),!(t=e.t0.toString()+" <audio>").startsWith("NotAllowedError")){e.next=12;break}throw new So({code:go.PLAY_NOT_ALLOWED,message:t});case 12:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(){return t.apply(this,arguments)})},{key:"on",value:function(e,t){this.emitter_.on(e,t)}}]),e}(),qm=function(){function e(t){a(this,e),this.stream_=t.stream,this.userId_=t.stream.getUserId(),this.log_=this.stream_.getIDLogger(),this.track_=t.track,this.div_=t.div,this.muted_=t.muted,this.objectFit_=t.objectFit,this.mirror_=t.mirror,this.emitter_=new Xh,this.initializeElement(),this.state_="NONE"}var t,n;return s(e,[{key:"initializeElement",value:function(){var e=new MediaStream;e.addTrack(this.track_);var t=document.createElement("video");t.srcObject=e,t.muted=!0;var n="width: 100%; height: 100%; object-fit: ".concat(this.objectFit_,";");this.mirror_&&(n+="transform: rotateY(180deg);"),t.setAttribute("id","video_".concat(this.stream_.getId())),t.setAttribute("style",n),t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this.div_.appendChild(t),this.element_=t,this.handleEvents()}},{key:"play",value:(n=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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),this.log_.warn("<video> play() error: "+e.t0),!(t=e.t0.toString()+" <video>").startsWith("NotAllowedError")){e.next=11;break}throw new So({code:go.PLAY_NOT_ALLOWED,message:t});case 11:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return n.apply(this,arguments)})},{key:"handleEvents",value:function(){this.handleElementEvent=this.handleElementEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.element_.addEventListener("playing",this.handleElementEvent),this.element_.addEventListener("ended",this.handleElementEvent),this.element_.addEventListener("pause",this.handleElementEvent),this.element_.addEventListener("error",this.handleElementEvent),this.element_.addEventListener("loadeddata",this.handleElementEvent),this.track_.addEventListener("ended",this.handleTrackEvent),this.track_.addEventListener("mute",this.handleTrackEvent),this.track_.addEventListener("unmute",this.handleTrackEvent)}},{key:"handleElementEvent",value:function(e){switch(e.type){case"playing":this.log_.info("stream - video player is starting playing"),this.state_="PLAYING",Dm.emit(Mm.VIDEO_PLAYING,{stream:this.stream_}),this.emitter_.emit(xm,{state:this.state_,reason:"playing"});break;case"ended":this.log_.info("stream - video player is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(xm,{state:this.state_,reason:"ended"}));break;case"pause":this.log_.info("stream - video player is paused"),this.state_="PAUSED",this.emitter_.emit(xm,{state:this.state_,reason:"pause"});break;case"error":if(this.element_&&this.element_.error){var t="".concat(Zf(),"/").concat(Lf().browserName,"/").concat(Lf().browserVersion);this.log_.error("stream - video player error observed. code: ".concat(this.element_.error.code," message: ").concat(this.element_.error.message," deviceInfo: ").concat(t)),Os("stat-".concat(this.stream_.getType(),"-video-").concat(Qa,"-").concat(this.element_.error.code,"-").concat(t),this.element_.error)}break;case"loadeddata":Dm.emit(Mm.VIDEO_LOADED_DATA,{stream:this.stream_})}}},{key:"handleTrackEvent",value:function(e){var t=e.type;switch(t){case"ended":this.log_.info("stream - video player track is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(xm,{state:this.state_,reason:"ended"}),Dm.emit(Mm.VIDEO_TRACK_ENDED,{stream:this.stream_,type:t}));break;case"mute":this.log_.info("stream - video track is unable to provide media output"),"PAUSED"!==this.state_&&(this.state_="PAUSED",this.emitter_.emit(xm,{state:this.state_,reason:"mute"}),Dm.emit(Mm.VIDEO_TRACK_MUTED,{stream:this.stream_,type:t}));break;case"unmute":this.log_.info("stream - video track is able to provide media output"),"PAUSED"===this.state_&&(this.state_="PLAYING",this.emitter_.emit(xm,{state:this.state_,reason:"unmute"}),Dm.emit(Mm.VIDEO_TRACK_UNMUTED,{stream:this.stream_}))}}},{key:"unbindEvents",value:function(){this.element_&&(this.element_.removeEventListener("playing",this.handleElementEvent),this.element_.removeEventListener("ended",this.handleElementEvent),this.element_.removeEventListener("pause",this.handleElementEvent),this.element_.removeEventListener("error",this.handleElementEvent),this.element_.removeEventListener("loadeddata",this.handleElementEvent)),this.track_&&(this.track_.removeEventListener("ended",this.handleTrackEvent),this.track_.removeEventListener("mute",this.handleTrackEvent),this.track_.removeEventListener("unmute",this.handleTrackEvent))}},{key:"stop",value:function(){this.unbindEvents(),this.div_.removeChild(this.element_),this.element_.srcObject=null,this.element_=null}},{key:"resume",value:(t=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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),this.log_.warn("<video> play() error: "+e.t0),!(t=e.t0.toString()+" <video>").startsWith("NotAllowedError")){e.next=11;break}throw new So({code:go.PLAY_NOT_ALLOWED,message:t});case 11:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return t.apply(this,arguments)})},{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)}}]),e}(),Km=function(){function e(t){a(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_=new Pm({id:"n|"+this.userId_,direction:this.isUplink_?"local":"remote",type:""}),this.signalChannel_=t.signalChannel,this.peerConnection_=null,this.connectTimer_=-1,this.isErrorObserved_=!1,this.emitter_=new Xh,this.currentState_=ba,this.waitForPeerConnectionConnectedPromise_=null}var t;return s(e,[{key:"initialize",value:function(){var e={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()}},{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(ba))}},{key:"getDTLSTransportState",value:function(){if(!this.peerConnection_)return"unknown";var e=null;if(this.isUplink_){if(!Wf()||0===this.peerConnection_.getSenders().length)return"unknown";e=this.peerConnection_.getSenders()[0].transport}else{if(!Gf()||0===this.peerConnection_.getReceivers().length)return"unknown";e=this.peerConnection_.getReceivers()[0].transport}return e?e.state:"unknown"}},{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)),"connecting"===e.target.connectionState&&this.emitConnectionStateChangedEvent(ka),"failed"===e.target.connectionState||"closed"===e.target.connectionState){var r="".concat(this.isUplink_?"uplink":"downlink"," ICE/DTLS Transport connection ").concat(e.target.connectionState,". ICE Transport state: ").concat(t,", DTLS Transport state: ").concat(n),i=new So({message:r,code:go.ICE_TRANSPORT_ERROR});Vs({eventType:Ba,error:i}),this.emitConnectionStateChangedEvent(ba),this.isErrorObserved_||this.emitter_.emit(cm,i)}if(("connected"===e.target.connectionState||"completed"===e.target.connectionState)&&(this.logSelectedCandidate(),Us({eventType:Ba}),this.emitConnectionStateChangedEvent(Ra),!this.isUplink_&&!this.sentSubscriptionAfterConnected_&&this.pendingSubscription_.length>0)){this.log_.info("send pending subscription after RTCPeerConnection is connected");var a=this.pendingSubscription_[0];this.doSendSubscription(a.data,a.stream,a.type),this.sentSubscriptionAfterConnected_=!0}}},{key:"emitConnectionStateChangedEvent",value:function(e){e!==this.currentState_&&(this.currentState_===Ta&&e===ka||(Dm.emit(Mm.CONNECTION_STATE_CHANGED,{client:this.client_,connection:this,prevState:this.currentState_,state:e}),this.emitter_.emit(um,{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(),r={eventId:e,eventDesc:t,timestamp:As(),userId:n,tinyId:this.client_.getTinyId()};this.isUplink_||(r.remoteUserId=this.userId_,r.remoteTinyId=this.tinyId_),pf(n,r)}},{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=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s;return regeneratorRuntime.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,n=k(t),e.prev=6,n.s();case 8:if((r=n.n()).done){e.next=18;break}if((i=g(r.value,2))[0],a=i[1],!$f(a)){e.next=16;break}return o=t.get(a.localCandidateId),s=t.get(a.remoteCandidateId),o&&this.log_.debug("local candidate: ".concat(o.candidateType," ").concat(o.protocol,":").concat(o.ip||o.address,":").concat(o.port," ").concat(o.networkType||""," ").concat("relay"===o.candidateType?"relayProtocol:"+o.relayProtocol:"")),s&&this.log_.debug("remote candidate: ".concat(s.candidateType," ").concat(s.protocol,":").concat(s.ip||s.address,":").concat(s.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),n.e(e.t0);case 23:return e.prev=23,n.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_===Ra)return t();var r=-1,i=function n(i){i.state===Ra&&(clearTimeout(r),e.emitter_.off(um,n,e),t())};r=setTimeout((function(){e.emitter_.off(um,i,e),n(new So({code:go.API_CALL_TIMEOUT,message:"connection timeout"}))}),1e4),e.emitter_.on(um,i,e)})),this.waitForPeerConnectionConnectedPromise_=this.waitForPeerConnectionConnectedPromise_.then((function(t){return e.waitForPeerConnectionConnectedPromise_=null,t})).catch((function(t){throw e.waitForPeerConnectionConnectedPromise_=null,t}))),this.waitForPeerConnectionConnectedPromise_}},{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)}}]),e}(),Qm=function(){function e(t){a(this,e),this.userId_=t.userId,this.isRemote_=t.isRemote,this.type_=t.type,this.log_=new Pm({id:"s|"+this.userId_,direction:this.isRemote_?"remote":"local",type:this.isRemote_?this.type_:""}),this.mirror_=!1,this.isRemote_||(this.mirror_=!0),Ks(t.mirror)||(this.mirror_=t.mirror),this.client_=null,Ks(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.id_=Vd(),this.audioOutputDeviceId_=0,this.audioVolume_=1,this.emitter_=new Xh,this.connectionState_=ba}var r,o,c,u,d;return s(e,[{key:"getType",value:function(){return this.type_}},{key:"getIDLogger",value:function(){return this.log_}},{key:"isSubscribed",get:function(){return"main"===this.type_&&this.connection_.isMainStreamSubscribed||"auxiliary"===this.type_&&this.connection_.isAuxStreamSubscribed}},{key:"isMainVideoSubscribed",get:function(){var e=this.getSubscribedState();return"main"===this.type_&&e&&e.video}},{key:"isMainAudioSubscribed",get:function(){var e=this.getSubscribedState();return"main"===this.type_&&e&&e.audio}},{key:"isAuxVideoSubscribed",get:function(){var e=this.getSubscribedState();return"auxiliary"===this.type_&&e&&e.auxiliary}},{key:"emitConnectionStateChanged",value:function(e){e.state!==this.connectionState_&&(e.state!==ba&&this.isRemote_&&!this.isSubscribed||(this.emitter_.emit(Im,e),this.connectionState_=e.state))}},{key:"setConnection",value:function(e){this.connection_!==e&&(e instanceof Km?(null!==this.connection_&&this.connection_.off(um,this.emitConnectionStateChanged,this),e.on(um,this.emitConnectionStateChanged,this)):null===e&&this.connection_.off(um,this.emitConnectionStateChanged,this),this.connection_=e)}},{key:"getConnection",value:function(){return this.connection_}},{key:"play",value:(d=i(regeneratorRuntime.mark((function e(t,r){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPlaying_){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"duplicated play() call observed, please stop() firstly"});case 2:return this.isPlaying_=!0,this.log_.info("stream start to play with options: ".concat(JSON.stringify(r))),(i=document.createElement("div")).setAttribute("id","player_".concat(this.id_)),i.setAttribute("style","width: 100%; height: 100%; position: relative; background-color: black; overflow: hidden;"),a=t,"object"!==n(t)&&(a=document.getElementById(t)),a.appendChild(i),this.div_=i,this.isRemote_||(this.muted_=!0),r&&!Ks(r.muted)&&(this.muted_=r.muted),this.isRemote_&&"auxiliary"===this.getType()&&(this.objectFit_="contain"),r&&!Ks(r.objectFit)&&(this.objectFit_=r.objectFit),Dm.emit(Mm.PLAY_STREAM_START,{stream:this}),e.next=18,Promise.all([this.playAudio(),this.playVideo()]);case 18:Dm.emit(Mm.STREAM_PLAY_SUCCESS,{stream:this});case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"playAudio",value:(u=i(regeneratorRuntime.mark((function e(){var n,r=this;return regeneratorRuntime.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(n=this.getAudioTrack(),this.audioPlayer_||!n){e.next=16;break}return this.log_.info("stream - create AudioPlayer and play"),this.audioPlayer_=new Wm({stream:this,track:n,div:this.div_,muted:this.muted_,outputDeviceId:this.audioOutputDeviceId_,volume:this.audioVolume_}),this.audioPlayer_.on(xm,(function(e){var n={type:"audio",state:e.state,reason:e.reason};Dm.emit(Mm.PLAYER_STATE_CHANGED,t({stream:r},n)),r.emitter_.emit(Em,n)})),e.prev=7,e.next=10,this.audioPlayer_.play();case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(7),this.emitter_.emit(Cm,e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[7,12]])}))),function(){return u.apply(this,arguments)})},{key:"playVideo",value:(c=i(regeneratorRuntime.mark((function e(){var n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasVideo()&&(!this.isRemote_||this.isMainVideoSubscribed||this.isAuxVideoSubscribed)){e.next=2;break}return e.abrupt("return");case 2:if(n=this.getVideoTrack(),this.videoPlayer_||!n){e.next=17;break}return Dm.emit(Mm.PLAY_VIDEO_START,{stream:this}),this.log_.info("stream - create VideoPlayer and play"),this.videoPlayer_=new qm({stream:this,track:n,div:this.div_,muted:this.muted_,objectFit:this.objectFit_,mirror:this.mirror_}),this.videoPlayer_.on(xm,(function(e){var n={type:"video",state:e.state,reason:e.reason};Dm.emit(Mm.PLAYER_STATE_CHANGED,t({stream:r},n)),r.emitter_.emit(Em,n)})),e.prev=8,e.next=11,this.videoPlayer_.play();case 11:e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(8),this.emitter_.emit(Cm,e.t0),e.t0;case 17:case"end":return e.stop()}}),e,this,[[8,13]])}))),function(){return c.apply(this,arguments)})},{key:"stopAudio",value:function(){this.audioPlayer_&&(this.log_.info("stream - stop AudioPlayer"),this.audioPlayer_.stop(),this.audioPlayer_=null)}},{key:"stopVideo",value:function(){this.videoPlayer_&&(this.log_.info("stream - stop VideoPlayer"),this.videoPlayer_.stop(),this.videoPlayer_=null)}},{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:(o=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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("stream - 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 o.apply(this,arguments)})},{key:"close",value:function(){this.isPlaying_&&this.stop(),this.mediaStream_&&(this.mediaStream_.preventEvent=1,this.mediaStream_.getTracks().forEach((function(e){e.stop()})),this.mediaStream_=null)}},{key:"muteAudio",value:function(){return this.addRemoteEvent(!0,"audio"),this.doEnableTrack("audio",!1)}},{key:"muteVideo",value:function(){return this.addRemoteEvent(!0,"video"),this.doEnableTrack("video",!1)}},{key:"unmuteAudio",value:function(){return this.addRemoteEvent(!1,"audio"),this.doEnableTrack("audio",!0)}},{key:"unmuteVideo",value:function(){return this.addRemoteEvent(!1,"video"),this.doEnableTrack("video",!0)}},{key:"addRemoteEvent",value:function(e,t){if(this.isRemote_&&this.client_){var n=this.client_.getUserId(),r="".concat(e?"mute":"unmute"," remote ").concat(t);pf(n,{eventId:"audio"===t?e?qp:Qp:e?Wp:Kp,eventDesc:r,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"audio"===e?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:(r=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioOutputDeviceId_=t,!this.audioPlayer_){e.next=4;break}return e.next=4,this.audioPlayer_.setSinkId(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.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:"hasAudio",value:function(){if(this.isRemote_){if(!this.connection_)return!1;var e=this.connection_.getTrackState();return"main"===this.type_&&e.audio}return!!this.getAudioTrack()}},{key:"hasVideo",value:function(){if(this.isRemote_){if(!this.connection_)return!1;var e=this.connection_.getTrackState();return"auxiliary"===this.type_?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:"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}(),Ym=function(e){u(r,e);var n=_(r);function r(e){var i;a(this,r);var o={isRemote:!0,type:e.type},s=t(t({},e),o);return(i=n.call(this,s)).isInSubscriptionCycle_=!1,i.isStreamAddedEventEmitted_=!1,i.isAbleToCallSubscription_=!0,i.installEvents(),i}return s(r,[{key:"installEvents",value:function(){Dm.on(Mm.REMOTE_STREAM_SUBSCRIBED,this.handleStreamSubscribed,this),Dm.on(Mm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamUnsubscribed,this)}},{key:"uninstallEvents",value:function(){Dm.off(Mm.REMOTE_STREAM_SUBSCRIBED,this.handleStreamSubscribed,this),Dm.off(Mm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamUnsubscribed,this)}},{key:"handleStreamSubscribed",value:function(e){e.client===this.client_&&e.stream===this&&this.connection_.getCurrentState()===Ra&&this.emitConnectionStateChanged({prevState:ba,state:Ra})}},{key:"handleStreamUnsubscribed",value:function(e){e.client===this.client_&&e.stream===this&&this.emitConnectionStateChanged({prevState:Ra,state:ba})}},{key:"getType",value:function(){return v(d(r.prototype),"getType",this).call(this)}},{key:"getIsAbleToCallSubscription",value:function(){return this.isAbleToCallSubscription_}},{key:"setIsAbleToCallSubscription",value:function(e){this.isAbleToCallSubscription_=e}},{key:"setInSubscriptionCycle",value:function(e){this.isInSubscriptionCycle_=e}},{key:"isInSubscriptionCycle",value:function(){return this.isInSubscriptionCycle_}},{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?v(d(r.prototype),"getAudioTrack",this).call(this):null}},{key:"getVideoTrack",value:function(){if(!this.connection_)return null;var e=this.connection_.getTrackState();return("main"!==this.type_||e.video)&&("auxiliary"!==this.type_||e.auxiliary)?v(d(r.prototype),"getVideoTrack",this).call(this):null}},{key:"close",value:function(){this.uninstallEvents(),v(d(r.prototype),"close",this).call(this)}}]),r}(Qm),$m=function(){function e(t){a(this,e),this.client_=t.client,this.subscribedStreams_=new Map,this.unsubscribedStreams_=new Map,this.subscriptedOptions_=new Map,this.autoRecoveryFlags_=new Map}var n,r,o;return s(e,[{key:"isEnabled",get:function(){return"webrtc"!==this.client_.getEnv()}},{key:"recover",value:(o=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.getUserId(),r=t.getType(),this.hasAutoRecoveryFlag(n,r)){e.next=5;break}return e.abrupt("return");case 5:if(i=this.getUnsubscribedStream(n,r)?"unsubscribe":"subscribe",e.prev=6,su.warn("recover() try to recover subscription [".concat(i,"][").concat(n,"][").concat(r,"]")),"subscribe"!==i){e.next=13;break}return e.next=11,this.recoverSubscription(n,t);case 11:e.next=15;break;case 13:return e.next=15,this.recoverUnsubscription(n,t);case 15:Us({eventType:Wa}),su.warn("recover() recover successfully [".concat(i,"][").concat(n,"][").concat(r,"]")),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(6),su.error("recover() recover failed [".concat(i,"][").concat(n,"][").concat(r,"]"),e.t0),Vs({eventType:Wa,error:e.t0});case 23:this.deleteAutoRecoveryFlag(n,r);case 24:case"end":return e.stop()}}),e,this,[[6,19]])}))),function(e){return o.apply(this,arguments)})},{key:"recoverSubscription",value:(r=i(regeneratorRuntime.mark((function e(n,r){var i,a,o,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.getOptions(n,r.getType()),a=this.getSubscribedStream(n,r.getType()),i&&a){e.next=4;break}return e.abrupt("return");case 4:return o=this.getStreamMuteState(a),s=o.isAudioMuted,c=o.isVideoMuted,this.mergeStream(a,r),u=a.getConnection(),e.next=9,u.subscribe(a,t(t({},i),{},{emitEvent:!1}));case 9:this.recoverPlayingState(a),s&&a.doEnableTrack("audio",!1),c&&a.doEnableTrack("video",!1);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"recoverUnsubscription",value:(n=i(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getUnsubscribedStream(t,n.getType())){e.next=3;break}return e.abrupt("return");case 3:return this.mergeStream(r,n),i=r.getConnection(),e.next=7,i.unsubscribe(r);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.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 r=n.parentNode;e.stop(),e.play(r,{objectFit:e.getObjectFit(),muted:e.getMuted()})}}},{key:"mergeStream",value:function(e,t){var n=t.getConnection(),r=t.getMediaStream();e.setConnection(n),n.setRemoteStream(r.id,e),e.setMediaStream(r),e.updateAudioPlayingState(t.hasAudio()),e.updateVideoPlayingState(t.hasVideo())}},{key:"addSubscriptionRecord",value:function(e,t,n){var r=t.getType();if(this.subscribedStreams_.has(e))this.subscribedStreams_.get(e).set(r,t);else{var i=new Map;i.set(t.getType(),t),this.subscribedStreams_.set(e,i)}if(this.subscriptedOptions_.has(e))this.subscriptedOptions_.get(e).set(r,n);else{var a=new Map;a.set(t.getType(),n),this.subscriptedOptions_.set(e,a)}this.deleteUnsubscriptionRecord(e,r)}},{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=S(this.subscribedStreams_.entries());e<t.length;e++)for(var n=g(t[e],2),r=n[0],i=0,a=S(n[1].entries());i<a.length;i++){var o=g(a[i],1)[0];this.setAutoRecoveryFlag(r,o)}for(var s=0,c=S(this.unsubscribedStreams_.entries());s<c.length;s++)for(var u=g(c[s],2),d=u[0],l=0,h=S(u[1].entries());l<h.length;l++){var p=g(h[l],1)[0];this.setAutoRecoveryFlag(d,p)}}},{key:"setAutoRecoveryFlag",value:function(e,t){if(su.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}(),Xm=/"/g;mt({target:"String",proto:!0,forced:function(e){return x((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))}("small")},{small:function(){return e="small",t="",n="",r=At(F(this)),i="<"+e,""!==t&&(i+=" "+t+'="'+At(n).replace(Xm,"&quot;")+'"'),i+">"+r+"</"+e+">";var e,t,n,r,i}});var Zm=function(){function e(){a(this,e),this.video_=document.createElement("video"),this.video_.autoplay=!0,this.canvas_=document.createElement("canvas"),this.canvasCtx_=this.canvas_.getContext("2d")}return s(e,[{key:"setSrc",value:function(e){this.video_.srcObject=e}},{key:"setCanvasRect",value:function(e,t){this.canvas_.width=e,this.canvas_.height=t}},{key:"drawVideoToCanvas",value:function(){this.canvasCtx_.drawImage(this.video_,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:"canvas",get:function(){return this.canvas_}},{key:"canvasCtx",get:function(){return this.canvasCtx_}},{key:"canDrawVideoToCanvas",get:function(){return this.video_.readyState===this.video_.HAVE_ENOUGH_DATA}}]),e}(),e_=function(){function e(){a(this,e),this.processor_=new Zm}return s(e,[{key:"generateSmallVideoTrack",value:function(e){var t=this.getSmallVideoProfile(e),n=this.processor_.generateStreamFromTrack(e.videoTrack);this.processor_.setSrc(n),this.processor_.setCanvasRect(t.width,t.height);var r=this.processor_.generateVideoTrackFromCanvasCapture(t.framerate);return this.interval_=Fd.setInterval(this.render.bind(this),Math.ceil(1e3/t.framerate)),r}},{key:"render",value:function(){this.processor_.canDrawVideoToCanvas&&this.processor_.drawVideoToCanvas()}},{key:"destroy",value:function(){Fd.clearInterval(this.interval_)}},{key:"getSmallVideoProfile",value:function(e){var t,n=e.videoTrack,r=e.smallStreamConfig,i=n.getSettings(),a=i?{width:i.width,height:i.height}:e.videoProfile,o=a.width*a.height,s=r.width*r.height;return o>s?t=o/s:(su.warn("Small stream resolution is larger than big stream, which is invalid."),t=o/19200),{width:parseInt(a.width/Math.sqrt(t)),height:parseInt(a.height/Math.sqrt(t)),framerate:r.framerate}}}]),e}(),t_={voiceActivityDetection:!1},n_=function(e){u(k,e);var t,n,r,o,c,l,h,p,f,m,g,S,y,b=_(k);function k(e){var t;return a(this,k),(t=b.call(this,e)).localStream_=null,t.exchangeSDPTimeout_=-1,t.isReconnecting_=!1,t.reconnectionCount_=0,t.reconnectionTimer_=-1,t.isFirstConnection_=!0,t.generator_=null,t.isSDPExchanging_=!1,t.ssrc_={audio:0,video:0,small:0},t}return s(k,[{key:"initialize",value:function(){v(d(k.prototype),"initialize",this).call(this),this.installEvents()}},{key:"reset",value:function(){v(d(k.prototype),"close",this).call(this),this.uninstallEvents(),this.clearExchangeSDPTimeout()}},{key:"close",value:function(){this.reset(),this.emitConnectionStateChangedEvent(ba),this.generator_&&(this.generator_.destroy(),this.generator_=null)}},{key:"installEvents",value:function(){this.emitter_.on(cm,this.handleError,this),this.emitter_.on(um,this.handleConnectionStateChange,this)}},{key:"uninstallEvents",value:function(){this.emitter_.off(cm,this.handleError,this),this.emitter_.off(um,this.handleConnectionStateChange,this)}},{key:"publish",value:(y=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.localStream_=t,n=t.getMediaStream(),this.log_.info("is publishing stream: ".concat(t.getId())),r=this.localStream_.getAudioTrack(),i=this.localStream_.getVideoTrack(),r&&this.peerConnection_.addTrack(r,n),i&&(this.peerConnection_.addTrack(i,n),this.client_.getIsEnableSmallStream()&&(a=this.localStream_.getVideoProfile(),this.generator_=new e_,o=this.generator_.generateSmallVideoTrack({videoTrack:i,videoProfile:a,smallStreamConfig:this.client_.smallStreamConfig_}),this.peerConnection_.addTrack(o,n))),this.updateMediaSettings(n),e.next=10,this.connect();case 10:return e.abrupt("return",t);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"updateMediaSettings",value:function(e){var t=this,n=this.client_.getSystemResult().detail,r=n.isH264EncodeSupported,i=n.isVp8EncodeSupported,a="";r?a="H264":i&&(a="VP8");var o={EncVideoCodec:a,EncVideoWidth:0,EncVideoHeight:0,EncVideoBr:"0",EncVideoFps:0,EncAudioCodec:"opus",EncAudioFS:0,EncAudioCh:0,EncAudioBr:"0"};"getSettings"in MediaStreamTrack.prototype?e.getTracks().forEach((function(e){var n=e.getSettings();if("audio"===e.kind){var r=1;n.channelCount&&(r=n.channelCount),o.EncAudioCh=r,o.EncAudioBr="".concat(1e3*t.localStream_.getAudioBitrate()),o.EncAudioFS=n.sampleRate}else"video"===e.kind&&(t.client_.getIsEnableSmallStream()&&(o.EncSmallVideoWidth=t.client_.smallStreamConfig.width,o.EncSmallVideoHeight=t.client_.smallStreamConfig.height,o.EncSmallVideoFps=t.client_.smallStreamConfig.framerate,o.EncSmallVideoBr="".concat(1e3*t.client_.smallStreamConfig.bitrate)),o.EncVideoWidth=n.width,o.EncVideoHeight=n.height,o.EncVideoFps=n.frameRate,o.EncVideoBr="".concat(1e3*t.localStream_.getVideoBitrate()))})):o=this.getMediaSettingsFromProfile(o),this.log_.info("updateMediaSettings: "+JSON.stringify(o)),this.signalChannel_.send(mp,o)}},{key:"getMediaSettingsFromProfile",value:function(e){var t=this.localStream_;if(t){if(t.getAudioTrack()){var n=t.getAudioProfile();e.EncAudioCh=n.channelCount,e.EncAudioBr="".concat(1e3*n.bitrate),e.EncAudioFS=n.sampleRate}if(t.getVideoTrack()){var r=t.getVideoProfile();e.EncVideoWidth=r.width,e.EncVideoHeight=r.height,e.EncVideoFps=r.frameRate,e.EncVideoBr="".concat(1e3*r.bitrate)}}return e}},{key:"addTrack",value:(S=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.peerConnection_){e.next=19;break}if(this.log_.info("is adding ".concat(t.kind," track to current published local stream")),!(this.peerConnection_.getTransceivers().findIndex((function(e){return"stopped"===e.direction}))>=0)){e.next=6;break}return this.log_.warn("transceiver is stopping, negotiate sdp first"),e.next=6,this.updateOffer(uo,t);case 6:if(!(n=this.peerConnection_.getSenders().find((function(e){return e.track&&e.track.kind===t.kind})))){e.next=13;break}return this.log_.warn("sender already exists, remove sender first"),r=n.track,this.removeSender(n),e.next=13,this.updateOffer(uo,r);case 13:return i=this.localStream_.getMediaStream(),this.peerConnection_.addTrack(t,i),this.updateMediaSettings(i),e.next=18,this.updateOffer(co,t);case 18:pf(this.userId_,{eventId:t.kind===ao?Dp:Pp,eventDesc:"add ".concat(t.kind," track to current published stream"),timestamp:As(),userId:this.userId_,tinyId:this.tinyId_});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"isNeedToResetOfferOrder",value:function(){if("plan-b"===this.sdpSemantics_||!this.peerConnection_||!this.peerConnection_.localDescription)return!1;for(var e=this.peerConnection_.localDescription.sdp,t=Af(e),n=0;n<t.media.length;n++)if(0===t.media[n].mid&&"video"===t.media[n].type)return!0;return!1}},{key:"removeSender",value:function(e){var t=null;"RTCPeerConnection"in window&&"getTransceivers"in window.RTCPeerConnection.prototype&&(t=this.peerConnection_.getTransceivers().find((function(t){return t.sender&&t.sender.track===e.track}))),this.peerConnection_.removeTrack(e),t&&qs(t.stop)&&(this.log_.info("stop transceiver"),t.stop())}},{key:"removeTrack",value:(g=i(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.peerConnection_||!Wf()){e.next=13;break}if(this.log_.info("is removing ".concat(t.kind," track from current published local stream")),"video"!==t.kind||!this.isNeedToResetOfferOrder()){e.next=8;break}return this.reset(),this.initialize(),e.next=7,this.publish(this.localStream_);case 7:return e.abrupt("return");case 8:return(n=this.peerConnection_.getSenders().find((function(e){return e.track===t})))&&(this.removeSender(n),this.updateMediaSettings(this.localStream_.getMediaStream())),e.next=12,this.updateOffer(uo,t);case 12:pf(this.userId_,{eventId:t.kind===ao?Op:Mp,eventDesc:"remove ".concat(t.kind," track from current published stream"),timestamp:As(),userId:this.userId_,tinyId:this.tinyId_});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"isReplaceTrackAvailable",value:function(){return"RTCRtpSender"in window&&"replaceTrack"in window.RTCRtpSender.prototype}},{key:"replaceTrack",value:(m=i(regeneratorRuntime.mark((function e(t){var n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isReplaceTrackAvailable()&&Wf()){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"replaceTrack is not supported in this browser, please use switchDevice or addTrack instead"});case 2:if(this.peerConnection_){e.next=4;break}throw new So({code:go.INVALID_OPERATION,message:"replaceTrack() is only valid after the LocalStream has been published"});case 4:if(0!==(n=this.peerConnection_.getSenders()).length){e.next=7;break}throw new So({code:go.INVALID_OPERATION,message:"replaceTrack() is only valid after the LocalStream has been published"});case 7:n.forEach((function(e){e.track&&e.track.kind===t.kind&&(r.log_.info("is replacing ".concat(t.kind," track to current published local stream")),e.replaceTrack(t))})),pf(this.userId_,{eventId:t.kind===ao?Gp:zp,eventDesc:"replace ".concat(t.kind," track from current published stream"),timestamp:As(),userId:this.userId_,tinyId:this.tinyId_});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"setBandwidth",value:(f=i(regeneratorRuntime.mark((function e(t,n,r){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isUplink_){e.next=2;break}return e.abrupt("return",r);case 2:if(Kf()){e.next=4;break}return e.abrupt("return","video"===n?this.updateVideoBandwidthRestriction(r,t):this.updateAudioBandwidthRestriction(r,t));case 4:if(!(i=this.peerConnection_.getSenders().find((function(e){return e.track&&e.track.kind===n})))){e.next=20;break}return(a=i.getParameters()).encodings&&0!==a.encodings.length||(a.encodings=[{}]),"unlimited"===t?delete a.encodings[0].maxBitrate:a.encodings[0].maxBitrate=1e3*t,e.prev=9,e.next=12,i.setParameters(a);case 12:return this.log_.debug(n+" bandwidth was set to "+t+" kbps"),e.abrupt("return",r);case 16:return e.prev=16,e.t0=e.catch(9),this.log_.info("failed to set bandwidth by setting maxBitrate: "+e.t0),e.abrupt("return","video"===n?this.updateVideoBandwidthRestriction(r,t):this.updateAudioBandwidthRestriction(r,t));case 20:return e.abrupt("return",r);case 21:case"end":return e.stop()}}),e,this,[[9,16]])}))),function(e,t,n){return f.apply(this,arguments)})},{key:"setSmallStreamBandwidth",value:(p=i(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isUplink_){e.next=2;break}return e.abrupt("return",n);case 2:if(Kf()){e.next=4;break}return e.abrupt("return",this.updateSmallVideoBandwidthRestriction(n,t));case 4:if(!(r=this.peerConnection_.getSenders().filter((function(e){return e.track&&"video"===e.track.kind}))[1])){e.next=20;break}return(i=r.getParameters()).encodings&&0!==i.encodings.length||(i.encodings=[{}]),"unlimited"===t?delete i.encodings[0].maxBitrate:i.encodings[0].maxBitrate=1e3*t,e.prev=9,e.next=12,r.setParameters(i);case 12:return this.log_.info("small stream bandwidth was set to "+t+" kbps"),e.abrupt("return",n);case 16:return e.prev=16,e.t0=e.catch(9),this.log_.debug("failed to set small stream bandwidth by setting maxBitrate: "+e.t0),e.abrupt("return",this.updateSmallVideoBandwidthRestriction(n,t));case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[9,16]])}))),function(e,t){return p.apply(this,arguments)})},{key:"updateVideoBandwidthRestriction",value:function(e,t){var n="AS";return hc&&(n="TIAS",t*=1e3),e=-1===e.indexOf("b="+n+":")?e.replace(/m=video (.*)\r\nc=IN (.*)\r\n/,"m=video $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n"):e.replace(new RegExp("b="+n+":.*\r\n"),"b="+n+":"+t+"\r\n")}},{key:"updateAudioBandwidthRestriction",value:function(e,t){var n="AS";return hc&&(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:"updateSmallVideoBandwidthRestriction",value:function(e,t){var n="AS";hc&&(n="TIAS",t*=1e3);var r=/m=video (.*)\r\nc=IN (.*)\r\n/g,i=[],a=r.exec(e);for(i.push(a);null!==a;)a=r.exec(e),i.push(a);var o=i[i.length-2],s=e.slice(0,o.index),c=e.slice(o.index);return e=-1===e.indexOf("b="+n+":")?s+(c=c.replace(/m=video (.*)\r\nc=IN (.*)\r\n/,"m=video $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n")):s+(c=c.replace(new RegExp("b="+n+":.*\r\n"),"b="+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=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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:(l=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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 l.apply(this,arguments)})},{key:"createOffer",value:(c=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection_.createOffer(t_);case 3:return t=e.sent,e.next=6,this.peerConnection_.setLocalDescription(t);case 6:this.updateSSRC(t.sdp),Us({eventType:Fa,kind:"offer"}),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),Vs({eventType:Fa,kind:"offer",error:e.t0}),e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return c.apply(this,arguments)})},{key:"doExchangeSDP",value:function(){var e=this;return new Promise((function(t,n){e.exchangeSDPTimeout_=setTimeout((function(){e.signalChannel_.off(cp.PUBLISH_RESULT,r),e.signalChannel_.off(cp.ON_PUBLISH_RESPONSE,r),e.clearExchangeSDPTimeout();var t=new So({code:go.API_CALL_TIMEOUT,message:"exchange sdp timeout"});n(t)}),5e3);var r=function(){var r=i(regeneratorRuntime.mark((function r(i){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,e.clearExchangeSDPTimeout(),r.next=4,e.acceptAnswer(i.data.content);case 4:t(),r.next=10;break;case 7:r.prev=7,r.t0=r.catch(0),n(r.t0);case 10:case"end":return r.stop()}}),r,null,[[0,7]])})));return function(e){return r.apply(this,arguments)}}(),a={type:e.peerConnection_.localDescription.type,sdp:e.removeVideoOrientation(e.peerConnection_.localDescription.sdp)};e.signalChannel_.once(cp.PUBLISH_RESULT,r),e.signalChannel_.once(cp.ON_PUBLISH_RESPONSE,r),e.log_.debug("sending sdp offer: "+a.sdp),e.signalChannel_.send(vp,a,0)}))}},{key:"setSDPDirection",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all",r=Af(e);return r.media.forEach((function(e){"all"!==n&&e.type!==n||(e.direction=t)})),Pf(r)}},{key:"updateOffer",value:(o=i(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection_.createOffer(t_);case 3:return r=e.sent,hc&&(r.sdp=this.setSDPDirection(r.sdp,"sendrecv")),e.next=7,this.peerConnection_.setLocalDescription(r);case 7:return i={action:t,trackId:n.id,kind:n.kind,type:"offer",sdp:this.peerConnection_.localDescription.sdp},this.log_.info("createOffer success, sending updated offer to remote server"),this.log_.debug("updatedOffer: "+i.sdp),e.next=12,this.doUpdateOffer(i);case 12:Us({eventType:Fa,kind:"offer"}),e.next=20;break;case 15:throw e.prev=15,e.t0=e.catch(0),this.log_.error(e.t0),Vs({eventType:Fa,kind:"offer",error:e.t0}),e.t0;case 20:case"end":return e.stop()}}),e,this,[[0,15]])}))),function(e,t){return o.apply(this,arguments)})},{key:"doUpdateOffer",value:function(e){var t=this;return new Promise((function(n,r){t.signalChannel_.send(up,e,0);var a=setTimeout((function(){t.signalChannel_.off(cp.UPDATE_OFFER_RESULT,o),r(new So({code:go.API_CALL_TIMEOUT,message:"update offer timeout observed"}))}),1e4),o=function(){var e=i(regeneratorRuntime.mark((function e(i){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,clearTimeout(a),e.next=4,t.acceptAnswer(i.data.content);case 4:n(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),r(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}();t.signalChannel_.once(cp.UPDATE_OFFER_RESULT,o)}))}},{key:"acceptAnswer",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(77392!==t.result){e.next=3;break}throw this.log_.error("your device does not support H.264 encoding."),new So({code:go.NOT_SUPPORTED_H264,message:"your device does not support H.264 encoding."});case 3:return n=this.localStream_.getVideoBitrate(),r=this.localStream_.getAudioBitrate(),i=this.removeVideoOrientation(t.sdp),e.prev=6,e.next=9,this.setBandwidth(n,"video",i);case 9:return i=e.sent,e.next=12,this.setBandwidth(r,"audio",i);case 12:if(i=e.sent,!this.client_.getIsEnableSmallStream()){e.next=18;break}return a=this.client_.smallStreamConfig,e.next=17,this.setSmallStreamBandwidth(a.bitrate,i);case 17:i=e.sent;case 18:return o={type:t.type,sdp:i},e.next=21,this.peerConnection_.setRemoteDescription(o);case 21:this.log_.debug("accepted answer: "+i),Us({eventType:ja,kind:"answer"}),e.next=30;break;case 25:throw e.prev=25,e.t0=e.catch(6),Vs({eventType:ja,kind:"answer",error:e.t0}),this.log_.error("failed to accept remote answer "+e.t0),e.t0;case 30:case"end":return e.stop()}}),e,this,[[6,25]])}))),function(e){return r.apply(this,arguments)})},{key:"sendMutedFlag",value:function(e){var t={srctinyid:0,userid:this.userId_,flag:e};this.log_.info("send muted flag: ".concat(e)),this.signalChannel_.send(fp,t)}},{key:"getIsReconnecting",value:function(){return this.isReconnecting_}},{key:"reconnect",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.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 So({code:go.UPLINK_RECONNECTION_FAILED,message:"uplink reconnect failed, please check your network and publish again"}),Vs({eventType:Na,error:t}),this.addEventInternal(cf,"uplink-connection reconnect fail"),this.emitConnectionStateChangedEvent(ba),this.emitter_.emit(cm,t),e.abrupt("return");case 12:if(this.signalChannel_.getCurrentState()===ap){e.next=16;break}return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"),this.signalChannel_.once(ep,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,"]")),n=Ws(this.reconnectionCount_),this.reconnectionTimer_=setTimeout((function(){r.log_.warn("reconnect() uplink reconnect timeout(".concat(n/1e3,"s), try again")),r.signalChannel_.off(cp.UNPUBLISH_RESULT,r.onUnpublishResult,r),r.clearReconnectionTimer(),r.reconnect()}),n),!(this.isSDPExchanging_||this.peerConnection_&&"connecting"===this.peerConnection_.connectionState)){e.next=23;break}return e.abrupt("return");case 23:this.signalChannel_.send(gp),this.signalChannel_.once(cp.UNPUBLISH_RESULT,this.onUnpublishResult,this),e.next=29;break;case 27:e.prev=27,e.t0=e.catch(17);case 29:case"end":return e.stop()}}),e,this,[[17,27]])}))),function(){return n.apply(this,arguments)})},{key:"onUnpublishResult",value:(t=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.reset(),this.initialize(),e.next=5,this.publish(this.localStream_);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return t.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:"stopReconnection",value:function(){this.log_.info("stop uplink reconnection"),this.isReconnecting_=!1,this.reconnectionCount_=0,this.clearReconnectionTimer(),this.signalChannel_.off(ep,this.reconnect,this)}},{key:"handleError",value:function(e){e.getCode()===go.ICE_TRANSPORT_ERROR&&(this.isFirstConnection_&&(this.isFirstConnection_=!1,Vs({eventType:La,error:e})),this.isReconnecting_||(this.isReconnecting_=!0,this.emitConnectionStateChangedEvent(Ta),this.reconnect(),this.addEventInternal(of,"uplink-connection is reconnecting")))}},{key:"handleConnectionStateChange",value:function(e){e.state===Ra&&(this.isFirstConnection_&&(this.isFirstConnection_=!1,Us({eventType:La}),this.addEventInternal(ef,"uplink-connection is connected")),this.isReconnecting_&&(Us({eventType:Na}),this.log_.warn("reconnect() uplink reconnect successfully"),this.addEventInternal(sf,"uplink-connection reconnect success"),this.stopReconnection()))}},{key:"updateSSRC",value:function(e){var t=this;try{var n=0;Af(e).media.forEach((function(e){if("audio"===e.type){var r=e.ssrcs[0];r&&(t.ssrc_.audio=r.id)}else{var i=e.ssrcs[0];switch(n+=1){case 1:i&&(t.ssrc_.video=i.id);break;case 2:i&&(t.ssrc_.small=i.id)}}}))}catch(O_){}}},{key:"getLocalStreamVideoTrackId",value:function(){if(this.localStream_){var e=this.localStream_.getVideoTrack();if(e)return e.id}return""}},{key:"getSSRC",value:function(){return this.ssrc_}}]),k}(Km),r_=function(e){u(f,e);var t,n,r,o,c,l,h,p=_(f);function f(e){var t;return a(this,f),(t=p.call(this,e)).remoteStreams_=new Map,t.autoSubscribe=e.autoSubscribe,t.trackState_={audio:e.trackState.audio,video:e.trackState.video,auxiliary:e.trackState.auxiliary},t.ssrc_={audio:0,video:0,auxiliary:0},t.subscribeState_={audio:e.autoSubscribe,video:e.autoSubscribe,auxiliary:e.autoSubscribe},t.pendingSubscription_=[],t.pendingStreams_=[],t.subscriptionTimeout_=-1,t.subscriptionRetryCount_=0,t.isSubscriptionPending_=!1,t.sentSubscriptionAfterConnected_=!1,t.isSDPExchanging_=!1,t.isReconnecting_=!1,t.reconnectionCount_=0,t.reconnectionTimer_=-1,t.isFirstConnection_=!0,t.installEvents(),t}return s(f,[{key:"isMainStreamSubscribed",get:function(){return(this.subscribeState_.audio||this.subscribeState_.video)&&(this.trackState_.audio||this.trackState_.video)}},{key:"isAuxStreamSubscribed",get:function(){return this.subscribeState_.auxiliary&&this.trackState_.auxiliary}},{key:"initialize",value:function(){v(d(f.prototype),"initialize",this).call(this),this.peerConnection_.ontrack=this.onTrack.bind(this)}},{key:"close",value:function(){var e=this;v(d(f.prototype),"close",this).call(this),this.emitConnectionStateChangedEvent(ba),-1!==this.subscriptionTimeout_&&(clearTimeout(this.subscriptionTimeout_),this.subscriptionTimeout_=-1),this.remoteStreams_.forEach((function(t){var n=t;n.setConnection(null),n.getIsStreamAddedEventEmitted()&&e.emitter_.emit(am,{stream:n})})),this.remoteStreams_.clear(),this.uninstallEvents()}},{key:"installEvents",value:function(){var e=this;Dm.on(Mm.REMOTE_STREAM_TRACK_UPDATED,this.onRemoteStreamUpdate,this),this.signalChannel_.on(cp.SUBSCRIBE_CHANGE_RESULT,this.onSubscribeChangeResult,this),this.signalChannel_.on(cp.UNSUBSCRIBE_RESULT,this.onUnsubscribeResult,this),this.emitter_.on(cm,(function(t){if(t.getCode()===go.ICE_TRANSPORT_ERROR&&(e.isFirstConnection_&&(e.isFirstConnection_=!1,Vs({eventType:Ua,error:t})),!e.isReconnecting_)){e.isReconnecting_=!0;var n=e.client_.getSubscriptionManager();if(n){var r,i=k(e.remoteStreams_.values());try{for(i.s();!(r=i.n()).done;){var a=r.value,o=a.getType();("main"===o&&(e.trackState_.audio||e.trackState_.video)||"auxiliary"===o&&e.trackState_.auxiliary)&&n.setAutoRecoveryFlag(e.userId_,a.getType())}}catch(s){i.e(s)}finally{i.f()}}e.emitConnectionStateChangedEvent(Ta),e.reconnect(),e.addEventInternal(uf,"downlink-connection is reconnecting")}})),this.emitter_.on(um,(function(t){t.state===Ra&&e.isFirstConnection_&&(e.isFirstConnection_=!1,Us({eventType:Ua}),e.addEventInternal(tf,"downlink-connection is connected"))}))}},{key:"uninstallEvents",value:function(){Dm.removeListener(Mm.REMOTE_STREAM_TRACK_UPDATED,this.onRemoteStreamUpdate,this),this.signalChannel_.removeListener(cp.SUBSCRIBE_CHANGE_RESULT,this.onSubscribeChangeResult,this),this.signalChannel_.removeListener(cp.UNSUBSCRIBE_RESULT,this.onUnsubscribeResult,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===so?Sa:ga,n=this.remoteStreams_.get(t);if(!n)return;e.action===co?this.handleRemoteAddTrack(e.kind,n):this.handleRemoteRemoveTrack(e.kind,n)}}},{key:"handleRemoteAddTrack",value:function(e,t){this.log_.info("remote add ".concat(e," track")),"audio"===e?t.updateAudioPlayingState(this.subscribeState_.audio):t.updateVideoPlayingState(e===so?this.subscribeState_.auxiliary:this.subscribeState_.video),t.getIsStreamAddedEventEmitted()?this.emitter_.emit(om,{stream:t}):(this.emitter_.emit(im,{stream:t}),this.currentState_===Ra&&t.emitConnectionStateChanged({prevState:ba,state:Ra}))}},{key:"handleRemoteRemoveTrack",value:function(e,t){t.getIsStreamAddedEventEmitted()&&(this.log_.info("remote remove ".concat(e," track")),e!==so&&(this.trackState_.audio||this.trackState_.video)||t.isInSubscriptionCycle()?("audio"===e?t.updateAudioPlayingState(!1):t.updateVideoPlayingState(!1),this.emitter_.emit(om,{stream:t})):(this.log_.info("remote stream ".concat(t.getType()," removed")),this.currentState_===Ra&&t.emitConnectionStateChanged({prevState:Ra,state:ba}),this.emitter_.emit(am,{stream:t})))}},{key:"updateTrackState",value:function(e,t){var n=e===co;switch(t){case ao:this.trackState_.audio=n;break;case oo:this.trackState_.video=n;break;case so:this.trackState_.auxiliary=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)),"unified-plan"===this.sdpSemantics_){var r=function(e){var t=xf.parse(e),n={audio:[],video:[]};return t.media.forEach((function(e){if(e.ssrcs){var t=e.ssrcs[0].id>>16&255;if("audio"===e.type)n.audio.push(ga);else if("video"==e.type){var r=t===ya?ga:Sa;n.video.push(r)}}})),n}(this.peerConnection_.remoteDescription.sdp);if("audio"===n.kind){if(0===r.audio.length||t.id!==ga)return void this.log_.debug("skip this invalid audio track")}else if(-1===r.video.indexOf(t.id))return void this.log_.debug("skip this invalid video track: ".concat(n.id," msid: ").concat(t.id))}Ns({eventType:"ontrack",kind:n.kind});var i=!1,a=this.remoteStreams_.get(t.id),o=t.id===ga?"main":"auxiliary";if(Ks(a)&&((a=new Ym({type:o,userId:this.userId_,client:this.client_})).setConnection(this),this.remoteStreams_.set(t.id,a),i=!0),a.setMediaStream(t),n.kind===ao?a.updateAudioPlayingState(this.subscribeState_.audio):"main"===o?a.updateVideoPlayingState(this.subscribeState_.video):a.updateVideoPlayingState(this.subscribeState_.auxiliary),("auxiliary"!==o||this.trackState_.auxiliary)&&("main"!==o||this.trackState_.audio||this.trackState_.video)){var s=this.client_.getSubscriptionManager();s&&s.hasAutoRecoveryFlag(this.userId_,o)||(i?this.emitter_.emit(im,{stream:a}):this.emitter_.emit(om,{stream:a}))}}},{key:"addRRTRLine",value:function(e){var t=e.split("\r\n"),n=new Map;t.forEach((function(e,r){/^a=rtcp-fb:/.test(e)&&t[r+1]&&!/^a=rtcp-fb:/.test(t[r+1])&&n.set(r+1,e.match(/^a=rtcp-fb:\d+/)[0]+" rrtr")}));for(var r=S(n),i=0;i<r.length;i++){var a=g(r[i],2),o=a[0],s=a[1];t.splice(o+i,0,s)}return t.join("\r\n")}},{key:"addSPSDescription",value:function(e){var t=Af(e);return t.media.forEach((function(e){"video"===e.type&&e.fmtp.forEach((function(e){e.config+=";sps-pps-idr-in-keyframe=1"}))})),Pf(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=Af(e);return n.media.forEach((function(e){e.ext=e.ext.filter((function(e){return!t.includes(e.uri)}))})),Pf(n)}},{key:"isSubscriptionStateNotChanged",value:function(e,t){return"main"===e.getType()?!Ks(t.audio)&&!Ks(t.video)&&t.audio===this.subscribeState_.audio&&t.video===this.subscribeState_.video:"auxiliary"===e.getType()?!Ks(t.video)&&this.subscribeState_.auxiliary===t.video:void 0}},{key:"subscribe",value:(h=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.emitEvent,i=void 0===r||r,a=t.getType(),!this.isSubscriptionStateNotChanged(t,n)){e.next=13;break}if(!this.peerConnection_){e.next=8;break}return e.next=6,this.waitForPeerConnectionConnected();case 6:e.next=11;break;case 8:return this.initialize(),e.next=11,this.connect();case 11:return i&&this.emitter_.emit(sm,{stream:t,result:!0}),e.abrupt("return",t);case 13:if("main"===a?(Ks(n.audio)||(this.subscribeState_.audio=n.audio),Ks(n.video)||(this.subscribeState_.video=n.video),this.addEventInternal(this.subscribeState_.audio?Fp:Bp,this.subscribeState_.audio?"subscribe audio":"unsubscribe audio"),this.addEventInternal(this.subscribeState_.video?Fp:Bp,this.subscribeState_.video?"subscribe video":"unsubscribe video")):Ks(n.video)||(this.subscribeState_.auxiliary=n.video),this.log_.info("subscribe ".concat(a," stream with options ").concat(JSON.stringify(n)," current state: ").concat(JSON.stringify(this.subscribeState_))),!this.peerConnection_&&!this.isSDPExchanging_){e.next=23;break}return o=$a,this.isMainStreamSubscribed||this.isAuxStreamSubscribed||(o=Ya),e.next=20,this.sendSubscription(t,o);case 20:"main"===a?(t.updateAudioPlayingState(this.subscribeState_.audio),t.updateVideoPlayingState(this.subscribeState_.video)):t.updateVideoPlayingState(this.subscribeState_.auxiliary),e.next=26;break;case 23:return this.initialize(),e.next=26,this.connect();case 26:return i&&this.emitter_.emit(sm,{stream:t,result:!0}),e.abrupt("return",t);case 28:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"unsubscribe",value:(l=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("main"!==(n=t.getType())){e.next=9;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,e.next=13;break;case 9:if(this.isAuxStreamSubscribed){e.next=12;break}return this.log_.info("auxiliary stream already unsubscribed"),e.abrupt("return",t);case 12:this.subscribeState_.auxiliary=!1;case 13:return r=Ya,("main"===n&&this.isAuxStreamSubscribed||"auxiliary"===n&&this.isMainStreamSubscribed)&&(r=$a),this.log_.info("unsubscribe ".concat(n," stream with ").concat(JSON.stringify(this.subscribeState_))),e.next=18,this.sendSubscription(t,r);case 18:return t.updateVideoPlayingState(!1),t.updateAudioPlayingState(!1),r===Ya&&((i=t.getMediaStream())&&i.getTracks().forEach((function(e){return i.removeTrack(e)})),this.closePeerConnection(),this.emitConnectionStateChangedEvent(ba)),this.addEventInternal(Bp,"unsubscribe audio"),this.addEventInternal(jp,"unsubscribe video"),e.abrupt("return",t);case 24:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"sendSubscription",value:function(e,t){var n=this;return new Promise((function(r,i){var a={srctinyid:n.tinyId_,userid:n.userId_,audio:n.subscribeState_.audio,bigVideo:n.subscribeState_.video,auxVideo:n.subscribeState_.auxiliary};n.pendingSubscription_.length>0?n.log_.debug("queue the subscription for later handling"):n.doSendSubscription(a,e,t),n.pendingSubscription_.push({stream:e,type:t,data:a,callback:function(e){var a=e.code,o=e.message;if(0===a)r();else{var s="".concat(t," failed");o&&(s="".concat(s,": ").concat(o));var c=new So({code:a,message:s});n.log_.error(c),i(c)}}}),e.setInSubscriptionCycle(!0)}))}},{key:"doSendSubscription",value:function(e,t,n){var r=this;if(!this.peerConnection_||"connected"!==this.peerConnection_.connectionState&&"completed"!==this.peerConnection_.connectionState)return this.log_.debug("try to send subscription [".concat(n,"] when peeConnection connected")),void(this.sentSubscriptionAfterConnected_=!1);t&&this.pendingStreams_.push(t),this.log_.debug("doSendSubscription() send SUBSCRIBE command with data: ".concat(JSON.stringify(e))),n===$a?this.signalChannel_.send(bp,e):n===Ya&&this.signalChannel_.send(yp,e),this.isSubscriptionPending_=!0,this.subscriptionTimeout_=setTimeout((function(){if(r.isSubscriptionPending_)if(r.log_.debug("subscription timeout"),r.subscriptionRetryCount_+=1,r.subscriptionRetryCount_<=3){r.log_.debug("resend subscription");var e=r.pendingSubscription_[0].data;r.doSendSubscription(e,t,n)}else r.log_.error("remote server not response to subscription"),r.pendingSubscription_.shift(),r.pendingStreams_.shift(),r.isSubscriptionPending_=!1,r.subscriptionRetryCount_=0,r.emitter_.emit(cm,new So({code:go.SUBSCRIPTION_TIMEOUT,message:"remote server not response to subscription"}))}),5e3)}},{key:"onSubscribeChangeResult",value:function(e){var t=e.data.content,n=t.srctinyid;if(this.hitTest(n)){var r=this.pendingSubscription_[0];r&&r.type===$a&&r.callback({code:t.errCode,message:t.errMsg}),this.sendNextSubscription()}}},{key:"onUnsubscribeResult",value:function(e){var t=e.data.content,n=t.srctinyid;if(this.hitTest(n)){var r=this.pendingSubscription_[0];r&&r.type===Ya&&r.callback({code:t.errCode,message:t.errMsg}),this.sendNextSubscription()}}},{key:"connect",value:(c=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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 c.apply(this,arguments)})},{key:"exchangeSDP",value:(o=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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 o.apply(this,arguments)})},{key:"createOffer",value:(r=i(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={voiceActivityDetection:!1},"RTCPeerConnection"in window&&"addTransceiver"in window.RTCPeerConnection.prototype&&"unified-plan"===this.sdpSemantics_?(this.peerConnection_.addTransceiver("audio",{direction:"recvonly"}),this.peerConnection_.addTransceiver("video",{direction:"recvonly"}),this.peerConnection_.addTransceiver("video",{direction:"recvonly"})):(t.offerToReceiveAudio=!0,t.offerToReceiveVideo=!0),e.next=4,this.peerConnection_.createOffer(t);case 4:return(n=e.sent).sdp=this.addRRTRLine(n.sdp),n.sdp=this.addSPSDescription(n.sdp),n.sdp=Df(n.sdp),"unified-plan"===this.sdpSemantics_&&(n.sdp=this.removeSDESDescription(n.sdp)),e.next=11,this.peerConnection_.setLocalDescription(n);case 11:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"doExchangeSDP",value:function(){var e=this;return new Promise((function(t,n){var r=-1,a=function(){var o=i(regeneratorRuntime.mark((function i(o){return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(i.prev=0,e.hitTest(o.data.content.srctinyid)){i.next=3;break}return i.abrupt("return");case 3:return clearTimeout(r),e.signalChannel_.off(cp.SUBSCRIBE_RESULT,a,e),i.next=7,e.onSubscribeResult(o);case 7:t(),i.next=13;break;case 10:i.prev=10,i.t0=i.catch(0),n(i.t0);case 13:case"end":return i.stop()}}),i,null,[[0,10]])})));return function(e){return o.apply(this,arguments)}}();r=setTimeout((function(){e.signalChannel_.off(cp.SUBSCRIBE_RESULT,a,e);var t=new So({code:go.API_CALL_TIMEOUT,message:"exchange sdp timeout"});n(t)}),5e3);var o=e.peerConnection_.localDescription,s={type:o.type,sdp:o.sdp,userid:e.userId_,srctinyid:e.tinyId_,audio:e.subscribeState_.audio,bigVideo:e.subscribeState_.video,auxVideo:e.subscribeState_.auxiliary};Dm.emit(Mm.CONNECTION_SEND_SUBSCRIBE_CMD,{client:e.client_,connection:e,userId:e.userId_,tinyId:e.tinyId_,role:_a,subscribeState:e.subscribeState_,trackState:e.trackState_}),e.signalChannel_.on(cp.SUBSCRIBE_RESULT,a,e),e.signalChannel_.send(Sp,s)}))}},{key:"onSubscribeResult",value:(n=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.data.content||77393!==t.data.content.errCode){e.next=3;break}throw this.log_.error("your device does not support H.264 decoding."),new So({code:go.NOT_SUPPORTED_H264,message:"your device does not support H.264 decoding."});case 3:if(n=t.data.content,r=n.type,i=n.sdp,a=n.errCode,o=n.errMsg,e.prev=4,0===a){e.next=7;break}throw new So({code:a,message:"exchange sdp failed".concat(o?" "+o:"")});case 7:return this.log_.debug("accept remote answer: "+i),e.next=10,this.peerConnection_.setRemoteDescription({type:r,sdp:i});case 10:this.updateSSRC(i),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),this.log_.error(e.t0),e.t0;case 17:case"end":return e.stop()}}),e,this,[[4,13]])}))),function(e){return n.apply(this,arguments)})},{key:"updateSSRC",value:function(e){var t=this;try{Af(e).media.forEach((function(e){if("audio"===e.type){var n=e.ssrcs.find((function(e){return e.value.includes(ga)}));n&&(t.ssrc_.audio=n.id)}else{var r=e.ssrcs.find((function(e){return e.value.includes(ga)})),i=e.ssrcs.find((function(e){return e.value.includes(Sa)}));r&&(t.ssrc_.video=r.id),i&&(t.ssrc_.auxiliary=i.id)}}))}catch(O_){}}},{key:"sendNextSubscription",value:function(){void 0!==this.pendingSubscription_.shift()&&(this.subscriptionRetryCount_=0,this.isSubscriptionPending_=!1,-1!==this.subscriptionTimeout_&&(clearTimeout(this.subscriptionTimeout_),this.subscriptionTimeout_=-1));var e=this.pendingStreams_.shift();if(e&&(this.log_.debug("mark ".concat(e.getType()," stream exit subscription cycle")),e.setInSubscriptionCycle(!1)),this.pendingSubscription_.length>0){var t=this.pendingSubscription_[0];this.log_.info("schedule a pending subscription"),this.doSendSubscription(t.data,t.stream,t.type)}}},{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(ga)}},{key:"getAuxStream",value:function(){return this.remoteStreams_.get(Sa)}},{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:(t=i(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.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 So({code:go.DOWNLINK_RECONNECTION_FAILED,message:"downlink reconnect failed, please check your network and re-join room"}),Vs({eventType:Va,error:t}),this.addEventInternal(lf,"downlink-connection reconnect fail"),this.emitConnectionStateChangedEvent(ba),this.emitter_.emit(cm,t),e.abrupt("return");case 12:if(this.signalChannel_.getCurrentState()===ap){e.next=16;break}return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"),this.signalChannel_.once(ep,this.reconnect,this),e.abrupt("return");case 16:if(this.reconnectionCount_++,this.log_.warn("reconnect() try to reconnect downlink [".concat(this.reconnectionCount_,"/").concat(30,"]")),n=Ws(this.reconnectionCount_),this.reconnectionTimer_=setTimeout((function(){r.log_.warn("reconnect() downlink [".concat(r.userId_,"] reconnect timeout(").concat(n/1e3,"s), try again")),r.clearReconnectionTimer(),r.reconnect()}),n),!(this.isSDPExchanging_||this.peerConnection_&&"connecting"===this.peerConnection_.connectionState)){e.next=22;break}return e.abrupt("return");case 22:return e.prev=22,this.closePeerConnection(),this.sentSubscriptionAfterConnected_=!1,this.initialize(),e.next=28,this.connect();case 28:this.stopReconnection(),this.log_.warn("reconnect() downlink reconnect successfully"),Us({eventType:Va}),this.addEventInternal(df,"downlink-connection reconnect success"),this.recoverSubscription(),e.next=37;break;case 35:e.prev=35,e.t0=e.catch(22);case 37:case"end":return e.stop()}}),e,this,[[22,35]])}))),function(){return t.apply(this,arguments)})},{key:"recoverSubscription",value:function(){var e=this,t=this.client_.getSubscriptionManager();t&&S(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(ga)),e}},{key:"clearReconnectionTimer",value:function(){-1!==this.reconnectionTimer_&&(clearTimeout(this.reconnectionTimer_),this.reconnectionTimer_=-1)}},{key:"stopReconnection",value:function(){this.log_.info("stop downlink reconnection"),this.isReconnecting_=!1,this.reconnectionCount_=0,this.clearReconnectionTimer(),this.signalChannel_.off(ep,this.reconnect,this)}},{key:"getCurrentState",value:function(){return this.currentState_}}]),f}(Km),i_=function(e){return function(t,n,r,i){_t(n);var a=ne(t),o=V(a),s=qe(a.length),c=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(c in o){i=o[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw TypeError("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in o&&(i=n(i,o[c],c,a));return i}},a_={left:i_(!1),right:i_(!0)}.left,o_=di("reduce");mt({target:"Array",proto:!0,forced:!o_||!Cl&&Q>79&&Q<83},{reduce:function(e){return a_(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var s_=function(){function e(){a(this,e),this.startTime=0,this.endTime=0,this.start()}return s(e,[{key:"start",value:function(){0===this.startTime&&(this.startTime=ec())}},{key:"stop",value:function(){0===this.endTime&&(this.endTime=ec())}},{key:"getDuration",value:function(){return 0===this.endTime?ec()-this.startTime:this.endTime-this.startTime}}]),e}(),c_=function(){function e(t){a(this,e),this.client_=t.client,this.intervalId_=-1,this.statsCalculator_=new Am,this.prevStats_=null,this.renderFreezeMap_=new Map,this.remoteStreamMap_=new Map,this.dataFreezeMap_=new Map,this.monitorFreezeData_=new Map}var t,n,r;return s(e,[{key:"installEvents",value:function(){Dm.on(Mm.PLAY_VIDEO_START,this.handlePlayVideoStart,this),Dm.on(Mm.VIDEO_TRACK_MUTED,this.onVideoTrackMuted,this),Dm.on(Mm.VIDEO_TRACK_UNMUTED,this.onVideoTrackUnmuted,this),Dm.on(Mm.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this),Dm.on(Mm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),Dm.on(Mm.VIDEO_PLAYING,this.handleVideoPlaying,this)}},{key:"uninstallEvents",value:function(){Dm.off(Mm.PLAY_VIDEO_START,this.handlePlayVideoStart,this),Dm.off(Mm.VIDEO_TRACK_MUTED,this.onVideoTrackMuted,this),Dm.off(Mm.VIDEO_TRACK_UNMUTED,this.onVideoTrackUnmuted,this),Dm.off(Mm.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this),Dm.off(Mm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),Dm.off(Mm.VIDEO_PLAYING,this.handleVideoPlaying,this)}},{key:"start",value:function(){var e=this;-1===this.intervalId_&&(this.installEvents(),this.intervalId_=Fd.setInterval(i(regeneratorRuntime.mark((function t(){return regeneratorRuntime.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]])}))),1e3))}},{key:"stop",value:function(){-1!==this.intervalId_&&(this.uninstallEvents(),Fd.clearInterval(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_,r=t.type_,i="".concat(n,"_").concat(r),a=this.dataFreezeMap_.get(i),o=new s_;a?a.durationItemList.push(o):this.dataFreezeMap_.set(i,{userId:n,type:r,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_,r=t.type_,i="".concat(n,"_").concat(r);this.stopDataFreeze({key:i,userId:n,type:r})}}},{key:"handleStreamStopped",value:function(e){var t=e.client,n=e.stream;if(t===this.client_){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);this.stopDataFreeze({key:a,userId:r,type:i})}}},{key:"stopDataFreeze",value:function(e){var t=e.key,n=e.userId,r=e.type,i=this.dataFreezeMap_.get(t);if(i&&i.isFreezing()){var a=i.durationItemList[i.durationItemList.length-1];a.stop();var o=a.getDuration();o>500?(Ns({eventType:"videoFrozenCount",delta:o}),this.monitorFreezeData_.set(t,{userId:n,type:r,duration:o})):i.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=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.client_.getConnections(),n={},r=k(t),e.prev=3,r.s();case 5:if((i=r.n()).done){e.next=20;break}if(a=g(i.value,2),o=a[0],(s=a[1]).getPeerConnection()){e.next=9;break}return e.abrupt("continue",18);case 9:return c=s.getSubscribeState(),u=s.getTrackState(),e.next=13,this.statsCalculator_.getReceiverStats(s);case 13:d=e.sent,(l={userId:d.userId,tinyId:o,hasVideo:u.video&&c.video,hasAuxiliary:u.auxiliary&&c.auxiliary,video:{framesDecoded:0},auxiliary:{framesDecoded:0}}).hasVideo&&(l.video.framesDecoded=d.video.framesDecoded),l.hasAuxiliary&&(l.auxiliary.framesDecoded=d.auxiliary.framesDecoded),n[d.userId]=l;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",n);case 29:case"end":return e.stop()}}),e,this,[[3,22,25,28]])}))),function(){return r.apply(this,arguments)})},{key:"detectFPS",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.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=regeneratorRuntime.keys(t);case 7:if((e.t1=e.t0()).done){e.next=17;break}if(n=e.t1.value,this.prevStats_[n]){e.next=11;break}return e.abrupt("continue",7);case 11:r=t[n].tinyId,i=this.client_.getMutedStates(),t[n].hasVideo&&this.prevStats_[n].hasVideo&&i.has(r)&&!i.get(r).videoMuted&&(a=t[n].video.framesDecoded-this.prevStats_[n].video.framesDecoded,this.handleRenderFreeze({userId:n,type:"main",fps:a})),t[n].hasAuxiliary&&this.prevStats_[n].hasAuxiliary&&(o=t[n].auxiliary.framesDecoded-this.prevStats_[n].auxiliary.framesDecoded,this.handleRenderFreeze({userId:n,type:"auxiliary",fps:o})),e.next=7;break;case 17:this.prevStats_=t;case 18:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"handleRenderFreeze",value:(t=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.userId,r=t.fps,i=t.type,a="".concat(n,"_").concat(i),o=this.renderFreezeMap_.get(a),r<=2?(s=ec(),o&&!o.isFreeze&&(o.freezeTimeline.push({startTime:s,endTime:void 0}),o.isFreeze=!0),o||this.renderFreezeMap_.set(a,{userId:n,type:i,isFreeze:!0,freezeTimeline:[{startTime:s,endTime:void 0}],renderFreezeTotal:0})):o&&o.isFreeze&&(o.isFreeze=!1,(c=o.freezeTimeline.pop()).endTime=ec(),u=c.endTime-c.startTime,o.freezeTimeline.push(c),o.renderFreezeTotal+=Math.min(5e3,u));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());if(this.remoteStreamMap_.has(n))this.remoteStreamMap_.get(n).remoteStream=t;else this.remoteStreamMap_.set(n,{isPlayingFired:!1,remoteStream:t})}}},{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 r=n.durationItemList[n.durationItemList.length-1];r.stop(),r.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,r=0;if(t)if(t.isFreeze){var i=ec()-t.freezeTimeline[t.freezeTimeline.length-1].startTime;n=t.renderFreezeTotal+Math.min(i,5e3),r=t.freezeTimeline.length}else n=t.renderFreezeTotal;return{renderFreeze:n,count:r}}},{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}(),u_=function e(t){a(this,e),this.userId=t.userId,this.tinyId=t.tinyId,this.role=t.role===_a?"anchor":"audience"};function d_(e){var t=e.retryFunction,n=e.settings,r=e.onError,a=e.onRetrying,o=e.context;return function(){for(var e=this,s=arguments.length,c=new Array(s),u=0;u<s;u++)c[u]=arguments[u];var d=n.retries||5,l=0,h=-1,p=0,f=function(){var s=i(regeneratorRuntime.mark((function i(s,u){var m,_,v,g;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,m=o||e,i.next=4,t.apply(m,c);case 4:_=i.sent,l=0,s(_),i.next=14;break;case 9:i.prev=9,i.t0=i.catch(0),v=function(){clearTimeout(h),l=0,p=2,u(i.t0)},g=function(){2!==p&&l<d?(l++,p=1,qs(a)&&a(l,v),h=setTimeout((function(){h=-1,f(s,u)}),n.timeout||1e3)):v()},r(i.t0,g,u);case 14:case"end":return i.stop()}}),i,null,[[0,9]])})));return function(e,t){return s.apply(this,arguments)}}();return new Promise(f)}}var l_=R((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 r(e,t,r,i,a,o){return n((s=n(n(t,e),n(i,o)))<<(c=a)|s>>>32-c,r);var s,c}function i(e,t,n,i,a,o,s){return r(t&n|~t&i,e,t,a,o,s)}function a(e,t,n,i,a,o,s){return r(t&i|n&~i,e,t,a,o,s)}function o(e,t,n,i,a,o,s){return r(t^n^i,e,t,a,o,s)}function s(e,t,n,i,a,o,s){return r(n^(t|~i),e,t,a,o,s)}function c(e,t){var r,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(r=0;r<e.length;r+=16)c=h,u=p,d=f,l=m,h=i(h,p,f,m,e[r],7,-680876936),m=i(m,h,p,f,e[r+1],12,-389564586),f=i(f,m,h,p,e[r+2],17,606105819),p=i(p,f,m,h,e[r+3],22,-1044525330),h=i(h,p,f,m,e[r+4],7,-176418897),m=i(m,h,p,f,e[r+5],12,1200080426),f=i(f,m,h,p,e[r+6],17,-1473231341),p=i(p,f,m,h,e[r+7],22,-45705983),h=i(h,p,f,m,e[r+8],7,1770035416),m=i(m,h,p,f,e[r+9],12,-1958414417),f=i(f,m,h,p,e[r+10],17,-42063),p=i(p,f,m,h,e[r+11],22,-1990404162),h=i(h,p,f,m,e[r+12],7,1804603682),m=i(m,h,p,f,e[r+13],12,-40341101),f=i(f,m,h,p,e[r+14],17,-1502002290),h=a(h,p=i(p,f,m,h,e[r+15],22,1236535329),f,m,e[r+1],5,-165796510),m=a(m,h,p,f,e[r+6],9,-1069501632),f=a(f,m,h,p,e[r+11],14,643717713),p=a(p,f,m,h,e[r],20,-373897302),h=a(h,p,f,m,e[r+5],5,-701558691),m=a(m,h,p,f,e[r+10],9,38016083),f=a(f,m,h,p,e[r+15],14,-660478335),p=a(p,f,m,h,e[r+4],20,-405537848),h=a(h,p,f,m,e[r+9],5,568446438),m=a(m,h,p,f,e[r+14],9,-1019803690),f=a(f,m,h,p,e[r+3],14,-187363961),p=a(p,f,m,h,e[r+8],20,1163531501),h=a(h,p,f,m,e[r+13],5,-1444681467),m=a(m,h,p,f,e[r+2],9,-51403784),f=a(f,m,h,p,e[r+7],14,1735328473),h=o(h,p=a(p,f,m,h,e[r+12],20,-1926607734),f,m,e[r+5],4,-378558),m=o(m,h,p,f,e[r+8],11,-2022574463),f=o(f,m,h,p,e[r+11],16,1839030562),p=o(p,f,m,h,e[r+14],23,-35309556),h=o(h,p,f,m,e[r+1],4,-1530992060),m=o(m,h,p,f,e[r+4],11,1272893353),f=o(f,m,h,p,e[r+7],16,-155497632),p=o(p,f,m,h,e[r+10],23,-1094730640),h=o(h,p,f,m,e[r+13],4,681279174),m=o(m,h,p,f,e[r],11,-358537222),f=o(f,m,h,p,e[r+3],16,-722521979),p=o(p,f,m,h,e[r+6],23,76029189),h=o(h,p,f,m,e[r+9],4,-640364487),m=o(m,h,p,f,e[r+12],11,-421815835),f=o(f,m,h,p,e[r+15],16,530742520),h=s(h,p=o(p,f,m,h,e[r+2],23,-995338651),f,m,e[r],6,-198630844),m=s(m,h,p,f,e[r+7],10,1126891415),f=s(f,m,h,p,e[r+14],15,-1416354905),p=s(p,f,m,h,e[r+5],21,-57434055),h=s(h,p,f,m,e[r+12],6,1700485571),m=s(m,h,p,f,e[r+3],10,-1894986606),f=s(f,m,h,p,e[r+10],15,-1051523),p=s(p,f,m,h,e[r+1],21,-2054922799),h=s(h,p,f,m,e[r+8],6,1873313359),m=s(m,h,p,f,e[r+15],10,-30611744),f=s(f,m,h,p,e[r+6],15,-1560198380),p=s(p,f,m,h,e[r+13],21,1309151649),h=s(h,p,f,m,e[r+4],6,-145523070),m=s(m,h,p,f,e[r+11],10,-1120210379),f=s(f,m,h,p,e[r+2],15,718787259),p=s(p,f,m,h,e[r+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="",r=32*e.length;for(t=0;t<r;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 r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function l(e){var t,n,r="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),r+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".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,r,i=d(e),a=[],o=[];for(a[15]=o[15]=void 0,i.length>16&&(i=c(i,8*e.length)),n=0;n<16;n+=1)a[n]=909522486^i[n],o[n]=1549556828^i[n];return r=c(a.concat(d(t)),512+8*t.length),u(c(o.concat(r),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}(T)})),h_=function(){function e(t){a(this,e),this.client_=t.client,this.signalChannel_=t.signalChannel,this.isMixing_=!1,this.config_=null,this.data_=null,this.remoteStreamMap_=new Map,this.installEvents()}var t,n;return s(e,[{key:"isPresetLayoutMode",get:function(){return this.config_&&this.config_.mode===Xa.PRESET_LAYOUT}},{key:"installEvents",value:function(){Dm.on(Mm.REMOTE_STREAM_SUBSCRIBED,this.onStreamSubscribed,this),Dm.on(Mm.REMOTE_STREAM_UNSUBSCRIBED,this.onStreamUnsubscribed,this),this.client_.on("stream-removed",this.onStreamRemoved,this)}},{key:"uninstallEvents",value:function(){Dm.off(Mm.REMOTE_STREAM_SUBSCRIBED,this.onStreamSubscribed,this),Dm.off(Mm.REMOTE_STREAM_UNSUBSCRIBED,this.onStreamUnsubscribed,this),this.client_.off("stream-removed",this.onStreamRemoved,this)}},{key:"stop",value:function(){this.uninstallEvents()}},{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:(n=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.resetIsUsedFlag(),this.validateMixTranscodeParamsType(t),this.config_=t,n=this.getInputParam(t,this.remoteStreamMap_),r=this.getOutputParam(t),i=this.getOutputSessionId({config:t,roomId:this.client_.getRoomId(),userId:this.client_.getUserId()}),this.validateMixTranscodeParamsValue(n,r),!this.isMixing_||!this.data_||i===this.data_.outputSessionId){e.next=12;break}return su.info("startMixTranscode() streamId changed, stop mixing before start"),e.next=12,this.doStopMixTranscode();case 12:return e.next=14,this.doStartMixTranscode({outputSessionId:i,inputParam:n,outputParam:r});case 14:e.next=20;break;case 16:throw e.prev=16,e.t0=e.catch(0),this.resetIsUsedFlag(),e.t0;case 20:case"end":return e.stop()}}),e,this,[[0,16]])}))),function(e){return n.apply(this,arguments)})},{key:"doStartMixTranscode",value:function(e){var t=this,n=e.outputSessionId,r=e.inputParam,i=e.outputParam;return new Promise((function(e,a){var o={roomid:String(t.client_.getRoomId()),sdkAppID:String(t.client_.getSDKAppId()),socketid:t.signalChannel_.getSocketId(),mcuRequestTime:Date.now(),outputSessionId:n,inputParam:r,outputParam:i};t.data_=o,su.info("startMixTranscode: ".concat(JSON.stringify(o))),t.signalChannel_.send(wp,o),t.isMixing_=!0;var s=setTimeout((function(){su.error("startMixTranscode timeout observed"),t.isMixing_=!1,t.signalChannel_.off(cp.START_MIX_TRANSCODE_RES,c),a(new So({code:go.START_MIX_TRANSCODE_FAILED,message:"startMixTranscode timeout"}))}),5e3),c=function(n){clearTimeout(s),n.data.content.errCode?(su.error("startMixTranscode failed, errCode: ".concat(n.data.content.errCode," errMsg: ").concat(n.data.content.errMsg)),t.isMixing_=!1,a(new So({code:go.START_MIX_TRANSCODE_FAILED,message:"startMixTranscode failed, errMsg: ".concat(n.data.content.errMsg)}))):e()};t.signalChannel_.once(cp.START_MIX_TRANSCODE_RES,c)}))}},{key:"stopMixTranscode",value:(t=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMixing_){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"mixTranscode hasn't been started"});case 2:return e.next=4,this.doStopMixTranscode();case 4:this.resetIsUsedFlag();case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"doStopMixTranscode",value:function(){var e=this;return new Promise((function(t,n){var r={roomid:String(e.client_.getRoomId()),sdkAppID:String(e.client_.getSDKAppId()),socketid:e.signalChannel_.getSocketId(),userid:e.client_.getUserId(),mcuRequestTime:Date.now(),outPutSessionId:e.data_.outputSessionId,streamType:e.data_.outputParam.streamType};su.info("stopMixTranscode: ".concat(JSON.stringify(r))),e.signalChannel_.send(Ip,r);var i=setTimeout((function(){su.error("stopMixTranscode timeout observed"),e.signalChannel_.off(cp.STOP_MIX_TRANSCODE_RES,a),n(new So({code:go.STOP_MIX_TRANSCODE_FAILED,message:"stopMixTranscode timeout"}))}),5e3),a=function(r){clearTimeout(i),r.data.content.errCode?(su.error("stopMixTranscode failed, errCode: ".concat(r.data.content.errCode," errMsg: ").concat(r.data.content.errMsg)),n(new So({code:go.STOP_MIX_TRANSCODE_FAILED,message:"stopMixTranscode failed, errMsg: ".concat(r.data.content.errMsg)}))):(e.isMixing_=!1,t())};e.signalChannel_.once(cp.STOP_MIX_TRANSCODE_RES,a)}))}},{key:"validateMixTranscodeParamsType",value:function(e){if("object"!==$s(e))throw new So({code:go.INVALID_PARAMETER,message:"param should be object when start mix transcoding"});var t=Xs(e,{streamId:to,videoWidth:no,videoHeight:no,videoBitrate:no,videoFramerate:no,videoGOP:no,audioSampleRate:no,audioBitrate:no,audioChannels:no,backgroundColor:no,backgroundImage:to,mixUsers:io});if(!t.ret)throw new So({code:go.INVALID_PARAMETER,message:t.message});var n={userId:to,pureAudio:ro,width:no,height:no,locationX:no,locationY:no,zOrder:no};e.mixUsers.forEach((function(e){var t=Xs(e,n);if(!t.ret)throw new So({code:go.INVALID_PARAMETER,message:"mixUser.".concat(t.message)})}))}},{key:"getOutputSessionId",value:function(e){var t=e.config,n=e.userId,r=e.roomId;return Qs(t.streamId)&&t.streamId.length>0?t.streamId:l_("".concat(r,"_").concat(n,"_main"))}},{key:"getInputParam",value:function(e,t){var n=e.mixUsers.map((function(e){return{userid:e.userId,width:e.width||0,height:e.height||0,locationX:e.locationX||0,locationY:e.locationY||0,zOrder:e.zOrder,streamType:Ks(e.streamType)||"auxiliary"!==e.streamType?0:1,inputType:e.pureAudio?eo.IT_PURE_AUDIO:eo.IT_AUDIO_VIDEO}}));return e.mode===Xa.PRESET_LAYOUT&&(n.forEach((function(e){if(e.userid===Za.REMOTE){var n=S(t.values()).find((function(e){return!e.isUsed}));n&&(e.userid=n.remoteStream.getUserId(),e.streamType="auxiliary"===n.remoteStream.getType()?1:0,n.isUsed=!0)}})),n=n.filter((function(e){return e.userid!==Za.REMOTE}))),n}},{key:"getOutputParam",value:function(e){var t=e.streamId||"";return{streamId:t,streamType:t.length>0?1:0,videoWidth:Ks(e.videoWidth)?640:e.videoWidth,videoHeight:Ks(e.videoHeight)?480:e.videoHeight,videoBitrate:e.videoBitrate||0,videoFramerate:e.videoFramerate||15,videoGOP:e.videoGOP||2,audioSampleRate:e.audioSampleRate||48e3,audioBitrate:e.audioBitrate||64,audioChannels:e.audioChannels||1,backgroundColor:e.backgroundColor||0,backgroundImage:e.backgroundImage||"",extraInfo:"",VCodec:2,ACodec:0}}},{key:"validateMixTranscodeParamsValue",value:function(e,t){var n=0,r=0;if(e.forEach((function(e){if(Ks(e.userid))throw new So({code:go.INVALID_PARAMETER,message:"mixUser.userId is required"});if(e.inputType!==eo.IT_PURE_AUDIO){if(e.width<0||e.height<0)throw new So({code:go.INVALID_PARAMETER,message:"mixUser.width and mixUser.height can't be less than 0"});if(e.locationX<0||e.locationY<0)throw new So({code:go.INVALID_PARAMETER,message:"mixUser.locationX and mixUser.locationY can't be less than 0"});if(!e.zOrder||e.zOrder<1||e>15)throw new So({code:go.INVALID_PARAMETER,message:"mixUser.zOrder should between 1 and 15"});e.width+e.locationX>n&&(n=e.width+e.locationX),e.height+e.locationY>r&&(r=e.height+e.locationY)}})),t.videoWidth<0||t.videoWidth<0)throw new So({code:go.INVALID_PARAMETER,message:"videoWidth and videoHeight of output stream can't be less than 0"});if(t.videoWidth<n||t.videoHeight<r)throw new So({code:go.INVALID_PARAMETER,message:"videoWidth and videoHeight of output stream should be contain all mix stream"})}},{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}(),p_=function(){function e(t){a(this,e),this.client_=t.client,this.signalChannel_=t.signalChannel,this.isPublishingTencentCDN_=!1,this.publishGivenCDNData_=null,this.isPublishingGivenCDN_=!1}return s(e,[{key:"getIsPublishingTencentCDN",value:function(){return this.isPublishingTencentCDN_}},{key:"getIsPublishingGivenCDN",value:function(){return this.isPublishingGivenCDN_}},{key:"startPublishTencentCDN",value:function(e){var t=this;e=e||"".concat(this.client_.getSDKAppId(),"_").concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main");var n={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),requestTime:Date.now(),sessionId:l_("".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main")),streamId:e,streamType:0};return su.info("startPublishTencentCDN: "+JSON.stringify(n)),new Promise((function(e,r){t.isPublishingTencentCDN_=!0;var i=setTimeout((function(){su.error("startPublishTencentCDN timeout observed"),t.isPublishingTencentCDN_=!1,t.signalChannel_.off(cp.START_PUBLISH_TENCENT_CDN_RES,a),r(new Error("startPublishTencentCDN timeout"))}),5e3),a=function(n){clearTimeout(i);var a=n.data.content,o=a.errCode,s=a.errMsg;0===o?e():(t.isPublishingTencentCDN_=!1,-102083===o&&(s="Please enable relayed-push in https://console.cloud.tencent.com/trtc/ and try later, refer to https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/tutorial-26-advanced-publish-cdn-stream.html"),su.error("startPublishTencentCDN failed, errCode: ".concat(o,", errMsg: ").concat(s)),r(new Error(s)))};t.signalChannel_.once(cp.START_PUBLISH_TENCENT_CDN_RES,a),t.signalChannel_.send(kp,n)}))}},{key:"stopPublishTencentCDN",value:function(){var e=this,t={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),requestTime:Date.now(),sessionId:l_("".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main"))};return su.info("stopPublishTencentCDN: "+JSON.stringify(t)),new Promise((function(n,r){var i=setTimeout((function(){su.error("stopPublishTencentCDN timeout observed"),e.signalChannel_.off(cp.STOP_PUBLISH_TENCENT_CDN_RES,a),r(new Error("stopPublishTencentCDN timeout"))}),5e3),a=function(t){clearTimeout(i);var a=t.data.content,o=a.errCode,s=a.errMsg;0===o?(e.isPublishingTencentCDN_=!1,n()):-102069===o?(su.warn("stopPublishTencentCDN failed, can not stopPublishTencentCDN in auto relayed-push mode"),e.isPublishingTencentCDN_=!1,n()):(su.error("stopPublishTencentCDN failed, errCode: ".concat(o," errMsg: ").concat(s)),r(new Error(s)))};e.signalChannel_.once(cp.STOP_PUBLISH_TENCENT_CDN_RES,a),e.signalChannel_.send(Tp,t)}))}},{key:"startPublishGivenCDN",value:function(e){var t=this,n={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),socketid:this.signalChannel_.getSocketId(),pushRequestTime:Date.now(),pushAppid:e.appId,pushBizId:e.bizId,pushCdnUrl:e.url,pushStreamType:"main"};return su.info("startPublishGivenCDN: "+JSON.stringify(n)),this.publishGivenCDNData_=n,new Promise((function(e,r){t.isPublishingGivenCDN_=!0;var i=setTimeout((function(){su.error("startPublishGivenCDN timeout observed"),t.isPublishingGivenCDN_=!1,t.signalChannel_.off(cp.START_PUBLISH_GIVEN_CDN_RES,a),r(new Error("startPublishGivenCDN timeout"))}),5e3),a=function(n){clearTimeout(i);var a=n.data.content,o=a.errCode,s=a.errMsg;0===o?e():(su.error("startPublishGivenCDN failed, errCode: ".concat(o,", errMsg: ").concat(s)),t.isPublishingGivenCDN_=!1,r(new Error(s)))};t.signalChannel_.once(cp.START_PUBLISH_GIVEN_CDN_RES,a),t.signalChannel_.send(Rp,n)}))}},{key:"stopPublishGivenCDN",value:function(){var e=this,t=this.publishGivenCDNData_,n=t.pushAppid,r=t.pushBizId,i=t.pushCdnUrl,a=t.pushStreamType,o={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),socketid:this.signalChannel_.getSocketId(),pushRequestTime:Date.now(),pushAppid:n,pushBizId:r,pushCdnUrl:i,pushStreamType:a};return su.info("stopPublishGivenCDN: "+JSON.stringify(o)),new Promise((function(t,n){var r=setTimeout((function(){su.error("stopPublishGivenCDN timeout observed"),e.signalChannel_.off(cp.STOP_PUBLISH_GIVEN_CDN_RES,i),n(new Error("stopPublishGivenCDN timeout"))}),5e3),i=function(i){clearTimeout(r);var a=i.data.content,o=a.errCode,s=a.errMsg;0===o?(e.isPublishingGivenCDN_=!1,t()):(su.error("stopPublishGivenCDN failed, errCode: ".concat(o," errMsg: ").concat(s)),n(new Error(s)))};e.signalChannel_.once(cp.STOP_PUBLISH_GIVEN_CDN_RES,i),e.signalChannel_.send(Ep,o)}))}}]),e}(),f_=function(){function e(t){a(this,e),this.client_=t.client,this.durationMap_=new Map,this.installEvents()}return s(e,[{key:"installEvents",value:function(){Dm.on(Mm.REMOTE_STREAM_SUBSCRIBED,this.handleSubscribed,this),Dm.on(Mm.REMOTE_STREAM_TRACK_UPDATED,this.handleStreamTrackUpdated,this),Dm.on(Mm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),Dm.on(Mm.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this)}},{key:"uninstallEvents",value:function(){Dm.off(Mm.REMOTE_STREAM_SUBSCRIBED,this.handleSubscribed,this),Dm.off(Mm.REMOTE_STREAM_UPDATED,this.handleStreamTrackUpdated,this),Dm.off(Mm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),Dm.off(Mm.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this)}},{key:"handleSubscribed",value:function(e){var t=e.client,n=e.stream;if(t===this.client_){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);if(n.hasAudio())if(n.isMainAudioSubscribed){var o=new s_,s=this.durationMap_.get(a);s?this.isRecording(s.audio)||s.audio.push(o):this.durationMap_.set(a,{userId:r,type:i,audio:[o],video:[]})}else this.stopDurationItem(a,"audio");if(n.hasVideo())if("main"===i&&n.isMainVideoSubscribed||"auxiliary"===i&&n.isAuxVideoSubscribed){var c=new s_,u=this.durationMap_.get(a);u?this.isRecording(u.video)||u.video.push(c):this.durationMap_.set(a,{userId:r,type:i,audio:[],video:[c]})}else this.stopDurationItem(a,"video")}}},{key:"handleStreamStopped",value:function(e){var t=e.client,n=e.stream;if(this.clientHitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);this.stopDurationItem(a,"audio"),this.stopDurationItem(a,"video")}}},{key:"handleStreamTrackUpdated",value:function(e){var t=e.client,n=e.userId,r=e.tinyId,i=e.kind,a=e.action;if(this.clientHitTest(t)&&this.client_.getConnections().has(r)){var o=i===so?i:"main",s="".concat(n,"_").concat(o);if(a===co){var c=this.client_.getConnections().get(r).getSubscribeState();if(i===ao&&!c.audio||i===oo&&!c.video||i===so&&!c.auxiliary)return;var u=new s_,d=this.durationMap_.get(s);d?(i!==ao||this.isRecording(d.audio)||d.audio.push(u),i===ao||this.isRecording(d.video)||d.video.push(u)):this.durationMap_.set(s,{userId:n,type:o,audio:i===ao?[u]:[],video:i===ao?[]:[u]})}else this.stopDurationItem(s,i===ao?"audio":"video")}}},{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()}}]),e}(),m_=rd.f,__=x((function(){return!Object.getOwnPropertyNames(1)}));mt({target:"Object",stat:!0,forced:__},{getOwnPropertyNames:m_});var v_=new(function(){function e(){a(this,e),this.prefix_="TRTC",this.queue_=new Map,this.intervalId_=Fd.setInterval(this.doFlush.bind(this),2e4),this.checkStorage()}return s(e,[{key:"getRealKey",value:function(e){return"".concat(this.prefix_,"_").concat(e)}},{key:"checkStorage",value:function(){var e=this;ou()&&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})).forEach((function(e){return localStorage.removeItem(e)}))}},{key:"doFlush",value:function(){if(ou())try{var e,t=k(this.queue_);try{for(t.s();!(e=t.n()).done;){var n=g(e.value,2),r=n[0],i=n[1];localStorage.setItem(r,JSON.stringify(i))}}catch(a){t.e(a)}finally{t.f()}}catch(O_){su.warn(O_)}}},{key:"getItem",value:function(e){if(!ou())return null;try{var t=JSON.parse(localStorage.getItem(this.getRealKey(e)));return t&&t.expiresIn>=Date.now()?t.value:null}catch(O_){su.warn(O_)}}},{key:"setItem",value:function(e,t){if(ou())try{var n={expiresIn:Date.now()+6048e5,value:t};this.queue_.set(this.getRealKey(e),n)}catch(O_){su.warn(O_)}}},{key:"deleteItem",value:function(e){if(!ou())return!1;try{return e=this.getRealKey(e),this.queue_.delete(e),localStorage.removeItem(e),!0}catch(O_){return su.warn(O_),!1}}},{key:"clear",value:function(){if(ou())try{localStorage.clear()}catch(O_){su.warn(O_)}}}]),e}()),g_={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5},S_={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},y_=function e(t){a(this,e),this.str_identifier=String(t.userId),this.uint64_tinyid=Number(t.tinyId),this.uint32_role=t.role},b_=function(){function e(t){var n=this;a(this,e),this.frameWorkType_=t.frameWorkType||30,this.client_=t.client,this.keyPrefix_="key_point",this.storageKey_="".concat(this.keyPrefix_,"_").concat(this.client_.getUserId()),this.log_=new Pm({id:"kpm|"+this.client_.getUserId(),direction:"local",type:""}),this.upload=d_({retryFunction:this.upload,settings:{timeout:500,retries:3},onError:function(e,t){return t()}}),Object.getOwnPropertyNames(this.__proto__).forEach((function(e){e.startsWith("handle")&&qs(n[e])&&(n[e]=function(e){var t=e.fn,n=e.context;return i(regeneratorRuntime.mark((function e(){var r,i,a,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(e.prev=0,r=o.length,i=new Array(r),a=0;a<r;a++)i[a]=o[a];return e.next=4,t.apply(n||this,i);case 4:return e.abrupt("return",e.sent);case 7:e.prev=7,e.t0=e.catch(0),su.error("".concat(t.name,"() error observed ")+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])})))}({fn:n[e],context:n}))})),this.initData(),this.installEvents(),this.intervalId_=Fd.setInterval(this.setStorage.bind(this),2e4)}var n,r,o;return s(e,[{key:"initData",value:function(){this.firstPublishedUserList_=[],this.networkQuality_={totalUplinkRTT:0,totalUplinkLoss:0,count:0,totalDownlinkRTTAndLossMap:new Map},this.basicInfo={string_sdk_version:"4.11.4",uint32_os_type:15,string_device_name:"",string_http_user_agent:navigator.userAgent,string_os_version:"",uint32_avg_rtt:0,uint32_avg_up_loss:0,uint32_scene:"live"===this.client_.getMode()?1:0,uint32_joining_duration:0,uint32_networkType:g_[zs()],uint32_framework:this.frameWorkType_},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_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_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(){Dm.on(Mm.JOIN_START,this.handleJoinStart,this),Dm.on(Mm.JOIN_SEND_CMD,this.handleJoinSendCMD,this),Dm.on(Mm.JOIN_RECEIVED_CMD_RES,this.handleJoinReceivedCMDResponce,this),Dm.on(Mm.JOIN_SUCCESS,this.handleJoinSuccess,this),Dm.on(Mm.JOIN_FAILED,this.handleJoinFailed,this),Dm.on(Mm.RECEIVED_PUBLISHED_USER_LIST,this.handleReceivedPublishUserList,this),Dm.on(Mm.CONNECTION_STATE_CHANGED,this.handleConnectionStateChanged,this),Dm.on(Mm.LEAVE_START,this.handleLeaveStart,this),Dm.on(Mm.LEAVE_SUCCESS,this.handleLeaveSuccess,this),Dm.on(Mm.LEAVE_SEND_CMD,this.handleLeaveSendCMD,this),Dm.on(Mm.CONNECTION_SEND_SUBSCRIBE_CMD,this.handleSendSubscribeCMD,this),Dm.on(Mm.VIDEO_PLAYING,this.handleVideoPlaying,this),Dm.on(Mm.AUDIO_PLAYING,this.handleAudioPlaying,this),Dm.on(Mm.NETWORK_QUALITY,this.handleNetworkQuality,this),Dm.on(Mm.HEARTBEAT_STATS,this.handleHeartbeatStats,this),Dm.on(Mm.REMOTE_STREAM_ADDED,this.handleRemoteStreamAdded,this),Dm.on(Mm.REMOTE_STREAM_SUBSCRIBE_START,this.handleRemoteStreamSubscribeStart,this),Dm.on(Mm.REMOTE_STREAM_SUBSCRIBED,this.handleRemoteStreamSubscribed,this),Dm.on(Mm.VIDEO_LOADED_DATA,this.handleVideoLoadedData,this),Dm.on(Mm.PLAY_STREAM_START,this.handlePlayStream,this),Dm.on(Mm.PUBLISH_START,this.handlePublishStart,this),Dm.on(Mm.LOCAL_STREAM_INITIALIZE_START,this.handleLocalStreamInitStart,this),Dm.on(Mm.LOCAL_STREAM_INITIALIZE_END,this.handleLocalStreamInitEnd,this),Dm.on(Mm.LOCAL_STREAM_INITIALIZE_FAILED,this.handleLocalStreamInitFailed,this)}},{key:"uninstallEvents",value:function(){Dm.off(Mm.JOIN_START,this.handleJoinStart,this),Dm.off(Mm.JOIN_SEND_CMD,this.handleJoinSendCMD,this),Dm.off(Mm.JOIN_RECEIVED_CMD_RES,this.handleJoinReceivedCMDResponce,this),Dm.off(Mm.RECEIVED_PUBLISHED_USER_LIST,this.handleReceivedPublishUserList,this),Dm.off(Mm.CONNECTION_STATE_CHANGED,this.handleConnectionStateChanged,this),Dm.off(Mm.LEAVE_START,this.handleLeaveStart,this),Dm.off(Mm.LEAVE_SUCCESS,this.handleLeaveSuccess,this),Dm.off(Mm.JOIN_FAILED,this.handleJoinFailed,this),Dm.off(Mm.LEAVE_SEND_CMD,this.handleLeaveSendCMD,this),Dm.off(Mm.CONNECTION_SEND_SUBSCRIBE_CMD,this.handleSendSubscribeCMD,this),Dm.off(Mm.VIDEO_LOADED_META_DATA,this.handleVideoPlaying,this),Dm.off(Mm.AUDIO_LOADED_META_DATA,this.handleAudioPlaying,this),Dm.off(Mm.NETWORK_QUALITY,this.handleNetworkQuality,this),Dm.off(Mm.HEARTBEAT_STATS,this.handleHeartbeatStats,this),Dm.off(Mm.REMOTE_STREAM_ADDED,this.handleRemoteStreamAdded,this),Dm.off(Mm.REMOTE_STREAM_SUBSCRIBE_START,this.handleRemoteStreamSubscribeStart,this),Dm.off(Mm.REMOTE_STREAM_SUBSCRIBED,this.handleRemoteStreamSubscribed,this),Dm.off(Mm.VIDEO_LOADED_DATA,this.handleVideoLoadedData,this),Dm.off(Mm.PLAY_STREAM_START,this.handlePlayStream,this),Dm.off(Mm.PUBLISH_START,this.handlePublishStart,this),Dm.off(Mm.LOCAL_STREAM_INITIALIZE_START,this.handleLocalStreamInitStart,this),Dm.off(Mm.LOCAL_STREAM_INITIALIZE_END,this.handleLocalStreamInitEnd,this),Dm.off(Mm.LOCAL_STREAM_INITIALIZE_FAILED,this.handleLocalStreamInitFailed,this)}},{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:"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,n=e.error;this.hitTest(t)&&(this.pathJoinRoom_.uint64_end_time=Date.now(),this.pathJoinRoom_.int32_end_ret=3,this.pathJoinRoom_.int32_send_request_enter_room_cmd_ret=n instanceof So?Number(n.getExtraCode()||n.getCode()):go.UNKNOWN,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.content.userlist)}},{key:"handleConnectionStateChanged",value:function(e){var t=e.client,n=e.state,r=e.connection;if(this.hitTest(t)&&n===Ra){this.client_.getUplinkConnection()===r&&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 i=this.pathMainVideoMap_.get("".concat(r.getUserId(),"_").concat("main"));i&&0===i.statsToReport.uint64_pc_connected_time&&(i.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,r=e.stream;if(this.hitTest(n)){var i=r.getUserId(),a=r.getType(),o="".concat(i,"_").concat(a),s=this.remoteStreamStatsMap_.get(o);if(s)s.stream=r;else{var c={userId:i,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({},S_),stream:r};c.statsToReport.msg_user_info=new y_({userId:i,tinyId:r.getTinyId(),role:_a}),c.statsToReport.uint32_stream_type="main"===a?2:7,this.remoteStreamStatsMap_.set(o,c)}}}},{key:"handleRemoteStreamSubscribeStart",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i),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 y_(e),n=Date.now(),r="".concat(e.userId,"_").concat("main");e.trackState.video&&e.subscribeState.video&&!this.pathMainVideoMap_.has(r)&&this.pathMainVideoMap_.set(r,{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(r)&&this.pathMainAudioMap_.set(r,{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 i="".concat(e.userId,"_").concat("auxiliary");e.trackState.auxiliary&&e.subscribeState.auxiliary&&!this.pathAuxiliaryMap_.has(i)&&this.pathAuxiliaryMap_.set(i,{sendSubscribeCMDTime:n})}}},{key:"handleRemoteStreamSubscribed",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i),o=this.remoteStreamStatsMap_.get(a);o&&0===o.subscribedTime&&(o.subscribedTime=Date.now(),o.stream=n)}}},{key:"handlePlayStream",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),r="".concat(n,"_").concat(t.getType());if(this.remoteStreamStatsMap_.has(r)){var i=this.remoteStreamStatsMap_.get(r);0===i.playStreamTime&&(i.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(),r="".concat(n,"_").concat(t.getType());if(this.pathMainVideoMap_.has(r)){var i=this.pathMainVideoMap_.get(r);0===i.statsToReport.uint64_combine_first_frame_time&&(i.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(),r="".concat(n,"_").concat(t.getType()),i=Date.now();if(this.pathMainVideoMap_.has(r)){var a=this.pathMainVideoMap_.get(r);if(0===a.statsToReport.uint64_render_first_frame_time&&(a.statsToReport.uint64_render_first_frame_time=i),this.remoteStreamStatsMap_.has(r)){var o=this.remoteStreamStatsMap_.get(r),s=o.statsToReport,c=o.playStreamTime,u=o.subscribedTime;0===s.uint32_video_render_first&&c-u<=100&&(s.uint32_video_render_first=i-a.sendSubscribeCMDTime)}}if("auxiliary"===t.getType()&&this.pathAuxiliaryMap_.has(r)&&this.remoteStreamStatsMap_.has(r)){var d=this.remoteStreamStatsMap_.get(r),l=d.statsToReport,h=d.playStreamTime,p=d.subscribedTime;0===l.uint32_video_render_first&&h-p<=100&&(l.uint32_video_render_first=i-this.pathAuxiliaryMap_.get(r).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 r=this.pathMainAudioMap_.get(n);0===r.statsToReport.uint64_play_first_frame_time&&(r.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,r=e.loss,i=e.userId,a=t.networkQuality_.totalDownlinkRTTAndLossMap.get(i);a?(a.totalRTT+=n,a.totalLoss+=r,a.count++):t.networkQuality_.totalDownlinkRTTAndLossMap.set(i,{totalRTT:n,totalLoss:r,count:1})})))}},{key:"handleHeartbeatStats",value:function(e){var t=this;if(this.hitTest(e.client)){var n=e.stats,r=n.VideoReportState,i=n.AudioReportState;r.VideoEncState[0]&&(this.localStreamStats_.totalVideoBitrate+=r.uint32_video_snd_br,this.localStreamStats_.totalVideoFPS+=r.VideoEncState[0].uint32_enc_fps,this.localStreamStats_.totalVideoWidth+=r.VideoEncState[0].uint32_enc_width,this.localStreamStats_.totalVideoHeight+=r.VideoEncState[0].uint32_enc_height,this.localStreamStats_.videoCount++),r.VideoDecState.forEach((function(e){var n=0===e.uint32_video_strtype,r=2===e.uint32_video_strtype,i="".concat(e.userId,"_").concat(n?"main":"auxiliary");if(t.remoteStreamStatsMap_.has(i)){var a=t.remoteStreamStatsMap_.get(i);(n&&a.stream.isMainVideoSubscribed||r&&a.stream.isAuxVideoSubscribed)&&(a.totalVideoFPS+=e.uint32_video_recv_fps,a.totalVideoBitrate+=e.uint32_video_recv_br,a.videoCount++,0===a.statsToReport.uint32_video_width&&(a.statsToReport.uint32_video_width=e.uint32_dec_width),0===a.statsToReport.uint32_video_height&&(a.statsToReport.uint32_video_height=e.uint32_dec_height))}})),i&&(i.AudioDecState.forEach((function(e){var n="".concat(e.userId,"_").concat("main");if(t.remoteStreamStatsMap_.has(n)){var r=t.remoteStreamStatsMap_.get(n);r.stream.isMainAudioSubscribed&&(r.totalAudioBitrate+=e.uint32_audio_real_recv_br,r.audioCount++,Math.floor(100*e.audioLevel)>0&&(r.totalAudioLevel+=e.audioLevel,r.audioLevelCount++))}})),Math.floor(100*i.sentAudioLevel)>0&&(this.localStreamStats_.totalAudioLevel+=i.sentAudioLevel,this.localStreamStats_.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,r=e.error,i=r instanceof So?r.getExtraCode()||r.getCode():{NotFoundError:1,NotAllowedError:2,NotReadableError:3,OverConstrainedError:4,AbortError:5}[r.name]||go.UNKNOWN;t&&0===this.pathJoinRoom_.uint64_init_audio_end_time&&(this.pathJoinRoom_.int32_init_audio_ret=i,this.pathJoinRoom_.uint64_init_audio_end_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_end_time&&(this.pathJoinRoom_.int32_init_camera_ret=i,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:(o=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(t=v_.getItem(this.storageKey_))){e.next=6;break}return e.next=5,this.upload(t);case 5:v_.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 o.apply(this,arguments)})},{key:"setStorage",value:function(){this.prepareReport();var e=this.getReportData();0!==e.msg_path_enter_room.uint64_start_time&&v_.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 r=t.userId;if(e.networkQuality_.totalDownlinkRTTAndLossMap.has(r)){var i=e.networkQuality_.totalDownlinkRTTAndLossMap.get(r),a=i.totalLoss,o=i.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,"audio"),t.statsToReport.uint32_video_play_time=s.getDuration(n,"video")),t.statsToReport.uint32_video_render_first=Math.min(t.statsToReport.uint32_video_render_first,5e3);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>5e3&&(t.statsToReport.uint64_play_first_frame_time=t.statsToReport.uint64_start_enter_time+5e3):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>5e3&&(t.statsToReport.uint64_render_first_frame_time=t.statsToReport.uint64_start_enter_time+5e3):e.pathMainVideoMap_.delete(n)})),this.pathJoinRoom_.uint64_end_time-this.pathJoinRoom_.uint64_start_time>5e3&&(this.pathJoinRoom_.uint64_end_time=this.pathJoinRoom_.uint64_start_time+5e3)}},{key:"getReportData",value:function(){var e=this.client_.getSignalInfo();return{uint32_sdk_app_id:Number(this.client_.getSDKAppId()),msg_user_info:new y_({userId:this.client_.getUserId(),tinyId:this.client_.getTinyId(),role:"anchor"===this.client_.getRole()?_a:va}),msg_basic_info:this.basicInfo,uint32_acc_ip:tc(e.relayIp),uint32_client_ip:tc(e.localIp,"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:S(this.pathMainVideoMap_.values()).map((function(e){return e.statsToReport})),msg_quality_statistics:S(this.remoteStreamStatsMap_.values()).map((function(e){return e.statsToReport})),str_room_name:String(this.client_.getRoomId()),msg_path_recv_audio:S(this.pathMainAudioMap_.values()).map((function(e){return e.statsToReport})),uint32_info_client_ip:tc(e.localIp,"small"),error_code:[],msg_local_statistics:this.localStreamStats_.statsToReport}}},{key:"report",value:(r=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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:v_.deleteItem(this.storageKey_),this.initData(),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 r.apply(this,arguments)})},{key:"upload",value:(n=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!au&&0!==t.msg_path_enter_room.uint64_start_time){e.next=2;break}return e.abrupt("return");case 2:return n=Math.floor(Math.random()*Math.pow(2,31)),r=Number(this.client_.getSDKAppId()),i="".concat("https://yun.tim.qq.com","/v5/AVQualityReportSvc/C2S?random=").concat(n,"&sdkappid=").concat(r,"&cmdtype=jssdk_new_endreport"),e.next=7,Cs.post(i,JSON.stringify(t));case 7:if("ok"===(a=e.sent).data){e.next=10;break}throw"key point upload failed: ".concat(a.data);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})}]),e}(),k_=function(){function e(t){var n,r=this;if(a(this,e),this.mode_=t.mode,this.sdpSemantics_="plan-b",Ks(t.sdpSemantics)?function(){if(!qf())return!1;if(Ks(window.RTCRtpTransceiver))return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;var e=new RTCPeerConnection,t=!1;try{e.addTransceiver("audio"),t=!0}catch(O_){}return e.close(),t}()&&(this.sdpSemantics_="unified-plan"):this.sdpSemantics_=t.sdpSemantics,this.sdkAppId_=t.sdkAppId,this.userId_=t.userId,this.log_=new Pm({id:"c|"+this.userId_,direction:"local",type:""}),this.userSig_=t.userSig,this.roomId_=0,this.useStringRoomId_=t.useStringRoomId||!1,this.recordId_=null,this.pureAudioPushMode_=null,this.version_=t.version,this.log_.info("using sdpSemantics: "+this.sdpSemantics_),su.setConfig({sdkAppId:this.sdkAppId_,userId:this.userId_,version:this.version_}),!Ks(t.recordId)){if(!Number.isInteger(Number(t.recordId)))throw new So({code:go.INVALID_PARAMETER,message:"recordId must be an integer number"});this.recordId_=t.recordId}this.signalChannel_=null,this.isScreenShareOnly_=0,Ks(t.isScreenShareOnly)||(this.isScreenShareOnly_=t.isScreenShareOnly?1:0),this.role_="anchor",this.privateMapKey_="",this.tinyId_=0,this.env_="",this.proxy_=null,this.connections_=new Map,this.mutedStates_=new Map,this.userMap_=new Map,this.syncUserListInterval_=-1,this.localStream_=null,this.isUplinkClosing_=!1,this.uplinkConnection_=null,this.emitter_=new Xh,this.signalInfo_={},this.isSignalReady_=!1,this.isJoined_=!1,this.heartbeat_=-1,this.lastHeartBeatTime_=-1,this.stats_=new Am,this.joinTimeout_=-1,this.unpublishTimeout_=-1,this.networkQuality_=null,this.badCaseDetector_=null,this.autoSubscribe_=!!Ks(t.autoSubscribe)||t.autoSubscribe,this.startJoinTimestamp_=0,this.joinedTimestamp_=0,this.joinOptions={},this.basis_={browser:Lf().browserName+"/"+Lf().browserVersion,os:Zf(),displayResolution:em(),isScreenShareSupported:zf(),isWebRTCSupported:Uf(),isGetUserMediaSupported:tm(),isWebAudioSupported:nm(),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING,isWebCodecSupported:(n={AudioDecoder:!1,AudioEncoder:!1,VideoDecoder:!1,VideoEncoder:!1,ImageDecoder:!1},Ks(window.AudioDecoder)||(n.AudioDecoder=!0),Ks(window.AudioEncoder)||(n.AudioEncoder=!0),Ks(window.VideoDecoder)||(n.VideoDecoder=!0),Ks(window.VideoEncoder)||(n.VideoEncoder=!0),Ks(window.ImageDecoder)||(n.ImageDecoder=!0),n),isMediaSessionSupported:"mediaSession"in navigator&&!Ks(navigator.mediaSession.setActionHandler),isWebTransportSupported:!Ks(window.WebTransport)},this.initBussinessInfo_(t),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_=null,this.keyPointManager_=new b_({client:this,frameWorkType:t.frameWorkType}),["join","leave","publish","unpublish","switchRole"].forEach((function(e){qs(r[e])&&(r[e]=function(e){var t=e.fn,n=e.context,r=e.name,a=!1;return i(regeneratorRuntime.mark((function e(){var i,o,s,c,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"previous ".concat(r,"() is ongoing, please avoid repeated calls")});case 2:for(e.prev=2,a=!0,i=u.length,o=new Array(i),s=0;s<i;s++)o[s]=u[s];return e.next=7,t.apply(n||this,o);case 7:return c=e.sent,a=!1,e.abrupt("return",c);case 12:throw e.prev=12,e.t0=e.catch(2),a=!1,e.t0;case 16:case"end":return e.stop()}}),e,this,[[2,12]])})))}({fn:r[e],context:r,name:e}))})),this.getUserList=d_({retryFunction:this.getUserList,settings:{retries:3},onError:function(e,t){return t()},onRetrying:function(e){r.log_.info("retrying to get user list [".concat(e,"/3]"))}}),this.isPublishing_=!1,this.isEnableSmallStream_=!1,this.smallStreamConfig_={bitrate:100,framerate:15,height:120,width:160},this.turnServers_=[],this.iceTransportPolicy_=t.iceTransportPolicy,this.schedule_={iceServers:null,iceTransportPolicy:null}}var n,r,o,c,u,d,l,h,p,f,m,_,v,S,y,b,T,R,E,w,I,C,x,A,P;return s(e,[{key:"initBussinessInfo_",value:function(e){this.bussinessInfo_=e.bussinessInfo;var t={};if(Qs(e.bussinessInfo)&&(t=JSON.parse(e.bussinessInfo)),!Ks(e.pureAudioPushMode)){if(!Number.isInteger(Number(e.pureAudioPushMode)))throw new So({code:go.INVALID_PARAMETER,message:"pureAudioPushMode must be an integer number"});this.pureAudioPushMode_=e.pureAudioPushMode,t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.pure_audio_push_mod=this.pureAudioPushMode_}if(!Ks(e.streamId)){if(!(Qs(e.streamId)&&String(e.streamId)&&String(e.streamId).length<=64))throw new So({code:go.INVALID_PARAMETER,message:"streamId must be a sting literal within 64 bytes, and not be empty"});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_streamid_main=e.streamId}if(!Ks(e.userDefineRecordId)){if(null===e.userDefineRecordId.match(/^[A-Za-z0-9_-]{1,64}$/gi))throw new So({code:go.INVALID_PARAMETER,message:"userDefineRecordId must be a sting literal contains (a-zA-Z),(0-9), underline and hyphen, within 64 bytes, and not be empty"});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_record_id=e.userDefineRecordId}if(!Ks(e.userDefinePushArgs)){if(!(Qs(e.userDefinePushArgs)&&String(e.userDefinePushArgs)&&String(e.userDefinePushArgs).length<=256))throw new So({code:go.INVALID_PARAMETER,message:"userDefinePushArgs must be a sting literal within 256 bytes, and not be empty"});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_push_args=e.userDefinePushArgs}_f(t)||(this.bussinessInfo_=JSON.stringify(t))}},{key:"setProxyServer",value:function(e){if(this.log_.info("set proxy server: ".concat(JSON.stringify(e))),Qs(e)){if(!e.startsWith("wss://"))throw new So({code:go.INVALID_PARAMETER,message:'proxy server url shall be started with "wss://"'});this.proxy_=e}else if(Gs(e)){var t=e.websocketProxy,n=e.loggerProxy;t&&(this.proxy_=t),n&&pa(n)}}},{key:"getUrl",value:function(e){var t=Bs(e);return!js()&&this.proxy_&&(t=this.proxy_),t}},{key:"getBackupUrl",value:function(){return this.proxy_?this.proxy_:Bs(la)}},{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:"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(Zs(e))})):Gs(e)&&t.push(Zs(e)),this.turnServers_=t}},{key:"getIceTransportPolicy",value:function(){return this.iceTransportPolicy_||this.schedule_.iceTransportPolicy||"all"}},{key:"initialize",value:function(e){var t=this;return new Promise((function(n,r){t.log_.info("setup signal channel"),t.signalChannel_=new vf({sdkAppId:t.sdkAppId_,userId:t.userId_,userSig:t.userSig_,url:t.getUrl(da),backupUrl:t.getUrl(la),version:t.version_}),t.schedule_.iceServers||function(e){return nc.apply(this,arguments)}({sdkAppId:t.sdkAppId_,userId:t.userId_,userSig:t.userSig_,useStringRoomId:t.useStringRoomId_,roomId:e.roomId}).then((function(e){e&&(t.schedule_.iceServers=e.data.iceServers,t.schedule_.iceTransportPolicy=e.data.iceTransportPolicy,t.log_.debug("got iceServers, policy: ".concat(t.schedule_.iceTransportPolicy," server: ").concat(JSON.stringify(t.schedule_.iceServers),", ")))})),t.networkQuality_||(t.networkQuality_=new Om({connections:t.connections_,signalChannel:t.signalChannel_,userId:t.userId_,client:t}),t.networkQuality_.on(km,(function(e){t.emitter_.emit(km,e)}))),t.deviceDetector_||(t.deviceDetector_=new Lm),t.subscriptionManager_||(t.subscriptionManager_=new $m({client:t})),t.badCaseDetector_||(t.badCaseDetector_=new c_({client:t})),t.callDurationCalculator_||(t.callDurationCalculator_=new f_({client:t})),t.mixTranscodeManager_||(t.mixTranscodeManager_=new h_({client:t,signalChannel:t.signalChannel_})),t.publishCDNManager_||(t.publishCDNManager_=new p_({client:t,signalChannel:t.signalChannel_})),t.signalChannel_.on(Zh,(function(e){switch(t.log_.info("SignalChannel state changed from ".concat(e.prevState," to ").concat(e.state)),e.state){case ap:e.prevState===ip?(t.log_.warn("signal channel reconnect successfully"),t.syncUserList(),Us({eventType:za})):e.prevState===rp&&Us({eventType:Ja})}t.emitter_.emit(fm,e)})),t.signalChannel_.on(tp,(function(e){t.isSignalReady_?(t.closeUplink(),t.closeConnections(),t.emitter_.emit(Rm,e)):r(e)})),t.signalChannel_.on(cp.CHANNEL_SETUP_FAILED,(function(e){t.log_.error("signal channel setup failed"),r(e)})),t.signalChannel_.on(cp.CHANNEL_SETUP_SUCCESS,(function(e){t.signalInfo_=e.signalInfo,t.tinyId_=t.signalInfo_.tinyId,t.isSignalReady_||(t.isSignalReady_=!0,n())})),t.signalChannel_.on(cp.PEER_JOIN,t.onPeerJoin,t),t.signalChannel_.on(cp.PEER_LEAVE,t.onPeerLeave,t),t.signalChannel_.on(cp.STREAM_ADDED,(function(e){t.onRemoteStreamAdded(e.data)})),t.signalChannel_.on(cp.STREAM_REMOVED,(function(e){t.onRemoteStreamRemoved(e.data)})),t.signalChannel_.on(cp.UPDATE_REMOTE_MUTE_STAT,(function(e){Dm.emit(Mm.RECEIVED_PUBLISHED_USER_LIST,{client:t,data:e.data}),t.onPublishedUserList(e.data),t.onUpdateRemoteMuteStat(e.data)})),t.signalChannel_.on(cp.CLINET_BANNED,function(){var e=i(regeneratorRuntime.mark((function e(n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.data.content,e.next=3,t.reset();case 3:i=r.type,"banned"===r.type?i="you got banned by account admin":"kick"===r.type?i="duplicated userId joining the room":"user_time_out"===r.type&&t.log_.warn("last heart beat time: ".concat(t.lastHeartBeatTime_," interval: ").concat(Date.now()-t.lastHeartBeatTime_)),Os("stat-banned:".concat(r.type)),t.log_.error("user was banned because of [".concat(r.type,"]")),t.onClientBanned(i);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),t.signalChannel_.on(cp.REQUEST_REBUILD_SESSION,(function(e){t.signalInfo_=e.signalInfo;var n=[];t.connections_&&n.push(0);var r,i=[],a=k(t.connections_);try{for(a.s();!(r=a.n()).done;){var o=g(r.value,2),s=o[0],c=o[1];n.push(s);var u=c.getPeerConnection();if(u){var d=u.remoteDescription;d&&i.push(d.sdp)}}}catch(h){a.e(h)}finally{a.f()}var l={socketid:t.signalInfo_.socketId,tinyid:t.tinyId_,appid:t.sdkAppId_,openid:t.userId_,sessionid:String(t.roomId_),sids:n,relayInfo:t.signalInfo_.relayInnerIp,remotesdp:i,useStrRoomid:!!t.useStringRoomId_&&1};t.log_.debug("reconnect - rebuild session with data: ".concat(JSON.stringify(l))),t.signalChannel_.send(pp,l)})),t.signalChannel_.on(cp.CLIENT_REJOIN,function(){var e=i(regeneratorRuntime.mark((function e(n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.reJoin();case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),t.signalChannel_.connect()}))}},{key:"join",value:(P=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isJoined_){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"duplicate join() called"});case 2:return n=Lf(),e.next=5,Jf();case 5:if(this.checkSystemResult_=e.sent,(r=js())||(r="qcloud",this.proxy_&&(this.proxy_.startsWith(ca)?r="trtc":this.proxy_.startsWith(ua)&&(r="webrtc"))),this.env_=r,Ms({env:r,sdkAppId:this.sdkAppId_,userId:this.userId_,version:this.version_,browserVersion:n.name+n.version,ua:navigator.userAgent}),this.uploadTrtcStats(),i=this.checkSystemResult_.detail,a=i.isH264EncodeSupported,o=i.isVp8EncodeSupported,Uf()&&(a||o)){e.next=14;break}throw new So({code:go.NOT_SUPPORTED,message:"the browser does NOT support WebRTC!"});case 14:if(!this.useStringRoomId_){e.next=20;break}if(Qs(t.roomId)&&/^[A-Za-z\d\s!#$%&()+\-:;<=.>?@[\]^_{}|~,]{1,64}$/.test(t.roomId)){e.next=18;break}throw new So({code:go.INVALID_PARAMETER,message:"roomId must be validate string when useStringRoomId is true"});case 18:e.next=23;break;case 20:if(Ys(t.roomId)&&/^[1-9]\d*$/.test(String(t.roomId))&&t.roomId<4294967295){e.next=23;break}throw new So({code:go.INVALID_PARAMETER,message:"roomId must be validate integer when useStringRoomId is false"});case 23:return this.joinOptions=t,this.startJoinTimestamp_=ec(),Dm.emit(Mm.JOIN_START,{client:this}),pf(this.userId_,{eventId:Yp,eventDesc:"joining room",timestamp:As(),userId:this.userId_,tinyId:this.tinyId_}),e.prev=27,e.next=30,this.initialize(t);case 30:return e.next=32,this.doJoin(t);case 32:Dm.emit(Mm.JOIN_SUCCESS,{client:this}),this.joinedTimestamp_=ec(),s=this.joinedTimestamp_-this.startJoinTimestamp_,Us({eventType:wa,delta:s}),Us({eventType:Ea}),e.next=46;break;case 39:return e.prev=39,e.t0=e.catch(27),Dm.emit(Mm.JOIN_FAILED,{client:this,error:e.t0}),Vs({eventType:Ea,error:e.t0}),e.next=45,this.reset();case 45:throw e.t0;case 46:case"end":return e.stop()}}),e,this,[[27,39]])}))),function(e){return P.apply(this,arguments)})},{key:"uploadTrtcStats",value:(A=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M_.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,M_.getCameras();case 12:i=e.sent,n=i&&i.length,e.next=18;break;case 16:e.prev=16,e.t1=e.catch(9);case 18:a={microphone:t,camera:n},o=this.checkSystemResult_.detail,s=o.isH264EncodeSupported,c=o.isVp8EncodeSupported,u=o.isH264DecodeSupported,d=o.isVp8DecodeSupported,l={webRTC:this.basis_.isWebRTCSupported,getUserMedia:this.basis_.isGetUserMediaSupported,webSocket:this.basis_.isWebSocketsSupported,screenShare:this.basis_.isScreenShareSupported,webAudio:this.basis_.isWebAudioSupported,h264Encode:s,h264Decode:u,vp8Encode:c,vp8Decode:d},h={browser:this.basis_.browser,os:this.basis_.os,trtc:l,devices:a},p={isWebCodecSupported:this.basis_.isWebCodecSupported,isMediaSessionSupported:this.basis_.isMediaSessionSupported,isWebTransportSupported:this.basis_.isWebTransportSupported},Os("trtcstats-"+JSON.stringify(h)),this.log_.info("TrtcStats-"+JSON.stringify(h)),Os("trtcadvancedstats-"+JSON.stringify(p));case 26:case"end":return e.stop()}}),e,this,[[0,7],[9,16]])}))),function(){return A.apply(this,arguments)})},{key:"getVersion",value:function(){var e=this.version_.split(".");return 1e3*parseInt(e[0])+100*parseInt(e[1])+parseInt(e[2])}},{key:"doJoin",value:function(e){var t=this;return new Promise((function(n,r){if(!t.isSignalReady_)throw new So({code:go.INVALID_OPERATION,message:"SignalChannel is not ready yet"});t.roomId_=e.roomId,Ks(e.role)||(t.role_=e.role);var i="";Ks(e.privateMapKey)||(i=e.privateMapKey),t.privateMapKey_=i,t.log_.info("Join() => joining room: ".concat(e.roomId," useStringRoomId: ").concat(t.useStringRoomId_," mode: ").concat(t.mode_," role: ").concat(t.role_));var a=t.signalInfo_,o={openid:a.openId,tinyid:a.tinyId,peerconnectionport:"",useStrRoomid:!!t.useStringRoomId_&&1,roomid:String(e.roomId),sdkAppID:String(t.sdkAppId_),socketid:a.socketId,userSig:t.userSig_,privMapEncrypt:i,privMap:"",relayip:a.relayInnerIp,dataport:a.dataPort,stunport:a.stunPort,checkSigSeq:a.checkSigSeq,pstnBizType:0,pstnPhoneNumber:null,recordId:t.recordId_,role:"user",jsSdkVersion:String(t.getVersion()),sdpSemantics:t.sdpSemantics_,browserVersion:iu,closeLocalMedia:!0,trtcscene:"live"===t.mode_?ma:fa,trtcrole:"anchor"===t.role_?_a:va,bussinessInfo:t.bussinessInfo_,isAuxUser:t.isScreenShareOnly_,autoSubscribe:t.autoSubscribe_};t.joinTimeout_=setTimeout((function(){t.log_.error("join room timeout observed"),r(new So({code:go.JOIN_ROOM_FAILED,message:"join room timeout"}))}),5e3),Dm.emit(Mm.JOIN_SEND_CMD,{client:t});var s={AbilityOption:{GeneralLimit:{CPULimit:{uint32_CPU_num:String(navigator.hardwareConcurrency||0),str_CPU_name:String(navigator.platform),uint32_CPU_maxfreq:String(0),model:"",uint32_total_memory:String(0)},uint32_terminal_type:String(dc?4:sc?2:oc?3:Vc?12:Uc?5:Fc?13:1),uint32_device_type:String(0),str_os_verion:dc?"Android":sc?"iPhone":oc?"iPad":Vc?"Mac":Uc?"Windows":Fc?"Linux":"unknown",uint32_link_type:String(1),str_client_version:"4.11.4",uint32_net_type:String(lo[zs()]),ua:navigator.userAgent,version:""}}},c=t.getSystemResult().detail,u=c.isH264EncodeSupported,d=c.isVp8EncodeSupported,l="";u?l="H264":d&&(l="VP8");var h={EncVideoCodec:l,EncVideoWidth:0,EncVideoHeight:0,EncVideoBr:"0",EncVideoFps:0,EncAudioCodec:"opus",EncAudioFS:0,EncAudioCh:0,EncAudioBr:"0"};s.AbilityOption.AVLimit=h,t.signalChannel_.sendWithReport(dp,o,s),t.signalChannel_.once(cp.JOIN_ROOM_RESULT,(function(e){clearTimeout(t.joinTimeout_),t.joinTimeout_=-1;var i=e.data.content.ret;Dm.emit(Mm.JOIN_RECEIVED_CMD_RES,{client:t,code:i}),i?(t.log_.error("Join room failed result: "+i+" error: "+e.data.content.error),r(new So({code:go.JOIN_ROOM_FAILED,extraCode:i,message:"Failed to join room - "+e.data.content.error}))):(t.isJoined_=!0,t.log_.info("Join room success, start heartbeat"),t.startHeartbeat(),t.badCaseDetector_&&t.badCaseDetector_.start(),t.syncUserList(),t.startSyncUserListInterval(),n())}))}))}},{key:"connectSignalBeforeReJoin",value:function(){var e=this;return new Promise((function(t,n){e.log_.warn("connectSignalBeforeReJoin() try to connect signal before reJoin"),e.isSignalReady_=!1,e.signalChannel_.close(),e.signalChannel_.once(cp.CHANNEL_SETUP_SUCCESS,(function(n){e.log_.warn("connectSignalBeforeReJoin() signal setup successfully"),t()})),e.signalChannel_.once(tp,(function(t){e.log_.warn("connectSignalBeforeReJoin() signal setup failed"),n(t)})),e.signalChannel_.connect()}))}},{key:"reJoin",value:(x=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_){e.next=3;break}return this.log_.warn("reJoin() you haven't join room yet, abort reJoin"),e.abrupt("return");case 3:return this.isJoined_=!1,e.prev=4,this.log_.warn("reJoin() try to reJoin room: ".concat(this.joinOptions.roomId)),this.subscriptionManager_&&this.subscriptionManager_.markAllStream(),e.next=9,this.connectSignalBeforeReJoin();case 9:return e.next=11,this.doJoin(this.joinOptions);case 11:if(this.log_.warn("reJoin() reJoin successfully"),Us({eventType:Ia}),e.prev=13,!this.uplinkConnection_||!this.localStream_||this.uplinkConnection_.getIsReconnecting()){e.next=17;break}return e.next=17,this.republish();case 17:e.next=21;break;case 19:e.prev=19,e.t0=e.catch(13);case 21:e.next=28;break;case 23:e.prev=23,e.t1=e.catch(4),this.log_.warn("reJoin() reJoin failed"+e.t1),Vs({eventType:Ia,error:e.t1}),this.emitter_.emit(Rm,new So({code:go.JOIN_ROOM_FAILED,message:"reJoin room: ".concat(this.joinOptions.roomId," failed, please check your network")}));case 28:case"end":return e.stop()}}),e,this,[[4,23],[13,19]])}))),function(){return x.apply(this,arguments)})},{key:"republish",value:(C=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.log_.warn("republish() try to re-publish localStream"),t=this.localStream_,e.next=5,this.doUnpublish(t);case 5:return e.next=7,this.publish(t);case 7:this.log_.warn("republish() re-publish localStream successfully"),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),this.log_.warn("republish() re-publish localStream failed "+e.t0),e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return C.apply(this,arguments)})},{key:"leave",value:(I=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Dm.emit(Mm.LEAVE_START,{client:this}),pf(this.userId_,{eventId:$p,eventDesc:"leaving room",timestamp:As(),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:return e.prev=9,e.next=12,this.doLeave();case 12:e.next=16;break;case 14:e.prev=14,e.t1=e.catch(9);case 16:Dm.emit(Mm.LEAVE_SUCCESS,{client:this}),Us({eventType:Ca}),t=Math.floor((ec()-this.joinedTimestamp_)/1e3),Us({eventType:xa,delta:t});case 20:case"end":return e.stop()}}),e,this,[[2,7],[9,14]])}))),function(){return I.apply(this,arguments)})},{key:"doLeave",value:function(){var e=this;return new Promise(function(){var t=i(regeneratorRuntime.mark((function t(n,r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.isJoined_){t.next=2;break}return t.abrupt("return",n());case 2:return Dm.emit(Mm.LEAVE_SEND_CMD,{client:e}),e.log_.info("leave() => leaving room"),e.signalChannel_.send(lp),t.next=7,e.reset();case 7:return t.abrupt("return",n());case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}},{key:"clearUnpublishTimeout",value:function(){this.unpublishTimeout_&&(clearTimeout(this.unpublishTimeout_),this.unpublishTimeout_=-1)}},{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:"destroy",value:function(){if(this.isJoined_)throw this.log_.warn("please call leave() before destroy() client"),new So({code:go.INVALID_OPERATION,message:"Please call leave() before destory() the client"});this.log_.info("destroying SignalChannel"),this.signalChannel_&&(this.signalChannel_.close(),this.signalChannel_=null)}},{key:"reset",value:(w=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.keyPointManager_&&this.keyPointManager_.prepareReport(),this.mixTranscodeManager_&&(this.mixTranscodeManager_.stop(),this.mixTranscodeManager_=null),this.publishCDNManager_&&(this.publishCDNManager_=null),this.userMap_.clear(),this.stopSyncUserListInterval(),this.stopHeartbeat(),this.closeConnections(),this.mutedStates_.clear(),this.clearUnpublishTimeout(),this.clearNetworkQuality(),this.badCaseDetector_&&this.callDurationCalculator_&&this.uploadAllCallStats(),e.prev=11,e.next=14,this.closeUplink();case 14:e.next=18;break;case 16:e.prev=16,e.t0=e.catch(11);case 18:this.isJoined_=!1,this.isSignalReady_=!1,this.destroy();case 21:case"end":return e.stop()}}),e,this,[[11,16]])}))),function(){return w.apply(this,arguments)})},{key:"startSyncUserListInterval",value:function(){"live"===this.mode_&&"audience"===this.role_&&-1===this.syncUserListInterval_&&(this.syncUserListInterval_=Fd.setInterval(this.syncUserList.bind(this),1e4))}},{key:"stopSyncUserListInterval",value:function(){Fd.clearInterval(this.syncUserListInterval_),this.syncUserListInterval_=-1}},{key:"syncUserList",value:(E=i(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.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&&(n.log_.info("peer leave detected: ".concat(e.userId)),n.cleanUser({userId:e.userId,tinyId:e.tinyId}))})),t.forEach((function(e){var t=e.userId;n.userMap_.has(t)||t===n.userId_||(n.userMap_.set(t,e),n.emitter_.emit(mm,{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 E.apply(this,arguments)})},{key:"getUserList",value:function(){var e=this;return new Promise((function(t,n){e.signalChannel_.send(Cp),e.signalChannel_.once(cp.USER_LIST_RES,(function(e){var n=e.data.content.userlist.map((function(e){var t=e.userid,n=e.srctinyid,r=e.role;return new u_({userId:t,tinyId:n,role:r})}));t(n)})),setTimeout(n,2e3)}))}},{key:"publish",value:(R=i(regeneratorRuntime.mark((function e(t){var n,r,a,o,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Mf.result){e.next=2;break}throw new So({code:go.NOT_SUPPORTED,message:"the browser does NOT support TRTC!"});case 2:if(this.isJoined_){e.next=4;break}throw new So({code:go.INVALID_OPERATION,message:"please call join() before publish()"});case 4:if("live"!==this.mode_||"audience"!==this.role_){e.next=6;break}throw new So({code:go.INVALID_OPERATION,message:"no permission to publish() under live/".concat("audience",', please call switchRole("').concat("anchor",'") firstly before publish()')});case 6:if(!this.localStream_){e.next=8;break}throw new So({code:go.INVALID_OPERATION,message:"duplicate publishing, please unpublish and then re-publish"});case 8:if(t.getIsReadyToPublish()){e.next=10;break}throw new So({code:go.INVALID_OPERATION,message:"cannot publish stream because stream is not initialized or is switching device"});case 10:if(!this.notPublishWithoutH264Supported_){e.next=12;break}throw new So({code:go.NOT_SUPPORTED_H264,message:"your device does not support H.264 encoding."});case 12:return t.setPublishState(po),this.isPublishing_=!0,n=ec(),Dm.emit(Mm.PUBLISH_START,{client:this,stream:t}),this.log_.info("publish() => publishing local stream"),r=new n_({userId:this.userId_,tinyId:this.tinyId_,client:this,isUplink:!0,signalChannel:this.signalChannel_}),t.setConnection(r),r.initialize(),r.on(cm,function(){var e=i(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.getCode())!==go.ICE_TRANSPORT_ERROR){e.next=3;break}return e.abrupt("return");case 3:if(n!==go.UPLINK_RECONNECTION_FAILED){e.next=6;break}return e.next=6,s.closeUplink();case 6:s.emitter_.emit(Rm,t);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.prev=21,e.next=24,r.publish(t);case 24:this.localStream_=e.sent,this.log_.info("local stream publish successfully"),this.isPublishing_=!1,t.setPublishState(fo),this.uplinkConnection_=r,a=ec(),o=a-n,Us({eventType:Aa}),Us({eventType:Pa,delta:o}),t.hasAudio()&&pf(this.userId_,{eventId:Dp,eventDesc:"publish audio track",timestamp:As(),userId:this.userId_,tinyId:this.tinyId_}),t.hasVideo()&&pf(this.userId_,{eventId:Pp,eventDesc:"publish video track",timestamp:As(),userId:this.userId_,tinyId:this.tinyId_}),this.networkQuality_&&this.networkQuality_.setUplinkConnection(this.uplinkConnection_),this.deviceDetector_&&this.deviceDetector_.setLocalStream(this.localStream_),Dm.emit(Mm.LOCAL_STREAM_PUBLISHED,{localStream:this.localStream_}),this.notPublishWithoutH264Supported_=!1,e.next=50;break;case 41:throw e.prev=41,e.t0=e.catch(21),e.t0.getCode()===go.NOT_SUPPORTED_H264&&(this.notPublishWithoutH264Supported_=!0),t.setPublishState(ho),r.close(),this.log_.error("failed to publish stream "+e.t0),this.isPublishing_=!1,Vs({eventType:Aa,error:e.t0}),e.t0;case 50:case"end":return e.stop()}}),e,this,[[21,41]])}))),function(e){return R.apply(this,arguments)})},{key:"unpublish",value:(T=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t===this.localStream_){e.next=2;break}throw new So({code:go.INVALID_PARAMETER,message:"stream has not been published yet"});case 2:return this.log_.info("unpublish() => unpublishing local stream"),e.prev=3,e.next=6,this.doUnpublish();case 6:Us({eventType:Da}),e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(3),Vs({eventType:Da,error:e.t0}),e.t0;case 13:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return T.apply(this,arguments)})},{key:"doUnpublish",value:function(){var e=this;return new Promise((function(t,n){e.signalChannel_.send(gp),e.unpublishTimeout_=setTimeout(i(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e.log_.warn("unpublish() timeout observed"),n.next=3,e.closeUplink();case 3:return n.abrupt("return",t());case 4:case"end":return n.stop()}}),n)}))),5e3),e.signalChannel_.once(cp.UNPUBLISH_RESULT,function(){var n=i(regeneratorRuntime.mark((function n(r){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e.clearUnpublishTimeout(),e.log_.info("received UNPUBLISH_RESULT, close uplink connection"),n.next=4,e.closeUplink();case 4:return n.abrupt("return",t());case 5:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}())}))}},{key:"closeUplink",value:(b=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isUplinkClosing_){e.next=3;break}return this.log_.warn("uplink is closing, abort current closeUplink request"),e.abrupt("return");case 3:this.isUplinkClosing_=!0,this.uplinkConnection_&&(this.uplinkConnection_.getIsReconnecting()&&this.uplinkConnection_.stopReconnection(),this.uplinkConnection_.close(),this.uplinkConnection_=null,this.networkQuality_&&this.networkQuality_.setUplinkConnection(null),this.localStream_.hasAudio()&&pf(this.userId_,{eventId:Op,eventDesc:"unpublish audio track",timestamp:As(),userId:this.userId_,tinyId:this.tinyId_}),this.localStream_.hasVideo()&&pf(this.userId_,{eventId:Mp,eventDesc:"unpublish video track",timestamp:As(),userId:this.userId_,tinyId:this.tinyId_}),this.localStream_.setConnection(null),this.localStream_=null,this.deviceDetector_&&this.deviceDetector_.setLocalStream(null)),this.isUplinkClosing_=!1;case 6:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{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:(y=i(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}throw new So({code:go.INVALID_PARAMETER,message:"stream is undefined or null"});case 2:if(t.isRemote()){e.next=4;break}throw new So({code:go.INVALID_PARAMETER,message:"try to subscribe a local stream"});case 4:if(r=t.getConnection()){e.next=7;break}throw new So({code:go.INVALID_OPERATION,message:Sf});case 7:if(!this.notSubscribeWithoutH264Supported_){e.next=9;break}throw new So({code:go.NOT_SUPPORTED_H264,message:"your device does not support H.264 decoding."});case 9:return this.log_.info("subscribe() => subscribe to [".concat(t.getUserId(),"] ").concat(t.getType()," stream with options: ").concat(JSON.stringify(n))),Ks(n)&&(n={audio:!0,video:!0}),Ks(n.video)&&(n.video=!0),Ks(n.audio)&&(n.audio=!0),e.prev=13,Dm.emit(Mm.REMOTE_STREAM_SUBSCRIBE_START,{client:this,stream:t}),e.next=17,r.subscribe(t,n);case 17:this.subscriptionManager_&&this.subscriptionManager_.addSubscriptionRecord(t.getUserId(),t,n),this.notSubscribeWithoutH264Supported_=!1,Us({eventType:Ma}),e.next=28;break;case 22:throw e.prev=22,e.t0=e.catch(13),i=new So({code:e.t0 instanceof So?e.t0.getCode():go.UNKNOWN,message:"failed to subscribe stream, reason: ".concat(e.t0.message)}),Vs({eventType:Ma,error:i}),this.log_.error(i),i;case 28:case"end":return e.stop()}}),e,this,[[13,22]])}))),function(e,t){return y.apply(this,arguments)})},{key:"unsubscribe",value:(S=i(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}throw new So({code:go.INVALID_PARAMETER,message:"stream is undefined or null"});case 2:if(t.isRemote()){e.next=4;break}throw new So({code:go.INVALID_PARAMETER,message:"try to unsubscribe a local stream"});case 4:if(n=t.getConnection()){e.next=7;break}throw new So({code:go.INVALID_OPERATION,message:Sf});case 7:return this.log_.info("unsubscribe() => unsubscribe to [".concat(t.getUserId(),"] ").concat(t.getType()," stream")),e.prev=8,e.next=11,n.unsubscribe(t);case 11:this.subscriptionManager_&&this.subscriptionManager_.addUnsubscriptionRecord(t.getUserId(),t),Dm.emit(Mm.REMOTE_STREAM_UNSUBSCRIBED,{client:this,stream:t}),Us({eventType:Oa}),e.next=20;break;case 16:throw e.prev=16,e.t0=e.catch(8),Vs({eventType:Oa,error:e.t0}),e.t0;case 20:case"end":return e.stop()}}),e,this,[[8,16]])}))),function(e){return S.apply(this,arguments)})},{key:"switchRole",value:(v=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("live"===this.mode_){e.next=2;break}throw new So({code:go.INVALID_PARAMETER,message:"role is only valid in live mode"});case 2:if("anchor"===t||"audience"===t){e.next=4;break}throw new So({code:go.INVALID_PARAMETER,message:"role could only be set to a value as ".concat("anchor"," or ").concat("audience")});case 4:if(this.isJoined_){e.next=6;break}throw new So({code:go.INVALID_OPERATION,message:"Please call join() before switchRole()"});case 6:if(this.role_!==t){e.next=8;break}return e.abrupt("return");case 8:if("audience"!==t||!this.localStream_){e.next=11;break}return e.next=11,this.unpublish(this.localStream_);case 11:return this.log_.info("switchRole() => switch role to: "+t),e.next=14,this.doSwitchRole(t);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"doSwitchRole",value:function(e){var t=this;return new Promise((function(n,r){var i={trtcscene:"live"===t.mode_?ma:fa,trtcrole:"anchor"===e?_a:va};t.log_.info("switchRole signal data: "+JSON.stringify(i));var a=setTimeout((function(){t.log_.error("switchRole timeout observed"),t.signalChannel_.off(cp.SWITCH_ROLE_RES,o),r(new So({code:go.SWITCH_ROLE_FAILED,message:"switchRole timeout"}))}),5e3),o=function(i){clearTimeout(a);var o=i.data.content,s=o.errCode,c=o.errMsg;0===s?(t.role_=e,n()):(t.log_.error("switchRole failed, errCode: ".concat(s,", errMsg: ").concat(c)),r(new So({code:go.SWITCH_ROLE_FAILED,message:"switchRole failed, errMsg: ".concat(c)})))};t.signalChannel_.once(cp.SWITCH_ROLE_RES,o),t.signalChannel_.send(xp,i)}))}},{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(r,i,a){var o=e.connections_.get(i);o&&n.push(t({userId:o.getUserId()},r))})),n}},{key:"getTransportStats",value:(_=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s;return regeneratorRuntime.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:n=e.sent,t.rtt=n.rtt;case 6:r=k(this.connections_),e.prev=7,r.s();case 9:if((i=r.n()).done){e.next=17;break}return(a=g(i.value,2))[0],o=a[1],e.next=13,this.stats_.getReceiverStats(o);case 13:s=e.sent,t.downlinksRTT[s.userId]=s.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 _.apply(this,arguments)})},{key:"getLocalAudioStats",value:(m=i(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.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:n=e.sent,t[this.userId_]={bytesSent:n.audio.bytesSent,packetsSent:n.audio.packetsSent};case 7:return e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"getLocalVideoStats",value:(f=i(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.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:n=e.sent,t[this.userId_]={bytesSent:n.video.bytesSent,packetsSent:n.video.packetsSent,framesEncoded:n.video.framesEncoded,framesSent:n.video.framesSent,frameWidth:n.video.frameWidth,frameHeight:n.video.frameHeight};case 7:return e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"getRemoteAudioStats",value:(p=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t={},n=k(this.connections_),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=12;break}return(i=g(r.value,2))[0],a=i[1],e.next=8,this.stats_.getReceiverStats(a);case 8:(o=e.sent).hasAudio&&(t[o.userId]={bytesReceived:o.audio.bytesReceived,packetsReceived:o.audio.packetsReceived,packetsLost:o.audio.packetsLost});case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),n.e(e.t0);case 17:return e.prev=17,n.f(),e.finish(17);case 20:return e.abrupt("return",t);case 21:case"end":return e.stop()}}),e,this,[[2,14,17,20]])}))),function(){return p.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(h=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=c.length>0&&void 0!==c[0]?c[0]:"main",n={},r=k(this.connections_),e.prev=3,r.s();case 5:if((i=r.n()).done){e.next=14;break}return(a=g(i.value,2))[0],o=a[1],e.next=9,this.stats_.getReceiverStats(o);case 9:s=e.sent,"main"===t&&s.hasVideo&&(n[s.userId]={bytesReceived:s.video.bytesReceived,packetsReceived:s.video.packetsReceived,packetsLost:s.video.packetsLost,framesDecoded:s.video.framesDecoded,frameWidth:s.video.frameWidth,frameHeight:s.video.frameHeight}),"auxiliary"===t&&s.hasAuxiliary&&(n[s.userId]={bytesReceived:s.auxiliary.bytesReceived,packetsReceived:s.auxiliary.packetsReceived,packetsLost:s.auxiliary.packetsLost,framesDecoded:s.auxiliary.framesDecoded,frameWidth:s.auxiliary.frameWidth,frameHeight:s.auxiliary.frameHeight});case 12:e.next=5;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(3),r.e(e.t0);case 19:return e.prev=19,r.f(),e.finish(19);case 22:return e.abrupt("return",n);case 23:case"end":return e.stop()}}),e,this,[[3,16,19,22]])}))),function(){return h.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(){if(-1===this.heartbeat_){this.log_.info("startHeartbeat..."),this.heartbeat_=Fd.setInterval(this.doHeartbeat.bind(this),2e3)}}},{key:"stopHeartbeat",value:function(){-1!==this.heartbeat_&&(this.log_.info("stopHeartbeat"),Fd.clearInterval(this.heartbeat_),this.heartbeat_=-1,this.lastHeartBeatTime_=-1)}},{key:"doHeartbeat",value:(l=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.badCaseDetector_.getMonitorFreeze(),e.next=3,this.stats_.getStatsReport({uplinkConnection:this.uplinkConnection_,downlinkConnections:this.connections_,freezeMap:t});case 3:if(n=e.sent,Dm.emit(Mm.HEARTBEAT_STATS,{client:this,stats:n}),this.badCaseDetector_.resetMonitor(),this.signalChannel_){e.next=8;break}return e.abrupt("return");case 8:r=this.signalChannel_.isConnected()?ff(this.userId_):[],i={WebRTCQualityReq:n,eventList:r,sdkAppId:this.sdkAppId_,tinyid:this.tinyId_,roomid:this.roomId_,socketid:this.signalInfo_.socketId,clientip:this.signalInfo_.localIp,serverip:this.signalInfo_.relayIp,cpunumber:navigator.hardwareConcurrency||0,cpudevice:navigator.platform,devicename:navigator.platform,ostype:navigator.platform,mode:this.localStream_?this.localStream_.getScreen()?"screen":"video":""},a=0,this.localStream_&&this.localStream_.getMediaStream()&&(o=this.localStream_.getMediaStream().getAudioTracks(),a=o.length>0&&o[0].muted?3:1),i.WebRTCQualityReq.AudioReportState.uint32_microphone_status=a,this.signalChannel_.send(hp,i),s=Date.now(),this.lastHeartBeatTime_>0&&s-this.lastHeartBeatTime_>1e4&&this.log_.warn("heartbeat interval is over 10s"),this.lastHeartBeatTime_=s;case 17:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"onRemoteStreamAdded",value:function(e){var t=e.content,n=t.srcopenid,r=t.srctinyid;if(null!==n){"live"!==this.mode_||"audience"!==this.role_||this.userMap_.has(n)||(this.userMap_.set(n,new u_({userId:n,tinyId:r,role:"anchor"})),this.emitter_.emit(mm,{userId:n}));var i=this.connections_.get(r);if(i){if(i.getIsReconnecting())return;this.log_.warn("duplicated stream-added observed, rebuild the connection"),i.close(),this.connections_.delete(r)}var a={audio:t.audio,video:t.bigVideo,auxiliary:t.auxVideo};this.log_.info("remote peer [".concat(n,"] published stream. trackState: ").concat(JSON.stringify(a))),this.createDownlinkConnection({userId:n,tinyId:r,trackState:a})}else this.log_.warn("received null userId on stream added")}},{key:"createDownlinkConnection",value:function(e){var t=e.userId,n=e.tinyId,r=e.trackState,i=new r_({userId:t,tinyId:n,client:this,isUplink:!1,signalChannel:this.signalChannel_,autoSubscribe:this.autoSubscribe_,trackState:r});if(this.connections_.set(n,i),this.installDownlinkEvents(i,t,n),this.autoSubscribe_)i.initialize(),i.connect().catch((function(){}));else{if(r.audio||r.video){var a=new Ym({type:"main",userId:t,client:this});a.setConnection(i),i.setRemoteStream(ga,a),a.setIsStreamAddedEventEmitted(!0),Dm.emit(Mm.REMOTE_STREAM_ADDED,{client:this,stream:a}),this.emitter_.emit(dm,{stream:a})}if(r.auxiliary){var o=new Ym({type:"auxiliary",userId:t,client:this});o.setConnection(i),i.setRemoteStream(Sa,o),o.setIsStreamAddedEventEmitted(!0),Dm.emit(Mm.REMOTE_STREAM_ADDED,{client:this,stream:o}),this.emitter_.emit(dm,{stream:o})}}}},{key:"installDownlinkEvents",value:function(e,t,n){var r=this;e.on(im,(function(e){e.stream.setIsStreamAddedEventEmitted(!0),Dm.emit(Mm.REMOTE_STREAM_ADDED,{client:r,stream:e.stream}),r.emitter_.emit(dm,{stream:e.stream})})),e.on(am,(function(e){e.stream.stop(),e.stream.setIsStreamAddedEventEmitted(!1),r.subscriptionManager_&&r.subscriptionManager_.deleteAutoRecoveryFlag(e.stream.getUserId(),e.stream.getType()),Dm.emit(Mm.REMOTE_STREAM_REMOVED,{client:r,stream:e.stream}),r.emitter_.emit(lm,{stream:e.stream})})),e.on(om,(function(e){Dm.emit(Mm.REMOTE_STREAM_UPDATED,{client:r,stream:e.stream}),r.emitter_.emit(hm,{stream:e.stream})})),e.on(sm,(function(e){Dm.emit(Mm.REMOTE_STREAM_SUBSCRIBED,{client:r,stream:e.stream}),r.emitter_.emit(pm,{stream:e.stream})})),e.on(cm,(function(e){var t=e.getCode();t!==go.ICE_TRANSPORT_ERROR&&(t===go.DOWNLINK_RECONNECTION_FAILED&&r.closeDownLink(n),t===go.NOT_SUPPORTED_H264&&(r.notSubscribeWithoutH264Supported_=!0),r.emitter_.emit(Rm,e))}))}},{key:"onRemoteStreamRemoved",value:function(e){var t=e.content,n=t.srctinyid,r=t.srcopenid,i=this.connections_.get(n);i&&(void 0===r&&(r=i.getUserId()),this.log_.info("remote peer [".concat(r,"] unpublished stream")),this.closeDownLink(n))}},{key:"onPeerJoin",value:function(e){var t=e.data.content,n=t.srctinyid,r=t.userid,i=t.role;this.userMap_.has(r)||(this.userMap_.set(r,new u_({userId:r,tinyId:n,role:i})),this.emitter_.emit(mm,{userId:r}))}},{key:"onPeerLeave",value:function(e){var t=e.data.content,n=t.srctinyid,r=t.userid;this.log_.info("peer leave [".concat(r,"]")),this.cleanUser({userId:r,tinyId:n})}},{key:"cleanUser",value:function(e){var t=e.userId,n=e.tinyId;this.userMap_.delete(t),this.closeDownLink(n),this.emitter_.emit(_m,{userId:t})}},{key:"onPublishedUserList",value:function(e){var t=this;try{var n=e.content.userlist.map((function(e){return e.userid}));this.connections_.forEach((function(e){var r=e.getUserId(),i=e.getTinyId();n.findIndex((function(e){return e===r}))<0&&(t.log_.info("peer unpublished detected [".concat(r,"]")),t.closeDownLink(i))})),e.content.userlist.forEach((function(e){var n=e.userid,r=e.srctinyid,i=e.flag;if(n!==t.userId_&&t.connections_.has(r)){var a=1&i,o=8&i,s=4&i,c=t.connections_.get(r).getTrackState(),u=c.audio,d=c.video,l=c.auxiliary;!d&&a&&Dm.emit(Mm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:co,kind:oo}),!u&&o&&Dm.emit(Mm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:co,kind:ao}),!l&&s&&Dm.emit(Mm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:co,kind:so}),d&&!a&&Dm.emit(Mm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:uo,kind:oo}),u&&!o&&Dm.emit(Mm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:uo,kind:ao}),l&&!s&&Dm.emit(Mm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:uo,kind:so})}}))}catch(O_){}}},{key:"onUpdateRemoteMuteStat",value:function(e){var t=this;e.content.userlist.forEach((function(e){var n=e.srctinyid,r=e.userid;if(0!==n&&n!==t.tinyId_){var i=t.connections_.get(n);if(i){var a=i.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(gm,{userId:r}):t.emitter_.emit(ym,{userId:r}):t.emitter_.emit(gm,{userId:r}),void(s?u?t.emitter_.emit(vm,{userId:r}):t.emitter_.emit(Sm,{userId:r}):t.emitter_.emit(vm,{userId:r}));var h=!u&&s;(!l.audioMuted&&l.hasAudio)!==h&&(h?t.emitter_.emit(Sm,{userId:r}):t.emitter_.emit(vm,{userId:r}));var p=!d&&o;(!l.videoMuted&&l.hasVideo)!==p&&(p?t.emitter_.emit(ym,{userId:r}):t.emitter_.emit(gm,{userId:r})),t.mutedStates_.set(n,{hasAudio:s,hasVideo:o,hasSmall:c,audioMuted:u,videoMuted:d})}}else t.mutedStates_.delete(n)}}))}},{key:"onClientBanned",value:function(e){this.emitter_.emit(bm,new So({code:go.CLIENT_BANNED,message:"client was banned because of "+e}))}},{key:"getEnv",value:function(){return this.env_}},{key:"getSubscriptionManager",value:function(){return this.subscriptionManager_}},{key:"startPublishCDNStream",value:(d=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.localStream_){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"please call publish() before startPublishCDNStream()"});case 2:if(Ks(t.streamId)||Qs(t.streamId)){e.next=4;break}throw new So({code:go.INVALID_PARAMETER,message:"option.streamId must be valid string or undefined"});case 4:return this.log_.info("startPublishCDNStream params: ".concat(JSON.stringify(t))),e.prev=5,e.next=8,this.publishCDNManager_.startPublishTencentCDN(t.streamId);case 8:if(!(t.appId&&t.bizId&&t.url)){e.next=11;break}return e.next=11,this.publishCDNManager_.startPublishGivenCDN(t);case 11:e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(5),new So({code:go.START_PUBLISH_CDN_FAILED,message:"startPublishCDNStream failed, errMsg: ".concat(e.t0.message)});case 16:case"end":return e.stop()}}),e,this,[[5,13]])}))),function(e){return d.apply(this,arguments)})},{key:"stopPublishCDNStream",value:(u=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.publishCDNManager_.getIsPublishingTencentCDN()){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"please call startPublishCDNStream() before stopPublishCDNStream()"});case 2:return this.log_.info("stopPublishCDNStream"),e.prev=3,e.next=6,this.publishCDNManager_.stopPublishTencentCDN();case 6:if(!this.publishCDNManager_.getIsPublishingGivenCDN()){e.next=9;break}return e.next=9,this.publishCDNManager_.stopPublishGivenCDN();case 9:e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(3),new So({code:go.STOP_PUBLISH_CDN_FAILED,message:"stopPublishCDNStream failed, errMsg: ".concat(e.t0.message)});case 14:case"end":return e.stop()}}),e,this,[[3,11]])}))),function(){return u.apply(this,arguments)})},{key:"startMixTranscode",value:(c=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_&&this.mixTranscodeManager_){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"please call startMixTranscode() after join()"});case 2:return Ks(t.mode)&&(t.mode=Xa.MANUAL),e.prev=3,this.log_.info("startMixTranscode with config ".concat(JSON.stringify(t))),Os("mix-transcode-mode:".concat(t.mode)),e.next=8,this.mixTranscodeManager_.startMixTranscode(t);case 8:Us({eventType:qa}),e.next=15;break;case 11:throw e.prev=11,e.t0=e.catch(3),Vs({eventType:qa,error:e.t0}),e.t0;case 15:case"end":return e.stop()}}),e,this,[[3,11]])}))),function(e){return c.apply(this,arguments)})},{key:"stopMixTranscode",value:(o=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_&&this.mixTranscodeManager_){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"please call startMixTranscode() after join()"});case 2:return e.prev=2,e.next=5,this.mixTranscodeManager_.stopMixTranscode();case 5:Us({eventType:Ka}),e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(2),Vs({eventType:Ka,error:e.t0}),e.t0;case 12:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(){return o.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(!Ys(t))throw new So({code:go.INVALID_PARAMETER,message:"parameter must be numeric type"});if(this.log_.info("enableAudioVolumeEvaluation with interval: "+t),t<=0)return this.enableAudioVolumeEvaluation_=!1,Fd.clearInterval(this.audioVolumeIntervalId_),void(this.audioVolumeIntervalId_=null);t=Math.floor(Math.max(t,16)),this.audioVolumeIntervalId_&&(Fd.clearInterval(this.audioVolumeIntervalId_),this.audioVolumeIntervalId_=null),this.enableAudioVolumeEvaluation_=!0,this.audioVolumeIntervalId_=Fd.setInterval((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 r=Math.floor(100*n.getAudioLevel());t.push({userId:e.getUserId(),audioVolume:r,stream:n})}})),e.emitter_.emit(Tm,{result:t})}),t,n)}},{key:"uploadAllCallStats",value:function(){var e=this;this.callDurationCalculator_.getDurationMap().forEach((function(t,n){var r={userId:t.userId,type:t.type,duration:e.callDurationCalculator_.getDuration(n,"video"),dataFreeze:e.badCaseDetector_.getDataFreezeDuration(n).dataFreeze,renderFreeze:e.badCaseDetector_.getRenderFreezeDuration(n).renderFreeze};Os("callStats-"+JSON.stringify(r))})),this.badCaseDetector_.stop(),this.callDurationCalculator_.reset()}},{key:"enableSmallStream",value:(r=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPublished()&&!this.isPublishing_){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"Cannot enable small stream after localStream published."});case 2:if(!rm()){e.next=7;break}this.setIsEnableSmallStream(!0),this.log_.info("SmallStream successfully enabled"),e.next=8;break;case 7:throw new So({code:go.INVALID_OPERATION,message:"Your browser does not support opening small stream"});case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"disableSmallStream",value:(n=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPublished()&&!this.isPublishing_){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"Cannot enable small stream after having published."});case 2:this.setIsEnableSmallStream(!1),this.log_.info("SmallStream successfully disabled");case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setSmallStreamProfile",value:function(e){var t=this;Object.keys(this.smallStreamConfig_).forEach((function(n){e[n]&&(t.smallStreamConfig_[n]=e[n])})),this.log_.info("setSmallStreamProfile: bitrate=".concat(this.smallStreamConfig_.bitrate,", framerate=").concat(this.smallStreamConfig_.framerate,", height=").concat(this.smallStreamConfig_.height,", width=").concat(this.smallStreamConfig_.width));var n=this.smallStreamConfig_,r=n.width,i=n.height,a=n.bitrate,o=n.framerate;if(r<0||i<0||a<0||o<0)throw new So({code:go.INVALID_PARAMETER,message:"Small stream profile is invalid."})}},{key:"setRemoteVideoStreamType",value:function(e,t){switch(this.log_.info("setRemoteVideoStreamType: streamType=".concat(e.getType(),", set ").concat(t)),t){case"big":case"small":this.changeVideoType(e,t)}}},{key:"changeVideoType",value:function(e,t){if(!(e instanceof Ym))throw new So({code:go.INVALID_PARAMETER,message:"remoteStream is invalid"});if(!e.getConnection())throw new So({code:go.INVALID_OPERATION,message:Sf});var n=this.getRemoteMutedState().filter((function(t){return t.userId===e.getUserId()}))[0];if("small"===t&&n&&!n.hasSmall)throw new So({code:go.INVALID_OPERATION,message:"remote peer ".concat(e.getUserId()," does not publish small stream")});this.log_.info("change video type: streamType=".concat(e.getType(),", set ").concat(t));var r=e.getConnection().getTinyId(),i=1;"big"===t&&(i=0),this.signalChannel_.send(Ap,{type:i,srctinyid:r})}},{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_}}]),e}(),T_=d_({retryFunction:function(){var e=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Qf()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,R_(t);case 4:if(n=e.sent,su.info("getUserMedia with constraints: "+JSON.stringify(n)),!n.audio){e.next=13;break}return e.next=9,M_.getMicrophones();case 9:if(r=e.sent,su.info("microphones: ".concat(JSON.stringify(r))),0!==r.length){e.next=13;break}throw new So({code:go.DEVICE_NOT_FOUND,message:"no microphone detected, but you are trying to get audio stream, please check your microphone and the configuration on TRTC.createStream."});case 13:if(!n.video){e.next=20;break}return e.next=16,M_.getCameras();case 16:if(i=e.sent,su.info("cameras: ".concat(JSON.stringify(i))),0!==i.length){e.next=20;break}throw new So({code:go.DEVICE_NOT_FOUND,message:"no camera detected, but you are trying to get video stream, please check your camera and the configuration on TRTC.createStream."});case 20:return e.next=22,navigator.mediaDevices.getUserMedia(n);case 22:return e.abrupt("return",e.sent);case 23:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),settings:{retries:3,timeout:500},onError:function(e,t,n){"NotReadableError"===e.name?t():n(e)},onRetrying:function(e){su.warn("getUserMedia NotReadableError observed, retrying [".concat(e,"/3]"))}});function R_(e){return E_.apply(this,arguments)}function E_(){return(E_=i(regeneratorRuntime.mark((function e(n){var r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r={echoCancellation:n.echoCancellation,autoGainControl:n.autoGainControl,noiseSuppression:n.noiseSuppression},n.audio){e.next=5;break}r=!1,e.next=15;break;case 5:if(_f(n.microphoneId)){e.next=9;break}r=t({deviceId:{exact:n.microphoneId},sampleRate:n.sampleRate,channelCount:n.channelCount},r),e.next=15;break;case 9:return r=t({sampleRate:n.sampleRate,channelCount:n.channelCount},r),e.next=12,M_.getMicrophones();case 12:i=e.sent,(a=i.filter((function(e){var t=e.deviceId;return t.length>0&&"default"!==t}))).length>0&&(r.deviceId={exact:a[0].deviceId});case 15:return o={},o=!Ks(n.facingMode)&&n.video?{facingMode:n.facingMode,width:n.width,height:n.height,frameRate:n.frameRate}:!_f(n.cameraId)&&n.video?{deviceId:{exact:n.cameraId},width:n.width,height:n.height,frameRate:n.frameRate}:!!n.video&&(!!Ks(n.width)||{width:n.width,height:n.height,frameRate:n.frameRate}),e.abrupt("return",{audio:r,video:o});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var w_=function(){var e=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Qf()){e.next=2;break}return e.abrupt("return");case 2:if(n=null,!(Zc&&eu<74||nu)){e.next=27;break}return r=C_(t),su.info("getDisplayMedia with constraints: "+JSON.stringify(r)),e.next=8,navigator.mediaDevices.getDisplayMedia(r);case 8:if(i=e.sent,!t.screenAudio){e.next=14;break}return su.warn("Your browser not support capture system audio"),e.abrupt("return",i);case 14:if(!t.audio){e.next=24;break}return a=I_(t),su.info("getUserMedia with constraints: "+JSON.stringify(a)),e.next=19,navigator.mediaDevices.getUserMedia(a);case 19:return n=e.sent,i.addTrack(n.getAudioTracks()[0]),e.abrupt("return",i);case 24:return e.abrupt("return",i);case 25:e.next=53;break;case 27:if(!t.screenAudio){e.next=37;break}return t.audioConstraints={echoCancellation:!0,noiseSuppression:!0,sampleRate:44100},o=C_(t),su.info("getDisplayMedia with constraints: "+JSON.stringify(o)),e.next=33,navigator.mediaDevices.getDisplayMedia(o);case 33:return s=e.sent,e.abrupt("return",s);case 37:return c=C_(t),su.info("getDisplayMedia with constraints: "+JSON.stringify(c)),e.next=41,navigator.mediaDevices.getDisplayMedia(c);case 41:if(u=e.sent,!t.audio){e.next=52;break}return d=I_(t),su.info("getUserMedia with constraints: "+JSON.stringify(d)),e.next=47,navigator.mediaDevices.getUserMedia(d);case 47:return n=e.sent,u.addTrack(n.getAudioTracks()[0]),e.abrupt("return",u);case 52:return e.abrupt("return",u);case 53:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function I_(e){var t={echoCancellation:e.echoCancellation,autoGainControl:e.autoGainControl,noiseSuppression:e.noiseSuppression,sampleRate:e.sampleRate,channelCount:e.channelCount};return Ks(e.microphoneId)||(t.deviceId={exact:e.microphoneId}),{audio:t,video:!1}}function C_(e){var t={},n={width:e.width,height:e.height,frameRate:e.frameRate};return Ks(e.screenSource)||(n.displaySurface=e.screenSource),t.video=n,Ks(e.audioConstraints)||(t.audio=e.audioConstraints),t}var x_=new Map;x_.set("120p",{width:160,height:120,frameRate:15,bitrate:200}),x_.set("180p",{width:320,height:180,frameRate:15,bitrate:350}),x_.set("240p",{width:320,height:240,frameRate:15,bitrate:400}),x_.set("360p",{width:640,height:360,frameRate:15,bitrate:800}),x_.set("480p",{width:640,height:480,frameRate:15,bitrate:900}),x_.set("720p",{width:1280,height:720,frameRate:15,bitrate:1500}),x_.set("1080p",{width:1920,height:1080,frameRate:15,bitrate:2e3}),x_.set("1440p",{width:2560,height:1440,frameRate:30,bitrate:4860}),x_.set("4K",{width:3840,height:2160,frameRate:30,bitrate:9e3});var A_=new Map;A_.set("480p",{width:640,height:480,frameRate:5,bitrate:900}),A_.set("480p_2",{width:640,height:480,frameRate:30,bitrate:1e3}),A_.set("720p",{width:1280,height:720,frameRate:5,bitrate:1200}),A_.set("720p_2",{width:1280,height:720,frameRate:30,bitrate:3e3}),A_.set("1080p",{width:1920,height:1080,frameRate:5,bitrate:1600}),A_.set("1080p_2",{width:1920,height:1080,frameRate:30,bitrate:4e3});var P_=new Map;P_.set("standard",{sampleRate:48e3,channelCount:1,bitrate:40}),P_.set("standard-stereo",{sampleRate:48e3,channelCount:2,bitrate:64}),P_.set("high",{sampleRate:48e3,channelCount:1,bitrate:192}),P_.set("high-stereo",{sampleRate:48e3,channelCount:2,bitrate:192});var D_=function(e){u(g,e);var r,o,c,l,h,p,f,m=_(g);function g(e){var n;a(this,g);var r=t(t({},e),{isRemote:!1,type:"local"});return e.screen&&(r.mirror=!1),(n=m.call(this,r)).video_=e.video,n.audio_=e.audio,n.cameraId_=e.cameraId,n.cameraGroupId_="",n.facingMode_=e.facingMode,n.microphoneId_=e.microphoneId,n.microphoneGroupId_="",n.videoSource_=e.videoSource,n.audioSource_=e.audioSource,n.screen_=e.screen,n.screenSource_=e.screenSource,n.screenAudio_=e.screenAudio,n.audioProfile_={echoCancellation:!!Ks(e.echoCancellation)||e.echoCancellation,autoGainControl:!!Ks(e.autoGainControl)||e.autoGainControl,noiseSuppression:!!Ks(e.noiseSuppression)||e.noiseSuppression,sampleRate:48e3,channelCount:1,bitrate:40},n.videoProfile_={width:640,height:480,frameRate:15,bitrate:900},n.screenProfile_={width:1920,height:1080,frameRate:5,bitrate:1600},n.videoBitrate_=n.screen_?1600:900,n.videoSetting_=null,n.mutedFlag_=0,n.initState(),n.installEvents(),n.log_.debug("stream created: "+n.id_),n}return s(g,[{key:"initState",value:function(){this.isAddingTrack_=!1,this.isRemovingTrack_=!1,this.setIsReadyToPublish(!1),this.setPublishState(ho)}},{key:"installEvents",value:function(){Dm.on(Mm.LOCAL_STREAM_PUBLISHED,this.onStreamPublished,this),Dm.on(Mm.VIDEO_TRACK_ENDED,this.onVideoTrackStopped,this),Dm.on(Mm.VIDEO_TRACK_MUTED,this.onVideoTrackStopped,this),Dm.on(Mm.AUDIO_TRACK_ENDED,this.onAudioTrackStopped,this),Dm.on(Mm.AUDIO_TRACK_MUTED,this.onAudioTrackStopped,this)}},{key:"uninstallEvents",value:function(){Dm.off(Mm.LOCAL_STREAM_PUBLISHED,this.onStreamPublished,this),Dm.off(Mm.VIDEO_TRACK_ENDED,this.onVideoTrackStopped,this),Dm.off(Mm.VIDEO_TRACK_MUTED,this.onVideoTrackStopped,this),Dm.off(Mm.AUDIO_TRACK_ENDED,this.onAudioTrackStopped,this),Dm.off(Mm.AUDIO_TRACK_MUTED,this.onAudioTrackStopped,this)}},{key:"initialize",value:function(){var e=this;return new Promise((function(t,n){if(Yf())n(new So({code:go.INVALID_OPERATION,message:gf}));else{if(Ks(e.audio_)){var r=new MediaStream;return Ks(e.audioSource_)||(r.addTrack(e.audioSource_),e.updateAudioPlayingState(!0)),Ks(e.videoSource_)||(r.addTrack(e.videoSource_),e.updateVideoPlayingState(!0)),e.setMediaStream(r),Us({eventType:Ha,kind:"custom"}),e.setIsReadyToPublish(!0),t()}e.screen_?(e.log_.info("initialize stream audio: "+e.audio_+" screenAudio: "+e.screenAudio_+" screen: "+e.screen_),w_({audio:e.audio_,screenAudio:e.screenAudio_,microphoneId:e.microphoneId_,screenSource:e.screenSource_,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){return e.setMediaStream(n),e.updateAudioPlayingState(e.audio_||e.screenAudio_),e.updateVideoPlayingState(!0),e.listenForScreenSharingStopped(e.getVideoTrack()),e.setVideoContentHint("detail"),e.updateDeviceIdInUse(),e.setIsReadyToPublish(!0),Us({eventType:Ha,kind:"getDisplayMedia"}),t()})).catch((function(t){Vs({eventType:Ha,kind:"getDisplayMedia",error:t}),e.log_.error("getDisplayMedia error observed "+t),n(t)}))):(Dm.emit(Mm.LOCAL_STREAM_INITIALIZE_START,{stream:e,audio:e.audio_,video:e.video_}),e.log_.info("initialize stream audio: "+e.audio_+" video: "+e.video_),T_({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}).then((function(n){return Dm.emit(Mm.LOCAL_STREAM_INITIALIZE_END,{stream:e,audio:e.audio_,video:e.video_}),"getSettings"in MediaStreamTrack.prototype&&(e.videoSetting_=n.getVideoTracks().length>0&&n.getVideoTracks()[0].getSettings()),e.setMediaStream(n),e.updateAudioPlayingState(e.audio_),e.updateVideoPlayingState(e.video_),e.updateDeviceIdInUse(),e.log_.debug("gotStream hasAudio: "+e.hasAudio()+" hasVideo: "+e.hasVideo()),e.setIsReadyToPublish(!0),Us({eventType:Ha,kind:"getUserMedia"}),t()})).catch((function(t){Dm.emit(Mm.LOCAL_STREAM_INITIALIZE_FAILED,{stream:e,audio:e.audio_,video:e.video_,error:t}),Vs({eventType:Ha,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(wm)}))}},{key:"muteAudio",value:function(){var e=v(d(g.prototype),"muteAudio",this).call(this);return e&&(this.log_.info("localStream mute audio"),this.sendMutedFlag(ao,!0)),e}},{key:"muteVideo",value:function(){var e=v(d(g.prototype),"muteVideo",this).call(this);return e&&(this.log_.info("localStream mute video"),this.sendMutedFlag(oo,!0)),e}},{key:"unmuteAudio",value:function(){var e=v(d(g.prototype),"unmuteAudio",this).call(this);return e&&(this.log_.info("localStream unmute audio"),this.sendMutedFlag(ao,!1)),e}},{key:"unmuteVideo",value:function(){var e=v(d(g.prototype),"unmuteVideo",this).call(this);return e&&(this.log_.info("localStream unmute video"),this.sendMutedFlag(oo,!1)),e}},{key:"sendMutedFlag",value:function(e,t){this.setMutedFlag(e,t);var n=this.getConnection();if(n){n.sendMutedFlag(this.mutedFlag_);var r=n.getUserId(),i=n.getTinyId(),a="".concat(t?"mute":"unmute"," local ").concat(e," track");pf(r,{eventId:e===ao?t?Lp:Up:t?Np:Vp,eventDesc:a,timestamp:As(),userId:r,tinyId:i})}}},{key:"setMutedFlag",value:function(e,t){e===ao?t?this.mutedFlag_|=4:this.mutedFlag_&=-5:t?this.mutedFlag_|=1:this.mutedFlag_&=-2,this.log_.info("set ".concat(e," muted state: [").concat(t?"mute":"unmute","]"))}},{key:"setAudioProfile",value:function(e){var r;"object"===n(e)?r=e:void 0===(r=P_.get(e))&&(r=P_.get("standard")),this.log_.info("setAudioProfile: "+JSON.stringify(r)),this.audioProfile_=t(t({},this.audioProfile_),r)}},{key:"setVideoProfile",value:(f=i(regeneratorRuntime.mark((function e(n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.connection_||Kf()){e.next=2;break}throw new So({code:go.NOT_SUPPORTED,message:"not supported on current browser"});case 2:if(Gs(n)?r=t(t({},this.videoProfile_),n):Qs(n)&&(r=x_.get(n),Ks(r)&&(r=x_.get("480p"))),this.log_.info("setVideoProfile "+JSON.stringify(r)),!(i=this.getVideoTrack())){e.next=8;break}return e.next=8,i.applyConstraints(r);case 8:if(this.videoBitrate_===r.bitrate){e.next=13;break}if(!this.connection_){e.next=12;break}return e.next=12,this.connection_.setBandwidth(r.bitrate,"video");case 12:this.videoBitrate_=r.bitrate;case 13:this.videoProfile_=r;case 14:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"getVideoBitrate",value:function(){return this.videoBitrate_}},{key:"getAudioBitrate",value:function(){return this.audioProfile_.bitrate}},{key:"setScreenProfile",value:function(e){var t=e;"object"!==n(e)&&void 0===(t=A_.get(e))&&(t=A_.get("1080p")),this.log_.info("setScreenProfile "+JSON.stringify(e)),this.screenProfile_=t,this.videoBitrate_=t.bitrate}},{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:(p=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,c,u,d,l,h,p,f,m,_,v,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.screen_||this.audioSource_||this.videoSource_)){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"cannot switch device on current stream"});case 2:if(this.publishState_!==po){e.next=4;break}throw new So({code:go.INVALID_OPERATION,message:"cannot switch device when publishing localStream"});case 4:if(!("audio"===t&&this.microphoneId_===n||"video"===t&&this.cameraId_===n)){e.next=6;break}return e.abrupt("return");case 6:if("audio"===t&&(this.microphoneId_=n,this.audio_||(this.audio_=!0)),"video"===t&&("user"===n||"environment"===n?this.facingMode_=n:this.cameraId_=n,this.video_||(this.video_=!0)),this.getMediaStream()){e.next=10;break}return e.abrupt("return");case 10:return this.setIsReadyToPublish(!1),this.log_.info("switchDevice "+t+" to: "+n),"video"===t&&(dc||uc||hc)&&((r=this.getVideoTrack())&&r.stop(),zc&&(i=this.getAudioTrack())&&(this.log_.info("stop audio track first in huawei env"),i.stop())),"audio"===t&&hc&&(a=this.getAudioTrack(),o=this.getMicrophoneTrackMixed(),a&&a.stop(),o&&o.stop()),e.next=16,T_({audio:this.audio_&&"audio"===t||zc,video:this.video_&&"video"===t,facingMode:"user"===n||"environment"===n?n:void 0,cameraId:this.cameraId_,microphoneId:this.microphoneId_,width:this.videoProfile_.width,height:this.videoProfile_.height,frameRate:this.videoProfile_.frameRate,sampleRate:this.audioProfile_.sampleRate,channelCount:this.audioProfile_.channelCount});case 16:if(s=e.sent,c=null,"audio"!==t){e.next=23;break}(u=s.getAudioTracks()[0])&&this.isAudioTrackMixed()?(d=this.getAudioTrack(),l=M_.AudioMixerPlugin.getAudioTrackMap(),h=M_.AudioMixerPlugin.mix({targetTrack:u,sourceList:l.get(d.id).sourceList,trackList:l.get(d.id).trackList}),c=h):c=u,e.next=29;break;case 23:if((c=s.getVideoTracks()[0])&&this.isVideoTrackBeautified()&&(c=this.generateBeautyTrack(c)),!(p=s.getAudioTracks()[0])||!zc){e.next=29;break}return e.next=29,this.replaceTrack_(p);case 29:return e.next=31,this.replaceTrack_(c);case 31:this.updateDeviceIdInUse(),(f=this.getConnection())&&(m=f.getUserId(),_=f.getTinyId(),v=Hp,g="switch camera","audio"===t&&(v=Jp,g="switch microphone"),pf(m,{eventId:v,eventDesc:g,timestamp:As(),userId:m,tinyId:_})),this.log_.info("switch ".concat("audio"===t?"microphone":"camera"," success ")),this.setIsReadyToPublish(!0);case 36:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"addTrack",value:(h=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isAddingTrack_){e.next=2;break}throw new So({code:go.INVALID_OPERATION,message:"previous addTrack is ongoing, please avoid repetitive execution"});case 2:if(!this.isRemovingTrack_){e.next=4;break}throw new So({code:go.INVALID_OPERATION,message:"cannot add track when a track is removing"});case 4:if(this.publishState_!==po){e.next=6;break}throw new So({code:go.INVALID_OPERATION,message:"cannot add track when publishing localStream"});case 6:if(n=this.getMediaStream()){e.next=9;break}throw new So({code:go.INVALID_OPERATION,message:"the local stream is not initialized yet"});case 9:if(!("audio"===t.kind&&n.getAudioTracks().length>0||"video"===t.kind&&n.getVideoTracks().length>0)){e.next=11;break}throw new So({code:go.INVALID_OPERATION,message:"A Stream has at most one audio track and one video track"});case 11:if("video"===t.kind&&"getSettings"in MediaStreamTrack.prototype&&(r=t.getSettings(),!this.videoSetting_||r.width===this.videoSetting_.width&&r.height===this.videoSetting_.height||this.log_.warn("video resolution of the track (".concat(r.width," x ").concat(r.height,") shall be kept the same as the previous: ").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,". It may cause abnormal Cloud Recording."))),e.prev=12,this.isAddingTrack_=!0,this.keepMuteState(t),!(i=this.getConnection())){e.next=19;break}return e.next=19,i.addTrack(t);case 19:n.addTrack(t),"audio"===t.kind?(this.audio_=!0,this.updateAudioPlayingState(!0)):(this.video_=!0,this.updateVideoPlayingState(!0)),this.isAddingTrack_=!1,e.next=28;break;case 24:throw e.prev=24,e.t0=e.catch(12),this.isAddingTrack_=!1,e.t0;case 28:case"end":return e.stop()}}),e,this,[[12,24]])}))),function(e){return h.apply(this,arguments)})},{key:"removeTrack",value:(l=i(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("audio"!==t.kind){e.next=2;break}throw new So({code:go.INVALID_PARAMETER,message:"remove audio track is not supported"});case 2:if(!this.isAddingTrack_){e.next=4;break}throw new So({code:go.INVALID_OPERATION,message:"cannot remove track when a track is adding"});case 4:if(!this.isRemovingTrack_){e.next=6;break}throw new So({code:go.INVALID_OPERATION,message:"previous removeTrack is ongoing, please avoid repetitive execution"});case 6:if(this.publishState_!==po){e.next=8;break}throw new So({code:go.INVALID_OPERATION,message:"cannot remove track when publishing localStream"});case 8:if(n=this.getMediaStream()){e.next=11;break}throw new So({code:go.INVALID_OPERATION,message:"the local stream is not initialized yet"});case 11:if(-1!==n.getTracks().indexOf(t)){e.next=13;break}throw new So({code:go.INVALID_PARAMETER,message:"the track to be removed is not being publishing"});case 13:if(1!==n.getTracks().length){e.next=15;break}throw new So({code:go.INVALID_OPERATION,message:"remove the only video track is not supported, please use replaceTrack or muteVideo"});case 15:if(e.prev=15,this.isRemovingTrack_=!0,!(r=this.getConnection())){e.next=21;break}return e.next=21,r.removeTrack(t);case 21:n.removeTrack(t),"audio"===t.kind?(this.audio_=!1,this.updateAudioPlayingState(!1)):(this.video_=!1,this.updateVideoPlayingState(!1)),this.isRemovingTrack_=!1,e.next=30;break;case 26:throw e.prev=26,e.t0=e.catch(15),this.isRemovingTrack_=!1,e.t0;case 30:case"end":return e.stop()}}),e,this,[[15,26]])}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(c=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.getMediaStream()){e.next=3;break}throw new So({code:go.INVALID_OPERATION,message:"the local stream is not initialized yet"});case 3:if(this.publishState_!==po){e.next=5;break}throw new So({code:go.INVALID_OPERATION,message:"cannot replace track when publishing localStream"});case 5:if(!("audio"===t.kind&&n.getAudioTracks().length<=0||"video"===t.kind&&n.getVideoTracks().length<=0)){e.next=7;break}throw new So({code:go.INVALID_PARAMETER,message:"try to replace ".concat(t.kind," track but there's no previous ").concat(t.kind," being published")});case 7:if("video"===t.kind&&"getSettings"in MediaStreamTrack.prototype&&(r=t.getSettings(),!this.videoSetting_||r.width===this.videoSetting_.width&&r.height===this.videoSetting_.height||this.log_.warn("video resolution of the track (".concat(r.width," x ").concat(r.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),"audio"===t.kind?(n.removeTrack(n.getAudioTracks()[0]),n.addTrack(t),v(d(g.prototype),"restartAudio",this).call(this)):(n.removeTrack(n.getVideoTracks()[0]),n.addTrack(t),v(d(g.prototype),"restartVideo",this).call(this)),!(i=this.getConnection())){e.next=14;break}return e.next=14,i.replaceTrack(t);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"updateStream",value:(o=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u,d,l,h,p,f,m,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaStream_){e.next=2;break}return e.abrupt("return");case 2:return this.log_.info("updateStream() try to recover local stream"),e.prev=3,e.next=6,M_.getCameras();case 6:return n=e.sent,e.next=9,M_.getMicrophones();case 9:if(r=e.sent,i=this.audio_&&t.audio,(a=this.video_&&t.video)&&0===n.length&&(a=!1,this.log_.info("updateStream() video flag is true, but no camera detected, set video to false")),i&&0===r.length&&(i=!1,this.log_.info("updateStream() audio flag is true, but no microphone detected, set audio to false")),!1!==i||!1!==a){e.next=17;break}return this.log_.info("updateStream() both audio and video are false, recover stream aborted"),e.abrupt("return");case 17:return o=t&&n.findIndex((function(e){return e.deviceId===t.cameraId}))>=0,s=t&&r.findIndex((function(e){return e.deviceId===t.microphoneId}))>=0,e.next=21,T_({audio:i,video:a,cameraId:o?t.cameraId:void 0,microphoneId:s?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});case 21:c=e.sent,u=c.getTracks(),d=0;case 24:if(!(d<u.length)){e.next=47;break}if("audio"!==(l=u[d]).kind||!this.isAudioTrackMixed()){e.next=37;break}if(h=this.getAudioTrack(),p=M_.AudioMixerPlugin.getAudioTrackMap(),(f=p.get(h.id)).hasMicrophone){e.next=33;break}return l.stop(),e.abrupt("continue",44);case 33:return m=M_.AudioMixerPlugin.mix({targetTrack:l,sourceList:f.sourceList,trackList:f.trackList}),e.next=36,this.replaceTrack_(m);case 36:return e.abrupt("continue",44);case 37:if("video"!==l.kind||!this.isVideoTrackBeautified()){e.next=42;break}return _=this.generateBeautyTrack(l),e.next=41,this.replaceTrack_(_);case 41:return e.abrupt("continue",44);case 42:return e.next=44,this.replaceTrack_(l);case 44:d++,e.next=24;break;case 47:this.updateDeviceIdInUse(),Us({eventType:Ga}),this.log_.info("updateStream() recover local stream successfully"),e.next=57;break;case 52:e.prev=52,e.t0=e.catch(3),Vs({eventType:Ga,error:e.t0}),this.log_.error("updateStream() failed to recover local stream, "+e.t0),this.emitter_.emit(Cm,new So({code:go.DEVICE_AUTO_RECOVER_FAILED,message:e.t0.message}));case 57:case"end":return e.stop()}}),e,this,[[3,52]])}))),function(e){return o.apply(this,arguments)})},{key:"replaceTrack_",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.mediaStream_.getAudioTracks(),r=this.mediaStream_.getVideoTracks(),!("audio"===t.kind&&n.length<=0||"video"===t.kind&&r.length<=0)){e.next=5;break}return this.log_.info("there is no previous ".concat(t.kind," track, replacement ignored")),e.abrupt("return");case 5:if(this.keepMuteState(t),"audio"===t.kind?(this.mediaStream_.removeTrack(n[0]),this.mediaStream_.addTrack(t),v(d(g.prototype),"restartAudio",this).call(this)):("getSettings"in MediaStreamTrack.prototype&&(i=t.getSettings(),!this.videoSetting_||i.width===this.videoSetting_.width&&i.height===this.videoSetting_.height||this.log_.warn("the resolution of video track to be replaced (".concat(i.width," x ").concat(i.height,") is different from the previous video settings (").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,"). It may cause a cloud recording exception"))),this.mediaStream_.removeTrack(r[0]),this.mediaStream_.addTrack(t),v(d(g.prototype),"restartVideo",this).call(this)),!(a=this.getConnection())){e.next=11;break}return e.next=11,a.replaceTrack(t);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"updateDeviceIdInUse",value:function(){var e=this;if(!this.mediaStream_)return this.cameraId_="",this.cameraGroupId_="",this.microphoneId_="",void(this.microphoneGroupId_="");"getSettings"in MediaStreamTrack.prototype&&this.mediaStream_.getTracks().forEach((function(t){if("audio"===t.kind&&e.isAudioTrackMixed()){var n=e.getMicrophoneTrackMixed();if(n){var r=n.getSettings(),i=r.deviceId,a=r.groupId;i&&(e.microphoneId_=i,e.microphoneGroupId_=a)}}else if("video"===t.kind&&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&&("audio"===t.kind?(e.microphoneId_=l,e.microphoneGroupId_=h):"video"!==t.kind||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(M_.AudioMixerPlugin){var e=M_.AudioMixerPlugin.getAudioTrackMap(),t=this.getAudioTrack();if(e&&t&&e.has(t.id))return!0}return!1}},{key:"getMicrophoneTrackMixed",value:function(){if(M_.AudioMixerPlugin){var e=M_.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(M_.beautyTrackMap){var e=M_.beautyTrackMap,t=this.getVideoTrack();if(t&&e.has(t.id))return!0}return!1}},{key:"getBeautyOriginTrack",value:function(){if(M_.beautyTrackMap){var e=M_.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:function(e){var t=this.getVideoTrack(),n=M_.beautyTrackMap.get(t.id).pluginInstance.generateBeautyTrack(e);return this.log_.info("regenerate beauty track, track id = ".concat(e.id)),n}},{key:"getScreen",value:function(){return this.screen_}},{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:"onStreamPublished",value:function(e){if(e.localStream===this){var t=this.getAudioTrack(),n=this.getVideoTrack();if(t){var r=!t.enabled;this.setMutedFlag(ao,r)}if(n){var i=!n.enabled;this.setMutedFlag(oo,i)}this.connection_&&this.connection_.sendMutedFlag(this.mutedFlag_)}}},{key:"keepMuteState",value:function(e){e instanceof MediaStreamTrack&&this.mutedFlag_&(e.kind===oo?1:4)&&(e.enabled=!1,this.log_.warn("prev ".concat(e.kind," track is muted, keep mute state")))}},{key:"onVideoTrackStopped",value:function(e){var t=e.stream,n=e.type;t===this&&this.video_&&this.cameraId_&&(Os("stat-local-video-".concat(n)),this.updateStream({audio:!1,video:!0,cameraId:this.cameraId_}))}},{key:"onAudioTrackStopped",value:function(e){var t=e.stream,n=e.type;t===this&&this.audio_&&this.microphoneId_&&(Os("stat-local-audio-".concat(n)),this.updateStream({audio:!0,video:!1,microphoneId:this.microphoneId_}))}},{key:"setAudioVolume",value:function(e){v(d(g.prototype),"setAudioVolume",this).call(this,e)}},{key:"close",value:function(){v(d(g.prototype),"close",this).call(this),this.uninstallEvents()}}]),g}(Qm),M_={VERSION:"4.11.4",Logger:{LogLevel:{TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5},setLogLevel:function(e){su.setLogLevel(e)},enableUploadLog:function(){su.enableUploadLog()},disableUploadLog:function(){su.disableUploadLog()}},checkSystemRequirements:function(){return i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Jf();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))()},isScreenShareSupported:function(){return zf()},isSmallStreamSupported:function(){return rm()},getDevices:function(){return i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Yf()&&!Qf()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.map((function(e,t){var n=e.label;e.label||(n=e.kind+"_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)})))()},getCameras:function(){return i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Yf()&&!Qf()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return"videoinput"===e.kind})).map((function(e,t){var n=e.label;e.label||(n="camera_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)})))()},getMicrophones:function(){return i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Yf()&&!Qf()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return"audioinput"===e.kind})).map((function(e,t){var n=e.label;e.label||(n="microphone_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)})))()},getSpeakers:function(){return i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Yf()&&!Qf()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4: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 r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)})))()},createClient:function(e){if(!(""!==e.userId.trim()))throw new So({code:go.INVALID_PARAMETER,message:"userId cannot be all spaces"});ol&&(ol=!1,su.getLogLevel()!=M_.Logger.LogLevel.NONE&&(console.info("******************************************************************************"),console.info("* 欢迎使用 TRTC Web SDK - 腾讯云实时音视频通信"),console.info("* API 文档:https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/index.html"),console.info("* 版本更新日志:https://cloud.tencent.com/document/product/647/38958"),console.info("* 反馈问题:https://github.com/tencentyun/TRTCSDK/issues"),console.info("******************************************************************************")),su.info("TRTC Web SDK Version: 4.11.4"),su.info("UserAgent: "+navigator.userAgent),su.info("URL of current page: "+location.href));var n={version:this.VERSION};return new k_(t(t({},n),e))},createStream:function(e){if(!Ks(e.screen)&&e.screen&&Ks(e.audio)&&(e.audio=!1),!(Ks(e.audio)&&Ks(e.video)||Ks(e.audioSource)&&Ks(e.videoSource)))throw new So({code:go.INVALID_PARAMETER,message:"LocalStream must be created by createStream() with either audio/video or audioSource/videoSourcebut can not be mixed with audio/video and audioSource/videoSource"});if(!Ks(e.screen)&&!0===e.screen&&!0===e.video)throw new So({code:go.INVALID_PARAMETER,message:"screen/video options are mutually exclusive, they can not be both true"});if(e.audio&&e.screenAudio)throw new So({code:go.INVALID_PARAMETER,message:"audio/screenAudio options are mutually exclusive, they can not be both true"});if(!0!==e.screen&&!0===e.screenAudio)throw new So({code:go.INVALID_PARAMETER,message:"screenAudio options are configurable while screen options is true"});if(!Ks(e.screen)&&!0===e.screen&&!this.isScreenShareSupported())throw new So({code:go.INVALID_OPERATION,message:"screen capture is not supported, please use the latest chrome browser"});return new D_(e)}};return Yf(),M_}));
273974
+ /* 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 r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,n,r,i,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(r,i)}function i(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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(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}}),t&&l(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(){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 p(e,t,n){return(p=h()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&l(i,n.prototype),i}).apply(null,arguments)}function f(e){var t="function"==typeof Map?new Map:void 0;return(f=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,r)}function r(){return p(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)})(e)}function m(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _(e){var t=h();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return m(this,n)}}function v(e,t,n){return(v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function g(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 r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(c){s=!0,i=c}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||y(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 S(e){return function(e){if(Array.isArray(e))return T(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(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 y(e,t){if(e){if("string"==typeof e)return T(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)?T(e,t):void 0}}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 R(e,t,n,r,i){var a={};return Object.keys(r).forEach((function(e){a[e]=r[e]})),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce((function(n,r){return r(e,t,n)||n}),a),i&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(i):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}var b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e,t){return e(t={exports:{}},t.exports),t.exports}var I,C,w=function(e){return e&&e.Math==Math&&e},A=w("object"==typeof globalThis&&globalThis)||w("object"==typeof window&&window)||w("object"==typeof self&&self)||w("object"==typeof b&&b)||function(){return this}()||Function("return this")(),D=function(e){try{return!!e()}catch(t){return!0}},P=!D((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),x={}.propertyIsEnumerable,O=Object.getOwnPropertyDescriptor,N={f:O&&!x.call({1:2},1)?function(e){var t=O(this,e);return!!t&&t.enumerable}:x},M=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},L={}.toString,V=function(e){return L.call(e).slice(8,-1)},U="".split,F=D((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==V(e)?U.call(e,""):Object(e)}:Object,j=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},B=function(e){return F(j(e))},H=function(e){return"object"==typeof e?null!==e:"function"==typeof e},G=function(e){return"function"==typeof e?e:void 0},J=function(e,t){return arguments.length<2?G(A[e]):A[e]&&A[e][t]},z=J("navigator","userAgent")||"",W=A.process,q=A.Deno,K=W&&W.versions||q&&q.version,Q=K&&K.v8;Q?C=(I=Q.split("."))[0]<4?1:I[0]+I[1]:z&&(!(I=z.match(/Edge\/(\d+)/))||I[1]>=74)&&(I=z.match(/Chrome\/(\d+)/))&&(C=I[1]);var Y=C&&+C,X=!!Object.getOwnPropertySymbols&&!D((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Y&&Y<41})),$=X&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Z=$?function(e){return"symbol"==typeof e}:function(e){var t=J("Symbol");return"function"==typeof t&&Object(e)instanceof t},ee=function(e,t){try{Object.defineProperty(A,e,{value:t,configurable:!0,writable:!0})}catch(n){A[e]=t}return t},te=A["__core-js_shared__"]||ee("__core-js_shared__",{}),ne=E((function(e){(e.exports=function(e,t){return te[e]||(te[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.16.0",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),re=function(e){return Object(j(e))},ie={}.hasOwnProperty,ae=Object.hasOwn||function(e,t){return ie.call(re(e),t)},oe=0,se=Math.random(),ce=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++oe+se).toString(36)},ue=ne("wks"),de=A.Symbol,le=$?de:de&&de.withoutSetter||ce,he=function(e){return ae(ue,e)&&(X||"string"==typeof ue[e])||(X&&ae(de,e)?ue[e]=de[e]:ue[e]=le("Symbol."+e)),ue[e]},pe=he("toPrimitive"),fe=function(e,t){if(!H(e)||Z(e))return e;var n,r=e[pe];if(void 0!==r){if(void 0===t&&(t="default"),n=r.call(e,t),!H(n)||Z(n))return n;throw TypeError("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var n,r;if("string"===t&&"function"==typeof(n=e.toString)&&!H(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!H(r=n.call(e)))return r;if("string"!==t&&"function"==typeof(n=e.toString)&&!H(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}(e,t)},me=function(e){var t=fe(e,"string");return Z(t)?t:String(t)},_e=A.document,ve=H(_e)&&H(_e.createElement),ge=function(e){return ve?_e.createElement(e):{}},Se=!P&&!D((function(){return 7!=Object.defineProperty(ge("div"),"a",{get:function(){return 7}}).a})),ye=Object.getOwnPropertyDescriptor,Te={f:P?ye:function(e,t){if(e=B(e),t=me(t),Se)try{return ye(e,t)}catch(n){}if(ae(e,t))return M(!N.f.call(e,t),e[t])}},ke=function(e){if(!H(e))throw TypeError(String(e)+" is not an object");return e},Re=Object.defineProperty,be={f:P?Re:function(e,t,n){if(ke(e),t=me(t),ke(n),Se)try{return Re(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},Ee=P?function(e,t,n){return be.f(e,t,M(1,n))}:function(e,t,n){return e[t]=n,e},Ie=Function.toString;"function"!=typeof te.inspectSource&&(te.inspectSource=function(e){return Ie.call(e)});var Ce,we,Ae,De=te.inspectSource,Pe=A.WeakMap,xe="function"==typeof Pe&&/native code/.test(De(Pe)),Oe=ne("keys"),Ne=function(e){return Oe[e]||(Oe[e]=ce(e))},Me={},Le=A.WeakMap;if(xe||te.state){var Ve=te.state||(te.state=new Le),Ue=Ve.get,Fe=Ve.has,je=Ve.set;Ce=function(e,t){if(Fe.call(Ve,e))throw new TypeError("Object already initialized");return t.facade=e,je.call(Ve,e,t),t},we=function(e){return Ue.call(Ve,e)||{}},Ae=function(e){return Fe.call(Ve,e)}}else{var Be=Ne("state");Me[Be]=!0,Ce=function(e,t){if(ae(e,Be))throw new TypeError("Object already initialized");return t.facade=e,Ee(e,Be,t),t},we=function(e){return ae(e,Be)?e[Be]:{}},Ae=function(e){return ae(e,Be)}}var He={set:Ce,get:we,has:Ae,enforce:function(e){return Ae(e)?we(e):Ce(e,{})},getterFor:function(e){return function(t){var n;if(!H(t)||(n=we(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},Ge=E((function(e){var t=He.get,n=He.enforce,r=String(String).split("String");(e.exports=function(e,t,i,a){var o,s=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof t||ae(i,"name")||Ee(i,"name",t),(o=n(i)).source||(o.source=r.join("string"==typeof t?t:""))),e!==A?(s?!u&&e[t]&&(c=!0):delete e[t],c?e[t]=i:Ee(e,t,i)):c?e[t]=i:ee(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||De(this)}))})),Je=Math.ceil,ze=Math.floor,We=function(e){return isNaN(e=+e)?0:(e>0?ze:Je)(e)},qe=Math.min,Ke=function(e){return e>0?qe(We(e),9007199254740991):0},Qe=Math.max,Ye=Math.min,Xe=function(e,t){var n=We(e);return n<0?Qe(n+t,0):Ye(n,t)},$e=function(e){return function(t,n,r){var i,a=B(t),o=Ke(a.length),s=Xe(r,o);if(e&&n!=n){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===n)return e||s||0;return!e&&-1}},Ze={includes:$e(!0),indexOf:$e(!1)},et=Ze.indexOf,tt=function(e,t){var n,r=B(e),i=0,a=[];for(n in r)!ae(Me,n)&&ae(r,n)&&a.push(n);for(;t.length>i;)ae(r,n=t[i++])&&(~et(a,n)||a.push(n));return a},nt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],rt=nt.concat("length","prototype"),it={f:Object.getOwnPropertyNames||function(e){return tt(e,rt)}},at={f:Object.getOwnPropertySymbols},ot=J("Reflect","ownKeys")||function(e){var t=it.f(ke(e)),n=at.f;return n?t.concat(n(e)):t},st=function(e,t){for(var n=ot(t),r=be.f,i=Te.f,a=0;a<n.length;a++){var o=n[a];ae(e,o)||r(e,o,i(t,o))}},ct=/#|\.prototype\./,ut=function(e,t){var n=lt[dt(e)];return n==pt||n!=ht&&("function"==typeof t?D(t):!!t)},dt=ut.normalize=function(e){return String(e).replace(ct,".").toLowerCase()},lt=ut.data={},ht=ut.NATIVE="N",pt=ut.POLYFILL="P",ft=ut,mt=Te.f,_t=function(e,t){var n,r,i,a,o,s=e.target,c=e.global,u=e.stat;if(n=c?A:u?A[s]||ee(s,{}):(A[s]||{}).prototype)for(r in t){if(a=t[r],i=e.noTargetGet?(o=mt(n,r))&&o.value:n[r],!ft(c?r:s+(u?".":"#")+r,e.forced)&&void 0!==i){if(typeof a==typeof i)continue;st(a,i)}(e.sham||i&&i.sham)&&Ee(a,"sham",!0),Ge(n,r,a,e)}},vt=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},gt=function(e,t,n){if(vt(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},St=Array.isArray||function(e){return"Array"==V(e)},yt=he("species"),Tt=function(e,t){return new(function(e){var t;return St(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!St(t.prototype)?H(t)&&null===(t=t[yt])&&(t=void 0):t=void 0),void 0===t?Array:t}(e))(0===t?0:t)},kt=[].push,Rt=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,a=6==e,o=7==e,s=5==e||a;return function(c,u,d,l){for(var h,p,f=re(c),m=F(f),_=gt(u,d,3),v=Ke(m.length),g=0,S=l||Tt,y=t?S(c,v):n||o?S(c,0):void 0;v>g;g++)if((s||g in m)&&(p=_(h=m[g],g,f),e))if(t)y[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:kt.call(y,h)}else switch(e){case 4:return!1;case 7:kt.call(y,h)}return a?-1:r||i?i:y}},bt={forEach:Rt(0),map:Rt(1),filter:Rt(2),some:Rt(3),every:Rt(4),find:Rt(5),findIndex:Rt(6),filterReject:Rt(7)},Et=he("species"),It=function(e){return Y>=51||!D((function(){var t=[];return(t.constructor={})[Et]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ct=bt.map,wt=It("map");_t({target:"Array",proto:!0,forced:!wt},{map:function(e){return Ct(this,e,arguments.length>1?arguments[1]:void 0)}});var At=bt.filter,Dt=It("filter");_t({target:"Array",proto:!0,forced:!Dt},{filter:function(e){return At(this,e,arguments.length>1?arguments[1]:void 0)}});var Pt=Te.f,xt=D((function(){Pt(1)}));_t({target:"Object",stat:!0,forced:!P||xt,sham:!P},{getOwnPropertyDescriptor:function(e,t){return Pt(B(e),t)}});E((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(I){s=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof l?t:l,a=Object.create(i.prototype),o=new R(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return E()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=y(o,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,o),a}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(I){return{type:"throw",arg:I}}}e.wrap=c;var d={};function l(){}function h(){}function p(){}var f={};s(f,i,(function(){return this}));var m=Object.getPrototypeOf,_=m&&m(m(b([])));_&&_!==t&&n.call(_,i)&&(f=_);var v=p.prototype=l.prototype=Object.create(f);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){var r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,s){var c=u(e[i],e,a);if("throw"!==c.type){var d=c.arg,l=d.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,o,s)}),(function(e){r("throw",e,o,s)})):t.resolve(l).then((function(e){d.value=e,o(d)}),(function(e){return r("throw",e,o,s)}))}s(c.arg)}(i,a,r,o)}))}return r=r?r.then(o,o):o()}}function y(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,y(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function T(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function b(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:E}}function E(){return{value:void 0,done:!0}}return h.prototype=p,s(v,"constructor",p),s(p,"constructor",h),h.displayName=s(p,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(S.prototype),s(S.prototype,a,(function(){return this})),e.AsyncIterator=S,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new S(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},g(v),s(v,o,"Generator"),s(v,i,(function(){return this})),s(v,"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 r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=b,R.prototype={constructor:R,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;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,d):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),d},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),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:b(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}(e.exports);try{regeneratorRuntime=t}catch(n){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));let Ot=!0,Nt=!0;function Mt(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function Lt(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);const a=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};const a=r.removeEventListener;r.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);const r=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,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(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 Vt(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Ot=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Ut(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Nt=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Ft(){if("object"==typeof window){if(Ot)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function jt(e,t){Nt&&console.warn(e+" is deprecated, please use "+t+" instead.")}function Bt(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ht(e){return Bt(e)?Object.keys(e).reduce((function(t,n){const r=Bt(e[n]),i=r?Ht(e[n]):e[n],a=r&&!Object.keys(i).length;return void 0===i||a?t:Object.assign(t,{[n]:i})}),{}):e}function Gt(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const a=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&function e(t,n,r){n&&!r.has(n.id)&&(r.set(n.id,n),Object.keys(n).forEach(i=>{i.endsWith("Id")?e(t,t.get(n[i]),r):i.endsWith("Ids")&&n[i].forEach(n=>{e(t,t.get(n),r)})}))}(e,n,i)})}),i}const Jt=Ft;function zt(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),e={},e[i("max",n)]=r.ideal,t.optional.push(e)):(e[i("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let a=e.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});const o=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||o)){let t;if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?t=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then(n=>{let o=(n=n.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes("back")&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),Jt("chrome: "+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return Jt("chrome: "+JSON.stringify(e)),i(e)},a=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(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(a(e))))}}}function Wt(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function qt(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Lt(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function Kt(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const 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()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Qt(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach(e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{n[t]=e.stat(t)}),t[n.id]=n}),t},a=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const r=function(e){n(a(i(e)))};return t.apply(this,[r,e])}return new Promise((e,n)=>{t.apply(this,[function(t){e(a(i(t)))},n])}).then(n,r)}}function Yt(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>Gt(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Lt(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>Gt(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function Xt(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function $t(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Xt(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.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){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const i=this.getSenders().find(e=>e.track===t);if(i)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const a=this._streams[n.id];if(a)a.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=o(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=c.get.apply(this);return""===e.type?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){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");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Zt(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function en(e,t){Lt(e,"negotiationneeded",e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e})}var tn=Object.freeze({__proto__:null,shimMediaStream:Wt,shimOnTrack:qt,shimGetSendersWithDtmf:Kt,shimGetStats:Qt,shimSenderReceiverGetStats:Yt,shimAddTrackRemoveTrackWithNative:Xt,shimAddTrackRemoveTrack:$t,shimPeerConnection:Zt,fixNegotiationNeeded:en,shimGetUserMedia:zt,shimGetDisplayMedia:function(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(t=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,a=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:a||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var nn=E((function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){var n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((function(e){return 0===e.indexOf(n)}))},t.parseCandidate=function(e){for(var t,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;case"ufrag":n.ufrag=t[r+1],n.usernameFragment=t[r+1];break;default:n[t[r]]=t[r+1]}return n},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.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"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},t.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.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},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.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},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(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}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){var r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),i=3;i<r.length;i++){var a=r[i],o=t.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(o){var s=t.parseRtpMap(o),c=t.matchPrefix(e,"a=fmtp:"+a+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(t.parseRtcpFb),n.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){n.headerExtensions.push(t.parseExtmap(e))})),n},t.writeRtpDescription=function(e,n){var r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));var i=0;return n.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),r+="a=rtcp-mux\r\n",n.headerExtensions&&n.headerExtensions.forEach((function(e){r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){var n,r=[],i=t.parseRtpParameters(e),a=-1!==i.fecMechanisms.indexOf("RED"),o=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(n=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&n&&(t.rtx={ssrc:n}),r.push(t),a&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&c&&r.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){var n={},r=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;var a=t.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},t.parseMsid=function(e){var n,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(n=i[0].value.split(" "))[0],track:n[1]}:void 0},t.parseSctpDescription=function(e){var n,r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(n=parseInt(i[0].substr(19),10)),isNaN(n)&&(n=65536);var a=t.matchPrefix(e,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substr(12),10),protocol:r.fmt,maxMessageSize:n};if(t.matchPrefix(e,"a=sctpmap:").length>0){var o=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(o[0],10),protocol:o[1],maxMessageSize:n}}},t.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("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,n,r){var i=void 0!==n?n:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,n,r,i){var a=t.writeRtpDescription(e.kind,n);if(a+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),a+="a=mid:"+e.mid+"\r\n",e.direction?a+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var o="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";a+="a="+o,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+o,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+o,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),a},t.getDirection=function(e,n){for(var r=t.splitLines(e),i=0;i<r.length;i++)switch(r[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[i].substr(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var n=t.splitLines(e)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){var n=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var n=t.splitLines(e),r=0;r<n.length;r++)if(n[r].length<2||"="!==n[r].charAt(1))return!1;return!0},e.exports=t}));function rn(e,t,n,r,i){var a=nn.writeRtpDescription(e.kind,t);if(a+=nn.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=nn.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":i||"active"),a+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var o=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=o;var s="msid:"+(r?r.id:"-")+" "+o+"\r\n";a+="a="+s,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+nn.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+nn.localCName+"\r\n"),a}function an(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]},i=function(e,t,n,i){var a=r(e.parameters.apt,n),o=r(t.parameters.apt,i);return a&&o&&a.name.toLowerCase()===o.name.toLowerCase()};return e.codecs.forEach((function(r){for(var a=0;a<t.codecs.length;a++){var o=t.codecs[a];if(r.name.toLowerCase()===o.name.toLowerCase()&&r.clockRate===o.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&o.parameters.apt&&!i(r,o,e.codecs,t.codecs))continue;(o=JSON.parse(JSON.stringify(o))).numChannels=Math.min(r.numChannels,o.numChannels),n.codecs.push(o),o.rtcpFeedback=o.rtcpFeedback.filter((function(e){for(var t=0;t<r.rtcpFeedback.length;t++)if(r.rtcpFeedback[t].type===e.type&&r.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}})),n}function on(e,t,n){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(n)}function sn(e,t){var n=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return n||e.addRemoteCandidate(t),!n}function cn(e,t){var n=new Error(t);return n.name=e,n.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],n}var un=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function r(t,n,r,i){var a=new Event("track");a.track=n,a.receiver=r,a.transceiver={receiver:r},a.streams=i,e.setTimeout((function(){t._dispatchEvent("track",a)}))}var i=function(n){var r=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){r[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw cn("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter((function(e){return 0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")&&-1===e.indexOf("turn:[")&&!n?(n=!0,!0):0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp")})),delete e.url,e.urls=i?r[0]:r,!!r.length}}))}(n.iceServers||[],t),this._iceGatherers=[],n.iceCandidatePoolSize)for(var a=n.iceCandidatePoolSize;a>0;a--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=nn.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var n=this.transceivers.length>0,r={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&n)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();r.iceTransport=i.iceTransport,r.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(r),r},i.prototype.addTrack=function(t,n){if(this._isClosed)throw cn("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find((function(e){return e.track===t})))throw cn("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(r=this.transceivers[i]);return r||(r=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(n)&&this.localStreams.push(n),r.track=t,r.stream=n,r.rtpSender=new e.RTCRtpSender(t,r.dtlsTransport),r.rtpSender},i.prototype.addStream=function(e){var n=this;if(t>=15025)e.getTracks().forEach((function(t){n.addTrack(t,e)}));else{var r=e.clone();e.getTracks().forEach((function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",(function(e){n.enabled=e.enabled}))})),r.getTracks().forEach((function(e){n.addTrack(e,r)}))}},i.prototype.removeTrack=function(t){if(this._isClosed)throw cn("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find((function(e){return e.rtpSender===t}));if(!n)throw cn("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var n=t.getSenders().find((function(t){return t.track===e}));n&&t.removeTrack(n)}))},i.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},i.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},i.prototype._createIceGatherer=function(t,n){var r=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var n=!e.candidate||0===Object.keys(e.candidate).length;i.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,n){var r=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var a=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var a=new Event("icecandidate");a.candidate={sdpMid:t,sdpMLineIndex:n};var o=e.candidate,s=!o||0===Object.keys(o).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),o.component=1,o.ufrag=i.getLocalParameters().usernameFragment;var c=nn.writeCandidate(o);a.candidate=Object.assign(a.candidate,nn.parseCandidate(c)),a.candidate.candidate=c,a.candidate.toJSON=function(){return{candidate:a.candidate.candidate,sdpMid:a.candidate.sdpMid,sdpMLineIndex:a.candidate.sdpMLineIndex,usernameFragment:a.candidate.usernameFragment}}}var u=nn.getMediaSections(r._localDescription.sdp);u[a.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+a.candidate.candidate+"\r\n",r._localDescription.sdp=nn.getDescription(r._localDescription.sdp)+u.join("");var d=r.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),s||r._dispatchEvent("icecandidate",a),d&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout((function(){a.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var r=new e.RTCDtlsTransport(n);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:r}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,n,r){var i=an(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:nn.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),r&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,n,r=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(cn("TypeError",'Unsupported type "'+e.type+'"'));if(!on("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(cn("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=nn.splitSections(e.sdp),n=t.shift(),t.forEach((function(e,t){var n=nn.parseRtpParameters(e);r.transceivers[t].localCapabilities=n})),r.transceivers.forEach((function(e,t){r._gather(e.mid,t)}));else if("answer"===e.type){t=nn.splitSections(r._remoteDescription.sdp),n=t.shift();var i=nn.matchPrefix(n,"a=ice-lite").length>0;t.forEach((function(e,t){var a=r.transceivers[t],o=a.iceGatherer,s=a.iceTransport,c=a.dtlsTransport,u=a.localCapabilities,d=a.remoteCapabilities;if(!(nn.isRejected(e)&&0===nn.matchPrefix(e,"a=bundle-only").length)&&!a.rejected){var l=nn.getIceParameters(e,n),h=nn.getDtlsParameters(e,n);i&&(h.role="server"),r.usingBundle&&0!==t||(r._gather(a.mid,t),"new"===s.state&&s.start(o,l,i?"controlling":"controlled"),"new"===c.state&&c.start(h));var p=an(u,d);r._transceive(a,p.codecs.length>0,!1)}}))}return r._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?r._updateSignalingState("have-local-offer"):r._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var a=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(cn("TypeError",'Unsupported type "'+i.type+'"'));if(!on("setRemoteDescription",i.type,a.signalingState)||a._isClosed)return Promise.reject(cn("InvalidStateError","Can not set remote "+i.type+" in state "+a.signalingState));var o={};a.remoteStreams.forEach((function(e){o[e.id]=e}));var s=[],c=nn.splitSections(i.sdp),u=c.shift(),d=nn.matchPrefix(u,"a=ice-lite").length>0,l=nn.matchPrefix(u,"a=group:BUNDLE ").length>0;a.usingBundle=l;var h=nn.matchPrefix(u,"a=ice-options:")[0];return a.canTrickleIceCandidates=!!h&&h.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(r,c){var h=nn.splitLines(r),p=nn.getKind(r),f=nn.isRejected(r)&&0===nn.matchPrefix(r,"a=bundle-only").length,m=h[0].substr(2).split(" ")[2],_=nn.getDirection(r,u),v=nn.parseMsid(r),g=nn.getMid(r)||nn.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===m||"UDP/DTLS/SCTP"===m))a.transceivers[c]={mid:g,kind:p,protocol:m,rejected:!0};else{var S,y,T,k,R,b,E,I,C;!f&&a.transceivers[c]&&a.transceivers[c].rejected&&(a.transceivers[c]=a._createTransceiver(p,!0));var w,A,D=nn.parseRtpParameters(r);f||(w=nn.getIceParameters(r,u),(A=nn.getDtlsParameters(r,u)).role="client"),E=nn.parseRtpEncodingParameters(r);var P=nn.parseRtcpParameters(r),x=nn.matchPrefix(r,"a=end-of-candidates",u).length>0,O=nn.matchPrefix(r,"a=candidate:").map((function(e){return nn.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!f&&l&&c>0&&a.transceivers[c]&&(a._disposeIceAndDtlsTransports(c),a.transceivers[c].iceGatherer=a.transceivers[0].iceGatherer,a.transceivers[c].iceTransport=a.transceivers[0].iceTransport,a.transceivers[c].dtlsTransport=a.transceivers[0].dtlsTransport,a.transceivers[c].rtpSender&&a.transceivers[c].rtpSender.setTransport(a.transceivers[0].dtlsTransport),a.transceivers[c].rtpReceiver&&a.transceivers[c].rtpReceiver.setTransport(a.transceivers[0].dtlsTransport)),"offer"!==i.type||f){if("answer"===i.type&&!f){y=(S=a.transceivers[c]).iceGatherer,T=S.iceTransport,k=S.dtlsTransport,R=S.rtpReceiver,b=S.sendEncodingParameters,I=S.localCapabilities,a.transceivers[c].recvEncodingParameters=E,a.transceivers[c].remoteCapabilities=D,a.transceivers[c].rtcpParameters=P,O.length&&"new"===T.state&&(!d&&!x||l&&0!==c?O.forEach((function(e){sn(S.iceTransport,e)})):T.setRemoteCandidates(O)),l&&0!==c||("new"===T.state&&T.start(y,w,"controlling"),"new"===k.state&&k.start(A)),!an(S.localCapabilities,S.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&S.sendEncodingParameters[0].rtx&&delete S.sendEncodingParameters[0].rtx,a._transceive(S,"sendrecv"===_||"recvonly"===_,"sendrecv"===_||"sendonly"===_),!R||"sendrecv"!==_&&"sendonly"!==_?delete S.rtpReceiver:(C=R.track,v?(o[v.stream]||(o[v.stream]=new e.MediaStream),n(C,o[v.stream]),s.push([C,R,o[v.stream]])):(o.default||(o.default=new e.MediaStream),n(C,o.default),s.push([C,R,o.default])))}}else{(S=a.transceivers[c]||a._createTransceiver(p)).mid=g,S.iceGatherer||(S.iceGatherer=a._createIceGatherer(c,l)),O.length&&"new"===S.iceTransport.state&&(!x||l&&0!==c?O.forEach((function(e){sn(S.iceTransport,e)})):S.iceTransport.setRemoteCandidates(O)),I=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(I.codecs=I.codecs.filter((function(e){return"rtx"!==e.name}))),b=S.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var N,M=!1;if("sendrecv"===_||"sendonly"===_){if(M=!S.rtpReceiver,R=S.rtpReceiver||new e.RTCRtpReceiver(S.dtlsTransport,p),M)C=R.track,v&&"-"===v.stream||(v?(o[v.stream]||(o[v.stream]=new e.MediaStream,Object.defineProperty(o[v.stream],"id",{get:function(){return v.stream}})),Object.defineProperty(C,"id",{get:function(){return v.track}}),N=o[v.stream]):(o.default||(o.default=new e.MediaStream),N=o.default)),N&&(n(C,N),S.associatedRemoteMediaStreams.push(N)),s.push([C,R,N])}else S.rtpReceiver&&S.rtpReceiver.track&&(S.associatedRemoteMediaStreams.forEach((function(t){var n=t.getTracks().find((function(e){return e.id===S.rtpReceiver.track.id}));n&&function(t,n){n.removeTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(n,t)})),S.associatedRemoteMediaStreams=[]);S.localCapabilities=I,S.remoteCapabilities=D,S.rtpReceiver=R,S.rtcpParameters=P,S.sendEncodingParameters=b,S.recvEncodingParameters=E,a._transceive(a.transceivers[c],!1,M)}}})),void 0===a._dtlsRole&&(a._dtlsRole="offer"===i.type?"active":"passive"),a._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?a._updateSignalingState("have-remote-offer"):a._updateSignalingState("stable"),Object.keys(o).forEach((function(t){var n=o[t];if(n.getTracks().length){if(-1===a.remoteStreams.indexOf(n)){a.remoteStreams.push(n);var i=new Event("addstream");i.stream=n,e.setTimeout((function(){a._dispatchEvent("addstream",i)}))}s.forEach((function(e){var t=e[0],i=e[1];n.id===e[2].id&&r(a,t,i,[n])}))}})),s.forEach((function(e){e[2]||r(a,e[0],e[1],[])})),e.setTimeout((function(){a&&a.transceivers&&a.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var n=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",n)}},i.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(cn("InvalidStateError","Can not call createOffer after close"));var r=n.transceivers.filter((function(e){return"audio"===e.kind})).length,i=n.transceivers.filter((function(e){return"video"===e.kind})).length,a=arguments[0];if(a){if(a.mandatory||a.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==a.offerToReceiveAudio&&(r=!0===a.offerToReceiveAudio?1:!1===a.offerToReceiveAudio?0:a.offerToReceiveAudio),void 0!==a.offerToReceiveVideo&&(i=!0===a.offerToReceiveVideo?1:!1===a.offerToReceiveVideo?0:a.offerToReceiveVideo)}for(n.transceivers.forEach((function(e){"audio"===e.kind?--r<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)}));r>0||i>0;)r>0&&(n._createTransceiver("audio"),r--),i>0&&(n._createTransceiver("video"),i--);var o=nn.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach((function(r,i){var a=r.track,o=r.kind,s=r.mid||nn.generateIdentifier();r.mid=s,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.usingBundle));var c=e.RTCRtpSender.getCapabilities(o);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),r.remoteCapabilities&&r.remoteCapabilities.codecs&&r.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(r.remoteCapabilities&&r.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=r.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];a&&t>=15019&&"video"===o&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,o)),r.localCapabilities=c,r.sendEncodingParameters=u})),"max-compat"!==n._config.bundlePolicy&&(o+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),o+="a=ice-options:trickle\r\n",n.transceivers.forEach((function(e,t){o+=rn(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),o+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,o+="a="+nn.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(o+="a=end-of-candidates\r\n"))}));var s=new e.RTCSessionDescription({type:"offer",sdp:o});return Promise.resolve(s)},i.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(cn("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(cn("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var r=nn.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(r+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),r+="a=ice-options:trickle\r\n";var i=nn.getMediaSections(n._remoteDescription.sdp).length;n.transceivers.forEach((function(e,a){if(!(a+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?r+="m=application 0 DTLS/SCTP 5000\r\n":r+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?r+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(r+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(r+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var o;if(e.stream)"audio"===e.kind?o=e.stream.getAudioTracks()[0]:"video"===e.kind&&(o=e.stream.getVideoTracks()[0]),o&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var s=an(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,r+=rn(e,s,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(r+="a=rtcp-rsize\r\n")}}));var a=new e.RTCSessionDescription({type:"answer",sdp:r});return Promise.resolve(a)},i.prototype.addIceCandidate=function(e){var t,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(r,i){if(!n._remoteDescription)return i(cn("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var a=e.sdpMLineIndex;if(e.sdpMid)for(var o=0;o<n.transceivers.length;o++)if(n.transceivers[o].mid===e.sdpMid){a=o;break}var s=n.transceivers[a];if(!s)return i(cn("OperationError","Can not add ICE candidate"));if(s.rejected)return r();var c=Object.keys(e.candidate).length>0?nn.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return r();if(c.component&&1!==c.component)return r();if((0===a||a>0&&s.iceTransport!==n.transceivers[0].iceTransport)&&!sn(s.iceTransport,c))return i(cn("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=nn.getMediaSections(n._remoteDescription.sdp))[a]+="a="+(c.type?u:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=nn.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var d=0;d<n.transceivers.length&&(n.transceivers[d].rejected||(n.transceivers[d].iceTransport.addRemoteCandidate({}),(t=nn.getMediaSections(n._remoteDescription.sdp))[d]+="a=end-of-candidates\r\n",n._remoteDescription.sdp=nn.getDescription(n._remoteDescription.sdp)+t.join(""),!n.usingBundle));d++);r()}))},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var n=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?n=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(n=e.rtpReceiver)})),!n)throw cn("InvalidAccessError","Invalid selector.");return n.getStats()}var r=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&r.push(e[t].getStats())}))})),Promise.all(r).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var n=e[t];if(n&&n.prototype&&n.prototype.getStats){var r=n.prototype.getStats;n.prototype.getStats=function(){return r.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(n){var r;e[n].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(r=e[n]).type]||r.type,t.set(n,e[n])})),t}))}}}));var a=["createOffer","createAnswer"];return a.forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(a=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),i};function dn(e){const t=e&&e.navigator,n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(e).catch(e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e)))}}function ln(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function hn(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const n=new Event("enabled");n.enabled=e,this.dispatchEvent(n)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const n=un(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e,t){let n=!1;return(e=JSON.parse(JSON.stringify(e))).filter(e=>{if(e&&(e.urls||e.url)){let t=e.urls||e.url;e.url&&!e.urls&&jt("RTCIceServer.url","RTCIceServer.urls");const r="string"==typeof t;return r&&(t=[t]),t=t.filter(e=>{if(0===e.indexOf("stun:"))return!1;const t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!n?(n=!0,!0):t&&!n}),delete e.url,e.urls=r?t[0]:t,!!t.length}})}(e.iceServers,t.version),Ft("ICE servers after filtering:",e.iceServers)),new n(e)},e.RTCPeerConnection.prototype=n.prototype}function pn(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var fn=Object.freeze({__proto__:null,shimPeerConnection:hn,shimReplaceTrack:pn,shimGetUserMedia:dn,shimGetDisplayMedia:ln});function mn(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){jt("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function _n(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function vn(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(r){if("TypeError"!==r.name)throw r;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function gn(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const 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 Sn(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Lt(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function yn(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){jt("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Tn(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function kn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],n=e&&"sendEncodings"in e;n&&e.sendEncodings.forEach(e=>{if("rid"in e){if(!/^[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")});const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function Rn(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function bn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function En(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var In=Object.freeze({__proto__:null,shimOnTrack:_n,shimPeerConnection:vn,shimSenderGetStats:gn,shimReceiverGetStats:Sn,shimRemoveStream:yn,shimRTCDataChannel:Tn,shimAddTransceiver:kn,shimGetParameters:Rn,shimCreateOffer:bn,shimCreateAnswer:En,shimGetUserMedia:mn,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}});function shimLocalStreamsAPI(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function shimRemoteStreamsAPI(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function Cn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){const r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function wn(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(An(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function An(e){return e&&void 0!==e.video?Object.assign({},e,{video:Ht(e.video)}):e}function Dn(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(jt("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Pn(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function xn(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&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.offerToReceiveVideo||n||this.addTransceiver("video")}return t.apply(this,arguments)}}function On(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Nn=Object.freeze({__proto__:null,shimLocalStreamsAPI:shimLocalStreamsAPI,shimRemoteStreamsAPI:shimRemoteStreamsAPI,shimCallbacksAPI:Cn,shimGetUserMedia:wn,shimConstraints:An,shimRTCIceServerUrls:Dn,shimTrackEventTransceiver:Pn,shimCreateOfferLegacy:xn,shimAudioContext:On});function Mn(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const n=new t(e),r=nn.parseCandidate(e.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Lt(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Ln(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=function(e){if(!e||!e.sdp)return!1;const t=nn.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=nn.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})},r=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n},i=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n},a=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const i=nn.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r},o=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const e=r(arguments[0]),t=i(e),n=a(arguments[0],e);let o;o=0===t&&0===n?Number.POSITIVE_INFINITY:0===t||0===n?Math.max(t,n):Math.min(t,n);const s={};Object.defineProperty(s,"maxMessageSize",{get:()=>o}),this._sctp=s}return o.apply(this,arguments)}}function Vn(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},Lt(e,"datachannel",e=>(t(e.channel,e.target),e))}function Un(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(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(e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function Fn(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function jn(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const 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())})}var Bn=Object.freeze({__proto__:null,shimRTCIceCandidate:Mn,shimMaxMessageSize:Ln,shimSendThrowTypeError:Vn,shimConnectionState:Un,removeExtmapAllowMixed:Fn,shimAddIceCandidateNullOrEmpty:jn});!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const n=Ft,r=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=Mt(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=Mt(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=Mt(n.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=Mt(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:r,commonShim:Bn,extractVersion:Mt,disableLog:Vt,disableWarnings:Ut};switch(r.browser){case"chrome":if(!tn||!Zt||!t.shimChrome)return n("Chrome shim is not included in this adapter release."),i;if(null===r.version)return n("Chrome shim can not determine version, not shimming."),i;n("adapter.js shimming chrome."),i.browserShim=tn,jn(e,r),zt(e,r),Wt(e),Zt(e,r),qt(e),$t(e,r),Kt(e),Qt(e),Yt(e),en(e,r),Mn(e),Un(e),Ln(e,r),Vn(e),Fn(e,r);break;case"firefox":if(!In||!vn||!t.shimFirefox)return n("Firefox shim is not included in this adapter release."),i;n("adapter.js shimming firefox."),i.browserShim=In,jn(e,r),mn(e,r),vn(e,r),_n(e),yn(e),gn(e),Sn(e),Tn(e),kn(e),Rn(e),bn(e),En(e),Mn(e),Un(e),Ln(e,r),Vn(e);break;case"edge":if(!fn||!hn||!t.shimEdge)return n("MS edge shim is not included in this adapter release."),i;n("adapter.js shimming edge."),i.browserShim=fn,dn(e),ln(e),hn(e,r),pn(e),Ln(e,r),Vn(e);break;case"safari":if(!Nn||!t.shimSafari)return n("Safari shim is not included in this adapter release."),i;n("adapter.js shimming safari."),i.browserShim=Nn,jn(e,r),Dn(e),xn(e),Cn(e),shimLocalStreamsAPI(e),shimRemoteStreamsAPI(e),Pn(e),wn(e),On(e),Mn(e),Ln(e,r),Vn(e),Fn(e,r);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var Hn=[].slice,Gn={},Jn=function(e,t,n){if(!(t in Gn)){for(var r=[],i=0;i<t;i++)r[i]="a["+i+"]";Gn[t]=Function("C,a","return new C("+r.join(",")+")")}return Gn[t](e,n)},zn=Function.bind||function(e){var t=vt(this),n=Hn.call(arguments,1),r=function(){var i=n.concat(Hn.call(arguments));return this instanceof r?Jn(t,i.length,i):t.apply(e,i)};return H(t.prototype)&&(r.prototype=t.prototype),r};_t({target:"Function",proto:!0},{bind:zn});var Wn=be.f,qn=Function.prototype,Kn=qn.toString,Qn=/^\s*function ([^ (]*)/;P&&!("name"in qn)&&Wn(qn,"name",{configurable:!0,get:function(){try{return Kn.call(this).match(Qn)[1]}catch(e){return""}}});var Yn,Xn=function(e){if(Z(e))throw TypeError("Cannot convert a Symbol value to a string");return String(e)},$n=function(){var e=ke(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},Zn=function(e,t){return RegExp(e,t)},er={UNSUPPORTED_Y:D((function(){var e=Zn("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:D((function(){var e=Zn("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},tr=Object.keys||function(e){return tt(e,nt)},nr=P?Object.defineProperties:function(e,t){ke(e);for(var n,r=tr(t),i=r.length,a=0;i>a;)be.f(e,n=r[a++],t[n]);return e},rr=J("document","documentElement"),ir=Ne("IE_PROTO"),ar=function(){},or=function(e){return"<script>"+e+"<\/script>"},sr=function(e){e.write(or("")),e.close();var t=e.parentWindow.Object;return e=null,t},cr=function(){try{Yn=new ActiveXObject("htmlfile")}catch(t){}cr=document.domain&&Yn?sr(Yn):function(){var e,t=ge("iframe");if(t.style)return t.style.display="none",rr.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(or("document.F=Object")),e.close(),e.F}()||sr(Yn);for(var e=nt.length;e--;)delete cr.prototype[nt[e]];return cr()};Me[ir]=!0;var ur=Object.create||function(e,t){var n;return null!==e?(ar.prototype=ke(e),n=new ar,ar.prototype=null,n[ir]=e):n=cr(),void 0===t?n:nr(n,t)},dr=D((function(){var e=RegExp(".","string".charAt(0));return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),lr=D((function(){var e=RegExp("(?<a>b)","string".charAt(5));return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),hr=He.get,pr=RegExp.prototype.exec,fr=ne("native-string-replace",String.prototype.replace),mr=pr,_r=function(){var e=/a/,t=/b*/g;return pr.call(e,"a"),pr.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),vr=er.UNSUPPORTED_Y||er.BROKEN_CARET,gr=void 0!==/()??/.exec("")[1];(_r||gr||vr||dr||lr)&&(mr=function(e){var t,n,r,i,a,o,s,c=this,u=hr(c),d=Xn(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=mr.call(l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=vr&&c.sticky,f=$n.call(c),m=c.source,_=0,v=d;if(p&&(-1===(f=f.replace("y","")).indexOf("g")&&(f+="g"),v=d.slice(c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==d.charAt(c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,_++),n=new RegExp("^(?:"+m+")",f)),gr&&(n=new RegExp("^"+m+"$(?!\\s)",f)),_r&&(r=c.lastIndex),i=pr.call(p?n:c,v),p?i?(i.input=i.input.slice(_),i[0]=i[0].slice(_),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:_r&&i&&(c.lastIndex=c.global?i.index+i[0].length:r),gr&&i&&i.length>1&&fr.call(i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&h)for(i.groups=o=ur(null),a=0;a<h.length;a++)o[(s=h[a])[0]]=i[s[1]];return i});var Sr=mr;_t({target:"RegExp",proto:!0,forced:/./.exec!==Sr},{exec:Sr});var yr="\t\n\v\f\r                 \u2028\u2029\ufeff",Tr="["+yr+"]",kr=RegExp("^"+Tr+Tr+"*"),Rr=RegExp(Tr+Tr+"*$"),br=function(e){return function(t){var n=Xn(j(t));return 1&e&&(n=n.replace(kr,"")),2&e&&(n=n.replace(Rr,"")),n}},Er={start:br(1),end:br(2),trim:br(3)},Ir=Er.trim,Cr=A.parseFloat,wr=1/Cr(yr+"-0")!=-Infinity?function(e){var t=Ir(Xn(e)),n=Cr(t);return 0===n&&"-"==t.charAt(0)?-0:n}:Cr;_t({global:!0,forced:parseFloat!=wr},{parseFloat:wr});var Ar=he("species"),Dr=RegExp.prototype,Pr=function(e,t,n,r){var i=he(e),a=!D((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),o=a&&!D((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[Ar]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!a||!o||n){var s=/./[i],c=t(i,""[e],(function(e,t,n,r,i){var o=t.exec;return o===Sr||o===Dr.exec?a&&!i?{done:!0,value:s.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}));Ge(String.prototype,e,c[0]),Ge(Dr,i,c[1])}r&&Ee(Dr[i],"sham",!0)},xr=function(e){return function(t,n){var r,i,a=Xn(j(t)),o=We(n),s=a.length;return o<0||o>=s?e?"":void 0:(r=a.charCodeAt(o))<55296||r>56319||o+1===s||(i=a.charCodeAt(o+1))<56320||i>57343?e?a.charAt(o):r:e?a.slice(o,o+2):i-56320+(r-55296<<10)+65536}},Or={codeAt:xr(!1),charAt:xr(!0)},Nr=Or.charAt,Mr=function(e,t,n){return t+(n?Nr(e,t).length:1)},Lr=function(e,t){var n=e.exec;if("function"==typeof n){var r=n.call(e,t);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==V(e))throw TypeError("RegExp#exec called on incompatible receiver");return Sr.call(e,t)};Pr("match",(function(e,t,n){return[function(t){var n=j(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](Xn(n))},function(e){var r=ke(this),i=Xn(e),a=n(t,r,i);if(a.done)return a.value;if(!r.global)return Lr(r,i);var o=r.unicode;r.lastIndex=0;for(var s,c=[],u=0;null!==(s=Lr(r,i));){var d=Xn(s[0]);c[u]=d,""===d&&(r.lastIndex=Mr(i,Ke(r.lastIndex),o)),u++}return 0===u?null:c}]}));var Vr=he("unscopables"),Ur=Array.prototype;null==Ur[Vr]&&be.f(Ur,Vr,{configurable:!0,value:ur(null)});var Fr,jr,Br,Hr=function(e){Ur[Vr][e]=!0},Gr={},Jr=!D((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),zr=Ne("IE_PROTO"),Wr=Object.prototype,qr=Jr?Object.getPrototypeOf:function(e){return e=re(e),ae(e,zr)?e[zr]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Wr:null},Kr=he("iterator"),Qr=!1;[].keys&&("next"in(Br=[].keys())?(jr=qr(qr(Br)))!==Object.prototype&&(Fr=jr):Qr=!0),(null==Fr||D((function(){var e={};return Fr[Kr].call(e)!==e})))&&(Fr={}),ae(Fr,Kr)||Ee(Fr,Kr,(function(){return this}));var Yr={IteratorPrototype:Fr,BUGGY_SAFARI_ITERATORS:Qr},Xr=be.f,$r=he("toStringTag"),Zr=function(e,t,n){e&&!ae(e=n?e:e.prototype,$r)&&Xr(e,$r,{configurable:!0,value:t})},ei=Yr.IteratorPrototype,ti=function(){return this},ni=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(r){}return function(n,r){return ke(n),function(e){if(!H(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),ri=Yr.IteratorPrototype,ii=Yr.BUGGY_SAFARI_ITERATORS,ai=he("iterator"),oi=function(){return this},si=function(e,t,n,r,i,a,o){!function(e,t,n){var r=t+" Iterator";e.prototype=ur(ei,{next:M(1,n)}),Zr(e,r,!1),Gr[r]=ti}(n,t,r);var s,c,u,d=function(e){if(e===i&&m)return m;if(!ii&&e in p)return p[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[ai]||p["@@iterator"]||i&&p[i],m=!ii&&f||d(i),_="Array"==t&&p.entries||f;if(_&&(s=qr(_.call(new e)),ri!==Object.prototype&&s.next&&(qr(s)!==ri&&(ni?ni(s,ri):"function"!=typeof s[ai]&&Ee(s,ai,oi)),Zr(s,l,!0))),"values"==i&&f&&"values"!==f.name&&(h=!0,m=function(){return f.call(this)}),p[ai]!==m&&Ee(p,ai,m),Gr[t]=m,i)if(c={values:d("values"),keys:a?m:d("keys"),entries:d("entries")},o)for(u in c)(ii||h||!(u in p))&&Ge(p,u,c[u]);else _t({target:t,proto:!0,forced:ii||h},c);return c},ci=He.set,ui=He.getterFor("Array Iterator"),di=si(Array,"Array",(function(e,t){ci(this,{type:"Array Iterator",target:B(e),index:0,kind:t})}),(function(){var e=ui(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");Gr.Arguments=Gr.Array,Hr("keys"),Hr("values"),Hr("entries");var li=it.f,hi={}.toString,pi="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],fi={f:function(e){return pi&&"[object Window]"==hi.call(e)?function(e){try{return li(e)}catch(t){return pi.slice()}}(e):li(B(e))}},mi=!D((function(){return Object.isExtensible(Object.preventExtensions({}))})),_i=E((function(e){var t=be.f,n=!1,r=ce("meta"),i=0,a=Object.isExtensible||function(){return!0},o=function(e){t(e,r,{value:{objectID:"O"+i++,weakData:{}}})},s=e.exports={enable:function(){s.enable=function(){},n=!0;var e=it.f,t=[].splice,i={};i[r]=1,e(i).length&&(it.f=function(n){for(var i=e(n),a=0,o=i.length;a<o;a++)if(i[a]===r){t.call(i,a,1);break}return i},_t({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:fi.f}))},fastKey:function(e,t){if(!H(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!ae(e,r)){if(!a(e))return"F";if(!t)return"E";o(e)}return e[r].objectID},getWeakData:function(e,t){if(!ae(e,r)){if(!a(e))return!0;if(!t)return!1;o(e)}return e[r].weakData},onFreeze:function(e){return mi&&n&&a(e)&&!ae(e,r)&&o(e),e}};Me[r]=!0})),vi=(_i.enable,_i.fastKey,_i.getWeakData,_i.onFreeze,he("iterator")),gi=Array.prototype,Si={};Si[he("toStringTag")]="z";var yi="[object z]"===String(Si),Ti=he("toStringTag"),ki="Arguments"==V(function(){return arguments}()),Ri=yi?V:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(n){}}(t=Object(e),Ti))?n:ki?V(t):"Object"==(r=V(t))&&"function"==typeof t.callee?"Arguments":r},bi=he("iterator"),Ei=function(e){var t=e.return;if(void 0!==t)return ke(t.call(e)).value},Ii=function(e,t){this.stopped=e,this.result=t},Ci=function(e,t,n){var r,i,a,o,s,c,u,d,l=n&&n.that,h=!(!n||!n.AS_ENTRIES),p=!(!n||!n.IS_ITERATOR),f=!(!n||!n.INTERRUPTED),m=gt(t,l,1+h+f),_=function(e){return r&&Ei(r),new Ii(!0,e)},v=function(e){return h?(ke(e),f?m(e[0],e[1],_):m(e[0],e[1])):f?m(e,_):m(e)};if(p)r=e;else{if("function"!=typeof(i=function(e){if(null!=e)return e[bi]||e["@@iterator"]||Gr[Ri(e)]}(e)))throw TypeError("Target is not iterable");if(void 0!==(d=i)&&(Gr.Array===d||gi[vi]===d)){for(a=0,o=Ke(e.length);o>a;a++)if((s=v(e[a]))&&s instanceof Ii)return s;return new Ii(!1)}r=i.call(e)}for(c=r.next;!(u=c.call(r)).done;){try{s=v(u.value)}catch(g){throw Ei(r),g}if("object"==typeof s&&s&&s instanceof Ii)return s}return new Ii(!1)},wi=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},Ai=he("iterator"),Di=!1;try{var Pi=0,xi={next:function(){return{done:!!Pi++}},return:function(){Di=!0}};xi[Ai]=function(){return this},Array.from(xi,(function(){throw 2}))}catch(cS){}var Oi=function(e,t){if(!t&&!Di)return!1;var n=!1;try{var r={};r[Ai]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(cS){}return n},Ni=function(e,t,n){var r,i;return ni&&"function"==typeof(r=t.constructor)&&r!==n&&H(i=r.prototype)&&i!==n.prototype&&ni(e,i),e},Mi=function(e,t,n){for(var r in t)Ge(e,r,t[r],n);return e},Li=he("species"),Vi=function(e){var t=J(e),n=be.f;P&&t&&!t[Li]&&n(t,Li,{configurable:!0,get:function(){return this}})},Ui=be.f,Fi=_i.fastKey,ji=He.set,Bi=He.getterFor,Hi=(function(e,t,n){var r=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),a=r?"set":"add",o=A[e],s=o&&o.prototype,c=o,u={},d=function(e){var t=s[e];Ge(s,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!H(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return i&&!H(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!H(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(ft(e,"function"!=typeof o||!(i||s.forEach&&!D((function(){(new o).entries().next()})))))c=n.getConstructor(t,e,r,a),_i.enable();else if(ft(e,!0)){var l=new c,h=l[a](i?{}:-0,1)!=l,p=D((function(){l.has(1)})),f=Oi((function(e){new o(e)})),m=!i&&D((function(){for(var e=new o,t=5;t--;)e[a](t,t);return!e.has(-0)}));f||((c=t((function(t,n){wi(t,c,e);var i=Ni(new o,t,c);return null!=n&&Ci(n,i[a],{that:i,AS_ENTRIES:r}),i}))).prototype=s,s.constructor=c),(p||m)&&(d("delete"),d("has"),r&&d("get")),(m||h)&&d(a),i&&s.clear&&delete s.clear}u[e]=c,_t({global:!0,forced:c!=o},u),Zr(c,e),i||n.setStrong(c,e,r)}("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(e,t,n,r){var i=e((function(e,a){wi(e,i,t),ji(e,{type:t,index:ur(null),first:void 0,last:void 0,size:0}),P||(e.size=0),null!=a&&Ci(a,e[r],{that:e,AS_ENTRIES:n})})),a=Bi(t),o=function(e,t,n){var r,i,o=a(e),c=s(e,t);return c?c.value=n:(o.last=c={index:i=Fi(t,!0),key:t,value:n,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=c),r&&(r.next=c),P?o.size++:e.size++,"F"!==i&&(o.index[i]=c)),e},s=function(e,t){var n,r=a(e),i=Fi(t);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==t)return n};return Mi(i.prototype,{clear:function(){for(var e=a(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,P?e.size=0:this.size=0},delete:function(e){var t=a(this),n=s(this,e);if(n){var r=n.next,i=n.previous;delete t.index[n.index],n.removed=!0,i&&(i.next=r),r&&(r.previous=i),t.first==n&&(t.first=r),t.last==n&&(t.last=i),P?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=a(this),r=gt(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!s(this,e)}}),Mi(i.prototype,n?{get:function(e){var t=s(this,e);return t&&t.value},set:function(e,t){return o(this,0===e?0:e,t)}}:{add:function(e){return o(this,e=0===e?0:e,e)}}),P&&Ui(i.prototype,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,n){var r=t+" Iterator",i=Bi(t),a=Bi(r);si(e,t,(function(e,t){ji(this,{type:r,target:e,state:i(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)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),Vi(t)}}),yi?{}.toString:function(){return"[object "+Ri(this)+"]"});yi||Ge(Object.prototype,"toString",Hi,{unsafe:!0});var Gi=Or.charAt,Ji=He.set,zi=He.getterFor("String Iterator");si(String,"String",(function(e){Ji(this,{type:"String Iterator",string:Xn(e),index:0})}),(function(){var e,t=zi(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=Gi(n,r),t.index+=e.length,{value:e,done:!1})}));var Wi={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},qi=he("iterator"),Ki=he("toStringTag"),Qi=di.values;for(var Yi in Wi){var Xi=A[Yi],$i=Xi&&Xi.prototype;if($i){if($i[qi]!==Qi)try{Ee($i,qi,Qi)}catch(cS){$i[qi]=Qi}if($i[Ki]||Ee($i,Ki,Yi),Wi[Yi])for(var Zi in di)if($i[Zi]!==di[Zi])try{Ee($i,Zi,di[Zi])}catch(cS){$i[Zi]=di[Zi]}}}var ea=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};Pr("search",(function(e,t,n){return[function(t){var n=j(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](Xn(n))},function(e){var r=ke(this),i=Xn(e),a=n(t,r,i);if(a.done)return a.value;var o=r.lastIndex;ea(o,0)||(r.lastIndex=0);var s=Lr(r,i);return ea(r.lastIndex,o)||(r.lastIndex=o),null===s?-1:s.index}]}));var ta=he("match"),na=function(e){var t;return H(e)&&(void 0!==(t=e[ta])?!!t:"RegExp"==V(e))},ra=be.f,ia=it.f,aa=He.enforce,oa=he("match"),sa=A.RegExp,ca=sa.prototype,ua=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,da=/a/g,la=/a/g,ha=new sa(da)!==da,pa=er.UNSUPPORTED_Y,fa=P&&(!ha||pa||dr||lr||D((function(){return la[oa]=!1,sa(da)!=da||sa(la)==la||"/a/i"!=sa(da,"i")})));if(ft("RegExp",fa)){for(var ma=function(e,t){var n,r,i,a,o,s,c=this instanceof ma,u=na(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===ma)return e;if((u||e instanceof ma)&&(e=e.source,d&&(t="flags"in h?h.flags:$n.call(h))),e=void 0===e?"":Xn(e),t=void 0===t?"":Xn(t),h=e,dr&&"dotAll"in da&&(r=!!t&&t.indexOf("s")>-1)&&(t=t.replace(/s/g,"")),n=t,pa&&"sticky"in da&&(i=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,"")),lr&&(e=(a=function(e){for(var t,n=e.length,r=0,i="",a=[],o={},s=!1,c=!1,u=0,d="";r<=n;r++){if("\\"===(t=e.charAt(r)))t+=e.charAt(++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:ua.test(e.slice(r+1))&&(r+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||ae(o,d))throw new SyntaxError("Invalid capture group name");o[d]=!0,a.push([d,u]),c=!1,d="";continue}c?d+=t:i+=t}return[i,a]}(e))[0],l=a[1]),o=Ni(sa(e,t),c?this:ca,ma),(r||i||l.length)&&(s=aa(o),r&&(s.dotAll=!0,s.raw=ma(function(e){for(var t,n=e.length,r=0,i="",a=!1;r<=n;r++)"\\"!==(t=e.charAt(r))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),i+=t):i+="[\\s\\S]":i+=t+e.charAt(++r);return i}(e),n)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Ee(o,"source",""===h?"(?:)":h)}catch(cS){}return o},_a=function(e){e in ma||ra(ma,e,{configurable:!0,get:function(){return sa[e]},set:function(t){sa[e]=t}})},va=ia(sa),ga=0;va.length>ga;)_a(va[ga++]);ca.constructor=ma,ma.prototype=ca,Ge(A,"RegExp",ma)}Vi("RegExp");var Sa=RegExp.prototype,ya=Sa.toString,Ta=D((function(){return"/a/b"!=ya.call({source:"a",flags:"b"})})),ka="toString"!=ya.name;(Ta||ka)&&Ge(RegExp.prototype,"toString",(function(){var e=ke(this),t=Xn(e.source),n=e.flags;return"/"+t+"/"+Xn(void 0===n&&e instanceof RegExp&&!("flags"in Sa)?$n.call(e):n)}),{unsafe:!0});var Ra=function(e,t){var n=[][e];return!!n&&D((function(){n.call(null,t||function(){throw 1},1)}))},ba=Ze.indexOf,Ea=[].indexOf,Ia=!!Ea&&1/[1].indexOf(1,-0)<0,Ca=Ra("indexOf");_t({target:"Array",proto:!0,forced:Ia||!Ca},{indexOf:function(e){return Ia?Ea.apply(this,arguments)||0:ba(this,e,arguments.length>1?arguments[1]:void 0)}});var wa=Math.floor,Aa="".replace,Da=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Pa=/\$([$&'`]|\d{1,2})/g,xa=function(e,t,n,r,i,a){var o=n+e.length,s=r.length,c=Pa;return void 0!==i&&(i=re(i),c=Da),Aa.call(a,c,(function(a,c){var u;switch(c.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(o);case"<":u=i[c.slice(1,-1)];break;default:var d=+c;if(0===d)return a;if(d>s){var l=wa(d/10);return 0===l?a:l<=s?void 0===r[l-1]?c.charAt(1):r[l-1]+c.charAt(1):a}u=r[d-1]}return void 0===u?"":u}))},Oa=he("replace"),Na=Math.max,Ma=Math.min,La="$0"==="a".replace(/./,"$0"),Va=!!/./[Oa]&&""===/./[Oa]("a","$0");Pr("replace",(function(e,t,n){var r=Va?"$":"$0";return[function(e,n){var r=j(this),i=null==e?void 0:e[Oa];return void 0!==i?i.call(e,r,n):t.call(Xn(r),e,n)},function(e,i){var a=ke(this),o=Xn(e);if("string"==typeof i&&-1===i.indexOf(r)&&-1===i.indexOf("$<")){var s=n(t,a,o,i);if(s.done)return s.value}var c="function"==typeof i;c||(i=Xn(i));var u=a.global;if(u){var d=a.unicode;a.lastIndex=0}for(var l=[];;){var h=Lr(a,o);if(null===h)break;if(l.push(h),!u)break;""===Xn(h[0])&&(a.lastIndex=Mr(o,Ke(a.lastIndex),d))}for(var p,f="",m=0,_=0;_<l.length;_++){h=l[_];for(var v=Xn(h[0]),g=Na(Ma(We(h.index),o.length),0),S=[],y=1;y<h.length;y++)S.push(void 0===(p=h[y])?p:String(p));var T=h.groups;if(c){var k=[v].concat(S,g,o);void 0!==T&&k.push(T);var R=Xn(i.apply(void 0,k))}else R=xa(v,o,g,S,T,i);g>=m&&(f+=o.slice(m,g)+R,m=g+v.length)}return f+o.slice(m)}]}),!!D((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!La||Va);var Ua=D((function(){qr(1)}));_t({target:"Object",stat:!0,forced:Ua,sham:!Jr},{getPrototypeOf:function(e){return qr(re(e))}});var Fa=J("Reflect","apply"),ja=Function.apply,Ba=!D((function(){Fa((function(){}))}));_t({target:"Reflect",stat:!0,forced:Ba},{apply:function(e,t,n){return vt(e),ke(n),Fa?Fa(e,t,n):ja.call(e,t,n)}});var Ha=function(e,t,n){var r=me(t);r in e?be.f(e,r,M(0,n)):e[r]=n},Ga=he("isConcatSpreadable"),Ja=Y>=51||!D((function(){var e=[];return e[Ga]=!1,e.concat()[0]!==e})),za=It("concat"),Wa=function(e){if(!H(e))return!1;var t=e[Ga];return void 0!==t?!!t:St(e)};_t({target:"Array",proto:!0,forced:!Ja||!za},{concat:function(e){var t,n,r,i,a,o=re(this),s=Tt(o,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(Wa(a=-1===t?o:arguments[t])){if(c+(i=Ke(a.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<i;n++,c++)n in a&&Ha(s,c,a[n])}else{if(c>=9007199254740991)throw TypeError("Maximum allowed index exceeded");Ha(s,c++,a)}return s.length=c,s}}),_t({target:"Date",stat:!0},{now:function(){return(new Date).getTime()}});var qa=Date.prototype,Ka=qa.toString,Qa=qa.getTime;"Invalid Date"!=String(new Date(NaN))&&Ge(qa,"toString",(function(){var e=Qa.call(this);return e==e?Ka.call(this):"Invalid Date"}));var Ya=he("species"),Xa=function(e,t){var n,r=ke(e).constructor;return void 0===r||null==(n=ke(r)[Ya])?t:vt(n)},$a=er.UNSUPPORTED_Y,Za=[].push,eo=Math.min;Pr("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=Xn(j(this)),i=void 0===n?4294967295:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!na(e))return t.call(r,e,i);for(var a,o,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(a=Sr.call(l,r))&&!((o=l.lastIndex)>d&&(c.push(r.slice(d,a.index)),a.length>1&&a.index<r.length&&Za.apply(c,a.slice(1)),s=a[0].length,d=o,c.length>=i));)l.lastIndex===a.index&&l.lastIndex++;return d===r.length?!s&&l.test("")||c.push(""):c.push(r.slice(d)),c.length>i?c.slice(0,i):c}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=j(this),a=null==t?void 0:t[e];return void 0!==a?a.call(t,i,n):r.call(Xn(i),t,n)},function(e,i){var a=ke(this),o=Xn(e),s=n(r,a,o,i,r!==t);if(s.done)return s.value;var c=Xa(a,RegExp),u=a.unicode,d=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+($a?"g":"y"),l=new c($a?"^(?:"+a.source+")":a,d),h=void 0===i?4294967295:i>>>0;if(0===h)return[];if(0===o.length)return null===Lr(l,o)?[o]:[];for(var p=0,f=0,m=[];f<o.length;){l.lastIndex=$a?0:f;var _,v=Lr(l,$a?o.slice(f):o);if(null===v||(_=eo(Ke(l.lastIndex+($a?f:0)),o.length))===p)f=Mr(o,f,u);else{if(m.push(o.slice(p,f)),m.length===h)return m;for(var g=1;g<=v.length-1;g++)if(m.push(v[g]),m.length===h)return m;f=p=_}}return m.push(o.slice(p)),m}]}),!!D((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),$a);var to=it.f,no=Te.f,ro=be.f,io=Er.trim,ao=A.Number,oo=ao.prototype,so="Number"==V(ur(oo)),co=function(e){if(Z(e))throw TypeError("Cannot convert a Symbol value to a number");var t,n,r,i,a,o,s,c,u=fe(e,"number");if("string"==typeof u&&u.length>2)if(43===(t=(u=io(u)).charCodeAt(0))||45===t){if(88===(n=u.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(u.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+u}for(o=(a=u.slice(2)).length,s=0;s<o;s++)if((c=a.charCodeAt(s))<48||c>i)return NaN;return parseInt(a,r)}return+u};if(ft("Number",!ao(" 0o1")||!ao("0b1")||ao("+0x1"))){for(var uo,lo=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof lo&&(so?D((function(){oo.valueOf.call(n)})):"Number"!=V(n))?Ni(new ao(co(t)),n,lo):co(t)},ho=P?to(ao):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),po=0;ho.length>po;po++)ae(ao,uo=ho[po])&&!ae(lo,uo)&&ro(lo,uo,no(ao,uo));lo.prototype=oo,oo.constructor=lo,Ge(A,"Number",lo)}var fo="wss://qcloud.rtc.qq.com",mo="wss://bk.rtc.qq.com",_o="wss://trtc.rtc.qq.com",vo="wss://webrtc.qq.com",go="",So=function(e){return go=e},yo=1,To=2,ko=20,Ro=21,bo="5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV",Eo="224d130c-7b5c-415b-aaa2-79c2eb5a6df2",Io=2,Co="DISCONNECTED",wo="CONNECTING",Ao="RECONNECTING",Do="CONNECTED",Po="join",xo="delta-join",Oo="rejoin",No="leave",Mo="delta-leave",Lo="publish",Vo="delta-publish",Uo="unpublish",Fo="subscribe",jo="unsubscribe",Bo="uplink-connection",Ho="uplink-reconnection",Go="downlink-connection",Jo="downlink-reconnection",zo="setLocalDescription",Wo="setRemoteDescription",qo="iceConnectionState",Ko="stream-initialize",Qo="websocketConnectionState",Yo="websocketReconnectionState",Xo="update-stream",$o="recover-subscription",Zo="start-mix-transcode",es="stop-mix-transcode",ts="player-error",ns="unsubscribe",rs="subscribe_change",is={MANUAL:"manual",PRESET_LAYOUT:"preset-layout"},as={REMOTE:"$PLACE_HOLDER_REMOTE$"},os={IT_AUDIO_VIDEO:0,IT_PICTURE:2,IT_CANVAS:3,IT_PURE_AUDIO:4,IT_PURE_VIDEO:5},ss="string",cs="number",us="boolean",ds="array",ls="object",hs="audio",ps="video",fs="auxiliary",ms="add",_s="remove",vs={unknown:0,wifi:1,"3g":2,"2g":3,"4g":4,wired:5},gs=-1,Ss=0,ys=1,Ts="https://schedule.rtc.qq.com/api/v1/config",ks="TRTC",Rs="Client",bs="LocalStream",Es="RemoteStream",Is="Stream",Cs="https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/",ws={INVALID_PARAMETER:4096,INVALID_OPERATION:4097,NOT_SUPPORTED:4098,DEVICE_NOT_FOUND:4099,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,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,UNKNOWN:65535},As=function(e){u(n,e);var t=_(n);function n(e){var r,i=e.message,o=e.code,s=void 0===o?ws.UNKNOWN:o,c=e.extraCode,u=void 0===c?0:c;return a(this,n),(r=t.call(this,i+" <".concat(function(e){for(var t in ws)if(ws[t]===e)return t;return"UNKNOWN"}(s)," 0x").concat(s.toString(16),">"))).code_=s,r.extraCode_=u,r.name="RtcError",r.message_=i,r}return s(n,[{key:"getCode",value:function(){return this.code_}},{key:"getExtraCode",value:function(){return this.extraCode_}}]),n}(f(Error)),Ds=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},Ps=Object.prototype.toString;function xs(e){return"[object Array]"===Ps.call(e)}function Os(e){return void 0===e}function Ns(e){return null!==e&&"object"==typeof e}function Ms(e){return"[object Function]"===Ps.call(e)}function Ls(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),xs(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var Vs={isArray:xs,isArrayBuffer:function(e){return"[object ArrayBuffer]"===Ps.call(e)},isBuffer:function(e){return null!==e&&!Os(e)&&null!==e.constructor&&!Os(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Ns,isUndefined:Os,isDate:function(e){return"[object Date]"===Ps.call(e)},isFile:function(e){return"[object File]"===Ps.call(e)},isBlob:function(e){return"[object Blob]"===Ps.call(e)},isFunction:Ms,isStream:function(e){return Ns(e)&&Ms(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:Ls,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,i=arguments.length;r<i;r++)Ls(arguments[r],n);return t},deepMerge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]="object"==typeof n?e({},n):n}for(var r=0,i=arguments.length;r<i;r++)Ls(arguments[r],n);return t},extend:function(e,t,n){return Ls(t,(function(t,r){e[r]=n&&"function"==typeof t?Ds(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}};function Us(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Fs=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(Vs.isURLSearchParams(t))r=t.toString();else{var i=[];Vs.forEach(t,(function(e,t){null!=e&&(Vs.isArray(e)?t+="[]":e=[e],Vs.forEach(e,(function(e){Vs.isDate(e)?e=e.toISOString():Vs.isObject(e)&&(e=JSON.stringify(e)),i.push(Us(t)+"="+Us(e))})))})),r=i.join("&")}if(r){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function js(){this.handlers=[]}js.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},js.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},js.prototype.forEach=function(e){Vs.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var Bs=js,Hs=function(e,t,n){return Vs.forEach(n,(function(n){e=n(e,t)})),e},Gs=function(e){return!(!e||!e.__CANCEL__)},Js="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function zs(){throw new Error("setTimeout has not been defined")}function Ws(){throw new Error("clearTimeout has not been defined")}var qs=zs,Ks=Ws;function Qs(e){if(qs===setTimeout)return setTimeout(e,0);if((qs===zs||!qs)&&setTimeout)return qs=setTimeout,setTimeout(e,0);try{return qs(e,0)}catch(t){try{return qs.call(null,e,0)}catch(t){return qs.call(this,e,0)}}}"function"==typeof Js.setTimeout&&(qs=setTimeout),"function"==typeof Js.clearTimeout&&(Ks=clearTimeout);var Ys,Xs=[],$s=!1,Zs=-1;function ec(){$s&&Ys&&($s=!1,Ys.length?Xs=Ys.concat(Xs):Zs=-1,Xs.length&&tc())}function tc(){if(!$s){var e=Qs(ec);$s=!0;for(var t=Xs.length;t;){for(Ys=Xs,Xs=[];++Zs<t;)Ys&&Ys[Zs].run();Zs=-1,t=Xs.length}Ys=null,$s=!1,function(e){if(Ks===clearTimeout)return clearTimeout(e);if((Ks===Ws||!Ks)&&clearTimeout)return Ks=clearTimeout,clearTimeout(e);try{Ks(e)}catch(t){try{return Ks.call(null,e)}catch(t){return Ks.call(this,e)}}}(e)}}function nc(e,t){this.fun=e,this.array=t}nc.prototype.run=function(){this.fun.apply(null,this.array)};function rc(){}var ic=rc,ac=rc,oc=rc,sc=rc,cc=rc,uc=rc,dc=rc;var lc=Js.performance||{},hc=lc.now||lc.mozNow||lc.msNow||lc.oNow||lc.webkitNow||function(){return(new Date).getTime()};var pc=new Date;var fc={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Xs.push(new nc(e,t)),1!==Xs.length||$s||Qs(tc)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ic,addListener:ac,once:oc,off:sc,removeListener:cc,removeAllListeners:uc,emit:dc,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*hc.call(lc),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-pc)/1e3}},mc=function(e,t){Vs.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},_c=function(e,t,n,r,i){return function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,r,i)},vc=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],gc=Vs.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=Vs.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},Sc=Vs.isStandardBrowserEnv()?{write:function(e,t,n,r,i,a){var o=[];o.push(e+"="+encodeURIComponent(t)),Vs.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),Vs.isString(r)&&o.push("path="+r),Vs.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},yc=function(e){return new Promise((function(t,n){var r=e.data,i=e.headers;Vs.isFormData(r)&&delete i["Content-Type"];var a=new XMLHttpRequest;if(e.auth){var o=e.auth.username||"",s=e.auth.password||"";i.Authorization="Basic "+btoa(o+":"+s)}var c,u,d=(c=e.baseURL,u=e.url,c&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(u)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(c,u):u);if(a.open(e.method.toUpperCase(),Fs(d,e.params,e.paramsSerializer),!0),a.timeout=e.timeout,a.onreadystatechange=function(){if(a&&4===a.readyState&&(0!==a.status||a.responseURL&&0===a.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in a?function(e){var t,n,r,i={};return e?(Vs.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=Vs.trim(e.substr(0,r)).toLowerCase(),n=Vs.trim(e.substr(r+1)),t){if(i[t]&&vc.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([n]):i[t]?i[t]+", "+n:n}})),i):i}(a.getAllResponseHeaders()):null,i={data:e.responseType&&"text"!==e.responseType?a.response:a.responseText,status:a.status,statusText:a.statusText,headers:r,config:e,request:a};!function(e,t,n){var r=n.config.validateStatus;!r||r(n.status)?e(n):t(_c("Request failed with status code "+n.status,n.config,null,n.request,n))}(t,n,i),a=null}},a.onabort=function(){a&&(n(_c("Request aborted",e,"ECONNABORTED",a)),a=null)},a.onerror=function(){n(_c("Network Error",e,null,a)),a=null},a.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(_c(t,e,"ECONNABORTED",a)),a=null},Vs.isStandardBrowserEnv()){var l=Sc,h=(e.withCredentials||gc(d))&&e.xsrfCookieName?l.read(e.xsrfCookieName):void 0;h&&(i[e.xsrfHeaderName]=h)}if("setRequestHeader"in a&&Vs.forEach(i,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete i[t]:a.setRequestHeader(t,e)})),Vs.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),e.responseType)try{a.responseType=e.responseType}catch(p){if("json"!==e.responseType)throw p}"function"==typeof e.onDownloadProgress&&a.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&a.upload&&a.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){a&&(a.abort(),n(e),a=null)})),void 0===r&&(r=null),a.send(r)}))},Tc={"Content-Type":"application/x-www-form-urlencoded"};function kc(e,t){!Vs.isUndefined(e)&&Vs.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Rc={adapter:function(){var e;return("undefined"!=typeof XMLHttpRequest||void 0!==fc&&"[object process]"===Object.prototype.toString.call(fc))&&(e=yc),e}(),transformRequest:[function(e,t){return mc(t,"Accept"),mc(t,"Content-Type"),Vs.isFormData(e)||Vs.isArrayBuffer(e)||Vs.isBuffer(e)||Vs.isStream(e)||Vs.isFile(e)||Vs.isBlob(e)?e:Vs.isArrayBufferView(e)?e.buffer:Vs.isURLSearchParams(e)?(kc(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Vs.isObject(e)?(kc(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Vs.forEach(["delete","get","head"],(function(e){Rc.headers[e]={}})),Vs.forEach(["post","put","patch"],(function(e){Rc.headers[e]=Vs.merge(Tc)}));var bc=Rc;function Ec(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Ic=function(e){return Ec(e),e.headers=e.headers||{},e.data=Hs(e.data,e.headers,e.transformRequest),e.headers=Vs.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Vs.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||bc.adapter)(e).then((function(t){return Ec(e),t.data=Hs(t.data,t.headers,e.transformResponse),t}),(function(t){return Gs(t)||(Ec(e),t&&t.response&&(t.response.data=Hs(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Cc=function(e,t){t=t||{};var n={},r=["url","method","params","data"],i=["headers","auth","proxy"],a=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];Vs.forEach(r,(function(e){void 0!==t[e]&&(n[e]=t[e])})),Vs.forEach(i,(function(r){Vs.isObject(t[r])?n[r]=Vs.deepMerge(e[r],t[r]):void 0!==t[r]?n[r]=t[r]:Vs.isObject(e[r])?n[r]=Vs.deepMerge(e[r]):void 0!==e[r]&&(n[r]=e[r])})),Vs.forEach(a,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}));var o=r.concat(i).concat(a),s=Object.keys(t).filter((function(e){return-1===o.indexOf(e)}));return Vs.forEach(s,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])})),n};function wc(e){this.defaults=e,this.interceptors={request:new Bs,response:new Bs}}wc.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Cc(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Ic,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},wc.prototype.getUri=function(e){return e=Cc(this.defaults,e),Fs(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Vs.forEach(["delete","get","head","options"],(function(e){wc.prototype[e]=function(t,n){return this.request(Vs.merge(n||{},{method:e,url:t}))}})),Vs.forEach(["post","put","patch"],(function(e){wc.prototype[e]=function(t,n,r){return this.request(Vs.merge(r||{},{method:e,url:t,data:n}))}}));var Ac=wc;function Dc(e){this.message=e}Dc.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Dc.prototype.__CANCEL__=!0;var Pc=Dc;function xc(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new Pc(e),t(n.reason))}))}xc.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},xc.source=function(){var e;return{token:new xc((function(t){e=t})),cancel:e}};var Oc=xc;function Nc(e){var t=new Ac(e),n=Ds(Ac.prototype.request,t);return Vs.extend(n,Ac.prototype,t),Vs.extend(n,t),n}var Mc=Nc(bc);Mc.Axios=Ac,Mc.create=function(e){return Nc(Cc(Mc.defaults,e))},Mc.Cancel=Pc,Mc.CancelToken=Oc,Mc.isCancel=Gs,Mc.all=function(e){return Promise.all(e)},Mc.spread=function(e){return function(t){return e.apply(null,t)}};var Lc=Mc,Vc=Mc;Lc.default=Vc;var Uc=Lc,Fc=((new Date).getTime(),0),jc=function(){return(new Date).getTime()+Fc},Bc=function(){var e=new Date;return e.setTime(jc()),e.toLocaleString()},Hc={sdkAppId:"",userId:"",version:"",env:"qcloud",browserVersion:"",ua:""},Gc=function(e){var t=vd(),n=t.name,r=t.version;Hc.sdkAppId="".concat(e.sdkAppId),Hc.version="".concat(e.version),Hc.env=e.env,Hc.userId=e.userId,Hc.browserVersion=n+r,Hc.ua=navigator.userAgent},Jc=function(e,t){var n={timestamp:Bc(),sdkAppId:Hc.sdkAppId,userId:Hc.userId,version:Hc.version,log:e};t&&(n.errorInfo=t.message),Uc.post(Yc(),JSON.stringify(n)).catch((function(){}))},zc=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)),Jc(t),"failed"===e.result&&(t="stat-".concat(e.eventType,"-").concat(e.result,"-").concat(e.code),Jc(t,e.error))},Wc=function(e){if(!fd){var n=t(t({},e),Hc);nu(n.code)&&(n.code="failed"===n.result?ws.UNKNOWN:0),Uc.post(Xc(),JSON.stringify(n)).catch((function(){}))}},qc=function(e){fd||(Wc(t(t({},e),{},{result:"success"})),"qcloud"===Hc.env&&zc(t(t({},e),{},{result:"success"})))},Kc=function(e){if(!fd){var n=e.eventType,r=e.code,i=e.error,a={eventType:n,result:"failed",code:r||(i instanceof As?i.getExtraCode()||i.getCode():ws.UNKNOWN)};Wc(a),"qcloud"===Hc.env&&zc(t(t({},a),{},{error:i}))}},Qc=function(){return function(e){var t=window.location.search.match(new RegExp("(\\?|&)"+e+"=([^&]*)(&|$)"));return t?decodeURIComponent(t[2]):""}("trtc_env")},Yc=function(){return"".concat(go||"https://yun.tim.qq.com","/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_log")},Xc=function(){return"".concat(go||"https://yun.tim.qq.com","/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_event")};function $c(){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 r=t&&t.type&&t.type.toLowerCase(),i=t&&t.effectiveType&&t.effectiveType.toLowerCase();"slow-2"===i&&(i="2g");var a=n||"unknown";if(r)switch(r){case"cellular":case"wimax":a=i||"unknown";break;case"wifi":a="wifi";break;case"ethernet":a="wired";break;case"none":case"other":case"unknown":a="unknown"}return gd.info("networkType:",a),a}var Zc=function(e){if(!e||"object"!==n(e)||"[object Object]"!=Object.prototype.toString.call(e))return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Function.prototype.toString.call(r)===Function.prototype.toString.call(Object)};function eu(e){var t=Math.round(e/2)+1;return t>6?13e3:1e3*function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return t<=1?r:e(t-1,r,n+r)}(t)}var tu=function(e){return"function"==typeof e},nu=function(e){return void 0===e},ru=function(e){return"string"==typeof e},iu=function(e){return"number"==typeof e};function au(e){return Reflect.apply(Object.prototype.toString,e,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}function ou(e,t){for(var n in e)if(t[n]&&"undefined"!==au(e[n])&&au(e[n])!==t[n].toLowerCase())return{ret:!1,message:"".concat(n," should be ").concat(t[n])};return{ret:!0}}function su(e){var t={};return t.urls="turn:".concat(e.url),nu(e.username)||nu(e.credential)||(t.username=e.username,t.credential=e.credential,t.credentialType="password",nu(e.credentialType)||(t.credentialType=e.credentialType)),t}function cu(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}function uu(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"big";if(!ru(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}function du(e){return lu.apply(this,arguments)}function lu(){return(lu=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n={userId:String(t.userId),sdkAppId:String(t.sdkAppId),isStrGroupId:t.useStringRoomId,groupId:String(t.roomId),sdkVersion:"4.11.7",userSig:String(t.userSig)},r=cu(),e.next=5,Uc.post(Ts,n,{timeout:1500});case 5:if(i=e.sent,Jc("stat-schedule-delta:".concat(cu()-r)),0!==i.data.code){e.next=9;break}return e.abrupt("return",i.data.data);case 9:gd.debug("schedule failed: "+i.data.msg),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),gd.debug("schedule failed: "+e.t0);case 15:case"end":return e.stop()}}),e,null,[[0,12]])})))).apply(this,arguments)}var hu,pu=window.navigator&&window.navigator.userAgent||"",fu=/AppleWebKit\/([\d.]+)/i.exec(pu),mu=(fu&&parseFloat(fu.pop()),/iPad/i.test(pu)),_u=/iPhone/i.test(pu)&&!mu,vu=/iPod/i.test(pu),gu=_u||mu||vu,Su=(gu&&function(){var e=pu.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),/Android/i.test(pu)),yu=Su&&function(){var e=pu.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),Tu=(Su&&/webkit/i.test(pu),/Firefox/i.test(pu)),ku=Tu&&function(){var e=pu.match(/Firefox\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),Ru=/Edge\//i.test(pu),bu=Ru&&function(){var e=pu.match(/Edge\/(\d+)/i);if(e&&e[1])return e[1]}(),Eu=/Edg\//i.test(pu),Iu=Eu&&function(){var e=pu.match(/Edg\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),Cu=/SogouMobileBrowser\//i.test(pu),wu=Cu&&function(){var e=pu.match(/SogouMobileBrowser\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),Au=/MetaSr\s/i.test(pu),Du=Au&&function(){var e=pu.match(/MetaSr(\s\d+(\.\d+)+)/);return e&&e[1]?parseFloat(e[1]):null}(),Pu=/TBS\/\d+/i.test(pu),xu=Pu&&function(){var e=pu.match(/TBS\/(\d+)/i);if(e&&e[1])return e[1]}(),Ou=/XWEB\/\d+/i.test(pu),Nu=Ou&&function(){var e=pu.match(/XWEB\/(\d+)/i);if(e&&e[1])return e[1]}(),Mu=(/MSIE\s8\.0/.test(pu),/MSIE\/\d+/i.test(pu)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(pu),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(pu)&&/rv:11.0/.test(pu)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(pu)),Lu=Mu&&function(){var e=pu.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])return e[1]}(),Vu=!Pu&&/MQQBrowser\/\d+/i.test(pu)&&/COVC\/\d+/i.test(pu),Uu=!Pu&&/MQQBrowser\/\d+/i.test(pu)&&!/COVC\/\d+/i.test(pu),Fu=(Uu||Vu)&&function(){var e=pu.match(/ MQQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),ju=!Pu&&/ QQBrowser\/\d+/i.test(pu),Bu=ju&&function(){var e=pu.match(/ QQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Hu=!Pu&&/QQBrowserLite\/\d+/i.test(pu),Gu=Hu&&function(){var e=pu.match(/QQBrowserLite\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Ju=!Pu&&/MQBHD\/\d+/i.test(pu),zu=Ju&&function(){var e=pu.match(/MQBHD\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Wu=/Windows/i.test(pu),qu=!gu&&/MAC OS X/i.test(pu),Ku=!Su&&/Linux/i.test(pu),Qu=(/MicroMessenger/i.test(pu),/UCBrowser/i.test(pu)),Yu=(/Electron/i.test(pu),/MiuiBrowser/i.test(pu)),Xu=Yu&&function(){var e=pu.match(/MiuiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),$u=/HuaweiBrowser/i.test(pu),Zu=/Huawei/i.test(pu),ed=$u&&function(){var e=pu.match(/HuaweiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),td=/SamsungBrowser/i.test(pu),nd=td&&function(){var e=pu.match(/SamsungBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),rd=/HeyTapBrowser/i.test(pu),id=rd&&function(){var e=pu.match(/HeyTapBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),ad=/VivoBrowser/i.test(pu),od=ad&&function(){var e=pu.match(/VivoBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),sd=/Chrome/i.test(pu),cd=!Ru&&!Au&&!Cu&&!Pu&&!Ou&&!Eu&&!ju&&!Yu&&!$u&&!td&&!rd&&!ad&&/Chrome/i.test(pu),ud=cd&&function(){var e=pu.match(/Chrome\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),dd=cd&&function(){var e=pu.match(/Chrome\/([\d.]+)/);return e&&e[1]?e[1]:null}(),ld=!sd&&!Uu&&!Vu&&!Hu&&!Ju&&/Safari/i.test(pu),hd=ld&&function(){var e=pu.match(/Version\/([\d.]+)/);return e&&e[1]?e[1]:null}(),pd=cd?"Chrome/"+dd:ld?"Safari/"+hd:"NotSupportedBrowser",fd="file:"===location.protocol||"localhost"===location.hostname||/^\d+\.\d+\.\d+\.\d+$/.test(location.hostname),md=function(){if(nu(hu))try{hu=window.localStorage}catch(cS){gd.warn(cS),hu=!1}return hu},_d=new Map([[Tu,["Firefox",ku]],[Eu,["Edg",Iu]],[cd,["Chrome",dd]],[ld,["Safari",hd]],[Pu,["TBS",xu]],[Ou,["XWEB",Nu]],[Mu&&_u,["WeChat",Lu]],[ju,["QQ(Win)",Bu]],[Uu,["QQ(Mobile)",Fu]],[Vu,["QQ(Mobile X5)",Fu]],[Hu,["QQ(Mac)",Gu]],[Ju,["QQ(iPad)",zu]],[Yu,["MI",Xu]],[$u,["HW",ed]],[td,["Samsung",nd]],[rd,["OPPO",id]],[ad,["VIVO",od]],[Ru,["EDGE",bu]],[Cu,["SogouMobile",wu]],[Au,["Sogou",Du]]]);function vd(){var e="unknown",t="unknown";return _d.get(!0)&&(e=_d.get(!0)[0],t=_d.get(!0)[1]),{name:e,version:t}}var gd=function(){var e=function(){},t=["trace","debug","info","warn","error"];function r(e,t){var n=e[t];if(tu(n.bind))return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(cS){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function i(t){return"debug"===t&&(t="log"),"undefined"!==("undefined"==typeof console?"undefined":n(console))&&(void 0!==console[t]?r(console,t):void 0!==console.log?r(console,"log"):e)}function a(e,n){for(var r=0;r<t.length;r++){var i=t[r];this[i]=this.methodFactory(i,e,n)}this.log=this.debug}function o(e,t,r){return function(){"undefined"!==("undefined"==typeof console?"undefined":n(console))&&(a.call(this,t,r),this[e].apply(this,arguments))}}function s(e,t,n){return i(e)||o.apply(this,arguments)}function c(e,r,i){var o,c=this,u="loglevel";function d(){var e;if("undefined"!==("undefined"==typeof window?"undefined":n(window))){try{md()&&(e=window.localStorage[u])}catch(t){}return void 0===c.levels[e]&&(e=void 0),e}}e&&(u+=":"+e),c.name=e,c.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},c.methodFactory=i||s,c.getLevel=function(){return o},c.setLevel=function(r,i){if(ru(r)&&void 0!==c.levels[r.toUpperCase()]&&(r=c.levels[r.toUpperCase()]),!(iu(r)&&r>=0&&r<=c.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(o=r,!1!==i&&function(e){var r=(t[e]||"silent").toUpperCase();if("undefined"!==("undefined"==typeof window?"undefined":n(window)))try{md()&&(window.localStorage[u]=r)}catch(i){}}(r),a.call(c,r,e),"undefined"===("undefined"==typeof console?"undefined":n(console))&&r<c.levels.SILENT)return"No console available for logging"},c.setDefaultLevel=function(e){d()||c.setLevel(e,!1)},c.enableAll=function(e){c.setLevel(c.levels.TRACE,e)},c.disableAll=function(e){c.setLevel(c.levels.SILENT,e)};var l=d();null==l&&(l=null==r?"WARN":r),c.setLevel(l,!1)}var u=new c,d={};u.getLogger=function(e){if(!ru(e)||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=d[e];return t||(t=d[e]=new c(e,u.getLevel(),u.methodFactory)),t};var l="undefined"!==("undefined"==typeof window?"undefined":n(window))?window.log:void 0;return u.noConflict=function(){return"undefined"!==("undefined"==typeof window?"undefined":n(window))&&window.log===u&&(window.log=l),u},u.getLoggers=function(){return d},u}(),Sd=It("slice"),yd=he("species"),Td=[].slice,kd=Math.max;_t({target:"Array",proto:!0,forced:!Sd},{slice:function(e,t){var n,r,i,a=B(this),o=Ke(a.length),s=Xe(e,o),c=Xe(void 0===t?o:t,o);if(St(a)&&("function"!=typeof(n=a.constructor)||n!==Array&&!St(n.prototype)?H(n)&&null===(n=n[yd])&&(n=void 0):n=void 0,n===Array||void 0===n))return Td.call(a,s,c);for(r=new(void 0===n?Array:n)(kd(c-s,0)),i=0;s<c;s++,i++)s in a&&Ha(r,i,a[s]);return r.length=i,r}});var Rd=[].join,bd=F!=Object,Ed=Ra("join",",");_t({target:"Array",proto:!0,forced:bd||!Ed},{join:function(e){return Rd.call(B(this),void 0===e?",":e)}}),_t({target:"Array",stat:!0},{isArray:St});var Id=It("splice"),Cd=Math.max,wd=Math.min;_t({target:"Array",proto:!0,forced:!Id},{splice:function(e,t){var n,r,i,a,o,s,c=re(this),u=Ke(c.length),d=Xe(e,u),l=arguments.length;if(0===l?n=r=0:1===l?(n=0,r=u-d):(n=l-2,r=wd(Cd(We(t),0),u-d)),u+n-r>9007199254740991)throw TypeError("Maximum allowed length exceeded");for(i=Tt(c,r),a=0;a<r;a++)(o=d+a)in c&&Ha(i,a,c[o]);if(i.length=r,n<r){for(a=d;a<u-r;a++)s=a+n,(o=a+r)in c?c[s]=c[o]:delete c[s];for(a=u;a>u-r+n;a--)delete c[a-1]}else if(n>r)for(a=u-r;a>d;a--)s=a+n-1,(o=a+r-1)in c?c[s]=c[o]:delete c[s];for(a=0;a<n;a++)c[a+d]=arguments[a+2];return c.length=u-r+n,i}});var Ad=function(e){var t=Xn(j(this)),n="",r=We(e);if(r<0||Infinity==r)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},Dd=Math.ceil,Pd=function(e){return function(t,n,r){var i,a,o=Xn(j(t)),s=o.length,c=void 0===r?" ":Xn(r),u=Ke(n);return u<=s||""==c?o:((a=Ad.call(c,Dd((i=u-s)/c.length))).length>i&&(a=a.slice(0,i)),e?o+a:a+o)}},xd={start:Pd(!1),end:Pd(!0)}.start,Od=Math.abs,Nd=Date.prototype,Md=Nd.getTime,Ld=Nd.toISOString,Vd=D((function(){return"0385-07-25T07:06:39.999Z"!=Ld.call(new Date(-50000000000001))}))||!D((function(){Ld.call(new Date(NaN))}))?function(){if(!isFinite(Md.call(this)))throw RangeError("Invalid time value");var e=this.getUTCFullYear(),t=this.getUTCMilliseconds(),n=e<0?"-":e>9999?"+":"";return n+xd(Od(e),n?6:4,0)+"-"+xd(this.getUTCMonth()+1,2,0)+"-"+xd(this.getUTCDate(),2,0)+"T"+xd(this.getUTCHours(),2,0)+":"+xd(this.getUTCMinutes(),2,0)+":"+xd(this.getUTCSeconds(),2,0)+"."+xd(t,3,0)+"Z"}:Ld;_t({target:"Date",proto:!0,forced:Date.prototype.toISOString!==Vd},{toISOString:Vd});var Ud=bt.some,Fd=Ra("some");_t({target:"Array",proto:!0,forced:!Fd},{some:function(e){return Ud(this,e,arguments.length>1?arguments[1]:void 0)}});var jd=[].slice,Bd=/MSIE .\./.test(z),Hd=function(e){return function(t,n){var r=arguments.length>2,i=r?jd.call(arguments,2):void 0;return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,i)}:t,n)}};_t({global:!0,bind:!0,forced:Bd},{setTimeout:Hd(A.setTimeout),setInterval:Hd(A.setInterval)});var Gd,Jd=function(){return"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)}))},zd=new(function(){function e(){a(this,e),this.intervalMap_=new Map}return s(e,[{key:"setInterval",value:function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t){var n=this,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!window||!window.requestAnimationFrame)return setInterval(e,t);var i=Jd(),a=cu(),o=a;this.intervalMap_.set(i,{rafId:null,timeoutId:null,onVisibilityChange:null});var s=function s(){if(r&&document.hidden){e();var c=setTimeout(s,t);n.setTimeoutId(i,c),a=cu(),o=a}else{(o=cu())-a>=t&&(a=o,e());var u=requestAnimationFrame(s);n.setRafId(i,u)}},c=requestAnimationFrame(s);if(this.setRafId(i,c),r){var u=function(){if(document.hidden){var e=cu()-a;if(e>=t)s();else{var r=setTimeout(s,t-e);n.setTimeoutId(i,r)}}};document.addEventListener("visibilitychange",u),this.setOnVisibilityChange(i,u)}return i}))},{key:"clearInterval",value:function(e){if(this.intervalMap_.has(e)){var t=this.intervalMap_.get(e),n=t.rafId,r=t.timeoutId,i=t.onVisibilityChange;cancelAnimationFrame(n),clearTimeout(r),document.removeEventListener("visibilitychange",i),this.intervalMap_.delete(e)}}},{key:"setTimeoutId",value:function(e,t){if(this.intervalMap_.has(e)){var n=this.intervalMap_.get(e);n.timeoutId&&clearTimeout(n.timeoutId),n.timeoutId=t}}},{key:"setRafId",value:function(e,t){if(this.intervalMap_.has(e)){var n=this.intervalMap_.get(e);n.rafId&&cancelAnimationFrame(n.rafId),n.rafId=t}}},{key:"setOnVisibilityChange",value:function(e,t){this.intervalMap_.has(e)&&(this.intervalMap_.get(e).onVisibilityChange=t)}}]),e}());function Wd(e){try{return JSON.stringify(e)}catch(cS){if(!Gd)try{var t={};t.a=t,JSON.stringify(t)}catch(n){Gd=n.message}if(cS.message===Gd)return"[Circular]";throw cS}}function qd(e){var t="",n=0;return e.length>1&&ru(e[0])&&(t=(t=e[0].replace(/(%?)(%([sdjo]))/g,(function(t,r,i,a){if(!r){var o=e[n+=1],s="";switch(a){case"s":s+=o;break;case"d":s+=+o;break;case"j":s=Wd(o);break;case"o":var c=Wd(o);"{"!==c[0]&&"["!==c[0]&&(c="<".concat(c,">")),s=function(e){if(!Object.getOwnPropertyDescriptor||!Object.getPrototypeOf)return Object.prototype.toString.call(e).slice(8,-1);for(;e;){var t=Object.getOwnPropertyDescriptor(e,"constructor");if(void 0!==t&&tu(t.value)&&""!==t.value.name)return t.value.name;e=Object.getPrototypeOf(e)}return""}(o)+c}return s}return t}))).replace(/%{2,2}/g,"%"),n+=1),e.length>n&&(t&&(t+=" "),t+=e.slice(n).join(" ")),t}var Kd=Object.prototype.hasOwnProperty;function Qd(){try{throw new Error}catch(e){return e.stack}}function Yd(e){var t=this,n=[],r=[];this.length=function(){return n.length},this.sent=function(){return r.length},this.push=function(t){n.push(t),n.length>e&&n.shift()},this.send=function(){return r.length||(r=n,n=[]),r},this.confirm=function(){r=[],t.content=""},this.fail=function(){n=r.concat(n),t.confirm();var i=1+n.length+r.length-e;i>0&&(r.splice(0,i),n=r.concat(n),t.confirm())}}var Xd,$d,Zd,el=!!Qd();function tl(e){return"[".concat(e.timestamp,"] <").concat(e.level.label.toUpperCase(),">").concat(e.logger?" (".concat(e.logger,")"):"",": ").concat(e.message).concat(e.stacktrace?"\n".concat(e.stacktrace):"")}var nl={interval:1e3,level:"trace",capacity:0,stacktrace:{levels:["trace","warn","error"],depth:3,excess:0},timestamp:function(){return(new Date).toISOString()},format:tl},rl=-1,il=!1,al="",ol="",sl="",cl=function(e){il||(al="".concat(e.sdkAppId),ol="".concat(e.userId),sl="".concat(e.version),il=!0)},ul=function(e,t){if(!e||!e.getLogger)throw new TypeError("Argument is not a root loglevel object");if(Xd)throw new Error("You can assign a plugin only one time");Xd=e;var r=function e(){for(var t={},r=0;r<arguments.length;r+=1){var i=Object(arguments[r]);for(var a in i)Kd.call(i,a)&&(t[a]="object"!==n(i[a])||Array.isArray(i[a])?i[a]:e(t[a],i[a]))}return t}(nl,t);r.capacity=r.capacity||500;var i,a=r.interval;rl=zd.setInterval((function(){if(!il)return;if(!o.sent()){if(!o.length())return;var e=o.send();o.content=i?'{"logs":['.concat(e.join(","),"]}"):e.join("\n"),function(e){if(!il)return;var t=JSON.stringify({timestamp:Bc(),sdkAppId:al,userId:ol,version:sl,log:e});Uc.post(Yc(),t).then((function(){o.confirm()})).catch((function(){o.fail()}))}(o.content)}}),a);var o=new Yd(r.capacity);return $d=e.methodFactory,Zd=function(e,t,n){var a=$d(e,t,n),s=el&&r.stacktrace.levels.some((function(t){return t===e})),c=Xd.levels[e.toUpperCase()];return function(){for(var u=arguments.length,d=new Array(u),l=0;l<u;l++)d[l]=arguments[l];var h=qd(d),p=c>=t;if(p){var f=new Date;f.setTime(jc());var m=f.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")+":".concat(f.getMilliseconds()),_="["+m+"] <"+e.toUpperCase()+"> "+h;a.apply(void 0,[_])}var v=Bc(),g=s?Qd():"";if(g){var S=g.split("\n");S.splice(0,r.stacktrace.excess+3);var y=r.stacktrace.depth;if(y&&S.length!==y+1){var T=S.splice(0,y);g=T.join("\n"),S.length&&(g+="\n and ".concat(S.length," more"))}else g=S.join("\n")}var k=r.format({message:h,level:{label:e,value:c},logger:n||"",timestamp:v,stacktrace:g});void 0===i&&(i=!ru(k));var R="";if(i)try{R+=JSON.stringify(k)}catch(cS){return a.apply(void 0,d),void Xd.getLogger("logger").error(cS)}else R+=k;o.push(R)}},e.methodFactory=Zd,e.setLevel(e.getLevel()),e},dl=function(){if(!Xd)throw new Error("You can't disable a not appled plugin");if(Zd!==Xd.methodFactory)throw new Error("You can't disable a plugin after appling another plugin");Xd.methodFactory=$d,Xd.setLevel(Xd.getLevel()),Xd=void 0,zd.clearInterval(rl)},ll=!1;gd.setConfig=function(e){cl(e)},gd.setLogLevel=function(e){gd.setLevel(e)},gd.getLogLevel=function(e){return gd.getLevel(e)},gd.enableUploadLog=function(){ll||(ul(gd),ll=!0)},gd.disableUploadLog=function(){ll&&(gd.warn("disable upload log! Without log we are difficult to help you triage the issue you might run into!"),dl(),ll=!1)},gd.enableUploadLog(),gd.setLevel("INFO");var hl=!0,pl=Math.floor;_t({target:"Number",stat:!0},{isInteger:function(e){return!H(e)&&isFinite(e)&&pl(e)===e}});var fl,ml=function(e){if(na(e))throw TypeError("The method doesn't accept regular expressions");return e},_l=he("match"),vl=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[_l]=!1,"/./"[e](t)}catch(r){}}return!1},gl=Te.f,Sl="".startsWith,yl=Math.min,Tl=vl("startsWith"),kl=!(Tl||(fl=gl(String.prototype,"startsWith"),!fl||fl.writable));_t({target:"String",proto:!0,forced:!kl&&!Tl},{startsWith:function(e){var t=Xn(j(this));ml(e);var n=Ke(yl(arguments.length>1?arguments[1]:void 0,t.length)),r=Xn(e);return Sl?Sl.call(t,r,n):t.slice(n,n+r.length)===r}});var Rl=bt.forEach,bl=Ra("forEach")?[].forEach:function(e){return Rl(this,e,arguments.length>1?arguments[1]:void 0)};for(var El in _t({target:"Array",proto:!0,forced:[].forEach!=bl},{forEach:bl}),Wi){var Il=A[El],Cl=Il&&Il.prototype;if(Cl&&Cl.forEach!==bl)try{Ee(Cl,"forEach",bl)}catch(cS){Cl.forEach=bl}}var wl,Al,Dl,Pl,xl=A.Promise,Ol=/(?:iphone|ipod|ipad).*applewebkit/i.test(z),Nl="process"==V(A.process),Ml=A.setImmediate,Ll=A.clearImmediate,Vl=A.process,Ul=A.MessageChannel,Fl=A.Dispatch,jl=0,Bl={};try{wl=A.location}catch(cS){}var Hl=function(e){if(Bl.hasOwnProperty(e)){var t=Bl[e];delete Bl[e],t()}},Gl=function(e){return function(){Hl(e)}},Jl=function(e){Hl(e.data)},zl=function(e){A.postMessage(String(e),wl.protocol+"//"+wl.host)};Ml&&Ll||(Ml=function(e){for(var t=[],n=arguments.length,r=1;n>r;)t.push(arguments[r++]);return Bl[++jl]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},Al(jl),jl},Ll=function(e){delete Bl[e]},Nl?Al=function(e){Vl.nextTick(Gl(e))}:Fl&&Fl.now?Al=function(e){Fl.now(Gl(e))}:Ul&&!Ol?(Pl=(Dl=new Ul).port2,Dl.port1.onmessage=Jl,Al=gt(Pl.postMessage,Pl,1)):A.addEventListener&&"function"==typeof postMessage&&!A.importScripts&&wl&&"file:"!==wl.protocol&&!D(zl)?(Al=zl,A.addEventListener("message",Jl,!1)):Al="onreadystatechange"in ge("script")?function(e){rr.appendChild(ge("script")).onreadystatechange=function(){rr.removeChild(this),Hl(e)}}:function(e){setTimeout(Gl(e),0)});var Wl,ql,Kl,Ql,Yl,Xl,$l,Zl,eh={set:Ml,clear:Ll},th=/web0s(?!.*chrome)/i.test(z),nh=Te.f,rh=eh.set,ih=A.MutationObserver||A.WebKitMutationObserver,ah=A.document,oh=A.process,sh=A.Promise,ch=nh(A,"queueMicrotask"),uh=ch&&ch.value;uh||(Wl=function(){var e,t;for(Nl&&(e=oh.domain)&&e.exit();ql;){t=ql.fn,ql=ql.next;try{t()}catch(cS){throw ql?Ql():Kl=void 0,cS}}Kl=void 0,e&&e.enter()},Ol||Nl||th||!ih||!ah?sh&&sh.resolve?(($l=sh.resolve(void 0)).constructor=sh,Zl=$l.then,Ql=function(){Zl.call($l,Wl)}):Ql=Nl?function(){oh.nextTick(Wl)}:function(){rh.call(A,Wl)}:(Yl=!0,Xl=ah.createTextNode(""),new ih(Wl).observe(Xl,{characterData:!0}),Ql=function(){Xl.data=Yl=!Yl}));var dh,lh,hh,ph,fh=uh||function(e){var t={fn:e,next:void 0};Kl&&(Kl.next=t),ql||(ql=t,Ql()),Kl=t},mh=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=vt(t),this.reject=vt(n)},_h={f:function(e){return new mh(e)}},vh=function(e){try{return{error:!1,value:e()}}catch(cS){return{error:!0,value:cS}}},gh="object"==typeof window,Sh=eh.set,yh=he("species"),Th="Promise",kh=He.get,Rh=He.set,bh=He.getterFor(Th),Eh=xl&&xl.prototype,Ih=xl,Ch=Eh,wh=A.TypeError,Ah=A.document,Dh=A.process,Ph=_h.f,xh=Ph,Oh=!!(Ah&&Ah.createEvent&&A.dispatchEvent),Nh="function"==typeof PromiseRejectionEvent,Mh=!1,Lh=ft(Th,(function(){var e=De(Ih),t=e!==String(Ih);if(!t&&66===Y)return!0;if(Y>=51&&/native code/.test(e))return!1;var n=new Ih((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(n.constructor={})[yh]=r,!(Mh=n.then((function(){}))instanceof r)||!t&&gh&&!Nh})),Vh=Lh||!Oi((function(e){Ih.all(e).catch((function(){}))})),Uh=function(e){var t;return!(!H(e)||"function"!=typeof(t=e.then))&&t},Fh=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;fh((function(){for(var r=e.value,i=1==e.state,a=0;n.length>a;){var o,s,c,u=n[a++],d=i?u.ok:u.fail,l=u.resolve,h=u.reject,p=u.domain;try{d?(i||(2===e.rejection&&Gh(e),e.rejection=1),!0===d?o=r:(p&&p.enter(),o=d(r),p&&(p.exit(),c=!0)),o===u.promise?h(wh("Promise-chain cycle")):(s=Uh(o))?s.call(o,l,h):l(o)):h(r)}catch(cS){p&&!c&&p.exit(),h(cS)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&Bh(e)}))}},jh=function(e,t,n){var r,i;Oh?((r=Ah.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),A.dispatchEvent(r)):r={promise:t,reason:n},!Nh&&(i=A["on"+e])?i(r):"unhandledrejection"===e&&function(e,t){var n=A.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},Bh=function(e){Sh.call(A,(function(){var t,n=e.facade,r=e.value;if(Hh(e)&&(t=vh((function(){Nl?Dh.emit("unhandledRejection",r,n):jh("unhandledrejection",n,r)})),e.rejection=Nl||Hh(e)?2:1,t.error))throw t.value}))},Hh=function(e){return 1!==e.rejection&&!e.parent},Gh=function(e){Sh.call(A,(function(){var t=e.facade;Nl?Dh.emit("rejectionHandled",t):jh("rejectionhandled",t,e.value)}))},Jh=function(e,t,n){return function(r){e(t,r,n)}},zh=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Fh(e,!0))},Wh=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw wh("Promise can't be resolved itself");var r=Uh(t);r?fh((function(){var n={done:!1};try{r.call(t,Jh(Wh,n,e),Jh(zh,n,e))}catch(cS){zh(n,cS,e)}})):(e.value=t,e.state=1,Fh(e,!1))}catch(cS){zh({done:!1},cS,e)}}};if(Lh&&(Ch=(Ih=function(e){wi(this,Ih,Th),vt(e),dh.call(this);var t=kh(this);try{e(Jh(Wh,t),Jh(zh,t))}catch(cS){zh(t,cS)}}).prototype,(dh=function(e){Rh(this,{type:Th,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Mi(Ch,{then:function(e,t){var n=bh(this),r=Ph(Xa(this,Ih));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=Nl?Dh.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Fh(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),lh=function(){var e=new dh,t=kh(e);this.promise=e,this.resolve=Jh(Wh,t),this.reject=Jh(zh,t)},_h.f=Ph=function(e){return e===Ih||e===hh?new lh(e):xh(e)},"function"==typeof xl&&Eh!==Object.prototype)){ph=Eh.then,Mh||(Ge(Eh,"then",(function(e,t){var n=this;return new Ih((function(e,t){ph.call(n,e,t)})).then(e,t)}),{unsafe:!0}),Ge(Eh,"catch",Ch.catch,{unsafe:!0}));try{delete Eh.constructor}catch(cS){}ni&&ni(Eh,Ch)}_t({global:!0,wrap:!0,forced:Lh},{Promise:Ih}),Zr(Ih,Th,!1),Vi(Th),hh=J(Th),_t({target:Th,stat:!0,forced:Lh},{reject:function(e){var t=Ph(this);return t.reject.call(void 0,e),t.promise}}),_t({target:Th,stat:!0,forced:Lh},{resolve:function(e){return function(e,t){if(ke(e),H(t)&&t.constructor===e)return t;var n=_h.f(e);return(0,n.resolve)(t),n.promise}(this,e)}}),_t({target:Th,stat:!0,forced:Vh},{all:function(e){var t=this,n=Ph(t),r=n.resolve,i=n.reject,a=vh((function(){var n=vt(t.resolve),a=[],o=0,s=1;Ci(e,(function(e){var c=o++,u=!1;a.push(void 0),s++,n.call(t,e).then((function(e){u||(u=!0,a[c]=e,--s||r(a))}),i)})),--s||r(a)}));return a.error&&i(a.value),n.promise},race:function(e){var t=this,n=Ph(t),r=n.reject,i=vh((function(){var i=vt(t.resolve);Ci(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var qh=Er.trim,Kh=A.parseInt,Qh=/^[+-]?0[Xx]/,Yh=8!==Kh(yr+"08")||22!==Kh(yr+"0x16")?function(e,t){var n=qh(Xn(e));return Kh(n,t>>>0||(Qh.test(n)?16:10))}:Kh;_t({global:!0,forced:parseInt!=Yh},{parseInt:Yh});var Xh=bt.findIndex,$h=!0;"findIndex"in[]&&Array(1).findIndex((function(){$h=!1})),_t({target:"Array",proto:!0,forced:$h},{findIndex:function(e){return Xh(this,e,arguments.length>1?arguments[1]:void 0)}}),Hr("findIndex");var Zh=D((function(){tr(1)}));_t({target:"Object",stat:!0,forced:Zh},{keys:function(e){return tr(re(e))}});var ep=N.f,tp=function(e){return function(t){for(var n,r=B(t),i=tr(r),a=i.length,o=0,s=[];a>o;)n=i[o++],P&&!ep.call(r,n)||s.push(e?[n,r[n]]:r[n]);return s}},np={entries:tp(!0),values:tp(!1)}.values;_t({target:"Object",stat:!0},{values:function(e){return np(e)}});var rp=Ze.includes;_t({target:"Array",proto:!0},{includes:function(e){return rp(this,e,arguments.length>1?arguments[1]:void 0)}}),Hr("includes"),_t({target:"String",proto:!0,forced:!vl("includes")},{includes:function(e){return!!~Xn(j(this)).indexOf(Xn(ml(e)),arguments.length>1?arguments[1]:void 0)}});var ip=E((function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,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 r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,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,r),!0;case 4:return d.fn.call(d.context,t,r,i),!0;case 5:return d.fn.call(d.context,t,r,i,a),!0;case 6:return d.fn.call(d.context,t,r,i,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,r);break;case 4:d[u].fn.call(d[u].context,t,r,i);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,r,i){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||i&&!s.once||r&&s.context!==r||o(this,a);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&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 r,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})),ap="connection-state-changed",op="connected",sp="error",cp="DISCONNECTED",up="CONNECTING",dp="RECONNECTING",lp="CONNECTED",hp={ON_PUBLISH_RESPONSE:2,NEW_ICE_CANDIDATE:4,CLINET_BANNED:8,CHANNEL_SETUP_SUCCESS:19,CHANNEL_SETUP_FAILED:80,REBUILD_SESSION_RESULT:514,JOIN_ROOM_RESULT:20,PEER_JOIN:4134,PEER_LEAVE:4135,STREAM_ADDED:16,STREAM_REMOVED:18,UPDATE_REMOTE_SDP:48,UPDATE_AUDIO_SSRC:50,UPDATE_VIDEO_SSRC:52,UPLINK_NETWORK_STATS:22,UPDATE_REMOTE_MUTE_STAT:23,CLOSE_PEER_ACK:10,SUBSCRIBE_ACK:26,PONG:775,PUBLISH_RESULT:4098,UNPUBLISH_RESULT:4100,SUBSCRIBE_RESULT:4102,UNSUBSCRIBE_RESULT:4104,SUBSCRIBE_CHANGE_RESULT:4106,UPDATE_OFFER_RESULT:4128,REMOTE_STREAM_UPDATE:4130,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},pp=[hp.UPDATE_REMOTE_MUTE_STAT,hp.UPLINK_NETWORK_STATS,hp.PONG,hp.REMOTE_STREAM_UPDATE,hp.USER_LIST_RES],fp={ON_PUBLISH_RESPONSE:"on-publish-response",NEW_ICE_CANDIDATE:"new-ice-candidate",CLINET_BANNED:"client-banned",CHANNEL_SETUP_SUCCESS:"channel-setup-success",CHANNEL_SETUP_FAILED:"channel-setup-failed",REBUILD_SESSION_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",UPDATE_REMOTE_SDP:"update-remote-sdp",UPDATE_AUDIO_SSRC:"update-audio-ssrc",UPDATE_VIDEO_SSRC:"update-video-ssrc",UPLINK_NETWORK_STATS:"uplink-network-stats",UPDATE_REMOTE_MUTE_STAT:"update-remote-mute-stat",CLOSE_PEER_ACK:"close-peer-ack",SUBSCRIBE_ACK:"subscribe-ack",REQUEST_REBUILD_SESSION:"request-rebuild-session",CLIENT_REJOIN:"client-rejoin",PONG:"pong",PUBLISH_RESULT:"publish-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",REMOTE_STREAM_UPDATE:"remote-stream-update",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"},mp="on_update_track",_p="on_create_room",vp="on_quit_room",gp="on_quality_report",Sp="on_rebuild_session",yp="on_mute_uplink",Tp="on_constraints_config",kp="ping",Rp="on_publish",bp="on_unpublish",Ep="on_sub",Ip="on_unsub",Cp="on_sub_change",wp="on_start_publishing",Ap="on_stop_publishing",Dp="on_start_push_user_cdn",Pp="on_stop_push_user_cdn",xp="on_start_mcu_mix",Op="on_stop_mcu_mix",Np="on_get_user_list",Mp="on_switch_role",Lp="on_change_video_type",Vp=32768,Up=32769,Fp=32770,jp=32771,Bp=32772,Hp=32773,Gp=32774,Jp=32775,zp=32777,Wp=32778,qp=32779,Kp=32780,Qp=32781,Yp=32782,Xp=32783,$p=32784,Zp=32785,ef=32786,tf=32787,nf=32788,rf=32789,af=32790,of=32791,sf=32792,cf=32793,uf=32794,df=32795,lf=32796,hf=32797,pf=32798,ff=32799,mf=32800,_f=32801,vf=32802,gf=new Map,Sf=function(e,t){var n=gf.get(e);n||(gf.set(e,[]),n=gf.get(e)),n.push(t)},yf=function(e){var t=gf.get(e);return t?gf.delete(e):t=[],t},Tf=Object.prototype.hasOwnProperty;function kf(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(Zc(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(Tf.call(e,t))return!1;return!0}return!1}var Rf=/"/g,bf=function(e,t,n,r){var i=Xn(j(e)),a="<"+t;return""!==n&&(a+=" "+n+'="'+Xn(r).replace(Rf,"&quot;")+'"'),a+">"+i+"</"+t+">"},Ef=function(e){return D((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))};_t({target:"String",proto:!0,forced:Ef("link")},{link:function(e){return bf(this,"a","href",e)}});var If="AVOID_REPEATED_CALL",Cf="INVALID_PARAMETER_REQUIRED",wf="INVALID_PARAMETER_TYPE",Af="INVALID_PARAMETER_EMPTY",Df="INVALID_PARAMETER_INSTANCE",Pf="INVALID_PARAMETER_RANGE",xf="API_CALL_TIMEOUT",Of="SIGNAL_CHANNEL_RECONNECTION_FAILED",Nf="SIGNAL_CHANNEL_SETUP_FAILED",Mf="ERROR_MESSAGE",Lf="SUBSCRIPTION_TIMEOUT",Vf="EXCHANGE_SDP_TIMEOUT",Uf="DOWNLINK_RECONNECTION_FAILED",Ff="EXCHANGE_SDP_FAILED",jf="UPLINK_RECONNECTION_FAILED",Bf="AUDIO",Hf="VIDEO",Gf="INVALID_RECORDID",Jf="INVALID_PURE_AUDIO",zf="INVALID_STREAMID",Wf="INVALID_USER_DEFINE_RECORDID",qf="INVALID_USER_DEFINE_PUSH_ARGS",Kf="INVALID_PROXY",Qf="INVALID_JOIN",Yf="INVALID_ROOMID_STRING",Xf="INVALID_ROOMID_INTEGER",$f="JOIN_ROOM_TIMEOUT",Zf="JOIN_ROOM_FAILED",em="REJOIN_ROOM_FAILED",tm="INVALID_LEAVE",nm="INVALID_PUBLISH",rm="INVALID_UNPUBLISH",im="INVALID_AUDIENCE",am="INVALID_INITIALIZE",om="INVALID_DUPLICATE_PUBLISHING",sm="INVALID_REMOTE_STREAM",cm="SUBSCRIBE_FAILED",um="INVALID_ROLE",dm="INVALID_OPERATION_SWITCH_ROLE",lm="SWITCH_ROLE_TIMEOUT",hm="SWITCH_ROLE_FAILED",pm="CLIENT_BANNED",fm="INVALID_OPERATION_START_PUBLISH_CDN",mm="INVALID_OPERATION_STOP_PUBLISH_CDN",_m="INVALID_PARAMETER_START_PUBLISH_CDN",vm="START_PUBLISH_CDN_FAILED",gm="STOP_PUBLISH_CDN_FAILED",Sm="START_MIX_TRANSCODE",ym="STOP_MIX_TRANSCODE",Tm="INVALID_AUDIO_VOLUME",km="ENABLE_SMALL_STREAM_PUBLISHED",Rm="DISABLE_SMALL_STREAM_PUBLISHED",bm="NOT_SUPPORTED_SMALL_STREAM",Em="INVALID_SMALL_STREAM_PROFILE",Im="INVALID_PARAMETER_REMOTE_STREAM",Cm="REMOTE_NOT_PUBLISH_SMALL_STREAM",wm="INVALID_SWITCH_DEVICE",Am="INVALID_SWITCH_DEVICE_PUBLISHING",Dm="INVALID_REPLACE_TRACK",Pm="INVALID_INITIALIZE_LOCAL_STREAM",xm="INVALID_ADD_TRACK_REPETITIVE",Om="INVALID_ADD_TRACK_REMOVING",Nm="INVALID_ADD_TRACK_PUBLISHING",Mm="INVALID_STREAM_INITIALIZED",Lm="INVALID_ADD_TRACK_NUMBER",Vm="INVALID_REMOVE_AUDIO_TRACK",Um="INVALID_REMOVE_AUDIO_ADDING",Fm="INVALID_REMOVE_AUDIO_ON",jm="INVALID_REMOVE_TRACK_PUBLISHING",Bm="INVALID_REMOVE_TRACK_NOT_PUBLISHING",Hm="INVALID_REMOVE_TRACK_NUMBER",Gm="INVALID_REMOVE_TRACK_NOT_PUBLISHED",Jm="START_MIX_TRANSCODE_TIMEOUT",zm="START_MIX_TRANSCODE_FAILED",Wm="STOP_MIX_TRANSCODE_TIMEOUT",qm="STOP_MIX_TRANSCODE_FAILED",Km="MIX_TRANSCODE_NOT_STARTED",Qm="MIX_TRANSCODE_PARAM",Ym="MIX_PARAMS_USER_ID",Xm="MIX_PARAMS_RECT",$m="MIX_PARAMS_LOCATION",Zm="MIX_PARAMS_ZORDER",e_="MIX_PARAMS_VIDEO",t_="MIX_PARAMS_STREAM",n_="INVALID_PLAY",r_="INVALID_CREATE_STREAM_SOURCE",i_="INVALID_CREATE_STREAM_SCREEN",a_="INVALID_CREATE_STREAM_AUDIO",o_="INVALID_CREATE_STREAM_SCREEN_AUDIO",s_="NOT_SUPPORTED_HTTP",c_="NOT_SUPPORTED_WEBRTC",u_="NOT_SUPPORTED_TRTC",d_="NOT_SUPPORTED_PROFILE",l_="NOT_SUPPORTED_H264ENCODE",h_="NOT_SUPPORTED_H264DECODE",p_="NOT_SUPPORTED_REPLACE_TRACK",f_="NOT_SUPPORTED_CAPTURE",m_="MICROPHONE_NOT_FOUND",__="CAMERA_NOT_FOUND",v_={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,r=e.fnName,i=e.value;return"'".concat(t||n.name,"' is a required param when calling ").concat(r,"(), received: ").concat(i,".")},INVALID_PARAMETER_TYPE:function(e){var t=e.key,n=e.rule,r=e.fnName,i=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(r,"(), received type: ").concat(au(i),".")},INVALID_PARAMETER_EMPTY:function(e){var t=e.key,n=e.rule,r=e.fnName,i=e.value;return"'".concat(t||n.name,"' cannot be '").concat(i,"' when calling ").concat(r,"().")},INVALID_PARAMETER_INSTANCE:function(e){var t=e.key,n=e.rule,r=e.fnName,i=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(r,"(), received type: ").concat(au(i),".")},INVALID_PARAMETER_RANGE:function(e){var t=e.key,n=e.rule,r=e.fnName,i=e.value;return"'".concat(t||n.name,"' must be one of ").concat(n.values.join("|")," when calling ").concat(r,"(), received: ").concat(i,".")},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},SUBSCRIPTION_TIMEOUT:"remote server does not respond to the subscription.",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.",AUDIO:function(e){return e.error.toString()+" <audio>"},VIDEO:function(e){return e.error.toString()+" <video>"},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:"roomId must be validate string when useStringRoomId is true.",INVALID_ROOMID_INTEGER:"roomId must be a 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){return"Failed to join room - "+e.error},REJOIN_ROOM_FAILED:function(e){return"reJoin room: ".concat(e.roomId," failed, please check your network.")},INVALID_LEAVE:"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("audience",', please call switchRole("').concat("anchor",'") firstly before publish().'),INVALID_INITIALIZE:"cannot publish stream because stream is not initialized or is switching device.",INVALID_DUPLICATE_PUBLISHING:"duplicate publishing, please unpublish 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){return"failed to subscribe stream, reason: ".concat(e.message,".")},INVALID_ROLE:"switchRole can only be called in live mode.",INVALID_PARAMETER_SWITCH_ROLE:"role could only be set to a value as ".concat("anchor"," or ").concat("audience","."),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.errCode," errMsg: ").concat(e.errMsg,".")},CLIENT_BANNED:function(e){return"client was banned because of "+e.reason+"."},INVALID_OPERATION_START_PUBLISH_CDN:"please call publish() before startPublishCDNStream().",INVALID_OPERATION_STOP_PUBLISH_CDN:"please call startPublishCDNStream() before stopPublishCDNStream().",INVALID_PARAMETER_START_PUBLISH_CDN:"streamId must be valid string or undefined.",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,".")},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.",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.",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_REMOVE_TRACK_NOT_PUBLISHED:function(e){return"try to replace ".concat(e.kind," track but there's no previous ").concat(e.kind," being published.")},START_MIX_TRANSCODE_TIMEOUT:"startMixTranscode timeout.",START_MIX_TRANSCODE_FAILED:function(e){return"startMixTranscode failed, errMsg: ".concat(e.errMsg,".")},STOP_MIX_TRANSCODE_TIMEOUT:"stopMixTranscode timeout.",STOP_MIX_TRANSCODE_FAILED:function(e){return"stopMixTranscode failed, errMsg: ".concat(e.errMsg,".")},MIX_TRANSCODE_NOT_STARTED:"mixTranscode has not been started.",MIX_TRANSCODE_PARAM:"param should be object when start mix transcoding.",MIX_PARAMS_USER_ID:"userId is required.",MIX_PARAMS_RECT:"width and height cannot be less than 0.",MIX_PARAMS_LOCATION:"locationX and locationY cannot be less than 0.",MIX_PARAMS_ZORDER:"zOrder should between 1 and 15.",MIX_PARAMS_VIDEO:"videoWidth and videoHeight cannot be less than 0.",MIX_PARAMS_STREAM:"videoWidth and videoHeight of output stream should be contain all mix stream.",INVALID_PLAY:"duplicate play() call observed, please stop() firstly.",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:"not supported in http protocol, please use https protocol.",NOT_SUPPORTED_WEBRTC:"your browser does NOT support WebRTC!",NOT_SUPPORTED_TRTC:"your browser does NOT support TRTC! ",NOT_SUPPORTED_PROFILE:"your browser does not support setVideoProfile.",NOT_SUPPORTED_MEDIA:"your browser 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_REPLACE_TRACK:"replaceTrack is not supported in this browser, please use switchDevice or addTrack instead.",NOT_SUPPORTED_CAPTURE:"captureScreen is not supported, please use chrome.",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."},g_=Cs+"module-ErrorCode.html",S_=function(){if(!md())return!1;var e=localStorage.getItem("trtc_error_assistance");e&&!function(e){var t=(new Date).getTime()-e.saveTime>=6048e5;return e.saveTime&&t}(JSON.parse(e))||(gd.log("request error info"),function(){var e=new XMLHttpRequest;if(e.open("GET","https://web.sdk.qcloud.com/trtc/webrtc/download/trtc-error-assistance.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("trtc_error_assistance",JSON.stringify({message:e.responseText,saveTime:(new Date).getTime()})),document.body.removeChild(t)}}())};function y_(e){var t=e.key,n=e.data,r=e.link,i="",a="",o="";kf(n)?i=v_[t]:tu(v_[t])&&(i=v_[t](n));var s=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("trtc_error_assistance");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,r=window.TRTC_ERROR_LINK;return document.body.removeChild(t),{TRTC_ERROR_INFO:n,TRTC_ERROR_LINK:r}}return{}}(),c=s.TRTC_ERROR_INFO,u=s.TRTC_ERROR_LINK;c&&c[t]&&(kf(n)?a=c[t]:tu(c[t])&&(a=c[t](n))),r?o=Cs+"".concat(r.className,".html#").concat(r.className===ks?".":"").concat(r.fnName):u&&u[t]&&(o=Cs+u[t]);var d=i;return d+=" "+a,d+=a?o?"查看文档:"+o:"查看文档:"+g_:o?"Refer to:"+o:"Refer to:"+g_}var T_=function(){function e(t){a(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,this.version_=t.version,this.urlWithParam_="".concat(this.url_,"?sdkAppid=").concat(this.sdkAppId_,"&identifier=").concat(this.userId_,"&userSig=").concat(this.userSig_),this.backupUrlWithParam_="".concat(this.backupUrl_,"?sdkAppid=").concat(this.sdkAppId_,"&identifier=").concat(this.userId_,"&userSig=").concat(this.userSig_),this.isConnected_=!1,this.isConnecting_=!1,this.socketInUse_=null,this.socket_=null,this.backupSocket_=null,this.backupTimer_=-1,this.signalInfo_={},this.currentState_=cp,this.reconnectionCount_=0,this.reconnectionTimer_=-1,this.seq_=0,this.pingPongTimeoutId_=-1,this.pingTimeoutId_=-1,this.emitter_=new ip}var t;return s(e,[{key:"connect",value:function(){var e=this;gd.info("connect to url: ".concat(this.urlWithParam_)),this.emitter_.emit(ap,{prevState:this.currentState_,state:up}),this.currentState_=up,this.socket_=new WebSocket(this.urlWithParam_),this.bindSocket(this.socket_),this.backupTimer_=setTimeout((function(){e.isConnected_||(gd.info("trying to connect to backupUrl"),e.tryConnectBackup())}),5e3)}},{key:"tryConnectBackup",value:function(){this.backupSocket_||(this.unbindAndCloseSocket("main"),gd.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("main"===e){if(this.socket_){this.unbindSocket(this.socket_);try{this.socket_.close(1e3)}catch(cS){}this.socket_=null}}else if(this.backupSocket_){this.unbindSocket(this.backupSocket_);try{this.backupSocket_.close(1e3)}catch(cS){}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.clearBackupTimer(),e.target===this.socket_?(this.unbindAndCloseSocket("backup"),this.socketInUse_=this.socket_):(this.unbindAndCloseSocket("main"),this.socketInUse_=this.backupSocket_);var t=e.target.url;gd.info("[".concat(this.userId_,"] websocket[").concat(t,"] is connected")),this.emitter_.emit(ap,{prevState:this.currentState_,state:lp}),this.currentState_===up?this.addSignalEvent(of,"signal channel is connected"):this.currentState_===dp&&this.addSignalEvent(df,"signal channel reconnect success"),this.currentState_=lp,this.emitter_.emit(op)}}},{key:"onclose",value:function(e){var t=e.target.url,n=e.target===this.socketInUse_;gd.info("[".concat(this.userId_,"] websocket[").concat(t," InUse: ").concat(n,"] is closed with code: ").concat(e.code)),e.target===this.socketInUse_&&(this.isConnected_=!1,e.wasClean&&1e3===e.code?(this.emitter_.emit(ap,{prevState:this.currentState_,state:cp}),this.currentState_=cp,this.addSignalEvent(af,"signal channel is disconnected")):(gd.warn("[".concat(this.userId_,"] onclose code:").concat(e.code," reason:").concat(e.reason)),gd.warn("close current websocket and schedule a reconnect timeout"),this.socketInUse_.onclose=function(){},this.socketInUse_.close(4011),this.socket_=this.backupSocket_=this.socketInUse_=null,this.reconnect("main")))}},{key:"onerror",value:function(e){var t=e.target.url;gd.debug("[".concat(this.userId_,"] websocket[").concat(t,"] error observed")),this.isConnected_?e.target===this.socketInUse_&&(this.isConnected_=!1,this.unbindAndCloseSocket("main"),this.unbindAndCloseSocket("backup"),this.socketInUse_=null,this.reconnect("main")):(this.isReconnecting_||Kc({eventType:Qo,code:ws.UNKNOWN}),e.target==this.socket_?(this.unbindAndCloseSocket("main"),this.reconnect("backup")):(this.unbindAndCloseSocket("backup"),this.reconnect("main"))),this.isConnecting_=!1,this.isConnected_=!1}},{key:"onmessage",value:function(e){var t=this;if(this.isConnected_){var n=JSON.parse(e.data),r=n.cmd,i=n.content,a=Object.values(hp),o=Object.keys(hp)[a.indexOf(r)],s=fp[o];if(!pp.includes(r)){var c=e.target==this.socket_?this.url_:this.backupUrl_;if(gd.debug("[".concat(this.userId_,"] websocket[").concat(c,"] received message: ").concat(e.data)),gd.info("[".concat(this.userId_,"] Received event: [ ").concat(s||"unknown cmd: "+r," ]")),(s===fp.UPDATE_REMOTE_SDP||s===fp.UPDATE_AUDIO_SSRC||s===fp.UPDATE_VIDEO_SSRC)&&i.offersdp)try{var u=JSON.parse(i.offersdp),d=u.audiossrc,l=u.videossrc,h=u.rtxssrc;gd.info("[".concat(this.userId_,"] ssrc info in offersdp: [ audiossrc: ").concat(d," videossrc: ").concat(l," rtxssrc: ").concat(h," ]"))}catch(m){}}switch(r){case hp.CHANNEL_SETUP_SUCCESS:this.signalInfo_.relayIp=i.relayip,this.signalInfo_.relayInnerIp=i.innerip,this.signalInfo_.signalIp=i.signalip,this.signalInfo_.localIp=i.localip,this.signalInfo_.dataPort=i.dataport,this.signalInfo_.stunPort=i.stunport,this.signalInfo_.checkSigSeq=i.checkSigSeq,this.signalInfo_.socketId=i.socketid,this.signalInfo_.tinyId=i.tinyid,this.signalInfo_.openId=i.openid,this.signalInfo_.stunPortList=i.stunportList,!i.stunportList||i.stunportList.length<=0?this.signalInfo_.stunServers="stun:"+i.relayip+":"+i.stunport:(this.signalInfo_.stunServers=[],i.stunportList.forEach((function(e){var n="stun:"+i.relayip+":"+e;t.signalInfo_.stunServers.push(n)}))),i.cgiurl&&(this.signalInfo_.logCgiUrl=i.cgiurl),i.svrTime&&function(e){Fc=e-(new Date).getTime();var t=new Date;t.setTime(e),gd.info("baseTime from server: "+t+" offset: "+Fc)}(i.svrTime),gd.info("ChannelSetup Success: signalIp:".concat(i.signalip," relayIp:").concat(i.relayip," clientIp:").concat(i.localip," checkSigSeq:").concat(i.checkSigSeq)),gd.info("start ping pong"),this.startPingPong(),this.isReconnecting_&&(this.reconnectionCount_=0,this.clearReconnectionTimer(),1===i.rc&&this.emitter_.emit(fp.REQUEST_REBUILD_SESSION,{signalInfo:this.signalInfo_})),this.emitter_.emit(s,{signalInfo:this.signalInfo_});break;case hp.REBUILD_SESSION_RESULT:0===i.result?(gd.info("reconnect - rebuild session succeeded"),this.client_.checkConnectionsToReconnect()):(this.emitter_.emit(fp.CLIENT_REJOIN),gd.error("reconnect - rebuild session failed: ".concat(JSON.stringify(i))));break;case hp.CHANNEL_SETUP_FAILED:if(!this.isReconnecting_){var p="sdkAppId invalid",f="";nu(i.errorCode)||(p=i.errorCode,f=i.errorMsg);var m=new As({code:ws.SIGNAL_CHANNEL_SETUP_FAILED,extraCode:p,message:y_({key:Nf,data:{errorCode:p,errorMsg:f}})});this.close(),Kc({eventType:Qo,error:m}),this.emitter_.emit(sp,m)}break;default:this.emitter_.emit(s,{data:n})}}}},{key:"addSignalEvent",value:function(e,t){Sf(this.userId_,{eventId:e,eventDesc:t,timestamp:jc(),userId:this.userId_,tinyId:this.signalInfo_.tinyId})}},{key:"reconnect",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"main";if(this.isConnecting_||-1!==this.reconnectionTimer_)gd.info("signal channel is reconnecting, ignoring current reconnection");else{if(this.reconnectionCount_>=30){gd.warn("SDK has tried reconnect signal channel for ".concat(30," times, but all failed. please check your network"));var n=new As({code:ws.SIGNAL_CHANNEL_RECONNECTION_FAILED,message:y_({key:Of})});return Kc({eventType:Yo,error:n}),this.addSignalEvent(lf,"signal channel reconnect fail"),void this.emitter_.emit(sp,n)}this.isConnecting_=!0,this.reconnectionCount_++,this.currentState_!==dp&&(this.emitter_.emit(ap,{prevState:this.currentState_,state:dp}),this.currentState_=dp,this.addSignalEvent(uf,"signal channel is reconnecting")),gd.warn("reconnecting to ".concat(t," signal channel [").concat(this.reconnectionCount_,"/").concat(30,"]"));var r=this.getReconnectionUrl(t);"main"===t?(this.socket_=new WebSocket(r),this.bindSocket(this.socket_)):(this.backupSocket_=new WebSocket(r),this.bindSocket(this.backupSocket_));var i=eu(this.reconnectionCount_);this.reconnectionTimer_=setTimeout((function(){gd.warn("reconnect ".concat(t," signal channel timeout(").concat(i/1e3,"s), close and try again")),e.isConnecting_=!1,e.clearReconnectionTimer(),e.unbindAndCloseSocket(t),e.reconnect("main"===t?"backup":"main")}),i)}}},{key:"isConnected",value:function(){return this.isConnected_}},{key:"isReconnecting_",get:function(){return-1!==this.reconnectionTimer_}},{key:"getReconnectionUrl",value:function(e){var t="main"===e?this.urlWithParam_:this.backupUrlWithParam_;return kf(this.signalInfo_)||-1!==t.indexOf("&rc=1")||(t+="&iip="+this.signalInfo_.relayInnerIp+"&dp="+this.signalInfo_.dataPort+"&oip="+this.signalInfo_.relayIp+"&sp="+this.signalInfo_.stunPort+"&rc=1"),t}},{key:"send",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(this.isConnected_){var r=this.createSendMessage(e);return r.data=t,void 0!==n&&(r.srctinyid=n),this.socketInUse_.send(JSON.stringify(r)),r.seq}}},{key:"sendWithoutUA",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;if(this.isConnected_){var r=this.createSendMessage(e,!1);return r.data=t,void 0!==n&&(r.srctinyid=n),this.socketInUse_.send(JSON.stringify(r)),r.seq}}},{key:"sendWithReport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;if(this.isConnected_){var r=this.createSendMessage(e);return r.data=t,r.report=n,this.socketInUse_.send(JSON.stringify(r)),r.seq}}},{key:"sendWaitForResponse",value:function(e){var t=this,n=e.command,r=e.data,i=e.timeout,a=void 0===i?5e3:i,o=e.responseCommand,s=e.commandDesc;return new Promise((function(e,i){var c=setTimeout((function(){t.off(o,u);var e=new As({code:ws.API_CALL_TIMEOUT,message:y_({key:xf,data:{error:{commandDesc:s,command:n}}})});gd.warn(e),i(e)}),a),u=function n(r){r.data.seq===d&&(clearTimeout(c),t.off(o,n),e(r))};t.on(o,u);var d=t.send(n,r,0)}))}},{key:"startPingPong",value:(t=i(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,-1===this.pingPongTimeoutId_){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.ping();case 5:this.pingPongTimeoutId_=setTimeout((function(){t.pingPongTimeoutId_=-1,t.startPingPong()}),1e4),this.client_.isRelayMaybeFailed()&&this.emitter_.emit(fp.CLIENT_REJOIN),e.next=14;break;case 9:e.prev=9,e.t0=e.catch(0),gd.warn("ping-pong failed, start signal reconnection"),this.close(),this.reconnect("main");case 14:case"end":return e.stop()}}),e,this,[[0,9]])}))),function(){return t.apply(this,arguments)})},{key:"stopPingPong",value:function(){gd.info("stop ping pong"),clearTimeout(this.pingTimeoutId_),clearTimeout(this.pingPongTimeoutId_),this.pingTimeoutId_=-1,this.pingPongTimeoutId_=-1}},{key:"ping",value:function(){var e=this;return new Promise((function(t,n){if(-1!==e.pingTimeoutId_)return t();e.sendWithoutUA(kp),e.once(fp.PONG,(function(){clearTimeout(e.pingTimeoutId_),e.pingTimeoutId_=-1,t()})),e.pingTimeoutId_=setTimeout((function(){e.pingTimeoutId_=-1,n()}),1e4)}))}},{key:"createSendMessage",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n={tag_key:e,data:"",openid:this.userId_,tinyid:this.signalInfo_.tinyId,version:this.version_,seq:++this.seq_};return t&&(n.ua=navigator.userAgent),n}},{key:"getCurrentState",value:function(){return this.currentState_}},{key:"getSocketId",value:function(){return this.signalInfo_.socketId}},{key:"close",value:function(){gd.info("close SignalChannel"),this.clearBackupTimer(),this.clearReconnectionTimer(),this.stopPingPong(),this.isConnecting_=!1,this.isConnected_=!1,this.socketInUse_=null,this.unbindAndCloseSocket("main"),this.unbindAndCloseSocket("backup")}},{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)}}]),e}(),k_=bt.find,R_=!0;"find"in[]&&Array(1).find((function(){R_=!1})),_t({target:"Array",proto:!0,forced:R_},{find:function(e){return k_(this,e,arguments.length>1?arguments[1]:void 0)}}),Hr("find");var b_=E((function(e){var t=e.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%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(t).forEach((function(e){t[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))})),E_=(b_.v,b_.o,b_.s,b_.i,b_.u,b_.e,b_.p,b_.z,b_.r,b_.t,b_.c,b_.b,b_.m,b_.a,E((function(e,t){var n=function(e){return String(Number(e))===e?Number(e):e},r=function(e,t,r){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var a=e.push?{}:i?t[e.name]:t;!function(e,t,r,i){if(i&&!r)t[i]=n(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(t[r[a]]=n(e[a+1]))}(r.match(e.reg),a,e.names,e.name),e.push&&t[e.push].push(a)},i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},n=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),a=n[n.length-1]);for(var o=0;o<(b_[t]||[]).length;o+=1){var s=b_[t][o];if(s.reg.test(i))return r(s,a,i)}})),t.media=n,t};var a=function(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=n(r[1]):1===r.length&&t.length>1&&(e[r[0]]=void 0),e};t.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(n),i=0;i<r.length;i+=3)t.push({component:r[i],ip:r[i+1],port:r[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,r=!1;return"~"!==e[0]?t=n(e):(t=n(e.substring(1,e.length)),r=!0),{scid:t,paused:r}}))}))}}))),I_=(E_.parse,E_.parseParams,E_.parseFmtpConfig,E_.parsePayloads,E_.parseRemoteCandidates,E_.parseImageAttributes,E_.parseSimulcastStreamList,/%[sdv%]/g),C_=function(e){var t=1,n=arguments,r=n.length;return e.replace(I_,(function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},w_=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var a=t.names[i];t.name?r.push(n[t.name][a]):r.push(n[t.names[i]])}else r.push(n[t.name]);return C_.apply(null,r)},A_=["v","o","s","i","u","e","p","c","b","t","r","z","a"],D_=["i","c","b","a"],P_={write:function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var n=t.outerOrder||A_,r=t.innerOrder||D_,i=[];return n.forEach((function(t){b_[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(w_(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(w_(t,n,e))}))}))})),e.media.forEach((function(e){i.push(w_("m",b_.m[0],e)),r.forEach((function(t){b_[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(w_(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(w_(t,n,e))}))}))}))})),i.join("\r\n")+"\r\n"},parse:E_.parse,parseParams:E_.parseParams,parseFmtpConfig:E_.parseFmtpConfig,parsePayloads:E_.parsePayloads,parseRemoteCandidates:E_.parseRemoteCandidates,parseImageAttributes:E_.parseImageAttributes,parseSimulcastStreamList:E_.parseSimulcastStreamList},x_=function(e){return P_.parse(e)},O_=function(e){return P_.write(e)},N_=function(e){var t=x_(e);return t.media.forEach((function(e){"audio"===e.type&&e.fmtp.forEach((function(e){e.config+=";sprop-stereo=1;stereo=1"}))})),O_(t)},M_={result:!1,detail:{isBrowserSupported:!1,isWebRTCSupported:!1,isMediaDevicesSupported:!1,isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH264DecodeSupported:!1,isVp8DecodeSupported:!1}},L_=function(){return!Qu&&!Ru&&(!(Eu&&Iu<80)&&!(Tu&&ku<56))},V_=function(){return["RTCPeerConnection","webkitRTCPeerConnection","RTCIceGatherer"].filter((function(e){return e in window})).length>0},U_=function(){if(!navigator.mediaDevices)return!1;var e=["getUserMedia","enumerateDevices"];return e.filter((function(e){return e in navigator.mediaDevices})).length===e.length},F_=function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!M_.detail.isH264EncodeSupported&&!M_.detail.isVp8EncodeSupported){e.next=2;break}return e.abrupt("return",{isH264EncodeSupported:M_.detail.isH264EncodeSupported,isVp8EncodeSupported:M_.detail.isVp8EncodeSupported});case 2:return t="",n=!1,r=!1,e.prev=5,i=new RTCPeerConnection,(a=document.createElement("canvas")).getContext("2d"),o=a.captureStream(0),i.addTrack(o.getVideoTracks()[0],o),e.next=13,i.createOffer();case 13:return-1!==(t=e.sent).sdp.toLowerCase().indexOf("h264")&&(n=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0),i.close(),M_.detail.isH264EncodeSupported=n,M_.detail.isVp8EncodeSupported=r,e.abrupt("return",{isH264EncodeSupported:M_.detail.isH264EncodeSupported,isVp8EncodeSupported:M_.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 j_(){return B_.apply(this,arguments)}function B_(){return(B_=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=i(regeneratorRuntime.mark((function e(t){var n,r,a,o,s,c,u,d,l,h,p,f,m,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={encode:!1,decode:!1},r=null,e.prev=2,a=document.createElement("canvas"),o=a.getContext("2d"),a.width=640,a.height=480,s=setInterval((function(){o.fillText("test",Math.floor(640*Math.random()),Math.floor(480*Math.random()))}),33),c=-1,u=-1,r=function(){clearInterval(c),clearInterval(s),clearTimeout(u),l.close(),h.close(),d.getTracks().forEach((function(e){return e.stop()}))},u=setTimeout((function(){r(),t(n)}),3e3),d=a.captureStream(),l=new RTCPeerConnection({}),h=new RTCPeerConnection({offerToReceiveAudio:!0,offerToReceiveVideo:!0}),l.addEventListener("icecandidate",(function(e){return h.addIceCandidate(e.candidate)})),h.addEventListener("icecandidate",(function(e){return l.addIceCandidate(e.candidate)})),l.addTrack(d.getVideoTracks()[0],d),e.next=20,l.createOffer();case 20:return p=e.sent,e.next=23,l.setLocalDescription(p);case 23:return e.next=25,h.setRemoteDescription(p);case 25:return e.next=27,h.createAnswer();case 27:return f=e.sent,m=x_(f.sdp),_=m.media[0].rtp.findIndex((function(e){return"H264"===e.codec})),m.media[0].rtp=[m.media[0].rtp[_]],m.media[0].fmtp=m.media[0].fmtp.filter((function(e){return e.payload===m.media[0].rtp[0].payload})),m.media[0].rtcpFb=m.media[0].rtcpFb.filter((function(e){return e.payload===m.media[0].rtp[0].payload})),f.sdp=O_(m),e.next=36,h.setLocalDescription(f);case 36:return e.next=38,l.setRemoteDescription(f);case 38:c=setInterval(i(regeneratorRuntime.mark((function e(){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.encode&&n.decode&&(r(),t(n)),e.next=3,l.getStats();case 3:return i=e.sent,e.next=6,h.getStats();case 6:a=e.sent,n.encode||i.forEach((function(e){"outbound-rtp"===e.type&&e.mediaType===ps&&e.framesEncoded>0&&(n.encode=!0)})),n.decode||a.forEach((function(e){"inbound-rtp"===e.type&&e.mediaType===ps&&e.framesDecoded>0&&(n.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(),gd.warn(e.t0),t(n);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)})))).apply(this,arguments)}var H_=function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!M_.detail.isH264DecodeSupported&&!M_.detail.isVp8DecodeSupported){e.next=2;break}return e.abrupt("return",{isH264DecodeSupported:M_.detail.isH264DecodeSupported,isVp8DecodeSupported:M_.detail.isVp8DecodeSupported});case 2:return t="",n=!1,r=!1,e.prev=5,i=new RTCPeerConnection,e.next=9,i.createOffer({offerToReceiveAudio:1,offerToReceiveVideo:1});case 9:return-1!==(t=e.sent).sdp.toLowerCase().indexOf("h264")&&(n=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0),i.close(),e.abrupt("return",{isH264DecodeSupported:n,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)}}(),G_=function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!M_.result){e.next=2;break}return e.abrupt("return",M_);case 2:return t=L_(),n=V_(),r=U_(),e.next=7,F_();case 7:return i=e.sent,a=i.isH264EncodeSupported,o=i.isVp8EncodeSupported,e.next=12,H_();case 12:if(s=e.sent,c=s.isH264DecodeSupported,u=s.isVp8DecodeSupported,M_.result=t&&n&&r&&(a||o)&&(c||u),M_.detail.isBrowserSupported=t,M_.detail.isWebRTCSupported=n,M_.detail.isMediaDevicesSupported=r,M_.detail.isH264EncodeSupported=a,M_.detail.isVp8EncodeSupported=o,M_.detail.isH264DecodeSupported=c,M_.detail.isVp8DecodeSupported=u,!a||!c||!rd&&!ad){e.next=32;break}return e.next=26,j_();case 26:d=e.sent,l=d.encode,h=d.decode,M_.detail.isH264EncodeSupported=l,M_.detail.isH264DecodeSupported=h,l&&h||gd.error("".concat(navigator.userAgent," isH264EncodeSupported: ").concat(l," isH264DecodeSupported: ").concat(h));case 32:return M_.result||gd.error("".concat(navigator.userAgent," isBrowserSupported: ").concat(t," ")+"isWebRTCSupported: ".concat(n," isMediaSupported: ").concat(r," ")+"isH264EncodeSupported: ".concat(M_.detail.isH264EncodeSupported," isVp8EncodeSupported: ").concat(o," ")+"isH264DecodeSupported: ".concat(M_.detail.isH264DecodeSupported," isVp8DecodeSupported: ").concat(u," ")),e.abrupt("return",M_);case 34:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),J_=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},z_=function(){return"RTCPeerConnection"in window&&"getReceivers"in window.RTCPeerConnection.prototype},W_=function(){return"RTCPeerConnection"in window&&"getSenders"in window.RTCPeerConnection.prototype},q_=function(){return"RTCRtpTransceiver"in window&&"stop"in window.RTCRtpTransceiver.prototype},K_=function(){return"RTCRtpSender"in window&&"setParameters"in window.RTCRtpSender.prototype&&W_()},Q_=function(){return!!nu(navigator.mediaDevices)&&(gd.error(v_.NOT_SUPPORTED_MEDIA),!0)},Y_=function(){return"http:"===location.protocol&&!fd&&(gd.error(v_.NOT_SUPPORTED_HTTP),!0)},X_=function(e){return!("candidate-pair"!==e.type||!e.nominated||"in-progress"!==e.state&&"succeeded"!==e.state)&&!("boolean"==typeof e.selected&&!e.selected)},$_=new Map([[Su,"Android"],[gu,"iOS"],[Wu,"Windows"],[qu,"MacOS"],[Ku,"Linux"]]),Z_=function(){var e="unknown";return $_.get(!0)&&(e=$_.get(!0)),e};function ev(){var e="";screen.width&&(e+=(screen.width?screen.width*window.devicePixelRatio:"")+" * "+(screen.height?screen.height*window.devicePixelRatio:""));return e}function tv(){var e=!1;return(navigator.getUserMedia||navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)&&(e=!0),e}function nv(){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 rv(){return!Mu&&!gu&&!(!L_()||!("captureStream"in HTMLCanvasElement.prototype))}G_();var iv="stream-added",av="stream-removed",ov="stream-updated",sv="stream-subscribed",cv="error",uv="connection-state-changed",dv="stream-added",lv="stream-removed",hv="stream-updated",pv="stream-subscribed",fv="connection-state-changed",mv="peer-join",_v="peer-leave",vv="mute-audio",gv="mute-video",Sv="unmute-audio",yv="unmute-video",Tv="client-banned",kv="network-quality",Rv="audio-volume",bv="error",Ev="player-state-changed",Iv="screen-sharing-stopped",Cv="connection-state-changed",wv="error",Av="player-state-changed",Dv=function(){function e(t){a(this,e),this.prevReport_={},this.prevEncoderImplementation_="",this.prevQualityLimitationReason_=""}var t,n,r,o;return s(e,[{key:"getSenderStats",value:(o=i(regeneratorRuntime.mark((function e(t){var n,r,i,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={audio:{bytesSent:0,packetsSent:0,audioLevel:0,totalAudioEnergy:0},video:{bytesSent:0,packetsSent:0,framesEncoded:0,frameWidth:0,frameHeight:0,framesSent:0,fpsCapture:0,smallFramesEncoded:0,smallFPSCapture:0,smallFramesSent:0},rtt:0},r=t.getPeerConnection(),i=t.getSSRC(),!r){e.next=14;break}return e.prev=4,e.next=7,r.getStats();case 7:e.sent.forEach((function(e){if("outbound-rtp"===e.type)if("video"===e.mediaType){if(!Tu&&nu(e.trackId))return;e.ssrc!==i.video||nu(e.encoderImplementation)||a.prevEncoderImplementation_===e.encoderImplementation||(gd.debug("[".concat(t.getUserId(),"] encoderImplementation change to ").concat(e.encoderImplementation)),a.prevEncoderImplementation_=e.encoderImplementation),e.ssrc!==i.video||nu(e.qualityLimitationReason)||a.prevQualityLimitationReason_===e.qualityLimitationReason||(gd.debug("[".concat(t.getUserId(),"] qualityLimitationReason change to ").concat(e.qualityLimitationReason)),a.prevQualityLimitationReason_=e.qualityLimitationReason);var r=t.getSSRC();e.ssrc===r.video?(n.video.bytesSent=e.bytesSent,n.video.packetsSent=e.packetsSent,n.video.framesEncoded=e.framesEncoded):(n.video.smallBytesSent=e.bytesSent,n.video.smallFramesEncoded=e.framesEncoded)}else"audio"===e.mediaType&&(n.audio.bytesSent=e.bytesSent,n.audio.packetsSent=e.packetsSent);else"candidate-pair"===e.type?X_(e)&&iu(e.currentRoundTripTime)&&(n.rtt=Math.floor(1e3*e.currentRoundTripTime)):"track"===e.type?(nu(e.frameWidth)||(e.trackIdentifier===t.getLocalStreamVideoTrackId()?(n.video.frameWidth=e.frameWidth,n.video.frameHeight=e.frameHeight,n.video.framesSent=e.framesSent):(n.video.smallFrameWidth=e.frameWidth,n.video.smallFrameHeight=e.frameHeight,n.video.smallFramesSent=e.framesSent)),nu(e.audioLevel)||(n.audio.audioLevel=e.audioLevel||0)):"media-source"===e.type&&("audio"===e.kind?(n.audio.audioLevel=e.audioLevel||0,n.audio.totalAudioEnergy=e.totalAudioEnergy||0):"video"===e.kind&&(e.trackIdentifier===t.getLocalStreamVideoTrackId()?n.video.fpsCapture=e.framesPerSecond:n.video.smallFPSCapture=e.framesPerSecond))})),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),gd.warn("failed to getStats on sender connection");case 14:return e.abrupt("return",n);case 15:case"end":return e.stop()}}),e,null,[[4,11]])}))),function(e){return o.apply(this,arguments)})},{key:"getReceiverStats",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={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=13;break}return e.prev=3,e.next=6,r.getStats();case 6:e.sent.forEach((function(e){if("inbound-rtp"===e.type){if("audio"===e.mediaType)n.audio.packetsReceived=e.packetsReceived,n.audio.bytesReceived=e.bytesReceived,n.audio.packetsLost=e.packetsLost,n.audio.jitter=e.jitter,n.hasAudio=!0;else if("video"===e.mediaType){if(Tu&&0===e.bytesReceived)return;var r=t.getSSRC();e.ssrc===r.video&&(n.video.packetsReceived=e.packetsReceived,n.video.bytesReceived=e.bytesReceived,n.video.packetsLost=e.packetsLost,n.video.framesReceived=e.framesReceived,n.video.framesDecoded=e.framesDecoded,n.video.fpsDecoded=e.framesPerSecond,n.hasVideo=!0),e.ssrc===r.auxiliary&&(n.auxiliary.packetsReceived=e.packetsReceived,n.auxiliary.bytesReceived=e.bytesReceived,n.auxiliary.packetsLost=e.packetsLost,n.auxiliary.framesReceived=e.framesReceived,n.auxiliary.framesDecoded=e.framesDecoded,n.auxiliary.fpsDecoded=e.framesPerSecond,n.hasAuxiliary=!0)}}else"track"===e.type?(nu(e.frameWidth)||(e.trackIdentifier===t.getMainStreamVideoTrackId()&&(n.video.frameWidth=e.frameWidth,n.video.frameHeight=e.frameHeight),e.trackIdentifier===t.getAuxStreamVideoTrackId()&&(n.auxiliary.frameWidth=e.frameWidth,n.auxiliary.frameHeight=e.frameHeight)),"audio"===e.kind&&(n.audio.audioLevel=e.audioLevel||0,n.audio.totalAudioEnergy=e.totalAudioEnergy||0)):"candidate-pair"===e.type&&X_(e)&&iu(e.currentRoundTripTime)&&(n.rtt=Math.floor(1e3*e.currentRoundTripTime))})),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),gd.warn("failed to getStats on receiver connection");case 13:return e.abrupt("return",n);case 14:case"end":return e.stop()}}),e,null,[[3,10]])}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(n=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,c,u;return regeneratorRuntime.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:i=[],a=k(n),e.prev=7,a.s();case 9:if((o=a.n()).done){e.next=17;break}return(s=g(o.value,2))[0],c=s[1],e.next=13,this.getReceiverStats(c);case 13:u=e.sent,i.push(u);case 15:e.next=9;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(7),a.e(e.t0);case 22:return e.prev=22,a.f(),e.finish(22);case 25:return e.abrupt("return",{senderStats:r,receiverStats:i});case 26:case"end":return e.stop()}}),e,this,[[7,19,22,25]])}))),function(e,t){return n.apply(this,arguments)})},{key:"prepareReport",value:function(e){var t=e.stats,n=e.report,r=e.freezeMap;if(!kf(t.senderStats)&&(n.uint32_delay=t.senderStats.rtt,n.RTTReportState.uint32_delay=t.senderStats.rtt,n.AudioReportState.sentAudioLevel=t.senderStats.audio.audioLevel,n.AudioReportState.sentAudioEnergy=t.senderStats.audio.totalAudioEnergy,n.AudioReportState.uint32_audio_enc_pkg_br=t.senderStats.audio.bytesSent,n.VideoReportState.uint32_video_snd_br=t.senderStats.video.bytesSent,n.VideoReportState.uint32_send_total_pkg=t.senderStats.video.packetsSent,n.VideoReportState.VideoEncState[0].uint32_enc_width=t.senderStats.video.frameWidth,n.VideoReportState.VideoEncState[0].uint32_enc_height=t.senderStats.video.frameHeight,n.VideoReportState.VideoEncState[0].uint32_enc_fps=t.senderStats.video.framesEncoded,n.VideoReportState.VideoEncState[0].uint32_capture_fps=t.senderStats.video.fpsCapture,n.VideoReportState.VideoEncState[0].uint32_send_fps=t.senderStats.video.framesSent,t.senderStats.video.smallBytesSent)){n.VideoReportState.uint32_small_video_snd_br=t.senderStats.video.smallBytesSent;var i={uint32_enc_width:t.senderStats.video.smallFrameWidth||0,uint32_enc_height:t.senderStats.video.smallFrameHeight||0,uint32_enc_fps:t.senderStats.video.smallFramesEncoded||0,uint32_capture_fps:t.senderStats.video.smallFPSCapture||0,uint32_send_fps:t.senderStats.video.smallFramesSent||0};n.VideoReportState.VideoEncState.push(i)}t.receiverStats.forEach((function(e){var t=e.userId;if(n.RTTReportState.RTTDecState.push({uint32_delay:e.rtt,uint64_sender_uin:e.tinyId}),e.hasAudio&&(n.AudioReportState.AudioDecState.push({uint32_audio_delay:0,uint32_audio_jitter:e.audio.jitter,uint32_audio_real_recv_pkg:e.audio.packetsReceived,uint32_audio_flow:e.audio.bytesReceived,uint32_audio_real_recv_br:0,uint64_sender_uin:e.tinyId,userId:e.userId,packetsLost:e.audio.packetsLost,totalPacketsLost:e.audio.packetsLost,audioLevel:e.audio.audioLevel,audioEnergy:e.audio.totalAudioEnergy}),n.AudioReportState.uint32_audio_real_recv_pkg+=e.audio.packetsReceived,n.AudioReportState.uint32_audio_flow+=e.audio.bytesReceived,n.uint32_real_num+=e.audio.packetsReceived),e.hasVideo){var i=r.get(t+"_main"),a=i?i.duration:0;n.VideoReportState.VideoDecState.push({uint32_video_recv_fps:e.video.framesReceived,uint32_video_dec_fps:e.video.fpsDecoded,uint32_video_recv_br:e.video.bytesReceived,uint32_video_real_recv_pkg:e.video.packetsReceived,uint32_dec_height:e.video.frameHeight,uint32_dec_width:e.video.frameWidth,uint32_video_jitter:0,uint64_sender_uin:e.tinyId,userId:e.userId,packetsLost:e.video.packetsLost,totalPacketsLost:e.video.packetsLost,uint32_video_strtype:0,int32_video_freeze_ms:a}),n.VideoReportState.uint32_video_total_real_recv_pkg+=e.video.packetsReceived,n.VideoReportState.uint32_video_rcv_br+=e.video.bytesReceived}if(e.hasAuxiliary){var o=r.get(t+"_auxiliary"),s=o?o.duration:0;n.VideoReportState.VideoDecState.push({uint32_video_recv_fps:e.auxiliary.framesReceived,uint32_video_dec_fps:e.auxiliary.fpsDecoded,uint32_video_recv_br:e.auxiliary.bytesReceived,uint32_video_real_recv_pkg:e.auxiliary.packetsReceived,uint32_dec_height:e.auxiliary.frameHeight,uint32_dec_width:e.auxiliary.frameWidth,uint32_video_jitter:0,uint64_sender_uin:e.tinyId,userId:e.userId,packetsLost:e.auxiliary.packetsLost,totalPacketsLost:e.auxiliary.packetsLost,uint32_video_strtype:2,int32_video_freeze_ms:s})}})),n.uint64_end_utime=(new Date).getTime();var a=this.prevReport_;if(this.prevReport_=JSON.parse(JSON.stringify(n)),kf(a))n.AudioReportState.uint32_audio_enc_pkg_br=8*n.AudioReportState.uint32_audio_enc_pkg_br/2,n.VideoReportState.uint32_video_rcv_br=8*n.VideoReportState.uint32_video_rcv_br/2,n.VideoReportState.uint32_video_snd_br=8*n.VideoReportState.uint32_video_snd_br/2,n.VideoReportState.uint32_small_video_snd_br&&(n.VideoReportState.uint32_small_video_snd_br=8*n.VideoReportState.uint32_small_video_snd_br/2),n.VideoReportState.VideoDecState.forEach((function(e){e.uint32_video_recv_br=8*e.uint32_video_recv_br/2,n.uint32_total_send_bps=n.AudioReportState.uint32_audio_enc_pkg_br+n.VideoReportState.uint32_video_snd_br}));else{if(n.uint64_begine_utime=a.uint64_end_utime,n.uint32_real_num-=a.uint32_real_num,n.uint32_real_num<=0&&(n.uint32_real_num=0),n.AudioReportState.uint32_audio_real_recv_pkg-=a.AudioReportState.uint32_audio_real_recv_pkg,n.AudioReportState.uint32_audio_real_recv_pkg<=0&&(n.AudioReportState.uint32_audio_real_recv_pkg=0),n.AudioReportState.uint32_audio_enc_pkg_br-=a.AudioReportState.uint32_audio_enc_pkg_br,n.AudioReportState.uint32_audio_enc_pkg_br<=0&&(n.AudioReportState.uint32_audio_enc_pkg_br=0),n.AudioReportState.uint32_audio_enc_pkg_br=8*n.AudioReportState.uint32_audio_enc_pkg_br/2,n.VideoReportState.uint32_video_snd_br-=a.VideoReportState.uint32_video_snd_br,n.VideoReportState.uint32_video_snd_br<=0&&(n.VideoReportState.uint32_video_snd_br=0),n.VideoReportState.uint32_video_snd_br=8*n.VideoReportState.uint32_video_snd_br/2,n.VideoReportState.uint32_small_video_snd_br&&(n.VideoReportState.uint32_small_video_snd_br-=a.VideoReportState.uint32_small_video_snd_br,n.VideoReportState.uint32_small_video_snd_br<=0&&(n.VideoReportState.uint32_small_video_snd_br=0),n.VideoReportState.uint32_small_video_snd_br=8*n.VideoReportState.uint32_small_video_snd_br/2),n.AudioReportState.uint32_audio_flow-=a.AudioReportState.uint32_audio_flow,n.AudioReportState.uint32_audio_flow<=0&&(n.AudioReportState.uint32_audio_flow=0),n.VideoReportState.uint32_send_total_pkg-=a.VideoReportState.uint32_send_total_pkg,n.VideoReportState.uint32_send_total_pkg<=0&&(n.VideoReportState.uint32_send_total_pkg=0),n.VideoReportState.uint32_video_rcv_br-=a.VideoReportState.uint32_video_rcv_br,n.VideoReportState.uint32_video_rcv_br<=0&&(n.VideoReportState.uint32_video_rcv_br=0),n.VideoReportState.uint32_video_rcv_br=8*n.VideoReportState.uint32_video_rcv_br/2,n.VideoReportState.uint32_video_total_real_recv_pkg-=a.VideoReportState.uint32_video_total_real_recv_pkg,n.VideoReportState.uint32_video_total_real_recv_pkg<=0&&(n.VideoReportState.uint32_video_total_real_recv_pkg=0),n.VideoReportState.VideoEncState[0].uint32_enc_fps-=a.VideoReportState.VideoEncState[0].uint32_enc_fps,n.VideoReportState.VideoEncState[0].uint32_enc_fps<0&&(n.VideoReportState.VideoEncState[0].uint32_enc_fps=0),n.VideoReportState.VideoEncState[0].uint32_enc_fps=n.VideoReportState.VideoEncState[0].uint32_enc_fps/2,n.VideoReportState.VideoEncState[0].uint32_send_fps-=a.VideoReportState.VideoEncState[0].uint32_send_fps,n.VideoReportState.VideoEncState[0].uint32_send_fps<0&&(n.VideoReportState.VideoEncState[0].uint32_send_fps=0),n.VideoReportState.VideoEncState[0].uint32_send_fps=n.VideoReportState.VideoEncState[0].uint32_send_fps/2,n.VideoReportState.VideoEncState[1]){var o=0,s=0;a.VideoReportState.VideoEncState[1]&&(o=a.VideoReportState.VideoEncState[1].uint32_enc_fps,s=a.VideoReportState.VideoEncState[1].uint32_enc_fps),n.VideoReportState.VideoEncState[1].uint32_enc_fps-=o,n.VideoReportState.VideoEncState[1].uint32_enc_fps<0&&(n.VideoReportState.VideoEncState[1].uint32_enc_fps=0),n.VideoReportState.VideoEncState[1].uint32_enc_fps=n.VideoReportState.VideoEncState[1].uint32_enc_fps/2,n.VideoReportState.VideoEncState[1].uint32_send_fps-=s,n.VideoReportState.VideoEncState[1].uint32_send_fps<0&&(n.VideoReportState.VideoEncState[1].uint32_send_fps=0),n.VideoReportState.VideoEncState[1].uint32_send_fps=n.VideoReportState.VideoEncState[1].uint32_send_fps/2}for(var c=n.VideoReportState.VideoDecState.length,u=0;u<c;u++){for(var d=n.VideoReportState.VideoDecState[u],l=d.uint64_sender_uin,h=d.uint32_video_strtype,p=d.uint32_video_real_recv_pkg,f=d.uint32_video_recv_br,m=d.uint32_video_recv_fps,_=0;_<a.VideoReportState.VideoDecState.length;_++){var v=a.VideoReportState.VideoDecState[_];if(v.uint64_sender_uin===l&&v.uint32_video_strtype===h){d.packetsLost=d.totalPacketsLost-v.totalPacketsLost,(p-=v.uint32_video_real_recv_pkg)<=0&&(p=0),(f-=v.uint32_video_recv_br)<=0&&(f=0),(m-=v.uint32_video_recv_fps)<0&&(m=0);break}}n.VideoReportState.VideoDecState[u].uint32_video_real_recv_pkg=p,n.VideoReportState.VideoDecState[u].uint32_video_recv_br=8*f/2,n.VideoReportState.VideoDecState[u].uint32_video_recv_fps=m/2}c=n.AudioReportState.AudioDecState.length;for(var g=0;g<c;g++){for(var S=n.AudioReportState.AudioDecState[g],y=S.uint32_audio_real_recv_pkg,T=S.uint32_audio_flow,k=S.uint64_sender_uin,R=0;R<a.AudioReportState.AudioDecState.length;R++){var b=a.AudioReportState.AudioDecState[R];if(b.uint64_sender_uin===k){S.packetsLost=S.totalPacketsLost-b.totalPacketsLost,(y-=b.uint32_audio_real_recv_pkg)<=0&&(y=0),(T-=b.uint32_audio_flow)<=0&&(T=0);break}}n.AudioReportState.AudioDecState[g].uint32_audio_real_recv_pkg=y,n.AudioReportState.AudioDecState[g].uint32_audio_flow=T,n.AudioReportState.AudioDecState[g].uint32_audio_real_recv_br=8*T/2}n.AudioReportState.uint32_audio_real_recv_br=8*n.AudioReportState.uint32_audio_flow/2,n.uint32_real_num=n.AudioReportState.uint32_audio_real_recv_pkg+n.VideoReportState.uint32_video_total_real_recv_pkg,n.uint32_total_send_bps=n.AudioReportState.uint32_audio_enc_pkg_br+n.VideoReportState.uint32_video_snd_br,n.uint32_total_recv_bps=n.AudioReportState.uint32_audio_real_recv_br+n.VideoReportState.uint32_video_rcv_br}return n}},{key:"getStatsReport",value:(t=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.uplinkConnection,r=t.downlinkConnections,i=t.freezeMap,a={uint64_begine_utime:(new Date).getTime(),uint64_end_utime:0,uint32_real_num:0,uint32_delay:0,uint32_CPU_curfreq:0,uint32_total_send_bps:0,uint32_total_recv_bps:0,AudioReportState:{uint32_audio_enc_pkg_br:0,uint32_audio_real_recv_pkg:0,uint32_audio_flow:0,uint32_audio_real_recv_br:0,uint32_audio_delay:0,uint32_audio_jitter:0,uint32_microphone_status:1,sentAudioLevel:0,sentAudioEnergy:0,AudioDecState:[]},VideoReportState:{uint32_video_delay:0,uint32_video_snd_br:0,uint32_video_total_real_recv_pkg:0,uint32_video_rcv_br:0,uint32_send_total_pkg:0,VideoEncState:[{uint32_enc_width:0,uint32_enc_height:0,uint32_capture_fps:0,uint32_enc_fps:0,uint32_send_fps:0}],VideoDecState:[]},RTTReportState:{uint32_delay:0,RTTDecState:[]}},e.next=4,this.getStats(n,r);case 4:return o=e.sent,this.prepareReport({stats:o,report:a,freezeMap:i}),e.abrupt("return",a);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}(),Pv=function(){function e(t){a(this,e),this.id_=t.id,this.direction_=t.direction,this.type_=t.type,this.directionPrefix_="local"===this.direction_?"":"*"}return s(e,[{key:"log",value:function(e,t){gd[e]("[".concat(this.directionPrefix_).concat(this.id_,"] ").concat(this.type_," ").concat(t))}},{key:"info",value:function(e){this.log("info",e)}},{key:"debug",value:function(e){this.log("debug",e)}},{key:"warn",value:function(e){this.log("warn",e)}},{key:"error",value:function(e){this.log("error",e)}}]),e}(),xv=new ip,Ov={JOIN_START:1,JOIN_SEND_CMD:2,JOIN_RECEIVED_CMD_RES:3,JOIN_SUCCESS:4,JOIN_FAILED:5,LEAVE_START:20,LEAVE_SEND_CMD:21,LEAVE_SUCCESS:22,HEARTBEAT_STATS:23,RECEIVED_PUBLISHED_USER_LIST:24,CALL_STATS:25,PUBLISH_START:27,STREAM_PLAY_SUCCESS:100,PLAYER_STATE_CHANGED:101,VIDEO_PLAYING:102,AUDIO_PLAYING:103,REMOTE_STREAM_TRACK_UPDATED:110,REMOTE_STREAM_ADDED:111,REMOTE_STREAM_SUBSCRIBE_START:112,REMOTE_STREAM_SUBSCRIBED:113,REMOTE_STREAM_UNSUBSCRIBED:114,REMOTE_STREAM_UPDATED:115,REMOTE_STREAM_REMOVED:116,LOCAL_STREAM_PUBLISHED:120,LOCAL_STREAM_INITIALIZE_START:121,LOCAL_STREAM_INITIALIZE_END:122,LOCAL_STREAM_INITIALIZE_FAILED:123,VIDEO_TRACK_MUTED:130,VIDEO_TRACK_UNMUTED:131,PLAY_STREAM_START:132,VIDEO_LOADED_DATA:133,PLAY_VIDEO_START:134,VIDEO_TRACK_ENDED:135,AUDIO_TRACK_MUTED:136,AUDIO_TRACK_ENDED:137,CONNECTION_STATE_CHANGED:200,CONNECTION_SEND_SUBSCRIBE_CMD:201,NETWORK_QUALITY:300},Nv=function(){function e(t){var n=t.signalChannel,r=t.connections,i=t.userId,o=t.client;a(this,e),this.client_=o,this.signalChannel_=n,this.connections_=r,this.log_=new Pv({id:"q|"+i,direction:"local",type:""}),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 ip,this.initialize()}var t,n;return s(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(S(this.downlinkLossAndRTTMap_.values())),n=t.rtt,r=t.loss;this.log_.info("downlink network quality change ".concat(this.downlinkNetworkQuality," -> ").concat(e,", rtt: ").concat(n,", loss: ").concat(r))}this.downlinkNetworkQuality_=e}},{key:"initialize",value:function(){var e=this;this.signalChannel_.on(fp.UPLINK_NETWORK_STATS,(function(t){e.handleUplinkNetworkQuality(t)})),this.signalChannel_.on(ap,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);var n=e.data.content;if(0===n.result){var r=n.expectAudPkg+n.expectVidPkg,i=n.recvAudPkg+n.recvVidPkg,a=r-i;if(0===r&&0===i)return;this.uplinkLoss_=a<=0?0:Math.round(a/r*100),this.uplinkRTT_=n.rtt,this.uplinkNetworkQuality=this.getNetworkQuality(this.uplinkLoss_,this.uplinkRTT_)}}},{key:"handleDownlinkNetworkQuality",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h,p,f,m,_=this;return regeneratorRuntime.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=S(this.connections_.values()),n=t.filter((function(e){return e.getPeerConnection()&&"connected"===e.getPeerConnection().connectionState})),t.filter((function(e){return e.getPeerConnection()&&_.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<n.length)){e.next=31;break}return i=n[r].getPeerConnection(),e.next=14,this.getStat(i);case 14:if(a=e.sent,o=a.rtt,s=a.totalPacketsLost,c=a.totalPacketsReceived,this.downlinkPrevStatMap_.has(i)){e.next=21;break}return this.downlinkPrevStatMap_.set(i,{totalPacketsLost:s,totalPacketsReceived:c}),e.abrupt("continue",28);case 21:u=0,d=this.downlinkPrevStatMap_.get(i),l=s-d.totalPacketsLost,h=c-d.totalPacketsReceived,u=l<=0||h<0?0:Math.round(l/(l+h)*100),this.downlinkPrevStatMap_.set(i,{totalPacketsLost:s,totalPacketsReceived:c}),this.downlinkLossAndRTTMap_.set(i,{rtt:o,loss:u,userId:n[r].getUserId()});case 28:r++,e.next=10;break;case 31:if(S(this.downlinkPrevStatMap_.keys()).forEach((function(e){_.isPeerConnectionDisconnected(e)&&(_.downlinkPrevStatMap_.delete(e),_.downlinkLossAndRTTMap_.delete(e))})),0!==this.downlinkLossAndRTTMap_.size){e.next=34;break}return e.abrupt("return");case 34:p=this.getAverageLossAndRTT(S(this.downlinkLossAndRTTMap_.values())),f=p.rtt,m=p.loss,this.downlinkRTT_=f,this.downlinkLoss_=m,this.downlinkNetworkQuality=this.getNetworkQuality(m,f);case 38:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getStat",value:(t=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={rtt:0,totalPacketsLost:0,totalPacketsReceived:0},t&&z_()){e.next=3;break}return e.abrupt("return",n);case 3:r=t.getReceivers(),e.prev=4,i=0;case 6:if(!(i<r.length)){e.next=15;break}return a=r[i],e.next=10,a.getStats();case 10:e.sent.forEach((function(e){"candidate-pair"===e.type&&iu(e.currentRoundTripTime)&&(n.rtt=Math.round(1e3*e.currentRoundTripTime)),"inbound-rtp"!==e.type||"audio"!==e.mediaType&&"video"!==e.mediaType||(n.totalPacketsLost+=e.packetsLost,n.totalPacketsReceived+=e.packetsReceived)}));case 12:i++,e.next=6;break;case 15:return e.abrupt("return",n);case 18:return e.prev=18,e.t0=e.catch(4),e.abrupt("return",n);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===cp?(this.uplinkRTT_=0,this.uplinkLoss_=0,this.uplinkNetworkQuality=6):e.state===lp&&6===this.uplinkNetworkQuality&&(this.uplinkNetworkQuality=5)}},{key:"handleUplinkConnectionStateChange",value:function(e){var t=e.state;t===Co?(this.uplinkLoss_=0,this.uplinkRTT_=0,this.uplinkNetworkQuality=6):t===Do&&6===this.uplinkNetworkQuality&&(this.uplinkNetworkQuality=5)}},{key:"isPeerConnectionDisconnected",value:function(e){return!(!e||"disconnected"!==e.connectionState&&"failed"!==e.connectionState&&"closed"!==e.connectionState)}},{key:"setUplinkConnection",value:function(e){this.uplinkConnection_=e,this.uplinkConnection_?this.uplinkConnection_.on(uv,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_=zd.setInterval((function(){e.handleDownlinkNetworkQuality(),xv.emit(Ov.NETWORK_QUALITY,{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(kv,{uplinkNetworkQuality:e.uplinkNetworkQuality,downlinkNetworkQuality:e.downlinkNetworkQuality,uplinkRTT:e.uplinkRTT_,uplinkLoss:e.uplinkLoss_,downlinkRTT:e.downlinkRTT_,downlinkLoss:e.downlinkLoss_})}),2e3)):this.log_.info("network quality calculating is already started")}},{key:"stop",value:function(){this.log_.info("stop network quality calculating"),-1!==this.interval_&&(zd.clearInterval(this.interval_),this.interval_=-1)}},{key:"on",value:function(e,t){this.emitter_.on(e,t)}}]),e}(),Mv=function(){function e(){a(this,e),this.log_=gd,this.localStream_=null,this.prevDevices_=[],this.initialize()}var t,n,r;return s(e,[{key:"initialize",value:(r=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:navigator.mediaDevices&&navigator.mediaDevices.addEventListener("devicechange",this.onDeviceChange.bind(this));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onDeviceChange",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r,i=this;return regeneratorRuntime.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,sS.getDevices();case 4:t=e.sent,n=t.filter((function(e){return i.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})),n.length>0&&this.handleDeviceAdded(this.prevDevices_,n),r.length>0&&this.handleDeviceRemoved(t,r),this.prevDevices_=t;case 10:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setLocalStream",value:(t=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return e.next=3,sS.getDevices();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){this.log_.warn("devicesAdded: ".concat(JSON.stringify(t))),this.localStream_.updateDeviceIdInUse();var n=t.filter((function(e){return"videoinput"===e.kind})),r=t.filter((function(e){return"audioinput"===e.kind})),i=e.filter((function(e){return"videoinput"===e.kind})),a=e.filter((function(e){return"audioinput"===e.kind})),o=n.length>0&&0===i.length&&this.localStream_.getVideo(),s=r.length>0&&0===a.length&&this.localStream_.getAudio();if(s&&o)return this.log_.info("new microphone and camera detected, but there was no device before."),void this.localStream_.updateStream({audio:!0,video:!0,cameraId:n[0].deviceId,microphoneId:r[0].deviceId});o&&(this.log_.info("new camera detected, but there was no camera before."),this.localStream_.updateStream({audio:!1,video:!0,cameraId:n[0].deviceId})),s&&(this.log_.info("new microphone detected, but there was no microphone before."),this.localStream_.updateStream({audio:!0,video:!1,microphoneId:r[0].deviceId}))}},{key:"handleDeviceRemoved",value:function(e,t){this.log_.warn("devicesRemoved: ".concat(JSON.stringify(t))),this.localStream_.updateDeviceIdInUse();var n=!1,r=!1,i=this.localStream_.getCameraId(),a=this.localStream_.getMicrophoneId();if("default"===a){var o=this.localStream_.getMicrophoneGroupId(),s=e.filter((function(e){return"default"===e.deviceId&&"audioinput"===e.kind}))[0];s&&s.groupId!==o&&(r=!0)}if(t.forEach((function(e){var t=e.deviceId;i.length>0&&t===i?n=!0:a.length>0&&t===a&&(r=!0)})),n&&r)return this.log_.warn("current camera and microphone in use is lost, cameraId: ".concat(i,", microphoneId: ").concat(a)),void((this.localStream_.getAudio()||this.localStream_.getVideo())&&this.localStream_.updateStream({video:!0,audio:!0}));n&&(this.log_.warn("current camera in use is lost, deviceId: ".concat(i)),this.localStream_.getVideo()&&this.localStream_.updateStream({video:!0,audio:!1})),r&&(this.log_.warn("current microphone in use is lost, deviceId: ".concat(a)),this.localStream_.getAudio()&&this.localStream_.updateStream({video:!1,audio:!0}))}}]),e}(),Lv=1..toFixed,Vv=Math.floor,Uv=function(e,t,n){return 0===t?n:t%2==1?Uv(e,t-1,n*e):Uv(e*e,t/2,n)},Fv=function(e,t,n){for(var r=-1,i=n;++r<6;)i+=t*e[r],e[r]=i%1e7,i=Vv(i/1e7)},jv=function(e,t){for(var n=6,r=0;--n>=0;)r+=e[n],e[n]=Vv(r/t),r=r%t*1e7},Bv=function(e){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==e[t]){var r=String(e[t]);n=""===n?r:n+Ad.call("0",7-r.length)+r}return n},Hv=Lv&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!D((function(){Lv.call({})}));_t({target:"Number",proto:!0,forced:Hv},{toFixed:function(e){var t,n,r,i,a=function(e){if("number"!=typeof e&&"Number"!=V(e))throw TypeError("Incorrect invocation");return+e}(this),o=We(e),s=[0,0,0,0,0,0],c="",u="0";if(o<0||o>20)throw RangeError("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return String(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*Uv(2,69,1))-69)<0?a*Uv(2,-t,1):a/Uv(2,t,1),n*=4503599627370496,(t=52-t)>0){for(Fv(s,0,n),r=o;r>=7;)Fv(s,1e7,0),r-=7;for(Fv(s,Uv(10,r,1),0),r=t-1;r>=23;)jv(s,1<<23),r-=23;jv(s,1<<r),Fv(s,1,1),jv(s,2),u=Bv(s)}else Fv(s,0,n),Fv(s,1<<-t,0),u=Bv(s)+Ad.call("0",o);return u=o>0?c+((i=u.length)<=o?"0."+Ad.call("0",o-i)+u:u.slice(0,i-o)+"."+u.slice(i-o)):c+u}});var Gv,Jv,zv=window.AudioContext||window.webkitAudioContext,Wv=null,qv=function(){function e(){var t=this;a(this,e),Wv||(Wv=new zv),this.context_=Wv,this.instant_=0,this.slow_=0,this.clip_=0,this.script_=this.context_.createScriptProcessor(2048,1,1),this.script_.onaudioprocess=function(e){var n,r=e.inputBuffer.getChannelData(0),i=0,a=0;for(n=0;n<r.length;++n)i+=r[n]*r[n],Math.abs(r[n])>.99&&(a+=1);t.instant_=Math.sqrt(i/r.length),t.slow_=.95*t.slow_+.05*t.instant_,t.clip_=a/r.length}}return s(e,[{key:"connectToSource",value:function(e,t){try{var n=new MediaStream;n.addTrack(e),this.mic_=this.context_.createMediaStreamSource(n),this.mic_.connect(this.script_),this.script_.connect(this.context_.destination),nu(t)||t(null)}catch(cS){gd.error("soundMeter connectToSource error: "+cS),nu(t)||t(cS)}}},{key:"stop",value:function(){this.mic_.disconnect(),this.script_.disconnect()}},{key:"resume",value:function(){this.context_&&this.context_.resume()}},{key:"getVolume",value:function(){return this.instant_.toFixed(2)}}]),e}(),Kv=function(){function e(t){a(this,e),this.stream_=t.stream,this.userId_=t.stream.getUserId(),this.log_=this.stream_.getIDLogger(),this.track_=t.track,this.div_=t.div,this.muted_=t.muted,this.outputDeviceId_=t.outputDeviceId,this.volume_=t.volume,this.emitter_=new ip,this.initializeElement(),this.state_="NONE",this.soundMeter_=null}var t,n,r,o;return s(e,[{key:"initializeElement",value:function(){var e=new MediaStream;e.addTrack(this.track_);var t=document.createElement("audio");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:"play",value:(o=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.outputDeviceId_){e.next=3;break}return e.next=3,this.element_.setSinkId(this.outputDeviceId_);case 3:return this.setVolume(this.volume_),e.prev=4,e.next=7,this.element_.play();case 7:e.next=15;break;case 9:if(e.prev=9,e.t0=e.catch(4),this.log_.warn("<audio> play() error: "+e.t0),!(t=e.t0.toString()+" <audio>").startsWith("NotAllowedError")){e.next=15;break}throw new As({code:ws.PLAY_NOT_ALLOWED,message:t});case 15:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(){return o.apply(this,arguments)})},{key:"handleEvents",value:function(){this.handleElementEvent=this.handleElementEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.element_.addEventListener("playing",this.handleElementEvent),this.element_.addEventListener("ended",this.handleElementEvent),this.element_.addEventListener("pause",this.handleElementEvent),this.element_.addEventListener("error",this.handleElementEvent),this.track_.addEventListener("ended",this.handleTrackEvent),this.track_.addEventListener("mute",this.handleTrackEvent),this.track_.addEventListener("unmute",this.handleTrackEvent)}},{key:"handleElementEvent",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.type,e.t0=n,e.next="playing"===e.t0?4:"ended"===e.t0?9:"pause"===e.t0?12:"error"===e.t0?16:27;break;case 4:return this.log_.info("stream - audio player is starting playing"),this.state_="PLAYING",xv.emit(Ov.AUDIO_PLAYING,{stream:this.stream_}),this.emitter_.emit(Av,{state:this.state_,reason:"playing"}),e.abrupt("break",27);case 9:return this.log_.info("stream - audio player is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(Av,{state:this.state_,reason:"ended"})),e.abrupt("break",27);case 12:return this.log_.info("stream - audio player is paused"),this.state_="PAUSED",this.emitter_.emit(Av,{state:this.state_,reason:"pause"}),e.abrupt("break",27);case 16:if(!this.element_||!this.element_.error){e.next=26;break}return r="".concat(Z_(),"/").concat(vd().name,"/").concat(vd().version),e.next=20,sS.getSpeakers();case 20:i=e.sent,a=i[0].label,(o=i.find((function(e){return e.deviceId===s.outputDeviceId_})))&&(a=o.label),this.log_.error("stream - audio player error observed. code: ".concat(this.element_.error.code," message: ").concat(this.element_.error.message," deviceInfo: ").concat(r," speaker: ").concat(a)),Jc("stat-".concat(this.stream_.getType(),"-audio-").concat(ts,"-").concat(this.element_.error.code,"-").concat(r,"-").concat(a),this.element_.error);case 26:return e.abrupt("break",27);case 27: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"ended":this.log_.info("stream - audio player track is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(Av,{state:this.state_,reason:"ended"})),xv.emit(Ov.AUDIO_TRACK_ENDED,{stream:this.stream_,type:t});break;case"mute":this.log_.info("stream - audio track is unable to provide media output"),"PAUSED"!==this.state_&&(this.state_="PAUSED",this.emitter_.emit(Av,{state:this.state_,reason:"mute"})),xv.emit(Ov.AUDIO_TRACK_MUTED,{stream:this.stream_,type:t});break;case"unmute":this.log_.info("stream - audio track is able to provide media output"),"PAUSED"===this.state_&&(this.state_="PLAYING",this.emitter_.emit(Av,{state:this.state_,reason:"unmute"}))}}},{key:"unbindEvents",value:function(){this.element_&&(this.element_.removeEventListener("playing",this.handleElementEvent),this.element_.removeEventListener("ended",this.handleElementEvent),this.element_.removeEventListener("pause",this.handleElementEvent),this.element_.removeEventListener("error",this.handleElementEvent)),this.track_&&(this.track_.removeEventListener("ended",this.handleTrackEvent),this.track_.removeEventListener("mute",this.handleTrackEvent),this.track_.removeEventListener("unmute",this.handleTrackEvent))}},{key:"setSinkId",value:(n=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.outputDeviceId_===t){e.next=4;break}return e.next=3,this.element_.setSinkId(t);case 3:this.outputDeviceId_=t;case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setVolume",value:function(e){this.log_.info("stream - audioElement setVolume to : ".concat(e)),this.element_.volume=e}},{key:"getAudioLevel",value:function(){return this.soundMeter_||(this.soundMeter_=new qv,this.soundMeter_.connectToSource(this.track_)),this.soundMeter_.getVolume()}},{key:"stop",value:function(){this.unbindEvents(),this.div_.removeChild(this.element_),this.element_.srcObject=null,this.soundMeter_&&(this.soundMeter_.stop(),this.soundMeter_=null),this.element_=null}},{key:"resume",value:(t=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.soundMeter_&&this.soundMeter_.resume(),e.next=4,this.element_.play();case 4:e.next=12;break;case 6:if(e.prev=6,e.t0=e.catch(0),this.log_.warn("<audio> play() error: "+e.t0),!(t=y_({key:Bf,data:{error:e.t0}})).startsWith("NotAllowedError")){e.next=12;break}throw new As({code:ws.PLAY_NOT_ALLOWED,message:t});case 12:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(){return t.apply(this,arguments)})},{key:"on",value:function(e,t){this.emitter_.on(e,t)}}]),e}(),Qv=function(){function e(t){a(this,e),this.stream_=t.stream,this.userId_=t.stream.getUserId(),this.log_=this.stream_.getIDLogger(),this.track_=t.track,this.div_=t.div,this.muted_=t.muted,this.objectFit_=t.objectFit,this.mirror_=t.mirror,this.emitter_=new ip,this.initializeElement(),this.state_="NONE"}var t,n;return s(e,[{key:"initializeElement",value:function(){var e=new MediaStream;e.addTrack(this.track_);var t=document.createElement("video");t.srcObject=e,t.muted=!0;var n="width: 100%; height: 100%; object-fit: ".concat(this.objectFit_,";");this.mirror_&&(n+="transform: rotateY(180deg);"),t.setAttribute("id","video_".concat(this.stream_.getId())),t.setAttribute("style",n),t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this.div_.appendChild(t),this.element_=t,this.handleEvents()}},{key:"play",value:(n=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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),this.log_.warn("<video> play() error: "+e.t0),!(t=e.t0.toString()+" <video>").startsWith("NotAllowedError")){e.next=11;break}throw new As({code:ws.PLAY_NOT_ALLOWED,message:t});case 11:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return n.apply(this,arguments)})},{key:"handleEvents",value:function(){this.handleElementEvent=this.handleElementEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.element_.addEventListener("playing",this.handleElementEvent),this.element_.addEventListener("ended",this.handleElementEvent),this.element_.addEventListener("pause",this.handleElementEvent),this.element_.addEventListener("error",this.handleElementEvent),this.element_.addEventListener("loadeddata",this.handleElementEvent),this.track_.addEventListener("ended",this.handleTrackEvent),this.track_.addEventListener("mute",this.handleTrackEvent),this.track_.addEventListener("unmute",this.handleTrackEvent)}},{key:"handleElementEvent",value:function(e){switch(e.type){case"playing":this.log_.info("stream - video player is starting playing"),this.state_="PLAYING",xv.emit(Ov.VIDEO_PLAYING,{stream:this.stream_}),this.emitter_.emit(Av,{state:this.state_,reason:"playing"});break;case"ended":this.log_.info("stream - video player is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(Av,{state:this.state_,reason:"ended"}));break;case"pause":this.log_.info("stream - video player is paused"),this.state_="PAUSED",this.emitter_.emit(Av,{state:this.state_,reason:"pause"});break;case"error":if(this.element_&&this.element_.error){var t="".concat(Z_(),"/").concat(vd().name,"/").concat(vd().version);this.log_.error("stream - video player error observed. code: ".concat(this.element_.error.code," message: ").concat(this.element_.error.message," deviceInfo: ").concat(t)),Jc("stat-".concat(this.stream_.getType(),"-video-").concat(ts,"-").concat(this.element_.error.code,"-").concat(t),this.element_.error)}break;case"loadeddata":xv.emit(Ov.VIDEO_LOADED_DATA,{stream:this.stream_})}}},{key:"handleTrackEvent",value:function(e){var t=e.type;switch(t){case"ended":this.log_.info("stream - video player track is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(Av,{state:this.state_,reason:"ended"})),xv.emit(Ov.VIDEO_TRACK_ENDED,{stream:this.stream_,type:t});break;case"mute":this.log_.info("stream - video track is unable to provide media output"),"PAUSED"!==this.state_&&(this.state_="PAUSED",this.emitter_.emit(Av,{state:this.state_,reason:"mute"})),xv.emit(Ov.VIDEO_TRACK_MUTED,{stream:this.stream_,type:t});break;case"unmute":this.log_.info("stream - video track is able to provide media output"),"PAUSED"===this.state_&&(this.state_="PLAYING",this.emitter_.emit(Av,{state:this.state_,reason:"unmute"}),xv.emit(Ov.VIDEO_TRACK_UNMUTED,{stream:this.stream_}))}}},{key:"unbindEvents",value:function(){this.element_&&(this.element_.removeEventListener("playing",this.handleElementEvent),this.element_.removeEventListener("ended",this.handleElementEvent),this.element_.removeEventListener("pause",this.handleElementEvent),this.element_.removeEventListener("error",this.handleElementEvent),this.element_.removeEventListener("loadeddata",this.handleElementEvent)),this.track_&&(this.track_.removeEventListener("ended",this.handleTrackEvent),this.track_.removeEventListener("mute",this.handleTrackEvent),this.track_.removeEventListener("unmute",this.handleTrackEvent))}},{key:"stop",value:function(){this.unbindEvents(),this.div_.removeChild(this.element_),this.element_.srcObject=null,this.element_=null}},{key:"resume",value:(t=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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),this.log_.warn("<video> play() error: "+e.t0),!(t=y_({key:Hf,data:{error:e.t0}})).startsWith("NotAllowedError")){e.next=11;break}throw new As({code:ws.PLAY_NOT_ALLOWED,message:t});case 11:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return t.apply(this,arguments)})},{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)}}]),e}(),Yv=function(){function e(t){a(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_=new Pv({id:"n|"+this.userId_,direction:this.isUplink_?"local":"remote",type:""}),this.signalChannel_=t.signalChannel,this.peerConnection_=null,this.connectTimer_=-1,this.isErrorObserved_=!1,this.emitter_=new ip,this.currentState_=Co,this.waitForPeerConnectionConnectedPromise_=null,this.isReconnecting_=!1,this.reconnectionCount_=0,this.reconnectionTimer_=-1,this.isFirstConnection_=!0}var t;return s(e,[{key:"initialize",value:function(){var e={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()}},{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(Co))}},{key:"getDTLSTransportState",value:function(){if(!this.peerConnection_)return"unknown";var e=null;if(this.isUplink_){if(!W_()||0===this.peerConnection_.getSenders().length)return"unknown";e=this.peerConnection_.getSenders()[0].transport}else{if(!z_()||0===this.peerConnection_.getReceivers().length)return"unknown";e=this.peerConnection_.getReceivers()[0].transport}return e?e.state:"unknown"}},{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)),"connecting"===e.target.connectionState&&this.emitConnectionStateChangedEvent(wo),"failed"===e.target.connectionState||"closed"===e.target.connectionState){var r="".concat(this.isUplink_?"uplink":"downlink"," ICE/DTLS Transport connection ").concat(e.target.connectionState,". ICE Transport state: ").concat(t,", DTLS Transport state: ").concat(n),i=new As({message:r,code:ws.ICE_TRANSPORT_ERROR});Kc({eventType:qo,error:i}),this.emitConnectionStateChangedEvent(Co),this.isErrorObserved_||this.emitter_.emit(cv,i)}if(("connected"===e.target.connectionState||"completed"===e.target.connectionState)&&(this.logSelectedCandidate(),qc({eventType:qo}),this.emitConnectionStateChangedEvent(Do),!this.isUplink_&&!this.sentSubscriptionAfterConnected_&&this.pendingSubscription_.length>0)){this.log_.info("send pending subscription after RTCPeerConnection is connected");var a=this.pendingSubscription_[0];this.doSendSubscription(a.data,a.stream,a.type),this.sentSubscriptionAfterConnected_=!0}}},{key:"emitConnectionStateChangedEvent",value:function(e){e!==this.currentState_&&(this.currentState_===Ao&&e===wo||(xv.emit(Ov.CONNECTION_STATE_CHANGED,{client:this.client_,connection:this,prevState:this.currentState_,state:e}),this.emitter_.emit(uv,{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(),r={eventId:e,eventDesc:t,timestamp:jc(),userId:n,tinyId:this.client_.getTinyId()};this.isUplink_||(r.remoteUserId=this.userId_,r.remoteTinyId=this.tinyId_),Sf(n,r)}},{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=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s;return regeneratorRuntime.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,n=k(t),e.prev=6,n.s();case 8:if((r=n.n()).done){e.next=18;break}if((i=g(r.value,2))[0],a=i[1],!X_(a)){e.next=16;break}return o=t.get(a.localCandidateId),s=t.get(a.remoteCandidateId),o&&this.log_.debug("local candidate: ".concat(o.candidateType," ").concat(o.protocol,":").concat(o.ip||o.address,":").concat(o.port," ").concat(o.networkType||""," ").concat("relay"===o.candidateType?"relayProtocol:"+o.relayProtocol:"")),s&&this.log_.debug("remote candidate: ".concat(s.candidateType," ").concat(s.protocol,":").concat(s.ip||s.address,":").concat(s.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),n.e(e.t0);case 23:return e.prev=23,n.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_===Do)return t();var r=-1,i=function n(i){i.state===Do&&(clearTimeout(r),e.emitter_.off(uv,n,e),t())};r=setTimeout((function(){e.emitter_.off(uv,i,e),n(new As({code:ws.API_CALL_TIMEOUT,message:"connection timeout"}))}),1e4),e.emitter_.on(uv,i,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(Ao),this.reconnect(),this.addEventInternal(this.isUplink_?hf:mf,"".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(op,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)}}]),e}(),Xv={TRTC:{createClient:{name:"clientConfig",required:!0,type:ls,properties:{sdkAppId:{required:!0,type:cs,allowEmpty:!1},userId:{required:!0,type:ss,allowEmpty:!1},userSig:{required:!0,type:ss,allowEmpty:!1},mode:{required:!0,type:ss,values:["rtc","live"]},useStringRoomId:{type:us},autoSubscribe:{type:us},streamId:{type:ss},userDefineRecordId:{type:ss},pureAudioPushMode:{type:cs,values:[1,2]}}},createStream:{name:"streamConfig",required:!0,type:ls,properties:{userId:{type:ss},audio:{type:us},video:{type:us},screen:{type:us},screenAudio:{type:us},microphoneId:{type:ss},cameraId:{type:ss},facingMode:{type:ss,values:["user","environment"]},audioSource:{instanceOf:MediaStreamTrack},videoSource:{instanceOf:MediaStreamTrack},mirror:{type:us}},validate:function(e){if(!nu(e.screen)&&e.screen&&nu(e.audio)&&(e.audio=!1),!(nu(e.audio)&&nu(e.video)||nu(e.audioSource)&&nu(e.videoSource)))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:r_})});if(!nu(e.screen)&&!0===e.screen&&!0===e.video)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:i_})});if(e.audio&&e.screenAudio)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:a_})});if(!0!==e.screen&&!0===e.screenAudio)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:o_})});if(!nu(e.screen)&&!0===e.screen&&!this.isScreenShareSupported())throw new As({code:ws.INVALID_OPERATION,message:y_({key:f_})})}}},CLIENT:{join:{name:"joinOptions",required:!0,properties:{roomId:{required:!0,type:[cs,ss],allowEmpty:!1,validate:function(e){if(this.useStringRoomId_){if(!(ru(e)&&/^[A-Za-z\d\s!#$%&()+\-:;<=.>?@[\]^_{}|~,]{1,64}$/.test(e)))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Yf})})}else if(!(iu(e)&&/^[1-9]\d*$/.test(String(e))&&e<4294967295))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Xf})})}},role:{type:[ss],values:["anchor","audience"]}}},publish:{name:"stream",required:!0,instanceOf:bs,validate:function(e){if(!M_.result)throw new As({code:ws.NOT_SUPPORTED,message:y_({key:u_})});if(!this.isJoined_)throw new As({code:ws.INVALID_OPERATION,message:y_({key:nm})});if("live"===this.mode_&&"audience"===this.role_)throw new As({code:ws.INVALID_OPERATION,message:y_({key:im})});if(this.localStream_)throw new As({code:ws.INVALID_OPERATION,message:y_({key:om})});if(!e.getIsReadyToPublish())throw new As({code:ws.INVALID_OPERATION,message:y_({key:am})});if(this.notPublishWithoutH264Supported_)throw new As({code:ws.NOT_SUPPORTED_H264,message:y_({key:l_})})}},unpublish:{name:"stream",required:!0,instanceOf:bs,validate:function(e){if(e!==this.localStream_)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:rm})})}},subscribe:[{name:"stream",required:!0,instanceOf:Es,validate:function(e){if(!e.getConnection())throw new As({code:ws.INVALID_OPERATION,message:y_({key:sm})});if(this.notSubscribeWithoutH264Supported_)throw new As({code:ws.NOT_SUPPORTED_H264,message:y_({key:h_})})}},{name:"options",type:ls,properties:{audio:{type:us},video:{type:us}}}],unsubscribe:{name:"stream",required:!0,instanceOf:Es,validate:function(e){if(!e.getConnection())throw new As({code:ws.INVALID_OPERATION,message:y_({key:sm})})}},switchRole:{name:"role",required:!0,values:["anchor","audience"],validate:function(){if("live"!==this.mode_)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:um})});if(!this.isJoined_)throw new As({code:ws.INVALID_OPERATION,message:y_({key:dm})})}}},LOCAL_STREAM:{switchDevice:[{name:"type",required:!0,type:ss,values:[hs,ps]},{name:"deviceId",required:!0,type:ss,validate:function(){if(this.screen_||this.audioSource_||this.videoSource_)throw new As({code:ws.INVALID_OPERATION,message:y_({key:wm})});if(this.publishState_===Ss)throw new As({code:ws.INVALID_OPERATION,message:y_({key:Am})})}}]},STREAM:{play:[{name:"elementId",required:!0,type:[ss,"HTMLDivElement"]},{name:"options",type:ls,properties:{objectFit:{type:ss,values:["contain","cover"]},muted:{type:us}},validate:function(){if(this.isPlaying_)throw new As({code:ws.INVALID_OPERATION,message:y_({key:n_})})}}]}},$v=Er.trim;function Zv(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e,n,r){var i=r.value;return r.value=function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return tg.call(this,t,r,n,this.name_),i.apply(this,r)},r}}function eg(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e,n,r){var a=r.value;return r.value=i(regeneratorRuntime.mark((function e(){var r,i,o,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=s.length,i=new Array(r),o=0;o<r;o++)i[o]=s[o];return tg.call(this,t,i,n,this.name_),e.abrupt("return",a.apply(this,i));case 3:case"end":return e.stop()}}),e,this)}))),r}}function tg(e,t,n,r){try{for(var i=0;i<e.length;i++){ng.call(this,{rule:e[i],value:t[i],fnName:n,className:r});var a=e[i].properties;if(Zc(a))for(var o=Object.keys(a),s=0;s<o.length;s++){var c=o[s];ng.call(this,{rule:a[c],value:t[i]&&t[i][c],key:c,fnName:n,className:r})}}}catch(cS){throw gd.error(cS),cS}}function ng(e){var t=e.rule,n=e.value,r=e.key,i=e.fnName,a=e.className;if(nu(n)){if(t.required)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Cf,data:{key:r,rule:t,fnName:i,value:n},link:{className:a,fnName:i}})})}else{if(Array.isArray(t.type)){if(!t.type.map((function(e){return e.toLowerCase()})).includes(au(n)))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:wf,data:{key:r,rule:t,fnName:i,value:n},link:{className:a,fnName:i}})})}else if(!nu(t.type)&&au(n)!==t.type)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:wf,data:{key:r,rule:t,fnName:i,value:n},link:{className:a,fnName:i}})});if(!1===t.allowEmpty&&(0===n||ru(n)&&""===n.trim()))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Af,data:{key:r,rule:t,fnName:i,value:n},link:{className:a,fnName:i}})});if(ru(t.instanceOf)){if(!n||n.name_!==t.instanceOf)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Df,data:{key:r,rule:t,fnName:i,value:n},link:{className:a,fnName:i}})})}else if(tu(t.instanceOf)&&!(n instanceof t.instanceOf))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Df,data:{key:r,rule:t,fnName:i,value:n},link:{className:a,fnName:i}})});if(t.values&&!t.values.includes(n))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Pf,data:{key:r,rule:t,fnName:i,value:n},link:{className:a,fnName:i}})});tu(t.validate)&&t.validate.call(this,n,this)}}_t({target:"String",proto:!0,forced:function(e){return D((function(){return!!yr[e]()||"​…᠎"!="​…᠎"[e]()||yr[e].name!==e}))}("trim")},{trim:function(){return $v(this)}});var rg=(Gv=eg.apply(void 0,S(Xv.STREAM.play)),R((Jv=function(){function e(t){a(this,e),this.name_=Is,this.userId_=t.userId,this.isRemote_=t.isRemote,this.type_=t.type,this.log_=new Pv({id:"s".concat(t.seq?t.seq:"","|").concat(this.userId_),direction:this.isRemote_?"remote":"local",type:this.isRemote_?this.type_:""}),this.mirror_=!1,this.isRemote_||(this.mirror_=!0),nu(t.mirror)||(this.mirror_=t.mirror),this.client_=null,nu(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.id_=Jd(),this.audioOutputDeviceId_=0,this.audioVolume_=1,this.emitter_=new ip,this.connectionState_=Co}var r,o,c,u,d;return s(e,[{key:"getType",value:function(){return this.type_}},{key:"getIDLogger",value:function(){return this.log_}},{key:"isSubscribed",get:function(){return"main"===this.type_&&this.connection_.isMainStreamSubscribed||"auxiliary"===this.type_&&this.connection_.isAuxStreamSubscribed}},{key:"isMainVideoSubscribed",get:function(){var e=this.getSubscribedState();return"main"===this.type_&&e&&e.video}},{key:"isMainAudioSubscribed",get:function(){var e=this.getSubscribedState();return"main"===this.type_&&e&&e.audio}},{key:"isAuxVideoSubscribed",get:function(){var e=this.getSubscribedState();return"auxiliary"===this.type_&&e&&e.auxiliary}},{key:"emitConnectionStateChanged",value:function(e){e.state!==this.connectionState_&&(e.state!==Co&&this.isRemote_&&!this.isSubscribed||(this.emitter_.emit(Cv,e),this.connectionState_=e.state))}},{key:"setConnection",value:function(e){this.connection_!==e&&(e instanceof Yv?(null!==this.connection_&&this.connection_.off(uv,this.emitConnectionStateChanged,this),e.on(uv,this.emitConnectionStateChanged,this)):null===e&&this.connection_.off(uv,this.emitConnectionStateChanged,this),this.connection_=e)}},{key:"getConnection",value:function(){return this.connection_}},{key:"play",value:(d=i(regeneratorRuntime.mark((function e(t,r){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isPlaying_=!0,this.log_.info("stream start to play with options: ".concat(JSON.stringify(r))),(i=document.createElement("div")).setAttribute("id","player_".concat(this.id_)),i.setAttribute("style","width: 100%; height: 100%; position: relative; background-color: black; overflow: hidden;"),a=t,"object"!==n(t)&&(a=document.getElementById(t)),a.appendChild(i),this.div_=i,this.isRemote_||(this.muted_=!0),r&&!nu(r.muted)&&(this.muted_=r.muted),this.isRemote_&&"auxiliary"===this.getType()&&(this.objectFit_="contain"),r&&!nu(r.objectFit)&&(this.objectFit_=r.objectFit),xv.emit(Ov.PLAY_STREAM_START,{stream:this}),e.next=16,Promise.all([this.playAudio(),this.playVideo()]);case 16:xv.emit(Ov.STREAM_PLAY_SUCCESS,{stream:this});case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"playAudio",value:(u=i(regeneratorRuntime.mark((function e(){var n,r=this;return regeneratorRuntime.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(n=this.getAudioTrack(),this.audioPlayer_||!n){e.next=16;break}return this.log_.info("stream - create AudioPlayer and play"),this.audioPlayer_=new Kv({stream:this,track:n,div:this.div_,muted:this.muted_,outputDeviceId:this.audioOutputDeviceId_,volume:this.audioVolume_}),this.audioPlayer_.on(Av,(function(e){var n={type:"audio",state:e.state,reason:e.reason};xv.emit(Ov.PLAYER_STATE_CHANGED,t({stream:r},n)),r.emitter_.emit(Ev,n)})),e.prev=7,e.next=10,this.audioPlayer_.play();case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(7),this.emitter_.emit(wv,e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[7,12]])}))),function(){return u.apply(this,arguments)})},{key:"playVideo",value:(c=i(regeneratorRuntime.mark((function e(){var n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasVideo()&&(!this.isRemote_||this.isMainVideoSubscribed||this.isAuxVideoSubscribed)){e.next=2;break}return e.abrupt("return");case 2:if(n=this.getVideoTrack(),this.videoPlayer_||!n){e.next=17;break}return xv.emit(Ov.PLAY_VIDEO_START,{stream:this}),this.log_.info("stream - create VideoPlayer and play"),this.videoPlayer_=new Qv({stream:this,track:n,div:this.div_,muted:this.muted_,objectFit:this.objectFit_,mirror:this.mirror_}),this.videoPlayer_.on(Av,(function(e){var n={type:"video",state:e.state,reason:e.reason};xv.emit(Ov.PLAYER_STATE_CHANGED,t({stream:r},n)),r.emitter_.emit(Ev,n)})),e.prev=8,e.next=11,this.videoPlayer_.play();case 11:e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(8),this.emitter_.emit(wv,e.t0),e.t0;case 17:case"end":return e.stop()}}),e,this,[[8,13]])}))),function(){return c.apply(this,arguments)})},{key:"stopAudio",value:function(){this.audioPlayer_&&(this.log_.info("stream - stop AudioPlayer"),this.audioPlayer_.stop(),this.audioPlayer_=null)}},{key:"stopVideo",value:function(){this.videoPlayer_&&(this.log_.info("stream - stop VideoPlayer"),this.videoPlayer_.stop(),this.videoPlayer_=null)}},{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:(o=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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("stream - 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 o.apply(this,arguments)})},{key:"close",value:function(){this.isPlaying_&&this.stop(),this.mediaStream_&&(this.mediaStream_.preventEvent=1,this.mediaStream_.getTracks().forEach((function(e){e.stop()})),this.mediaStream_=null)}},{key:"muteAudio",value:function(){return this.addRemoteEvent(!0,"audio"),this.doEnableTrack("audio",!1)}},{key:"muteVideo",value:function(){return this.addRemoteEvent(!0,"video"),this.doEnableTrack("video",!1)}},{key:"unmuteAudio",value:function(){return this.addRemoteEvent(!1,"audio"),this.doEnableTrack("audio",!0)}},{key:"unmuteVideo",value:function(){return this.addRemoteEvent(!1,"video"),this.doEnableTrack("video",!0)}},{key:"addRemoteEvent",value:function(e,t){if(this.isRemote_&&this.client_){var n=this.client_.getUserId(),r="".concat(e?"mute":"unmute"," remote ").concat(t);Sf(n,{eventId:"audio"===t?e?Zp:tf:e?$p:ef,eventDesc:r,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"audio"===e?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:(r=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioOutputDeviceId_=t,!this.audioPlayer_){e.next=4;break}return e.next=4,this.audioPlayer_.setSinkId(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.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:"hasAudio",value:function(){if(this.isRemote_){if(!this.connection_)return!1;var e=this.connection_.getTrackState();return"main"===this.type_&&e.audio}return!!this.getAudioTrack()}},{key:"hasVideo",value:function(){if(this.isRemote_){if(!this.connection_)return!1;var e=this.connection_.getTrackState();return"auxiliary"===this.type_?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:"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}()).prototype,"play",[Gv],Object.getOwnPropertyDescriptor(Jv.prototype,"play"),Jv.prototype),Jv),ig=function(e){u(RemoteStream,e);var n=_(RemoteStream);function RemoteStream(e){var r;a(this,RemoteStream);var i={isRemote:!0,type:e.type},o=t(t({},e),i);return(r=n.call(this,o)).name_=Es,r.isInSubscriptionCycle_=!1,r.isStreamAddedEventEmitted_=!1,r.isAbleToCallSubscription_=!0,r.installEvents(),r}return s(RemoteStream,[{key:"installEvents",value:function(){xv.on(Ov.REMOTE_STREAM_SUBSCRIBED,this.handleStreamSubscribed,this),xv.on(Ov.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamUnsubscribed,this)}},{key:"uninstallEvents",value:function(){xv.off(Ov.REMOTE_STREAM_SUBSCRIBED,this.handleStreamSubscribed,this),xv.off(Ov.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamUnsubscribed,this)}},{key:"handleStreamSubscribed",value:function(e){e.client===this.client_&&e.stream===this&&this.connection_.getCurrentState()===Do&&this.emitConnectionStateChanged({prevState:Co,state:Do})}},{key:"handleStreamUnsubscribed",value:function(e){e.client===this.client_&&e.stream===this&&this.emitConnectionStateChanged({prevState:Do,state:Co})}},{key:"getType",value:function(){return v(d(RemoteStream.prototype),"getType",this).call(this)}},{key:"getIsAbleToCallSubscription",value:function(){return this.isAbleToCallSubscription_}},{key:"setIsAbleToCallSubscription",value:function(e){this.isAbleToCallSubscription_=e}},{key:"setInSubscriptionCycle",value:function(e){this.isInSubscriptionCycle_=e}},{key:"isInSubscriptionCycle",value:function(){return this.isInSubscriptionCycle_}},{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?v(d(RemoteStream.prototype),"getAudioTrack",this).call(this):null}},{key:"getVideoTrack",value:function(){if(!this.connection_)return null;var e=this.connection_.getTrackState();return("main"!==this.type_||e.video)&&("auxiliary"!==this.type_||e.auxiliary)?v(d(RemoteStream.prototype),"getVideoTrack",this).call(this):null}},{key:"close",value:function(){this.uninstallEvents(),v(d(RemoteStream.prototype),"close",this).call(this)}}]),RemoteStream}(rg),ag=function(){function e(t){a(this,e),this.client_=t.client,this.subscribedStreams_=new Map,this.unsubscribedStreams_=new Map,this.subscriptedOptions_=new Map,this.autoRecoveryFlags_=new Map}var t,n,r;return s(e,[{key:"isEnabled",get:function(){return"webrtc"!==this.client_.getEnv()}},{key:"recover",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.getUserId(),r=t.getType(),this.hasAutoRecoveryFlag(n,r)){e.next=5;break}return e.abrupt("return");case 5:if(i=this.getUnsubscribedStream(n,r)?"unsubscribe":"subscribe",e.prev=6,gd.warn("recover() try to recover subscription [".concat(i,"][").concat(n,"][").concat(r,"]")),"subscribe"!==i){e.next=13;break}return e.next=11,this.recoverSubscription(n,t);case 11:e.next=15;break;case 13:return e.next=15,this.recoverUnsubscription(n,t);case 15:qc({eventType:$o}),gd.warn("recover() recover successfully [".concat(i,"][").concat(n,"][").concat(r,"]")),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(6),gd.error("recover() recover failed [".concat(i,"][").concat(n,"][").concat(r,"]"),e.t0),Kc({eventType:$o,error:e.t0});case 23:this.deleteAutoRecoveryFlag(n,r);case 24:case"end":return e.stop()}}),e,this,[[6,19]])}))),function(e){return r.apply(this,arguments)})},{key:"recoverSubscription",value:(n=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getOptions(t,n.getType()),i=this.getSubscribedStream(t,n.getType()),r&&i){e.next=4;break}return e.abrupt("return");case 4:a=this.getStreamMuteState(i),o=a.isAudioMuted,s=a.isVideoMuted,this.mergeStream(i,n),this.recoverPlayingState(i),o&&i.doEnableTrack("audio",!1),s&&i.doEnableTrack("video",!1);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"recoverUnsubscription",value:(t=i(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getUnsubscribedStream(t,n.getType())){e.next=3;break}return e.abrupt("return");case 3:this.mergeStream(r,n);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 r=n.parentNode;e.stop(),e.play(r,{objectFit:e.getObjectFit(),muted:e.getMuted()})}}},{key:"mergeStream",value:function(e,t){var n=t.getConnection(),r=t.getMediaStream();e.setConnection(n),n.setRemoteStream(r.id,e),e.setMediaStream(r),e.updateAudioPlayingState(t.hasAudio()),e.updateVideoPlayingState(t.hasVideo())}},{key:"addSubscriptionRecord",value:function(e,t,n){var r=t.getType();if(this.subscribedStreams_.has(e))this.subscribedStreams_.get(e).set(r,t);else{var i=new Map;i.set(t.getType(),t),this.subscribedStreams_.set(e,i)}if(this.subscriptedOptions_.has(e))this.subscriptedOptions_.get(e).set(r,n);else{var a=new Map;a.set(t.getType(),n),this.subscriptedOptions_.set(e,a)}this.deleteUnsubscriptionRecord(e,r)}},{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=S(this.subscribedStreams_.entries());e<t.length;e++)for(var n=g(t[e],2),r=n[0],i=0,a=S(n[1].entries());i<a.length;i++){var o=g(a[i],1)[0];this.setAutoRecoveryFlag(r,o)}for(var s=0,c=S(this.unsubscribedStreams_.entries());s<c.length;s++)for(var u=g(c[s],2),d=u[0],l=0,h=S(u[1].entries());l<h.length;l++){var p=g(h[l],1)[0];this.setAutoRecoveryFlag(d,p)}}},{key:"setAutoRecoveryFlag",value:function(e,t){if(gd.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}();_t({target:"String",proto:!0,forced:Ef("small")},{small:function(){return bf(this,"small","","")}});var og=function(){function e(){a(this,e),this.video_=document.createElement("video"),this.video_.autoplay=!0,this.canvas_=document.createElement("canvas"),this.canvasCtx_=this.canvas_.getContext("2d")}return s(e,[{key:"setSrc",value:function(e){this.video_.srcObject=e}},{key:"setCanvasRect",value:function(e,t){this.canvas_.width=e,this.canvas_.height=t}},{key:"drawVideoToCanvas",value:function(){this.canvasCtx_.drawImage(this.video_,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:"canvas",get:function(){return this.canvas_}},{key:"canvasCtx",get:function(){return this.canvasCtx_}},{key:"canDrawVideoToCanvas",get:function(){return this.video_.readyState===this.video_.HAVE_ENOUGH_DATA}}]),e}(),sg=function(){function e(){a(this,e),this.processor_=new og}return s(e,[{key:"generateSmallVideoTrack",value:function(e){var t=this.getSmallVideoProfile(e),n=this.processor_.generateStreamFromTrack(e.videoTrack);this.processor_.setSrc(n),this.processor_.setCanvasRect(t.width,t.height);var r=this.processor_.generateVideoTrackFromCanvasCapture(t.framerate);return this.interval_=zd.setInterval(this.render.bind(this),Math.ceil(1e3/t.framerate)),r}},{key:"render",value:function(){this.processor_.canDrawVideoToCanvas&&this.processor_.drawVideoToCanvas()}},{key:"destroy",value:function(){zd.clearInterval(this.interval_)}},{key:"getSmallVideoProfile",value:function(e){var t,n=e.videoTrack,r=e.smallStreamConfig,i=n.getSettings(),a=i&&i.width&&i.height?{width:i.width,height:i.height}:e.videoProfile,o=a.width*a.height,s=r.width*r.height;return gd.log("big stream resolution: ".concat(a.height,"*").concat(a.width," small stream resolution: ").concat(r.height,"*").concat(r.width," ")),o>s?t=o/s:(gd.warn("Small stream resolution is larger than big stream, which is invalid. big: ".concat(a.width," * ").concat(a.height," small: ").concat(r.width," * ").concat(r.height)),t=o/19200),{width:parseInt(a.width/Math.sqrt(t)),height:parseInt(a.height/Math.sqrt(t)),framerate:r.framerate}}}]),e}(),cg={voiceActivityDetection:!1},ug=function(e){u(k,e);var t,n,r,o,c,l,h,p,f,m,g,S,y,T=_(k);function k(e){var t;return a(this,k),(t=T.call(this,e)).localStream_=null,t.exchangeSDPTimeout_=-1,t.generator_=null,t.isSDPExchanging_=!1,t.ssrc_={audio:0,video:0,small:0},t}return s(k,[{key:"initialize",value:function(){v(d(k.prototype),"initialize",this).call(this),this.installEvents()}},{key:"reset",value:function(){v(d(k.prototype),"close",this).call(this),this.uninstallEvents(),this.clearExchangeSDPTimeout()}},{key:"close",value:function(){this.reset(),this.emitConnectionStateChangedEvent(Co),this.generator_&&(this.generator_.destroy(),this.generator_=null)}},{key:"installEvents",value:function(){this.emitter_.on(cv,this.handleError,this),this.emitter_.on(uv,this.handleConnectionStateChange,this)}},{key:"uninstallEvents",value:function(){this.emitter_.off(cv,this.handleError,this),this.emitter_.off(uv,this.handleConnectionStateChange,this)}},{key:"publish",value:(y=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.localStream_=t,n=t.getMediaStream(),this.log_.info("is publishing stream: ".concat(t.getId())),r=this.localStream_.getAudioTrack(),i=this.localStream_.getVideoTrack(),r&&this.peerConnection_.addTrack(r,n),i&&(this.peerConnection_.addTrack(i,n),this.client_.getIsEnableSmallStream()&&(a=this.localStream_.getVideoProfile(),this.generator_=new sg,o=this.generator_.generateSmallVideoTrack({videoTrack:i,videoProfile:a,smallStreamConfig:this.client_.smallStreamConfig_}),this.peerConnection_.addTrack(o,n))),this.updateMediaSettings(n),e.next=10,this.connect();case 10:return e.abrupt("return",t);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"updateMediaSettings",value:function(e){var t=this,n=this.client_.getSystemResult().detail,r=n.isH264EncodeSupported,i=n.isVp8EncodeSupported,a="";r?a="H264":i&&(a="VP8");var o={EncVideoCodec:a,EncVideoWidth:0,EncVideoHeight:0,EncVideoBr:"0",EncVideoFps:0,EncAudioCodec:"opus",EncAudioFS:0,EncAudioCh:0,EncAudioBr:"0"};"getSettings"in MediaStreamTrack.prototype?e.getTracks().forEach((function(e){var n=e.getSettings();if("audio"===e.kind){var r=1;n.channelCount&&(r=n.channelCount),o.EncAudioCh=r,o.EncAudioBr="".concat(1e3*t.localStream_.getAudioBitrate()),o.EncAudioFS=n.sampleRate}else"video"===e.kind&&(t.client_.getIsEnableSmallStream()&&(o.EncSmallVideoWidth=t.client_.smallStreamConfig.width,o.EncSmallVideoHeight=t.client_.smallStreamConfig.height,o.EncSmallVideoFps=t.client_.smallStreamConfig.framerate,o.EncSmallVideoBr="".concat(1e3*t.client_.smallStreamConfig.bitrate)),o.EncVideoWidth=n.width,o.EncVideoHeight=n.height,o.EncVideoFps=n.frameRate,o.EncVideoBr="".concat(1e3*t.localStream_.getVideoBitrate()))})):o=this.getMediaSettingsFromProfile(o),this.log_.info("updateMediaSettings: "+JSON.stringify(o)),this.signalChannel_.send(Tp,o)}},{key:"getMediaSettingsFromProfile",value:function(e){var t=this.localStream_;if(t){if(t.getAudioTrack()){var n=t.getAudioProfile();e.EncAudioCh=n.channelCount,e.EncAudioBr="".concat(1e3*n.bitrate),e.EncAudioFS=n.sampleRate}if(t.getVideoTrack()){var r=t.getVideoProfile();e.EncVideoWidth=r.width,e.EncVideoHeight=r.height,e.EncVideoFps=r.frameRate,e.EncVideoBr="".concat(1e3*r.bitrate)}}return e}},{key:"addTrack",value:(S=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.peerConnection_){e.next=19;break}if(this.log_.info("is adding ".concat(t.kind," track to current published local stream")),!(this.peerConnection_.getTransceivers().findIndex((function(e){return"stopped"===e.direction}))>=0)){e.next=6;break}return this.log_.warn("transceiver is stopping, negotiate sdp first"),e.next=6,this.updateOffer(_s,t);case 6:if(!(n=this.peerConnection_.getSenders().find((function(e){return e.track&&e.track.kind===t.kind})))){e.next=13;break}return this.log_.warn("sender already exists, remove sender first"),r=n.track,this.removeSender(n),e.next=13,this.updateOffer(_s,r);case 13:return i=this.localStream_.getMediaStream(),this.peerConnection_.addTrack(t,i),this.updateMediaSettings(i),e.next=18,this.updateOffer(ms,t);case 18:Sf(this.userId_,{eventId:t.kind===hs?Up:Vp,eventDesc:"add ".concat(t.kind," track to current published stream"),timestamp:jc(),userId:this.userId_,tinyId:this.tinyId_});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"isNeedToResetOfferOrder",value:function(){if("plan-b"===this.sdpSemantics_||!this.peerConnection_||!this.peerConnection_.localDescription)return!1;for(var e=this.peerConnection_.localDescription.sdp,t=x_(e),n=0;n<t.media.length;n++)if(0===t.media[n].mid&&"video"===t.media[n].type)return!0;return!1}},{key:"removeSender",value:function(e){var t=null;"RTCPeerConnection"in window&&"getTransceivers"in window.RTCPeerConnection.prototype&&(t=this.peerConnection_.getTransceivers().find((function(t){return t.sender&&t.sender.track===e.track}))),this.peerConnection_.removeTrack(e),t&&tu(t.stop)&&(this.log_.info("stop transceiver"),t.stop())}},{key:"removeTrack",value:(g=i(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.peerConnection_||!W_()){e.next=13;break}if(this.log_.info("is removing ".concat(t.kind," track from current published local stream")),"video"!==t.kind||!this.isNeedToResetOfferOrder()){e.next=8;break}return this.reset(),this.initialize(),e.next=7,this.publish(this.localStream_);case 7:return e.abrupt("return");case 8:return(n=this.peerConnection_.getSenders().find((function(e){return e.track===t})))&&(this.removeSender(n),this.updateMediaSettings(this.localStream_.getMediaStream())),e.next=12,this.updateOffer(_s,t);case 12:Sf(this.userId_,{eventId:t.kind===hs?jp:Fp,eventDesc:"remove ".concat(t.kind," track from current published stream"),timestamp:jc(),userId:this.userId_,tinyId:this.tinyId_});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"isReplaceTrackAvailable",value:function(){return"RTCRtpSender"in window&&"replaceTrack"in window.RTCRtpSender.prototype}},{key:"replaceTrack",value:(m=i(regeneratorRuntime.mark((function e(t){var n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isReplaceTrackAvailable()&&W_()){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:p_})});case 2:if(this.peerConnection_){e.next=4;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Dm})});case 4:if(0!==(n=this.peerConnection_.getSenders()).length){e.next=7;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Dm})});case 7:n.forEach((function(e){e.track&&e.track.kind===t.kind&&(r.log_.info("is replacing ".concat(t.kind," track to current published local stream")),e.replaceTrack(t))})),Sf(this.userId_,{eventId:t.kind===hs?Xp:Yp,eventDesc:"replace ".concat(t.kind," track from current published stream"),timestamp:jc(),userId:this.userId_,tinyId:this.tinyId_});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"setBandwidth",value:(f=i(regeneratorRuntime.mark((function e(t,n,r){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isUplink_){e.next=2;break}return e.abrupt("return",r);case 2:if(K_()){e.next=4;break}return e.abrupt("return","video"===n?this.updateVideoBandwidthRestriction(r,t):this.updateAudioBandwidthRestriction(r,t));case 4:if(!(i=this.peerConnection_.getSenders().find((function(e){return e.track&&e.track.kind===n})))){e.next=20;break}return(a=i.getParameters()).encodings&&0!==a.encodings.length||(a.encodings=[{}]),"unlimited"===t?delete a.encodings[0].maxBitrate:a.encodings[0].maxBitrate=1e3*t,e.prev=9,e.next=12,i.setParameters(a);case 12:return this.log_.debug(n+" bandwidth was set to "+t+" kbps"),e.abrupt("return",r);case 16:return e.prev=16,e.t0=e.catch(9),this.log_.info("failed to set bandwidth by setting maxBitrate: "+e.t0),e.abrupt("return","video"===n?this.updateVideoBandwidthRestriction(r,t):this.updateAudioBandwidthRestriction(r,t));case 20:return e.abrupt("return",r);case 21:case"end":return e.stop()}}),e,this,[[9,16]])}))),function(e,t,n){return f.apply(this,arguments)})},{key:"setSmallStreamBandwidth",value:(p=i(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isUplink_){e.next=2;break}return e.abrupt("return",n);case 2:if(K_()){e.next=4;break}return e.abrupt("return",this.updateSmallVideoBandwidthRestriction(n,t));case 4:if(!(r=this.peerConnection_.getSenders().filter((function(e){return e.track&&"video"===e.track.kind}))[1])){e.next=20;break}return(i=r.getParameters()).encodings&&0!==i.encodings.length||(i.encodings=[{}]),"unlimited"===t?delete i.encodings[0].maxBitrate:i.encodings[0].maxBitrate=1e3*t,e.prev=9,e.next=12,r.setParameters(i);case 12:return this.log_.info("small stream bandwidth was set to "+t+" kbps"),e.abrupt("return",n);case 16:return e.prev=16,e.t0=e.catch(9),this.log_.debug("failed to set small stream bandwidth by setting maxBitrate: "+e.t0),e.abrupt("return",this.updateSmallVideoBandwidthRestriction(n,t));case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[9,16]])}))),function(e,t){return p.apply(this,arguments)})},{key:"updateVideoBandwidthRestriction",value:function(e,t){var n="AS";return Tu&&(n="TIAS",t*=1e3),e=-1===e.indexOf("b="+n+":")?e.replace(/m=video (.*)\r\nc=IN (.*)\r\n/,"m=video $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n"):e.replace(new RegExp("b="+n+":.*\r\n"),"b="+n+":"+t+"\r\n")}},{key:"updateAudioBandwidthRestriction",value:function(e,t){var n="AS";return Tu&&(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:"updateSmallVideoBandwidthRestriction",value:function(e,t){var n="AS";Tu&&(n="TIAS",t*=1e3);var r=/m=video (.*)\r\nc=IN (.*)\r\n/g,i=[],a=r.exec(e);for(i.push(a);null!==a;)a=r.exec(e),i.push(a);var o=i[i.length-2],s=e.slice(0,o.index),c=e.slice(o.index);return e=-1===e.indexOf("b="+n+":")?s+(c=c.replace(/m=video (.*)\r\nc=IN (.*)\r\n/,"m=video $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n")):s+(c=c.replace(new RegExp("b="+n+":.*\r\n"),"b="+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=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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:(l=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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 l.apply(this,arguments)})},{key:"createOffer",value:(c=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection_.createOffer(cg);case 3:return t=e.sent,e.next=6,this.peerConnection_.setLocalDescription(t);case 6:this.updateSSRC(t.sdp),qc({eventType:zo,kind:"offer"}),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),Kc({eventType:zo,kind:"offer",error:e.t0}),e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return c.apply(this,arguments)})},{key:"doExchangeSDP",value:function(){var e=this;return new Promise((function(t,n){e.exchangeSDPTimeout_=setTimeout((function(){e.signalChannel_.off(fp.PUBLISH_RESULT,r),e.signalChannel_.off(fp.ON_PUBLISH_RESPONSE,r),e.clearExchangeSDPTimeout();var t=new As({code:ws.API_CALL_TIMEOUT,message:y_({key:Vf})});n(t)}),5e3);var r=function(){var r=i(regeneratorRuntime.mark((function r(i){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,e.clearExchangeSDPTimeout(),r.next=4,e.acceptAnswer(i.data.content);case 4:t(),r.next=10;break;case 7:r.prev=7,r.t0=r.catch(0),n(r.t0);case 10:case"end":return r.stop()}}),r,null,[[0,7]])})));return function(e){return r.apply(this,arguments)}}(),a={type:e.peerConnection_.localDescription.type,sdp:e.removeVideoOrientation(e.peerConnection_.localDescription.sdp),screen:e.localStream_.hasScreenTrack()};e.signalChannel_.once(fp.PUBLISH_RESULT,r),e.signalChannel_.once(fp.ON_PUBLISH_RESPONSE,r),e.log_.debug("sending sdp offer: "+a.sdp),e.signalChannel_.send(Rp,a,0)}))}},{key:"setSDPDirection",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all",r=x_(e);return r.media.forEach((function(e){"all"!==n&&e.type!==n||(e.direction=t)})),O_(r)}},{key:"updateOffer",value:(o=i(regeneratorRuntime.mark((function e(t,n){var r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection_.createOffer(cg);case 3:return r=e.sent,Tu&&(r.sdp=this.setSDPDirection(r.sdp,"sendrecv")),e.next=7,this.peerConnection_.setLocalDescription(r);case 7:return i={action:t,trackId:n.id,kind:n.kind,type:"offer",sdp:this.peerConnection_.localDescription.sdp},this.log_.info("createOffer success, sending updated offer to remote server"),this.log_.debug("updatedOffer: "+i.sdp),e.next=12,this.signalChannel_.sendWaitForResponse({command:mp,data:i,responseCommand:fp.UPDATE_OFFER_RESULT,timeout:1e4,commandDesc:"update offer"});case 12:return a=e.sent,e.next=15,this.acceptAnswer(a.data.content);case 15:qc({eventType:zo,kind:"offer"}),e.next=23;break;case 18:throw e.prev=18,e.t0=e.catch(0),this.log_.error(e.t0),Kc({eventType:zo,kind:"offer",error:e.t0}),e.t0;case 23:case"end":return e.stop()}}),e,this,[[0,18]])}))),function(e,t){return o.apply(this,arguments)})},{key:"acceptAnswer",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(77392!==t.result){e.next=3;break}throw this.log_.error(v_.NOT_SUPPORTED_H264ENCODE),new As({code:ws.NOT_SUPPORTED_H264,message:y_({key:l_})});case 3:return n=this.localStream_.getVideoBitrate(),r=this.localStream_.getAudioBitrate(),i=this.removeVideoOrientation(t.sdp),e.prev=6,e.next=9,this.setBandwidth(n,"video",i);case 9:return i=e.sent,e.next=12,this.setBandwidth(r,"audio",i);case 12:if(i=e.sent,!this.client_.getIsEnableSmallStream()){e.next=18;break}return a=this.client_.smallStreamConfig,e.next=17,this.setSmallStreamBandwidth(a.bitrate,i);case 17:i=e.sent;case 18:return o={type:t.type,sdp:i},e.next=21,this.peerConnection_.setRemoteDescription(o);case 21:this.log_.debug("accepted answer: "+i),qc({eventType:Wo,kind:"answer"}),e.next=30;break;case 25:throw e.prev=25,e.t0=e.catch(6),Kc({eventType:Wo,kind:"answer",error:e.t0}),this.log_.error("failed to accept remote answer "+e.t0),e.t0;case 30:case"end":return e.stop()}}),e,this,[[6,25]])}))),function(e){return r.apply(this,arguments)})},{key:"sendMutedFlag",value:function(e){var t={srctinyid:0,userid:this.userId_,flag:e};this.log_.info("send muted flag: ".concat(e)),this.signalChannel_.send(yp,t)}},{key:"getIsReconnecting",value:function(){return this.isReconnecting_}},{key:"reconnect",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.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 As({code:ws.UPLINK_RECONNECTION_FAILED,message:y_({key:jf})}),Kc({eventType:Ho,error:t}),this.addEventInternal(ff,"uplink-connection reconnect fail"),this.emitConnectionStateChangedEvent(Co),this.emitter_.emit(cv,t),e.abrupt("return");case 12:if(this.signalChannel_.getCurrentState()===lp){e.next=16;break}return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"),this.signalChannel_.once(op,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,"]")),n=eu(this.reconnectionCount_),this.reconnectionTimer_=setTimeout((function(){r.log_.warn("reconnect() uplink reconnect timeout(".concat(n/1e3,"s), try again")),r.signalChannel_.off(fp.UNPUBLISH_RESULT,r.onUnpublishResult,r),r.clearReconnectionTimer(),r.reconnect()}),n),!(this.isSDPExchanging_||this.peerConnection_&&"connecting"===this.peerConnection_.connectionState)){e.next=23;break}return e.abrupt("return");case 23:this.signalChannel_.send(bp),this.signalChannel_.once(fp.UNPUBLISH_RESULT,this.onUnpublishResult,this),e.next=29;break;case 27:e.prev=27,e.t0=e.catch(17);case 29:case"end":return e.stop()}}),e,this,[[17,27]])}))),function(){return n.apply(this,arguments)})},{key:"onUnpublishResult",value:(t=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.reset(),this.initialize(),e.next=5,this.publish(this.localStream_);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return t.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()===ws.ICE_TRANSPORT_ERROR&&(this.isFirstConnection_&&(this.isFirstConnection_=!1,Kc({eventType:Bo,error:e})),this.isReconnecting_||this.startReconnection())}},{key:"handleConnectionStateChange",value:function(e){e.state===Do&&(this.isFirstConnection_&&(this.isFirstConnection_=!1,qc({eventType:Bo}),this.addEventInternal(sf,"uplink-connection is connected")),this.isReconnecting_&&(qc({eventType:Ho}),this.log_.warn("reconnect() uplink reconnect successfully"),this.addEventInternal(pf,"uplink-connection reconnect success"),this.stopReconnection()))}},{key:"updateSSRC",value:function(e){var t=this;try{var n=0;x_(e).media.forEach((function(e){if("audio"===e.type){var r=e.ssrcs[0];r&&(t.ssrc_.audio=r.id)}else{var i=e.ssrcs[0];switch(n+=1){case 1:i&&(t.ssrc_.video=i.id);break;case 2:i&&(t.ssrc_.small=i.id)}}}))}catch(cS){}}},{key:"getLocalStreamVideoTrackId",value:function(){if(this.localStream_){var e=this.localStream_.getVideoTrack();if(e)return e.id}return""}},{key:"getSSRC",value:function(){return this.ssrc_}}]),k}(Yv),dg=function(e){u(f,e);var t,n,r,o,c,l,h,p=_(f);function f(e){var t;return a(this,f),(t=p.call(this,e)).remoteStreams_=new Map,t.autoSubscribe=e.autoSubscribe,t.trackState_={audio:e.trackState.audio,video:e.trackState.video,auxiliary:e.trackState.auxiliary},t.ssrc_={audio:0,video:0,auxiliary:0},t.subscribeState_={audio:e.autoSubscribe,video:e.autoSubscribe,auxiliary:e.autoSubscribe},t.pendingSubscription_=[],t.pendingStreams_=[],t.subscriptionTimeout_=-1,t.subscriptionRetryCount_=0,t.isSubscriptionPending_=!1,t.sentSubscriptionAfterConnected_=!1,t.isSDPExchanging_=!1,t.installEvents(),t}return s(f,[{key:"isMainStreamSubscribed",get:function(){return(this.subscribeState_.audio||this.subscribeState_.video)&&(this.trackState_.audio||this.trackState_.video)}},{key:"isAuxStreamSubscribed",get:function(){return this.subscribeState_.auxiliary&&this.trackState_.auxiliary}},{key:"initialize",value:function(){v(d(f.prototype),"initialize",this).call(this),this.peerConnection_.ontrack=this.onTrack.bind(this)}},{key:"close",value:function(){var e=this;v(d(f.prototype),"close",this).call(this),this.emitConnectionStateChangedEvent(Co),-1!==this.subscriptionTimeout_&&(clearTimeout(this.subscriptionTimeout_),this.subscriptionTimeout_=-1),this.remoteStreams_.forEach((function(t){var n=t;n.setConnection(null),n.getIsStreamAddedEventEmitted()&&e.emitter_.emit(av,{stream:n})})),this.remoteStreams_.clear(),this.uninstallEvents()}},{key:"installEvents",value:function(){var e=this;xv.on(Ov.REMOTE_STREAM_TRACK_UPDATED,this.onRemoteStreamUpdate,this),this.signalChannel_.on(fp.SUBSCRIBE_CHANGE_RESULT,this.onSubscribeChangeResult,this),this.signalChannel_.on(fp.UNSUBSCRIBE_RESULT,this.onUnsubscribeResult,this),this.emitter_.on(cv,(function(t){t.getCode()===ws.ICE_TRANSPORT_ERROR&&(e.isFirstConnection_&&(e.isFirstConnection_=!1,Kc({eventType:Go,error:t})),e.isReconnecting_||e.startReconnection())})),this.emitter_.on(uv,(function(t){t.state===Do&&e.isFirstConnection_&&(e.isFirstConnection_=!1,qc({eventType:Go}),e.addEventInternal(cf,"downlink-connection is connected"))}))}},{key:"uninstallEvents",value:function(){xv.removeListener(Ov.REMOTE_STREAM_TRACK_UPDATED,this.onRemoteStreamUpdate,this),this.signalChannel_.removeListener(fp.SUBSCRIBE_CHANGE_RESULT,this.onSubscribeChangeResult,this),this.signalChannel_.removeListener(fp.UNSUBSCRIBE_RESULT,this.onUnsubscribeResult,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===fs?Eo:bo,n=this.remoteStreams_.get(t);if(!n)return;e.action===ms?this.handleRemoteAddTrack(e.kind,n):this.handleRemoteRemoveTrack(e.kind,n)}}},{key:"handleRemoteAddTrack",value:function(e,t){this.log_.info("remote add ".concat(e," track")),"audio"===e?t.updateAudioPlayingState(this.subscribeState_.audio):t.updateVideoPlayingState(e===fs?this.subscribeState_.auxiliary:this.subscribeState_.video),t.getIsStreamAddedEventEmitted()?this.emitter_.emit(ov,{stream:t}):(this.emitter_.emit(iv,{stream:t}),this.currentState_===Do&&t.emitConnectionStateChanged({prevState:Co,state:Do}))}},{key:"handleRemoteRemoveTrack",value:function(e,t){t.getIsStreamAddedEventEmitted()&&(this.log_.info("remote remove ".concat(e," track")),e!==fs&&(this.trackState_.audio||this.trackState_.video)||t.isInSubscriptionCycle()?("audio"===e?t.updateAudioPlayingState(!1):t.updateVideoPlayingState(!1),this.emitter_.emit(ov,{stream:t})):(this.log_.info("remote stream ".concat(t.getType()," removed")),this.currentState_===Do&&t.emitConnectionStateChanged({prevState:Do,state:Co}),this.emitter_.emit(av,{stream:t})))}},{key:"updateTrackState",value:function(e,t){var n=e===ms;switch(t){case hs:this.trackState_.audio=n;break;case ps:this.trackState_.video=n;break;case fs:this.trackState_.auxiliary=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)),"unified-plan"===this.sdpSemantics_){var r=function(e){var t=P_.parse(e),n={audio:[],video:[]};return t.media.forEach((function(e){if(e.ssrcs){var t=e.ssrcs[0].id>>16&255;if("audio"===e.type)n.audio.push(bo);else if("video"==e.type){var r=t===Io?bo:Eo;n.video.push(r)}}})),n}(this.peerConnection_.remoteDescription.sdp);if("audio"===n.kind){if(0===r.audio.length||t.id!==bo)return void this.log_.debug("skip this invalid audio track")}else if(-1===r.video.indexOf(t.id))return void this.log_.debug("skip this invalid video track: ".concat(n.id," msid: ").concat(t.id))}Wc({eventType:"ontrack",kind:n.kind});var i=!1,a=this.remoteStreams_.get(t.id),o=t.id===bo?"main":"auxiliary";if(nu(a)&&((a=new ig({type:o,userId:this.userId_,client:this.client_})).setConnection(this),this.remoteStreams_.set(t.id,a),i=!0),a.setMediaStream(t),n.kind===hs?a.updateAudioPlayingState(this.subscribeState_.audio):"main"===o?a.updateVideoPlayingState(this.subscribeState_.video):a.updateVideoPlayingState(this.subscribeState_.auxiliary),("auxiliary"!==o||this.trackState_.auxiliary)&&("main"!==o||this.trackState_.audio||this.trackState_.video)){var s=this.client_.getSubscriptionManager();s&&s.hasAutoRecoveryFlag(this.userId_,o)||(i?this.emitter_.emit(iv,{stream:a}):this.emitter_.emit(ov,{stream:a}))}}},{key:"addRRTRLine",value:function(e){var t=e.split("\r\n"),n=new Map;t.forEach((function(e,r){/^a=rtcp-fb:/.test(e)&&t[r+1]&&!/^a=rtcp-fb:/.test(t[r+1])&&n.set(r+1,e.match(/^a=rtcp-fb:\d+/)[0]+" rrtr")}));for(var r=S(n),i=0;i<r.length;i++){var a=g(r[i],2),o=a[0],s=a[1];t.splice(o+i,0,s)}return t.join("\r\n")}},{key:"addSPSDescription",value:function(e){var t=x_(e);return t.media.forEach((function(e){"video"===e.type&&e.fmtp.forEach((function(e){e.config+=";sps-pps-idr-in-keyframe=1"}))})),O_(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=x_(e);return n.media.forEach((function(e){e.ext=e.ext.filter((function(e){return!t.includes(e.uri)}))})),O_(n)}},{key:"isSubscriptionStateNotChanged",value:function(e,t){return"main"===e.getType()?!nu(t.audio)&&!nu(t.video)&&t.audio===this.subscribeState_.audio&&t.video===this.subscribeState_.video:"auxiliary"===e.getType()?!nu(t.video)&&this.subscribeState_.auxiliary===t.video:void 0}},{key:"subscribe",value:(h=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.emitEvent,i=void 0===r||r,a=t.getType(),!this.isSubscriptionStateNotChanged(t,n)){e.next=13;break}if(!this.peerConnection_){e.next=8;break}return e.next=6,this.waitForPeerConnectionConnected();case 6:e.next=11;break;case 8:return this.initialize(),e.next=11,this.connect();case 11:return i&&this.emitter_.emit(sv,{stream:t,result:!0}),e.abrupt("return",t);case 13:if("main"===a?(nu(n.audio)||(this.subscribeState_.audio=n.audio),nu(n.video)||(this.subscribeState_.video=n.video),this.addEventInternal(this.subscribeState_.audio?zp:qp,this.subscribeState_.audio?"subscribe audio":"unsubscribe audio"),this.addEventInternal(this.subscribeState_.video?zp:qp,this.subscribeState_.video?"subscribe video":"unsubscribe video")):nu(n.video)||(this.subscribeState_.auxiliary=n.video),this.log_.info("subscribe ".concat(a," stream with options ").concat(JSON.stringify(n)," current state: ").concat(JSON.stringify(this.subscribeState_))),!this.peerConnection_&&!this.isSDPExchanging_){e.next=23;break}return o=rs,this.isMainStreamSubscribed||this.isAuxStreamSubscribed||(o=ns),e.next=20,this.sendSubscription(t,o);case 20:"main"===a?(t.updateAudioPlayingState(this.subscribeState_.audio),t.updateVideoPlayingState(this.subscribeState_.video)):t.updateVideoPlayingState(this.subscribeState_.auxiliary),e.next=26;break;case 23:return this.initialize(),e.next=26,this.connect();case 26:return i&&this.emitter_.emit(sv,{stream:t,result:!0}),e.abrupt("return",t);case 28:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"unsubscribe",value:(l=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("main"!==(n=t.getType())){e.next=9;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,e.next=13;break;case 9:if(this.isAuxStreamSubscribed){e.next=12;break}return this.log_.info("auxiliary stream already unsubscribed"),e.abrupt("return",t);case 12:this.subscribeState_.auxiliary=!1;case 13:return r=ns,("main"===n&&this.isAuxStreamSubscribed||"auxiliary"===n&&this.isMainStreamSubscribed)&&(r=rs),this.log_.info("unsubscribe ".concat(n," stream with ").concat(JSON.stringify(this.subscribeState_))),e.next=18,this.sendSubscription(t,r);case 18:return t.updateVideoPlayingState(!1),t.updateAudioPlayingState(!1),r===ns&&((i=t.getMediaStream())&&i.getTracks().forEach((function(e){return i.removeTrack(e)})),this.closePeerConnection(),this.emitConnectionStateChangedEvent(Co)),this.addEventInternal(qp,"unsubscribe audio"),this.addEventInternal(Wp,"unsubscribe video"),e.abrupt("return",t);case 24:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"sendSubscription",value:function(e,t){var n=this;return new Promise((function(r,i){var a={srctinyid:n.tinyId_,userid:n.userId_,audio:n.subscribeState_.audio,bigVideo:n.subscribeState_.video,auxVideo:n.subscribeState_.auxiliary};n.pendingSubscription_.length>0?n.log_.debug("queue the subscription for later handling"):n.doSendSubscription(a,e,t),n.pendingSubscription_.push({stream:e,type:t,data:a,callback:function(e){var a=e.code,o=e.message;if(0===a)r();else{var s=new As({code:a,message:y_({key:Mf,data:{type:t,message:o}})});n.log_.error(s),i(s)}}}),e.setInSubscriptionCycle(!0)}))}},{key:"doSendSubscription",value:function(e,t,n){var r=this;if(!this.peerConnection_||"connected"!==this.peerConnection_.connectionState&&"completed"!==this.peerConnection_.connectionState)return this.log_.debug("try to send subscription [".concat(n,"] when peeConnection connected")),void(this.sentSubscriptionAfterConnected_=!1);t&&this.pendingStreams_.push(t),this.log_.debug("doSendSubscription() send SUBSCRIBE command with data: ".concat(JSON.stringify(e))),n===rs?this.signalChannel_.send(Cp,e):n===ns&&this.signalChannel_.send(Ip,e),this.isSubscriptionPending_=!0,this.subscriptionTimeout_=setTimeout((function(){if(r.isSubscriptionPending_)if(r.log_.debug("subscription timeout"),r.subscriptionRetryCount_+=1,r.subscriptionRetryCount_<=3){r.log_.debug("resend subscription");var e=r.pendingSubscription_[0].data;r.doSendSubscription(e,t,n)}else r.log_.error(v_.SUBSCRIPTION_TIMEOUT),r.pendingSubscription_.shift(),r.pendingStreams_.shift(),r.isSubscriptionPending_=!1,r.subscriptionRetryCount_=0,r.emitter_.emit(cv,new As({code:ws.SUBSCRIPTION_TIMEOUT,message:y_({key:Lf})}))}),5e3)}},{key:"onSubscribeChangeResult",value:function(e){var t=e.data.content,n=t.srctinyid;if(this.hitTest(n)){var r=this.pendingSubscription_[0];r&&r.type===rs&&r.callback({code:t.errCode,message:t.errMsg}),this.sendNextSubscription()}}},{key:"onUnsubscribeResult",value:function(e){var t=e.data.content,n=t.srctinyid;if(this.hitTest(n)){var r=this.pendingSubscription_[0];r&&r.type===ns&&r.callback({code:t.errCode,message:t.errMsg}),this.sendNextSubscription()}}},{key:"connect",value:(c=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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 c.apply(this,arguments)})},{key:"exchangeSDP",value:(o=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a;return regeneratorRuntime.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,n=t.type,r=t.sdp,i={type:n,sdp:r,userid:this.userId_,srctinyid:this.tinyId_,audio:this.subscribeState_.audio,bigVideo:this.subscribeState_.video,auxVideo:this.subscribeState_.auxiliary},xv.emit(Ov.CONNECTION_SEND_SUBSCRIBE_CMD,{client:this.client_,connection:this,userId:this.userId_,tinyId:this.tinyId_,role:ko,subscribeState:this.subscribeState_,trackState:this.trackState_}),e.next=10,this.signalChannel_.sendWaitForResponse({command:Ep,commandDesc:"exchange sdp",data:i,responseCommand:fp.SUBSCRIBE_RESULT});case 10:return a=e.sent,e.next=13,this.onSubscribeResult(a);case 13:this.isSDPExchanging_=!1,e.next=20;break;case 16:throw e.prev=16,e.t0=e.catch(0),this.isSDPExchanging_=!1,e.t0;case 20:case"end":return e.stop()}}),e,this,[[0,16]])}))),function(){return o.apply(this,arguments)})},{key:"createOffer",value:(r=i(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={voiceActivityDetection:!1},"RTCPeerConnection"in window&&"addTransceiver"in window.RTCPeerConnection.prototype&&"unified-plan"===this.sdpSemantics_?(this.peerConnection_.addTransceiver("audio",{direction:"recvonly"}),this.peerConnection_.addTransceiver("video",{direction:"recvonly"}),this.peerConnection_.addTransceiver("video",{direction:"recvonly"})):(t.offerToReceiveAudio=!0,t.offerToReceiveVideo=!0),e.next=4,this.peerConnection_.createOffer(t);case 4:return(n=e.sent).sdp=this.addRRTRLine(n.sdp),n.sdp=this.addSPSDescription(n.sdp),n.sdp=N_(n.sdp),"unified-plan"===this.sdpSemantics_&&(n.sdp=this.removeSDESDescription(n.sdp)),e.next=11,this.peerConnection_.setLocalDescription(n);case 11:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onSubscribeResult",value:(n=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.data.content||77393!==t.data.content.errCode){e.next=3;break}throw this.log_.error(v_.NOT_SUPPORTED_H264DECODE),new As({code:ws.NOT_SUPPORTED_H264,message:y_(h_)});case 3:if(n=t.data.content,r=n.type,i=n.sdp,a=n.errCode,o=n.errMsg,e.prev=4,0===a){e.next=7;break}throw new As({code:a,message:y_({key:Ff,data:{errMsg:o}})});case 7:return this.log_.debug("accept remote answer: "+i),e.next=10,this.peerConnection_.setRemoteDescription({type:r,sdp:i});case 10:this.updateSSRC(i),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),this.log_.error(e.t0),e.t0;case 17:case"end":return e.stop()}}),e,this,[[4,13]])}))),function(e){return n.apply(this,arguments)})},{key:"updateSSRC",value:function(e){var t=this;try{x_(e).media.forEach((function(e){if("audio"===e.type){var n=e.ssrcs.find((function(e){return e.value.includes(bo)}));n&&(t.ssrc_.audio=n.id)}else{var r=e.ssrcs.find((function(e){return e.value.includes(bo)})),i=e.ssrcs.find((function(e){return e.value.includes(Eo)}));r&&(t.ssrc_.video=r.id),i&&(t.ssrc_.auxiliary=i.id)}}))}catch(cS){}}},{key:"sendNextSubscription",value:function(){void 0!==this.pendingSubscription_.shift()&&(this.subscriptionRetryCount_=0,this.isSubscriptionPending_=!1,-1!==this.subscriptionTimeout_&&(clearTimeout(this.subscriptionTimeout_),this.subscriptionTimeout_=-1));var e=this.pendingStreams_.shift();if(e&&(this.log_.debug("mark ".concat(e.getType()," stream exit subscription cycle")),e.setInSubscriptionCycle(!1)),this.pendingSubscription_.length>0){var t=this.pendingSubscription_[0];this.log_.info("schedule a pending subscription"),this.doSendSubscription(t.data,t.stream,t.type)}}},{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(bo)}},{key:"getAuxStream",value:function(){return this.remoteStreams_.get(Eo)}},{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:(t=i(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.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 As({code:ws.DOWNLINK_RECONNECTION_FAILED,message:y_({key:Uf})}),Kc({eventType:Jo,error:t}),this.addEventInternal(vf,"downlink-connection reconnect fail"),this.emitConnectionStateChangedEvent(Co),this.emitter_.emit(cv,t),e.abrupt("return");case 12:if(this.signalChannel_.getCurrentState()===lp){e.next=16;break}return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"),this.signalChannel_.once(op,this.reconnect,this),e.abrupt("return");case 16:if(this.reconnectionCount_++,this.log_.warn("reconnect() try to reconnect downlink [".concat(this.reconnectionCount_,"/").concat(30,"]")),n=eu(this.reconnectionCount_),this.reconnectionTimer_=setTimeout((function(){r.log_.warn("reconnect() downlink [".concat(r.userId_,"] reconnect timeout(").concat(n/1e3,"s), try again")),r.clearReconnectionTimer(),r.reconnect()}),n),!(this.isSDPExchanging_||this.peerConnection_&&"connecting"===this.peerConnection_.connectionState)){e.next=22;break}return e.abrupt("return");case 22:return e.prev=22,this.closePeerConnection(),this.sentSubscriptionAfterConnected_=!1,this.initialize(),e.next=28,this.connect();case 28:this.stopReconnection(),this.log_.warn("reconnect() downlink reconnect successfully"),qc({eventType:Jo}),this.addEventInternal(_f,"downlink-connection reconnect success"),this.recoverSubscription(),e.next=37;break;case 35:e.prev=35,e.t0=e.catch(22);case 37:case"end":return e.stop()}}),e,this,[[22,35]])}))),function(){return t.apply(this,arguments)})},{key:"recoverSubscription",value:function(){var e=this,t=this.client_.getSubscriptionManager();t&&S(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(bo)),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=k(this.remoteStreams_.values());try{for(n.s();!(t=n.n()).done;){var r=t.value,i=r.getType();("main"===i&&(this.trackState_.audio||this.trackState_.video)||"auxiliary"===i&&this.trackState_.auxiliary)&&e.setAutoRecoveryFlag(this.userId_,r.getType())}}catch(a){n.e(a)}finally{n.f()}}v(d(f.prototype),"startReconnection",this).call(this)}},{key:"getCurrentState",value:function(){return this.currentState_}}]),f}(Yv),lg=function(e){return function(t,n,r,i){vt(n);var a=re(t),o=F(a),s=Ke(a.length),c=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(c in o){i=o[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw TypeError("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in o&&(i=n(i,o[c],c,a));return i}},hg={left:lg(!1),right:lg(!0)}.left,pg=Ra("reduce");_t({target:"Array",proto:!0,forced:!pg||!Nl&&Y>79&&Y<83},{reduce:function(e){return hg(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var fg=function(){function e(){a(this,e),this.startTime=0,this.endTime=0,this.start()}return s(e,[{key:"start",value:function(){0===this.startTime&&(this.startTime=cu())}},{key:"stop",value:function(){0===this.endTime&&(this.endTime=cu())}},{key:"getDuration",value:function(){return 0===this.endTime?cu()-this.startTime:this.endTime-this.startTime}}]),e}(),mg=function(){function e(t){a(this,e),this.client_=t.client,this.intervalId_=-1,this.statsCalculator_=new Dv,this.prevStats_=null,this.renderFreezeMap_=new Map,this.remoteStreamMap_=new Map,this.dataFreezeMap_=new Map,this.monitorFreezeData_=new Map}var t,n,r;return s(e,[{key:"installEvents",value:function(){xv.on(Ov.PLAY_VIDEO_START,this.handlePlayVideoStart,this),xv.on(Ov.VIDEO_TRACK_MUTED,this.onVideoTrackMuted,this),xv.on(Ov.VIDEO_TRACK_UNMUTED,this.onVideoTrackUnmuted,this),xv.on(Ov.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this),xv.on(Ov.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),xv.on(Ov.VIDEO_PLAYING,this.handleVideoPlaying,this)}},{key:"uninstallEvents",value:function(){xv.off(Ov.PLAY_VIDEO_START,this.handlePlayVideoStart,this),xv.off(Ov.VIDEO_TRACK_MUTED,this.onVideoTrackMuted,this),xv.off(Ov.VIDEO_TRACK_UNMUTED,this.onVideoTrackUnmuted,this),xv.off(Ov.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this),xv.off(Ov.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),xv.off(Ov.VIDEO_PLAYING,this.handleVideoPlaying,this)}},{key:"start",value:function(){var e=this;-1===this.intervalId_&&(this.installEvents(),this.intervalId_=zd.setInterval(i(regeneratorRuntime.mark((function t(){return regeneratorRuntime.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]])}))),1e3))}},{key:"stop",value:function(){-1!==this.intervalId_&&(this.uninstallEvents(),zd.clearInterval(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_,r=t.type_,i="".concat(n,"_").concat(r),a=this.dataFreezeMap_.get(i),o=new fg;a?a.durationItemList.push(o):this.dataFreezeMap_.set(i,{userId:n,type:r,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_,r=t.type_,i="".concat(n,"_").concat(r);this.stopDataFreeze({key:i,userId:n,type:r})}}},{key:"handleStreamStopped",value:function(e){var t=e.client,n=e.stream;if(t===this.client_){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);this.stopDataFreeze({key:a,userId:r,type:i})}}},{key:"stopDataFreeze",value:function(e){var t=e.key,n=e.userId,r=e.type,i=this.dataFreezeMap_.get(t);if(i&&i.isFreezing()){var a=i.durationItemList[i.durationItemList.length-1];a.stop();var o=a.getDuration();o>500?(Wc({eventType:"videoFrozenCount",delta:o}),this.monitorFreezeData_.set(t,{userId:n,type:r,duration:o})):i.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=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.client_.getConnections(),n={},r=k(t),e.prev=3,r.s();case 5:if((i=r.n()).done){e.next=20;break}if(a=g(i.value,2),o=a[0],(s=a[1]).getPeerConnection()){e.next=9;break}return e.abrupt("continue",18);case 9:return c=s.getSubscribeState(),u=s.getTrackState(),e.next=13,this.statsCalculator_.getReceiverStats(s);case 13:d=e.sent,(l={userId:d.userId,tinyId:o,hasVideo:u.video&&c.video,hasAuxiliary:u.auxiliary&&c.auxiliary,video:{framesDecoded:0},auxiliary:{framesDecoded:0}}).hasVideo&&(l.video.framesDecoded=d.video.framesDecoded),l.hasAuxiliary&&(l.auxiliary.framesDecoded=d.auxiliary.framesDecoded),n[d.userId]=l;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",n);case 29:case"end":return e.stop()}}),e,this,[[3,22,25,28]])}))),function(){return r.apply(this,arguments)})},{key:"detectFPS",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.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=regeneratorRuntime.keys(t);case 7:if((e.t1=e.t0()).done){e.next=17;break}if(n=e.t1.value,this.prevStats_[n]){e.next=11;break}return e.abrupt("continue",7);case 11:r=t[n].tinyId,i=this.client_.getMutedStates(),t[n].hasVideo&&this.prevStats_[n].hasVideo&&i.has(r)&&!i.get(r).videoMuted&&(a=t[n].video.framesDecoded-this.prevStats_[n].video.framesDecoded,this.handleRenderFreeze({userId:n,type:"main",fps:a})),t[n].hasAuxiliary&&this.prevStats_[n].hasAuxiliary&&(o=t[n].auxiliary.framesDecoded-this.prevStats_[n].auxiliary.framesDecoded,this.handleRenderFreeze({userId:n,type:"auxiliary",fps:o})),e.next=7;break;case 17:this.prevStats_=t;case 18:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"handleRenderFreeze",value:(t=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.userId,r=t.fps,i=t.type,a="".concat(n,"_").concat(i),o=this.renderFreezeMap_.get(a),r<=2?(s=cu(),o&&!o.isFreeze&&(o.freezeTimeline.push({startTime:s,endTime:void 0}),o.isFreeze=!0),o||this.renderFreezeMap_.set(a,{userId:n,type:i,isFreeze:!0,freezeTimeline:[{startTime:s,endTime:void 0}],renderFreezeTotal:0})):o&&o.isFreeze&&(o.isFreeze=!1,(c=o.freezeTimeline.pop()).endTime=cu(),u=c.endTime-c.startTime,o.freezeTimeline.push(c),o.renderFreezeTotal+=Math.min(5e3,u));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());if(this.remoteStreamMap_.has(n))this.remoteStreamMap_.get(n).remoteStream=t;else this.remoteStreamMap_.set(n,{isPlayingFired:!1,remoteStream:t})}}},{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 r=n.durationItemList[n.durationItemList.length-1];r.stop(),r.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,r=0;if(t)if(t.isFreeze){var i=cu()-t.freezeTimeline[t.freezeTimeline.length-1].startTime;n=t.renderFreezeTotal+Math.min(i,5e3),r=t.freezeTimeline.length}else n=t.renderFreezeTotal;return{renderFreeze:n,count:r}}},{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}(),_g=function e(t){a(this,e),this.userId=t.userId,this.tinyId=t.tinyId,this.role=t.role===ko?"anchor":"audience"};function vg(e){var t=e.retryFunction,n=e.settings,r=e.onError,a=e.onRetrying,o=e.context;return function(){for(var e=this,s=arguments.length,c=new Array(s),u=0;u<s;u++)c[u]=arguments[u];var d=n.retries||5,l=0,h=-1,p=0,f=function(){var s=i(regeneratorRuntime.mark((function i(s,u){var m,_,v,g;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,m=o||e,i.next=4,t.apply(m,c);case 4:_=i.sent,l=0,s(_),i.next=14;break;case 9:i.prev=9,i.t0=i.catch(0),v=function(){clearTimeout(h),l=0,p=2,u(i.t0)},g=function(){2!==p&&l<d?(l++,p=1,tu(a)&&a(l,v),h=setTimeout((function(){h=-1,f(s,u)}),n.timeout||1e3)):v()},r(i.t0,g,u);case 14:case"end":return i.stop()}}),i,null,[[0,9]])})));return function(e,t){return s.apply(this,arguments)}}();return new Promise(f)}}var gg=E((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 r(e,t,r,i,a,o){return n((s=n(n(t,e),n(i,o)))<<(c=a)|s>>>32-c,r);var s,c}function i(e,t,n,i,a,o,s){return r(t&n|~t&i,e,t,a,o,s)}function a(e,t,n,i,a,o,s){return r(t&i|n&~i,e,t,a,o,s)}function o(e,t,n,i,a,o,s){return r(t^n^i,e,t,a,o,s)}function s(e,t,n,i,a,o,s){return r(n^(t|~i),e,t,a,o,s)}function c(e,t){var r,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(r=0;r<e.length;r+=16)c=h,u=p,d=f,l=m,h=i(h,p,f,m,e[r],7,-680876936),m=i(m,h,p,f,e[r+1],12,-389564586),f=i(f,m,h,p,e[r+2],17,606105819),p=i(p,f,m,h,e[r+3],22,-1044525330),h=i(h,p,f,m,e[r+4],7,-176418897),m=i(m,h,p,f,e[r+5],12,1200080426),f=i(f,m,h,p,e[r+6],17,-1473231341),p=i(p,f,m,h,e[r+7],22,-45705983),h=i(h,p,f,m,e[r+8],7,1770035416),m=i(m,h,p,f,e[r+9],12,-1958414417),f=i(f,m,h,p,e[r+10],17,-42063),p=i(p,f,m,h,e[r+11],22,-1990404162),h=i(h,p,f,m,e[r+12],7,1804603682),m=i(m,h,p,f,e[r+13],12,-40341101),f=i(f,m,h,p,e[r+14],17,-1502002290),h=a(h,p=i(p,f,m,h,e[r+15],22,1236535329),f,m,e[r+1],5,-165796510),m=a(m,h,p,f,e[r+6],9,-1069501632),f=a(f,m,h,p,e[r+11],14,643717713),p=a(p,f,m,h,e[r],20,-373897302),h=a(h,p,f,m,e[r+5],5,-701558691),m=a(m,h,p,f,e[r+10],9,38016083),f=a(f,m,h,p,e[r+15],14,-660478335),p=a(p,f,m,h,e[r+4],20,-405537848),h=a(h,p,f,m,e[r+9],5,568446438),m=a(m,h,p,f,e[r+14],9,-1019803690),f=a(f,m,h,p,e[r+3],14,-187363961),p=a(p,f,m,h,e[r+8],20,1163531501),h=a(h,p,f,m,e[r+13],5,-1444681467),m=a(m,h,p,f,e[r+2],9,-51403784),f=a(f,m,h,p,e[r+7],14,1735328473),h=o(h,p=a(p,f,m,h,e[r+12],20,-1926607734),f,m,e[r+5],4,-378558),m=o(m,h,p,f,e[r+8],11,-2022574463),f=o(f,m,h,p,e[r+11],16,1839030562),p=o(p,f,m,h,e[r+14],23,-35309556),h=o(h,p,f,m,e[r+1],4,-1530992060),m=o(m,h,p,f,e[r+4],11,1272893353),f=o(f,m,h,p,e[r+7],16,-155497632),p=o(p,f,m,h,e[r+10],23,-1094730640),h=o(h,p,f,m,e[r+13],4,681279174),m=o(m,h,p,f,e[r],11,-358537222),f=o(f,m,h,p,e[r+3],16,-722521979),p=o(p,f,m,h,e[r+6],23,76029189),h=o(h,p,f,m,e[r+9],4,-640364487),m=o(m,h,p,f,e[r+12],11,-421815835),f=o(f,m,h,p,e[r+15],16,530742520),h=s(h,p=o(p,f,m,h,e[r+2],23,-995338651),f,m,e[r],6,-198630844),m=s(m,h,p,f,e[r+7],10,1126891415),f=s(f,m,h,p,e[r+14],15,-1416354905),p=s(p,f,m,h,e[r+5],21,-57434055),h=s(h,p,f,m,e[r+12],6,1700485571),m=s(m,h,p,f,e[r+3],10,-1894986606),f=s(f,m,h,p,e[r+10],15,-1051523),p=s(p,f,m,h,e[r+1],21,-2054922799),h=s(h,p,f,m,e[r+8],6,1873313359),m=s(m,h,p,f,e[r+15],10,-30611744),f=s(f,m,h,p,e[r+6],15,-1560198380),p=s(p,f,m,h,e[r+13],21,1309151649),h=s(h,p,f,m,e[r+4],6,-145523070),m=s(m,h,p,f,e[r+11],10,-1120210379),f=s(f,m,h,p,e[r+2],15,718787259),p=s(p,f,m,h,e[r+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="",r=32*e.length;for(t=0;t<r;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 r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function l(e){var t,n,r="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),r+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".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,r,i=d(e),a=[],o=[];for(a[15]=o[15]=void 0,i.length>16&&(i=c(i,8*e.length)),n=0;n<16;n+=1)a[n]=909522486^i[n],o[n]=1549556828^i[n];return r=c(a.concat(d(t)),512+8*t.length),u(c(o.concat(r),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}(b)})),Sg=function(){function e(t){a(this,e),this.client_=t.client,this.signalChannel_=t.signalChannel,this.isMixing_=!1,this.config_=null,this.data_=null,this.remoteStreamMap_=new Map,this.installEvents()}var t,n;return s(e,[{key:"isPresetLayoutMode",get:function(){return this.config_&&this.config_.mode===is.PRESET_LAYOUT}},{key:"installEvents",value:function(){xv.on(Ov.REMOTE_STREAM_SUBSCRIBED,this.onStreamSubscribed,this),xv.on(Ov.REMOTE_STREAM_UNSUBSCRIBED,this.onStreamUnsubscribed,this),this.client_.on("stream-removed",this.onStreamRemoved,this)}},{key:"uninstallEvents",value:function(){xv.off(Ov.REMOTE_STREAM_SUBSCRIBED,this.onStreamSubscribed,this),xv.off(Ov.REMOTE_STREAM_UNSUBSCRIBED,this.onStreamUnsubscribed,this),this.client_.off("stream-removed",this.onStreamRemoved,this)}},{key:"stop",value:function(){this.uninstallEvents()}},{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:(n=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.resetIsUsedFlag(),this.validateMixTranscodeParamsType(t),this.config_=t,n=this.getInputParam(t,this.remoteStreamMap_),r=this.getOutputParam(t),i=this.getOutputSessionId({config:t,roomId:this.client_.getRoomId(),userId:this.client_.getUserId()}),this.validateMixTranscodeParamsValue(n,r),!this.isMixing_||!this.data_||i===this.data_.outputSessionId){e.next=12;break}return gd.info("startMixTranscode() streamId changed, stop mixing before start"),e.next=12,this.doStopMixTranscode();case 12:return e.next=14,this.doStartMixTranscode({outputSessionId:i,inputParam:n,outputParam:r});case 14:e.next=20;break;case 16:throw e.prev=16,e.t0=e.catch(0),this.resetIsUsedFlag(),e.t0;case 20:case"end":return e.stop()}}),e,this,[[0,16]])}))),function(e){return n.apply(this,arguments)})},{key:"doStartMixTranscode",value:function(e){var t=this,n=e.outputSessionId,r=e.inputParam,i=e.outputParam;return new Promise((function(e,a){var o={roomid:String(t.client_.getRoomId()),sdkAppID:String(t.client_.getSDKAppId()),socketid:t.signalChannel_.getSocketId(),mcuRequestTime:Date.now(),outputSessionId:n,inputParam:r,outputParam:i};t.data_=o,gd.info("startMixTranscode: ".concat(JSON.stringify(o))),t.signalChannel_.send(xp,o),t.isMixing_=!0;var s=setTimeout((function(){gd.error("startMixTranscode timeout observed"),t.isMixing_=!1,t.signalChannel_.off(fp.START_MIX_TRANSCODE_RES,c),a(new As({code:ws.START_MIX_TRANSCODE_FAILED,message:y_({key:Jm})}))}),5e3),c=function(n){clearTimeout(s),n.data.content.errCode?(gd.error("startMixTranscode failed, errCode: ".concat(n.data.content.errCode," errMsg: ").concat(n.data.content.errMsg)),t.isMixing_=!1,a(new As({code:ws.START_MIX_TRANSCODE_FAILED,message:y_({key:zm,data:{errMsg:n.data.content.errMsg}})}))):e()};t.signalChannel_.once(fp.START_MIX_TRANSCODE_RES,c)}))}},{key:"stopMixTranscode",value:(t=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMixing_){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Km})});case 2:return e.next=4,this.doStopMixTranscode();case 4:this.resetIsUsedFlag();case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"doStopMixTranscode",value:function(){var e=this;return new Promise((function(t,n){var r={roomid:String(e.client_.getRoomId()),sdkAppID:String(e.client_.getSDKAppId()),socketid:e.signalChannel_.getSocketId(),userid:e.client_.getUserId(),mcuRequestTime:Date.now(),outPutSessionId:e.data_.outputSessionId,streamType:e.data_.outputParam.streamType};gd.info("stopMixTranscode: ".concat(JSON.stringify(r))),e.signalChannel_.send(Op,r);var i=setTimeout((function(){gd.error("stopMixTranscode timeout observed"),e.signalChannel_.off(fp.STOP_MIX_TRANSCODE_RES,a),n(new As({code:ws.STOP_MIX_TRANSCODE_FAILED,message:y_({key:Wm})}))}),5e3),a=function(r){clearTimeout(i),r.data.content.errCode?(gd.error("stopMixTranscode failed, errCode: ".concat(r.data.content.errCode," errMsg: ").concat(r.data.content.errMsg)),n(new As({code:ws.STOP_MIX_TRANSCODE_FAILED,message:y_({key:qm,data:{errMsg:r.data.content.errMsg}})}))):(e.isMixing_=!1,t())};e.signalChannel_.once(fp.STOP_MIX_TRANSCODE_RES,a)}))}},{key:"validateMixTranscodeParamsType",value:function(e){if("object"!==au(e))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Qm})});var t=ou(e,{streamId:ss,videoWidth:cs,videoHeight:cs,videoBitrate:cs,videoFramerate:cs,videoGOP:cs,audioSampleRate:cs,audioBitrate:cs,audioChannels:cs,backgroundColor:cs,backgroundImage:ss,mixUsers:ds});if(!t.ret)throw new As({code:ws.INVALID_PARAMETER,message:t.message});var n={userId:ss,roomId:this.client_.getUseStringRoomId()?ss:cs,pureAudio:us,width:cs,height:cs,locationX:cs,locationY:cs,zOrder:cs};e.mixUsers.forEach((function(e){var t=ou(e,n);if(!t.ret)throw new As({code:ws.INVALID_PARAMETER,message:"mixUser.".concat(t.message)})}))}},{key:"getOutputSessionId",value:function(e){var t=e.config,n=e.userId,r=e.roomId;return ru(t.streamId)&&t.streamId.length>0?t.streamId:gg("".concat(r,"_").concat(n,"_main"))}},{key:"getInputParam",value:function(e,t){var n=this,r=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:nu(e.streamType)||"auxiliary"!==e.streamType?0:1,inputType:e.pureAudio?os.IT_PURE_AUDIO:os.IT_AUDIO_VIDEO}}));return e.mode===is.PRESET_LAYOUT&&(r.forEach((function(e){if(e.userid===as.REMOTE){var n=S(t.values()).find((function(e){return!e.isUsed}));n&&(e.userid=n.remoteStream.getUserId(),e.streamType="auxiliary"===n.remoteStream.getType()?1:0,n.isUsed=!0)}})),r=r.filter((function(e){return e.userid!==as.REMOTE}))),r}},{key:"getOutputParam",value:function(e){var t=e.streamId||"";return{streamId:t,streamType:t.length>0?1:0,videoWidth:nu(e.videoWidth)?640:e.videoWidth,videoHeight:nu(e.videoHeight)?480:e.videoHeight,videoBitrate:e.videoBitrate||0,videoFramerate:e.videoFramerate||15,videoGOP:e.videoGOP||2,audioSampleRate:e.audioSampleRate||48e3,audioBitrate:e.audioBitrate||64,audioChannels:e.audioChannels||1,backgroundColor:e.backgroundColor||0,backgroundImage:e.backgroundImage||"",extraInfo:"",VCodec:2,ACodec:0}}},{key:"validateMixTranscodeParamsValue",value:function(e,t){var n=0,r=0;if(e.forEach((function(e){if(nu(e.userid))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Ym})});if(e.inputType!==os.IT_PURE_AUDIO){if(e.width<0||e.height<0)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Xm})});if(e.locationX<0||e.locationY<0)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:$m})});if(!e.zOrder||e.zOrder<1||e>15)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Zm})});e.width+e.locationX>n&&(n=e.width+e.locationX),e.height+e.locationY>r&&(r=e.height+e.locationY)}})),t.videoWidth<0||t.videoWidth<0)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:e_})});if(t.videoWidth<n||t.videoHeight<r)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:t_})})}},{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}(),yg=function(){function e(t){a(this,e),this.client_=t.client,this.signalChannel_=t.signalChannel,this.isPublishingTencentCDN_=!1,this.publishGivenCDNData_=null,this.isPublishingGivenCDN_=!1}return s(e,[{key:"getIsPublishingTencentCDN",value:function(){return this.isPublishingTencentCDN_}},{key:"getIsPublishingGivenCDN",value:function(){return this.isPublishingGivenCDN_}},{key:"startPublishTencentCDN",value:function(e){var t=this;e=e||"".concat(this.client_.getSDKAppId(),"_").concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main");var n={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),requestTime:Date.now(),sessionId:gg("".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main")),streamId:e,streamType:0};return gd.info("startPublishTencentCDN: "+JSON.stringify(n)),new Promise((function(e,r){t.isPublishingTencentCDN_=!0;var i=setTimeout((function(){gd.error("startPublishTencentCDN timeout observed"),t.isPublishingTencentCDN_=!1,t.signalChannel_.off(fp.START_PUBLISH_TENCENT_CDN_RES,a),r(new Error("startPublishTencentCDN timeout"))}),5e3),a=function(n){clearTimeout(i);var a=n.data.content,o=a.errCode,s=a.errMsg;0===o?e():(t.isPublishingTencentCDN_=!1,-102083===o&&(s="Please enable relayed-push in https://console.cloud.tencent.com/trtc/ and try later, refer to https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/tutorial-26-advanced-publish-cdn-stream.html"),gd.error("startPublishTencentCDN failed, errCode: ".concat(o,", errMsg: ").concat(s)),r(new Error(s)))};t.signalChannel_.once(fp.START_PUBLISH_TENCENT_CDN_RES,a),t.signalChannel_.send(wp,n)}))}},{key:"stopPublishTencentCDN",value:function(){var e=this,t={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),requestTime:Date.now(),sessionId:gg("".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main"))};return gd.info("stopPublishTencentCDN: "+JSON.stringify(t)),new Promise((function(n,r){var i=setTimeout((function(){gd.error("stopPublishTencentCDN timeout observed"),e.signalChannel_.off(fp.STOP_PUBLISH_TENCENT_CDN_RES,a),r(new Error("stopPublishTencentCDN timeout"))}),5e3),a=function(t){clearTimeout(i);var a=t.data.content,o=a.errCode,s=a.errMsg;0===o?(e.isPublishingTencentCDN_=!1,n()):-102069===o?(gd.warn("stopPublishTencentCDN failed, can not stopPublishTencentCDN in auto relayed-push mode"),e.isPublishingTencentCDN_=!1,n()):(gd.error("stopPublishTencentCDN failed, errCode: ".concat(o," errMsg: ").concat(s)),r(new Error(s)))};e.signalChannel_.once(fp.STOP_PUBLISH_TENCENT_CDN_RES,a),e.signalChannel_.send(Ap,t)}))}},{key:"startPublishGivenCDN",value:function(e){var t=this,n={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),socketid:this.signalChannel_.getSocketId(),pushRequestTime:Date.now(),pushAppid:e.appId,pushBizId:e.bizId,pushCdnUrl:e.url,pushStreamType:"main"};return gd.info("startPublishGivenCDN: "+JSON.stringify(n)),this.publishGivenCDNData_=n,new Promise((function(e,r){t.isPublishingGivenCDN_=!0;var i=setTimeout((function(){gd.error("startPublishGivenCDN timeout observed"),t.isPublishingGivenCDN_=!1,t.signalChannel_.off(fp.START_PUBLISH_GIVEN_CDN_RES,a),r(new Error("startPublishGivenCDN timeout"))}),5e3),a=function(n){clearTimeout(i);var a=n.data.content,o=a.errCode,s=a.errMsg;0===o?e():(gd.error("startPublishGivenCDN failed, errCode: ".concat(o,", errMsg: ").concat(s)),t.isPublishingGivenCDN_=!1,r(new Error(s)))};t.signalChannel_.once(fp.START_PUBLISH_GIVEN_CDN_RES,a),t.signalChannel_.send(Dp,n)}))}},{key:"stopPublishGivenCDN",value:function(){var e=this,t=this.publishGivenCDNData_,n=t.pushAppid,r=t.pushBizId,i=t.pushCdnUrl,a=t.pushStreamType,o={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),socketid:this.signalChannel_.getSocketId(),pushRequestTime:Date.now(),pushAppid:n,pushBizId:r,pushCdnUrl:i,pushStreamType:a};return gd.info("stopPublishGivenCDN: "+JSON.stringify(o)),new Promise((function(t,n){var r=setTimeout((function(){gd.error("stopPublishGivenCDN timeout observed"),e.signalChannel_.off(fp.STOP_PUBLISH_GIVEN_CDN_RES,i),n(new Error("stopPublishGivenCDN timeout"))}),5e3),i=function(i){clearTimeout(r);var a=i.data.content,o=a.errCode,s=a.errMsg;0===o?(e.isPublishingGivenCDN_=!1,t()):(gd.error("stopPublishGivenCDN failed, errCode: ".concat(o," errMsg: ").concat(s)),n(new Error(s)))};e.signalChannel_.once(fp.STOP_PUBLISH_GIVEN_CDN_RES,i),e.signalChannel_.send(Pp,o)}))}}]),e}(),Tg=function(){function e(t){a(this,e),this.client_=t.client,this.durationMap_=new Map,this.installEvents()}return s(e,[{key:"installEvents",value:function(){xv.on(Ov.REMOTE_STREAM_SUBSCRIBED,this.handleSubscribed,this),xv.on(Ov.REMOTE_STREAM_TRACK_UPDATED,this.handleStreamTrackUpdated,this),xv.on(Ov.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),xv.on(Ov.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this)}},{key:"uninstallEvents",value:function(){xv.off(Ov.REMOTE_STREAM_SUBSCRIBED,this.handleSubscribed,this),xv.off(Ov.REMOTE_STREAM_UPDATED,this.handleStreamTrackUpdated,this),xv.off(Ov.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),xv.off(Ov.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this)}},{key:"handleSubscribed",value:function(e){var t=e.client,n=e.stream;if(t===this.client_){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);if(n.hasAudio())if(n.isMainAudioSubscribed){var o=new fg,s=this.durationMap_.get(a);s?this.isRecording(s.audio)||s.audio.push(o):this.durationMap_.set(a,{userId:r,type:i,audio:[o],video:[]})}else this.stopDurationItem(a,"audio");if(n.hasVideo())if("main"===i&&n.isMainVideoSubscribed||"auxiliary"===i&&n.isAuxVideoSubscribed){var c=new fg,u=this.durationMap_.get(a);u?this.isRecording(u.video)||u.video.push(c):this.durationMap_.set(a,{userId:r,type:i,audio:[],video:[c]})}else this.stopDurationItem(a,"video")}}},{key:"handleStreamStopped",value:function(e){var t=e.client,n=e.stream;if(this.clientHitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);this.stopDurationItem(a,"audio"),this.stopDurationItem(a,"video")}}},{key:"handleStreamTrackUpdated",value:function(e){var t=e.client,n=e.userId,r=e.tinyId,i=e.kind,a=e.action;if(this.clientHitTest(t)&&this.client_.getConnections().has(r)){var o=i===fs?i:"main",s="".concat(n,"_").concat(o);if(a===ms){var c=this.client_.getConnections().get(r).getSubscribeState();if(i===hs&&!c.audio||i===ps&&!c.video||i===fs&&!c.auxiliary)return;var u=new fg,d=this.durationMap_.get(s);d?(i!==hs||this.isRecording(d.audio)||d.audio.push(u),i===hs||this.isRecording(d.video)||d.video.push(u)):this.durationMap_.set(s,{userId:n,type:o,audio:i===hs?[u]:[],video:i===hs?[]:[u]})}else this.stopDurationItem(s,i===hs?"audio":"video")}}},{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()}}]),e}(),kg=fi.f,Rg=D((function(){return!Object.getOwnPropertyNames(1)}));_t({target:"Object",stat:!0,forced:Rg},{getOwnPropertyNames:kg});var bg,Eg,Ig,Cg,wg,Ag,Dg,Pg,xg,Og,Ng,Mg,Lg=new(function(){function e(){a(this,e),this.prefix_="TRTC",this.queue_=new Map,this.intervalId_=zd.setInterval(this.doFlush.bind(this),2e4),this.checkStorage()}return s(e,[{key:"getRealKey",value:function(e){return"".concat(this.prefix_,"_").concat(e)}},{key:"checkStorage",value:function(){var e=this;md()&&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})).forEach((function(e){return localStorage.removeItem(e)}))}},{key:"doFlush",value:function(){if(md())try{var e,t=k(this.queue_);try{for(t.s();!(e=t.n()).done;){var n=g(e.value,2),r=n[0],i=n[1];localStorage.setItem(r,JSON.stringify(i))}}catch(a){t.e(a)}finally{t.f()}}catch(cS){gd.warn(cS)}}},{key:"getItem",value:function(e){if(!md())return null;try{var t=JSON.parse(localStorage.getItem(this.getRealKey(e)));return t&&t.expiresIn>=Date.now()?t.value:null}catch(cS){gd.warn(cS)}}},{key:"setItem",value:function(e,t){if(md())try{var n={expiresIn:Date.now()+6048e5,value:t};this.queue_.set(this.getRealKey(e),n)}catch(cS){gd.warn(cS)}}},{key:"deleteItem",value:function(e){if(!md())return!1;try{return e=this.getRealKey(e),this.queue_.delete(e),localStorage.removeItem(e),!0}catch(cS){return gd.warn(cS),!1}}},{key:"clear",value:function(){if(md())try{localStorage.clear()}catch(cS){gd.warn(cS)}}}]),e}()),Vg={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5},Ug={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},Fg=function e(t){a(this,e),this.str_identifier=String(t.userId),this.uint64_tinyid=Number(t.tinyId),this.uint32_role=t.role},jg=function(){function e(t){var n=this;a(this,e),this.frameWorkType_=t.frameWorkType||30,this.client_=t.client,this.keyPrefix_="key_point",this.storageKey_="".concat(this.keyPrefix_,"_").concat(this.client_.getUserId()),this.log_=new Pv({id:"kpm|"+this.client_.getUserId(),direction:"local",type:""}),this.upload=vg({retryFunction:this.upload,settings:{timeout:500,retries:3},onError:function(e,t){return t()}}),Object.getOwnPropertyNames(this.__proto__).forEach((function(e){e.startsWith("handle")&&tu(n[e])&&(n[e]=function(e){var t=e.fn,n=e.context;return i(regeneratorRuntime.mark((function e(){var r,i,a,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(e.prev=0,r=o.length,i=new Array(r),a=0;a<r;a++)i[a]=o[a];return e.next=4,t.apply(n||this,i);case 4:return e.abrupt("return",e.sent);case 7:e.prev=7,e.t0=e.catch(0),gd.error("".concat(t.name,"() error observed ")+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])})))}({fn:n[e],context:n}))})),this.initData(),this.installEvents(),this.intervalId_=zd.setInterval(this.setStorage.bind(this),2e4)}var n,r,o;return s(e,[{key:"initData",value:function(){this.firstPublishedUserList_=[],this.networkQuality_={totalUplinkRTT:0,totalUplinkLoss:0,count:0,totalDownlinkRTTAndLossMap:new Map},this.basicInfo={string_sdk_version:"4.11.7",uint32_os_type:15,string_device_name:"",string_http_user_agent:navigator.userAgent,string_os_version:"",uint32_avg_rtt:0,uint32_avg_up_loss:0,uint32_scene:"live"===this.client_.getMode()?1:0,uint32_joining_duration:0,uint32_networkType:Vg[$c()],uint32_framework:this.frameWorkType_},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_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_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(){xv.on(Ov.JOIN_START,this.handleJoinStart,this),xv.on(Ov.JOIN_SEND_CMD,this.handleJoinSendCMD,this),xv.on(Ov.JOIN_RECEIVED_CMD_RES,this.handleJoinReceivedCMDResponce,this),xv.on(Ov.JOIN_SUCCESS,this.handleJoinSuccess,this),xv.on(Ov.JOIN_FAILED,this.handleJoinFailed,this),xv.on(Ov.RECEIVED_PUBLISHED_USER_LIST,this.handleReceivedPublishUserList,this),xv.on(Ov.CONNECTION_STATE_CHANGED,this.handleConnectionStateChanged,this),xv.on(Ov.LEAVE_START,this.handleLeaveStart,this),xv.on(Ov.LEAVE_SUCCESS,this.handleLeaveSuccess,this),xv.on(Ov.LEAVE_SEND_CMD,this.handleLeaveSendCMD,this),xv.on(Ov.CONNECTION_SEND_SUBSCRIBE_CMD,this.handleSendSubscribeCMD,this),xv.on(Ov.VIDEO_PLAYING,this.handleVideoPlaying,this),xv.on(Ov.AUDIO_PLAYING,this.handleAudioPlaying,this),xv.on(Ov.NETWORK_QUALITY,this.handleNetworkQuality,this),xv.on(Ov.HEARTBEAT_STATS,this.handleHeartbeatStats,this),xv.on(Ov.REMOTE_STREAM_ADDED,this.handleRemoteStreamAdded,this),xv.on(Ov.REMOTE_STREAM_SUBSCRIBE_START,this.handleRemoteStreamSubscribeStart,this),xv.on(Ov.REMOTE_STREAM_SUBSCRIBED,this.handleRemoteStreamSubscribed,this),xv.on(Ov.VIDEO_LOADED_DATA,this.handleVideoLoadedData,this),xv.on(Ov.PLAY_STREAM_START,this.handlePlayStream,this),xv.on(Ov.PUBLISH_START,this.handlePublishStart,this),xv.on(Ov.LOCAL_STREAM_INITIALIZE_START,this.handleLocalStreamInitStart,this),xv.on(Ov.LOCAL_STREAM_INITIALIZE_END,this.handleLocalStreamInitEnd,this),xv.on(Ov.LOCAL_STREAM_INITIALIZE_FAILED,this.handleLocalStreamInitFailed,this)}},{key:"uninstallEvents",value:function(){xv.off(Ov.JOIN_START,this.handleJoinStart,this),xv.off(Ov.JOIN_SEND_CMD,this.handleJoinSendCMD,this),xv.off(Ov.JOIN_RECEIVED_CMD_RES,this.handleJoinReceivedCMDResponce,this),xv.off(Ov.RECEIVED_PUBLISHED_USER_LIST,this.handleReceivedPublishUserList,this),xv.off(Ov.CONNECTION_STATE_CHANGED,this.handleConnectionStateChanged,this),xv.off(Ov.LEAVE_START,this.handleLeaveStart,this),xv.off(Ov.LEAVE_SUCCESS,this.handleLeaveSuccess,this),xv.off(Ov.JOIN_FAILED,this.handleJoinFailed,this),xv.off(Ov.LEAVE_SEND_CMD,this.handleLeaveSendCMD,this),xv.off(Ov.CONNECTION_SEND_SUBSCRIBE_CMD,this.handleSendSubscribeCMD,this),xv.off(Ov.VIDEO_LOADED_META_DATA,this.handleVideoPlaying,this),xv.off(Ov.AUDIO_LOADED_META_DATA,this.handleAudioPlaying,this),xv.off(Ov.NETWORK_QUALITY,this.handleNetworkQuality,this),xv.off(Ov.HEARTBEAT_STATS,this.handleHeartbeatStats,this),xv.off(Ov.REMOTE_STREAM_ADDED,this.handleRemoteStreamAdded,this),xv.off(Ov.REMOTE_STREAM_SUBSCRIBE_START,this.handleRemoteStreamSubscribeStart,this),xv.off(Ov.REMOTE_STREAM_SUBSCRIBED,this.handleRemoteStreamSubscribed,this),xv.off(Ov.VIDEO_LOADED_DATA,this.handleVideoLoadedData,this),xv.off(Ov.PLAY_STREAM_START,this.handlePlayStream,this),xv.off(Ov.PUBLISH_START,this.handlePublishStart,this),xv.off(Ov.LOCAL_STREAM_INITIALIZE_START,this.handleLocalStreamInitStart,this),xv.off(Ov.LOCAL_STREAM_INITIALIZE_END,this.handleLocalStreamInitEnd,this),xv.off(Ov.LOCAL_STREAM_INITIALIZE_FAILED,this.handleLocalStreamInitFailed,this)}},{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:"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,n=e.error;this.hitTest(t)&&(this.pathJoinRoom_.uint64_end_time=Date.now(),this.pathJoinRoom_.int32_end_ret=3,this.pathJoinRoom_.int32_send_request_enter_room_cmd_ret=n instanceof As?Number(n.getExtraCode()||n.getCode()):ws.UNKNOWN,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.content.userlist)}},{key:"handleConnectionStateChanged",value:function(e){var t=e.client,n=e.state,r=e.connection;if(this.hitTest(t)&&n===Do){this.client_.getUplinkConnection()===r&&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 i=this.pathMainVideoMap_.get("".concat(r.getUserId(),"_").concat("main"));i&&0===i.statsToReport.uint64_pc_connected_time&&(i.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,r=e.stream;if(this.hitTest(n)){var i=r.getUserId(),a=r.getType(),o="".concat(i,"_").concat(a),s=this.remoteStreamStatsMap_.get(o);if(s)s.stream=r;else{var c={userId:i,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({},Ug),stream:r};c.statsToReport.msg_user_info=new Fg({userId:i,tinyId:r.getTinyId(),role:ko}),c.statsToReport.uint32_stream_type="main"===a?2:7,this.remoteStreamStatsMap_.set(o,c)}}}},{key:"handleRemoteStreamSubscribeStart",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i),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 Fg(e),n=Date.now(),r="".concat(e.userId,"_").concat("main");e.trackState.video&&e.subscribeState.video&&!this.pathMainVideoMap_.has(r)&&this.pathMainVideoMap_.set(r,{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(r)&&this.pathMainAudioMap_.set(r,{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 i="".concat(e.userId,"_").concat("auxiliary");e.trackState.auxiliary&&e.subscribeState.auxiliary&&!this.pathAuxiliaryMap_.has(i)&&this.pathAuxiliaryMap_.set(i,{sendSubscribeCMDTime:n})}}},{key:"handleRemoteStreamSubscribed",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i),o=this.remoteStreamStatsMap_.get(a);o&&0===o.subscribedTime&&(o.subscribedTime=Date.now(),o.stream=n)}}},{key:"handlePlayStream",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),r="".concat(n,"_").concat(t.getType());if(this.remoteStreamStatsMap_.has(r)){var i=this.remoteStreamStatsMap_.get(r);0===i.playStreamTime&&(i.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(),r="".concat(n,"_").concat(t.getType());if(this.pathMainVideoMap_.has(r)){var i=this.pathMainVideoMap_.get(r);0===i.statsToReport.uint64_combine_first_frame_time&&(i.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(),r="".concat(n,"_").concat(t.getType()),i=Date.now();if(this.pathMainVideoMap_.has(r)){var a=this.pathMainVideoMap_.get(r);if(0===a.statsToReport.uint64_render_first_frame_time&&(a.statsToReport.uint64_render_first_frame_time=i),this.remoteStreamStatsMap_.has(r)){var o=this.remoteStreamStatsMap_.get(r),s=o.statsToReport,c=o.playStreamTime,u=o.subscribedTime;0===s.uint32_video_render_first&&c-u<=100&&(s.uint32_video_render_first=i-a.sendSubscribeCMDTime)}}if("auxiliary"===t.getType()&&this.pathAuxiliaryMap_.has(r)&&this.remoteStreamStatsMap_.has(r)){var d=this.remoteStreamStatsMap_.get(r),l=d.statsToReport,h=d.playStreamTime,p=d.subscribedTime;0===l.uint32_video_render_first&&h-p<=100&&(l.uint32_video_render_first=i-this.pathAuxiliaryMap_.get(r).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 r=this.pathMainAudioMap_.get(n);0===r.statsToReport.uint64_play_first_frame_time&&(r.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,r=e.loss,i=e.userId,a=t.networkQuality_.totalDownlinkRTTAndLossMap.get(i);a?(a.totalRTT+=n,a.totalLoss+=r,a.count++):t.networkQuality_.totalDownlinkRTTAndLossMap.set(i,{totalRTT:n,totalLoss:r,count:1})})))}},{key:"handleHeartbeatStats",value:function(e){var t=this;if(this.hitTest(e.client)){var n=e.stats,r=n.VideoReportState,i=n.AudioReportState;r.VideoEncState[0]&&(this.localStreamStats_.totalVideoBitrate+=r.uint32_video_snd_br,this.localStreamStats_.totalVideoFPS+=r.VideoEncState[0].uint32_enc_fps,this.localStreamStats_.totalVideoWidth+=r.VideoEncState[0].uint32_enc_width,this.localStreamStats_.totalVideoHeight+=r.VideoEncState[0].uint32_enc_height,this.localStreamStats_.videoCount++),r.VideoDecState.forEach((function(e){var n=0===e.uint32_video_strtype,r=2===e.uint32_video_strtype,i="".concat(e.userId,"_").concat(n?"main":"auxiliary");if(t.remoteStreamStatsMap_.has(i)){var a=t.remoteStreamStatsMap_.get(i);(n&&a.stream.isMainVideoSubscribed||r&&a.stream.isAuxVideoSubscribed)&&(a.totalVideoFPS+=e.uint32_video_recv_fps,a.totalVideoBitrate+=e.uint32_video_recv_br,a.videoCount++,0===a.statsToReport.uint32_video_width&&(a.statsToReport.uint32_video_width=e.uint32_dec_width),0===a.statsToReport.uint32_video_height&&(a.statsToReport.uint32_video_height=e.uint32_dec_height))}})),i&&(i.AudioDecState.forEach((function(e){var n="".concat(e.userId,"_").concat("main");if(t.remoteStreamStatsMap_.has(n)){var r=t.remoteStreamStatsMap_.get(n);r.stream.isMainAudioSubscribed&&(r.totalAudioBitrate+=e.uint32_audio_real_recv_br,r.audioCount++,Math.floor(100*e.audioLevel)>0&&(r.totalAudioLevel+=e.audioLevel,r.audioLevelCount++))}})),Math.floor(100*i.sentAudioLevel)>0&&(this.localStreamStats_.totalAudioLevel+=i.sentAudioLevel,this.localStreamStats_.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,r=e.error,i=r instanceof As?r.getExtraCode()||r.getCode():{NotFoundError:1,NotAllowedError:2,NotReadableError:3,OverConstrainedError:4,AbortError:5}[r.name]||ws.UNKNOWN;t&&0===this.pathJoinRoom_.uint64_init_audio_end_time&&(this.pathJoinRoom_.int32_init_audio_ret=i,this.pathJoinRoom_.uint64_init_audio_end_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_end_time&&(this.pathJoinRoom_.int32_init_camera_ret=i,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:(o=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(t=Lg.getItem(this.storageKey_))){e.next=6;break}return e.next=5,this.upload(t);case 5:Lg.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 o.apply(this,arguments)})},{key:"setStorage",value:function(){this.prepareReport();var e=this.getReportData();0!==e.msg_path_enter_room.uint64_start_time&&Lg.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 r=t.userId;if(e.networkQuality_.totalDownlinkRTTAndLossMap.has(r)){var i=e.networkQuality_.totalDownlinkRTTAndLossMap.get(r),a=i.totalLoss,o=i.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,"audio"),t.statsToReport.uint32_video_play_time=s.getDuration(n,"video")),t.statsToReport.uint32_video_render_first=Math.min(t.statsToReport.uint32_video_render_first,5e3);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>5e3&&(t.statsToReport.uint64_play_first_frame_time=t.statsToReport.uint64_start_enter_time+5e3):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>5e3&&(t.statsToReport.uint64_render_first_frame_time=t.statsToReport.uint64_start_enter_time+5e3):e.pathMainVideoMap_.delete(n)})),this.pathJoinRoom_.uint64_end_time-this.pathJoinRoom_.uint64_start_time>5e3&&(this.pathJoinRoom_.uint64_end_time=this.pathJoinRoom_.uint64_start_time+5e3)}},{key:"getReportData",value:function(){var e=this.client_.getSignalInfo();return{uint32_sdk_app_id:Number(this.client_.getSDKAppId()),msg_user_info:new Fg({userId:this.client_.getUserId(),tinyId:this.client_.getTinyId(),role:"anchor"===this.client_.getRole()?ko:Ro}),msg_basic_info:this.basicInfo,uint32_acc_ip:uu(e.relayIp),uint32_client_ip:uu(e.localIp,"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:S(this.pathMainVideoMap_.values()).map((function(e){return e.statsToReport})),msg_quality_statistics:S(this.remoteStreamStatsMap_.values()).map((function(e){return e.statsToReport})),str_room_name:String(this.client_.getRoomId()),msg_path_recv_audio:S(this.pathMainAudioMap_.values()).map((function(e){return e.statsToReport})),uint32_info_client_ip:uu(e.localIp,"small"),error_code:[],msg_local_statistics:this.localStreamStats_.statsToReport}}},{key:"report",value:(r=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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:Lg.deleteItem(this.storageKey_),this.initData(),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 r.apply(this,arguments)})},{key:"upload",value:(n=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!fd&&0!==t.msg_path_enter_room.uint64_start_time){e.next=2;break}return e.abrupt("return");case 2:return n=Math.floor(Math.random()*Math.pow(2,31)),r=Number(this.client_.getSDKAppId()),i="".concat("https://yun.tim.qq.com","/v5/AVQualityReportSvc/C2S?random=").concat(n,"&sdkappid=").concat(r,"&cmdtype=jssdk_new_endreport"),e.next=7,Uc.post(i,JSON.stringify(t));case 7:if("ok"===(a=e.sent).data){e.next=10;break}throw"key point upload failed: ".concat(a.data);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})}]),e}();function Bg(){return function(e,t,n){var r=n.value,a=new Map;return n.value=i(regeneratorRuntime.mark((function e(){var n,i,o,s,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.get(this)){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:If,data:{name:t}})});case 2:for(e.prev=2,a.set(this,!0),n=c.length,i=new Array(n),o=0;o<n;o++)i[o]=c[o];return e.next=7,r.apply(this,i);case 7:return s=e.sent,a.set(this,!1),e.abrupt("return",s);case 12:throw e.prev=12,e.t0=e.catch(2),a.set(this,!1),e.t0;case 16:case"end":return e.stop()}}),e,this,[[2,12]])}))),n}}var Hg=(bg=Bg(),Eg=eg(Xv.CLIENT.join),Ig=Bg(),Cg=Bg(),wg=eg(Xv.CLIENT.publish),Ag=Bg(),Dg=eg(Xv.CLIENT.unpublish),Pg=eg.apply(void 0,S(Xv.CLIENT.subscribe)),xg=eg(Xv.CLIENT.unsubscribe),Og=Bg(),Ng=eg(Xv.CLIENT.switchRole),R((Mg=function(){function Client(e){var t,n=this;if(a(this,Client),this.name_=Rs,this.mode_=e.mode,this.sdpSemantics_="plan-b",nu(e.sdpSemantics)?function(){if(!q_())return!1;if(nu(window.RTCRtpTransceiver))return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;var e=new RTCPeerConnection,t=!1;try{e.addTransceiver("audio"),t=!0}catch(cS){}return e.close(),t}()&&(this.sdpSemantics_="unified-plan"):this.sdpSemantics_=e.sdpSemantics,this.sdkAppId_=e.sdkAppId,this.userId_=e.userId,this.log_=new Pv({id:"c".concat(e.seq,"|").concat(this.userId_),direction:"local",type:""}),this.userSig_=e.userSig,this.roomId_=0,this.useStringRoomId_=e.useStringRoomId||!1,this.recordId_=null,this.pureAudioPushMode_=null,this.version_=e.version,this.log_.info("using sdpSemantics: "+this.sdpSemantics_),gd.setConfig({sdkAppId:this.sdkAppId_,userId:this.userId_,version:this.version_}),!nu(e.recordId)){if(!Number.isInteger(Number(e.recordId)))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Gf})});this.recordId_=e.recordId}this.signalChannel_=null,this.isScreenShareOnly_=0,nu(e.isScreenShareOnly)||(this.isScreenShareOnly_=e.isScreenShareOnly?1:0),this.role_="anchor",this.privateMapKey_="",this.tinyId_=0,this.env_="",this.proxy_=null,this.connections_=new Map,this.mutedStates_=new Map,this.userMap_=new Map,this.syncUserListInterval_=-1,this.localStream_=null,this.uplinkConnection_=null,this.emitter_=new ip,this.signalInfo_={},this.isSignalReady_=!1,this.isJoined_=!1,this.heartbeat_=-1,this.lastHeartBeatTime_=-1,this.stats_=new Dv,this.joinTimeout_=-1,this.networkQuality_=null,this.badCaseDetector_=null,this.autoSubscribe_=!!nu(e.autoSubscribe)||e.autoSubscribe,this.startJoinTimestamp_=0,this.joinedTimestamp_=0,this.joinOptions={},this.basis_={browser:vd().name+"/"+vd().version,os:Z_(),displayResolution:ev(),isScreenShareSupported:J_(),isWebRTCSupported:V_(),isGetUserMediaSupported:tv(),isWebAudioSupported:nv(),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING,isWebCodecSupported:(t={AudioDecoder:!1,AudioEncoder:!1,VideoDecoder:!1,VideoEncoder:!1,ImageDecoder:!1},nu(window.AudioDecoder)||(t.AudioDecoder=!0),nu(window.AudioEncoder)||(t.AudioEncoder=!0),nu(window.VideoDecoder)||(t.VideoDecoder=!0),nu(window.VideoEncoder)||(t.VideoEncoder=!0),nu(window.ImageDecoder)||(t.ImageDecoder=!0),t),isMediaSessionSupported:"mediaSession"in navigator&&!nu(navigator.mediaSession.setActionHandler),isWebTransportSupported:!nu(window.WebTransport)},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_=null,this.keyPointManager_=new jg({client:this,frameWorkType:e.frameWorkType}),this.getUserList=vg({retryFunction:this.getUserList,settings:{retries:3},onError:function(e,t){return t()},onRetrying:function(e){n.log_.info("retrying to get user list [".concat(e,"/3]"))}}),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}}var e,n,r,o,c,u,d,l,h,p,f,m,_,v,y,T,R,b,E,I,C,w,A,D;return s(Client,[{key:"initBussinessInfo_",value:function(e){this.bussinessInfo_=e.bussinessInfo;var t={};if(ru(e.bussinessInfo)&&(t=JSON.parse(e.bussinessInfo)),!nu(e.pureAudioPushMode)){if(!Number.isInteger(Number(e.pureAudioPushMode)))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Jf})});this.pureAudioPushMode_=e.pureAudioPushMode,t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.pure_audio_push_mod=this.pureAudioPushMode_}if(!nu(e.streamId)){if(!(ru(e.streamId)&&String(e.streamId)&&String(e.streamId).length<=64))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:zf})});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_streamid_main=e.streamId}if(!nu(e.userDefineRecordId)){if(null===e.userDefineRecordId.match(/^[A-Za-z0-9_-]{1,64}$/gi))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Wf})});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_record_id=e.userDefineRecordId}if(!nu(e.userDefinePushArgs)){if(!(ru(e.userDefinePushArgs)&&String(e.userDefinePushArgs)&&String(e.userDefinePushArgs).length<=256))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:qf})});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_push_args=e.userDefinePushArgs}kf(t)||(this.bussinessInfo_=JSON.stringify(t))}},{key:"setProxyServer",value:function(e){if(this.log_.info("set proxy server: ".concat(JSON.stringify(e))),ru(e)){if(!e.startsWith("wss://"))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Kf})});this.proxy_=e}else if(Zc(e)){var t=e.websocketProxy,n=e.loggerProxy;t&&(this.proxy_=t),n&&So(n)}}},{key:"schedule",value:(D=i(regeneratorRuntime.mark((function e(n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,du({userId:this.userId_,sdkAppId:this.sdkAppId_,roomId:n,useStringRoomId:this.useStringRoomId_,version:this.version_,userSig:this.userSig_});case 2:(r=e.sent)&&(this.log_.debug("schedule: ".concat(JSON.stringify(r))),this.schedule_=t(t({},this.schedule_),r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"getSignalChannelUrl",value:function(){var e={mainUrl:fo,backupUrl:mo},t=Qc();return t?e.mainUrl=e.backupUrl="wss://".concat(t,".rtc.qq.com"):this.proxy_?e.mainUrl=e.backupUrl=this.proxy_: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:"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(su(e))})):Zc(e)&&t.push(su(e)),this.turnServers_=t}},{key:"getIceTransportPolicy",value:function(){return this.iceTransportPolicy_||this.schedule_.iceTransportPolicy||"all"}},{key:"initialize",value:function(){var e=this;return new Promise((function(t,n){e.log_.info("setup signal channel");var r=e.getSignalChannelUrl(),i=r.mainUrl,a=r.backupUrl;e.signalChannel_=new T_({sdkAppId:e.sdkAppId_,userId:e.userId_,userSig:e.userSig_,url:i,backupUrl:a,version:e.version_,client:e}),e.networkQuality_||(e.networkQuality_=new Nv({connections:e.connections_,signalChannel:e.signalChannel_,userId:e.userId_,client:e}),e.networkQuality_.on(kv,(function(t){e.emitter_.emit(kv,t)}))),e.deviceDetector_||(e.deviceDetector_=new Mv),e.subscriptionManager_||(e.subscriptionManager_=new ag({client:e})),e.badCaseDetector_||(e.badCaseDetector_=new mg({client:e})),e.callDurationCalculator_||(e.callDurationCalculator_=new Tg({client:e})),e.mixTranscodeManager_||(e.mixTranscodeManager_=new Sg({client:e,signalChannel:e.signalChannel_})),e.publishCDNManager_||(e.publishCDNManager_=new yg({client:e,signalChannel:e.signalChannel_})),e.signalChannel_.on(ap,(function(t){switch(e.log_.info("SignalChannel state changed from ".concat(t.prevState," to ").concat(t.state)),t.state){case lp:t.prevState===dp?(e.log_.warn("signal channel reconnect successfully"),e.syncUserList(),qc({eventType:Yo})):t.prevState===up&&qc({eventType:Qo})}e.emitter_.emit(fv,t)})),e.signalChannel_.on(sp,(function(t){e.isSignalReady_?(e.closeUplink(),e.closeConnections(),e.emitter_.emit(bv,t)):n(t)})),e.signalChannel_.on(fp.CHANNEL_SETUP_FAILED,(function(t){e.log_.error("signal channel setup failed"),n(t)})),e.signalChannel_.on(fp.CHANNEL_SETUP_SUCCESS,(function(n){e.signalInfo_=n.signalInfo,e.tinyId_=e.signalInfo_.tinyId,e.isSignalReady_||(e.isSignalReady_=!0,t())})),e.signalChannel_.on(fp.PEER_JOIN,e.onPeerJoin,e),e.signalChannel_.on(fp.PEER_LEAVE,e.onPeerLeave,e),e.signalChannel_.on(fp.STREAM_ADDED,(function(t){e.onRemoteStreamAdded(t.data)})),e.signalChannel_.on(fp.STREAM_REMOVED,(function(t){e.onRemoteStreamRemoved(t.data)})),e.signalChannel_.on(fp.UPDATE_REMOTE_MUTE_STAT,(function(t){xv.emit(Ov.RECEIVED_PUBLISHED_USER_LIST,{client:e,data:t.data}),e.onPublishedUserList(t.data),e.onUpdateRemoteMuteStat(t.data)})),e.signalChannel_.on(fp.CLINET_BANNED,(function(t){var n=t.data.content;e.reset();var r=n.type;"banned"===n.type?r="you got banned by account admin":"kick"===n.type?r="duplicated userId joining the room":"user_time_out"===n.type&&e.log_.warn("last heart beat time: ".concat(e.lastHeartBeatTime_," interval: ").concat(Date.now()-e.lastHeartBeatTime_)),Jc("stat-banned:".concat(n.type)),e.log_.error("user was banned because of [".concat(n.type,"]")),e.onClientBanned(r)})),e.signalChannel_.on(fp.REQUEST_REBUILD_SESSION,(function(t){e.signalInfo_=t.signalInfo;var n=[];e.connections_&&n.push(0);var r,i=[],a=k(e.connections_);try{for(a.s();!(r=a.n()).done;){var o=g(r.value,2),s=o[0],c=o[1];n.push(s);var u=c.getPeerConnection();if(u){var d=u.remoteDescription;d&&i.push(d.sdp)}}}catch(h){a.e(h)}finally{a.f()}var l={socketid:e.signalInfo_.socketId,tinyid:e.tinyId_,appid:e.sdkAppId_,openid:e.userId_,sessionid:String(e.roomId_),sids:n,relayInfo:e.signalInfo_.relayInnerIp,remotesdp:i,useStrRoomid:!!e.useStringRoomId_&&1};e.log_.debug("reconnect - rebuild session with data: ".concat(JSON.stringify(l))),e.signalChannel_.send(Sp,l)})),e.signalChannel_.on(fp.CLIENT_REJOIN,(function(){e.reJoin()})),e.signalChannel_.connect()}))}},{key:"join",value:(A=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isJoined_){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Qf})});case 2:return e.next=4,G_();case 4:if(this.checkSystemResult_=e.sent,(n=Qc())||(n="qcloud",this.proxy_&&(this.proxy_.startsWith(_o)?n="trtc":this.proxy_.startsWith(vo)&&(n="webrtc"))),this.env_=n,Gc({env:n,sdkAppId:this.sdkAppId_,userId:this.userId_,version:this.version_}),this.uploadTrtcStats(),r=this.checkSystemResult_.detail,i=r.isH264EncodeSupported,a=r.isVp8EncodeSupported,V_()&&(i||a)){e.next=13;break}throw new As({code:ws.NOT_SUPPORTED,message:y_({key:c_})});case 13:if(this.joinOptions=t,this.startJoinTimestamp_=cu(),xv.emit(Ov.JOIN_START,{client:this}),Sf(this.userId_,{eventId:nf,eventDesc:"joining room",timestamp:jc(),userId:this.userId_,tinyId:this.tinyId_}),e.prev=17,this.schedule_.domains){e.next=21;break}return e.next=21,this.schedule(t.roomId);case 21:return e.next=23,this.initialize(t);case 23:return e.next=25,this.doJoin(t);case 25:xv.emit(Ov.JOIN_SUCCESS,{client:this}),this.joinedTimestamp_=cu(),o=this.joinedTimestamp_-this.startJoinTimestamp_,qc({eventType:xo,delta:o}),qc({eventType:Po}),e.next=38;break;case 32:throw e.prev=32,e.t0=e.catch(17),xv.emit(Ov.JOIN_FAILED,{client:this,error:e.t0}),Kc({eventType:Po,error:e.t0}),this.reset(),e.t0;case 38:case"end":return e.stop()}}),e,this,[[17,32]])}))),function(e){return A.apply(this,arguments)})},{key:"uploadTrtcStats",value:(w=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,sS.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,sS.getCameras();case 12:i=e.sent,n=i&&i.length,e.next=18;break;case 16:e.prev=16,e.t1=e.catch(9);case 18:a={microphone:t,camera:n},o=this.checkSystemResult_.detail,s=o.isH264EncodeSupported,c=o.isVp8EncodeSupported,u=o.isH264DecodeSupported,d=o.isVp8DecodeSupported,l={webRTC:this.basis_.isWebRTCSupported,getUserMedia:this.basis_.isGetUserMediaSupported,webSocket:this.basis_.isWebSocketsSupported,screenShare:this.basis_.isScreenShareSupported,webAudio:this.basis_.isWebAudioSupported,h264Encode:s,h264Decode:u,vp8Encode:c,vp8Decode:d},h={browser:this.basis_.browser,os:this.basis_.os,trtc:l,devices:a},p={isWebCodecSupported:this.basis_.isWebCodecSupported,isMediaSessionSupported:this.basis_.isMediaSessionSupported,isWebTransportSupported:this.basis_.isWebTransportSupported},Jc("trtcstats-"+JSON.stringify(h)),this.log_.info("TrtcStats-"+JSON.stringify(h)),Jc("trtcadvancedstats-"+JSON.stringify(p));case 26:case"end":return e.stop()}}),e,this,[[0,7],[9,16]])}))),function(){return w.apply(this,arguments)})},{key:"getVersion",value:function(){var e=this.version_.split(".");return 1e3*parseInt(e[0])+100*parseInt(e[1])+parseInt(e[2])}},{key:"doJoin",value:function(e){var t=this;return new Promise((function(n,r){if(!t.isSignalReady_)throw new As({code:ws.INVALID_OPERATION,message:y_({key:Xf})});t.roomId_=e.roomId,nu(e.role)||(t.role_=e.role);var i="";nu(e.privateMapKey)||(i=e.privateMapKey),t.privateMapKey_=i,t.log_.info("Join() => joining room: ".concat(e.roomId," useStringRoomId: ").concat(t.useStringRoomId_," mode: ").concat(t.mode_," role: ").concat(t.role_));var a=t.signalInfo_,o={openid:a.openId,tinyid:a.tinyId,peerconnectionport:"",useStrRoomid:!!t.useStringRoomId_&&1,roomid:String(e.roomId),sdkAppID:String(t.sdkAppId_),socketid:a.socketId,userSig:t.userSig_,privMapEncrypt:i,privMap:"",relayip:a.relayInnerIp,dataport:a.dataPort,stunport:a.stunPort,checkSigSeq:a.checkSigSeq,pstnBizType:0,pstnPhoneNumber:null,recordId:t.recordId_,role:"user",jsSdkVersion:String(t.getVersion()),sdpSemantics:t.sdpSemantics_,browserVersion:pd,closeLocalMedia:!0,trtcscene:"live"===t.mode_?To:yo,trtcrole:"anchor"===t.role_?ko:Ro,bussinessInfo:t.bussinessInfo_,isAuxUser:t.isScreenShareOnly_,autoSubscribe:t.autoSubscribe_};t.joinTimeout_=setTimeout((function(){t.log_.error("join room timeout observed"),r(new As({code:ws.JOIN_ROOM_FAILED,message:y_({key:$f})}))}),5e3),xv.emit(Ov.JOIN_SEND_CMD,{client:t});var s={AbilityOption:{GeneralLimit:{CPULimit:{uint32_CPU_num:String(navigator.hardwareConcurrency||0),str_CPU_name:String(navigator.platform),uint32_CPU_maxfreq:String(0),model:"",uint32_total_memory:String(0)},uint32_terminal_type:String(Su?4:_u?2:mu?3:qu?12:Wu?5:Ku?13:1),uint32_device_type:String(0),str_os_verion:Su?"Android":_u?"iPhone":mu?"iPad":qu?"Mac":Wu?"Windows":Ku?"Linux":"unknown",uint32_link_type:String(1),str_client_version:"4.11.7",uint32_net_type:String(vs[$c()]),ua:navigator.userAgent,version:""}}},c=t.getSystemResult().detail,u=c.isH264EncodeSupported,d=c.isVp8EncodeSupported,l="";u?l="H264":d&&(l="VP8");var h={EncVideoCodec:l,EncVideoWidth:0,EncVideoHeight:0,EncVideoBr:"0",EncVideoFps:0,EncAudioCodec:"opus",EncAudioFS:0,EncAudioCh:0,EncAudioBr:"0"};s.AbilityOption.AVLimit=h,t.signalChannel_.sendWithReport(_p,o,s),t.signalChannel_.once(fp.JOIN_ROOM_RESULT,(function(e){clearTimeout(t.joinTimeout_),t.joinTimeout_=-1;var i=e.data.content.ret;xv.emit(Ov.JOIN_RECEIVED_CMD_RES,{client:t,code:i}),i?(t.log_.error("Join room failed result: "+i+" error: "+e.data.content.error),r(new As({code:ws.JOIN_ROOM_FAILED,extraCode:i,message:y_({key:Zf,data:{error:e.data.content.error}})}))):(t.isJoined_=!0,t.log_.info("Join room success, start heartbeat"),t.startHeartbeat(),t.badCaseDetector_&&t.badCaseDetector_.start(),t.syncUserList(),t.startSyncUserListInterval(),n())}))}))}},{key:"connectSignalBeforeReJoin",value:function(){var e=this;return new Promise((function(t,n){e.log_.warn("connectSignalBeforeReJoin() try to connect signal before reJoin"),e.isSignalReady_=!1,e.signalChannel_.close(),e.signalChannel_.once(fp.CHANNEL_SETUP_SUCCESS,(function(n){e.log_.warn("connectSignalBeforeReJoin() signal setup successfully"),t()})),e.signalChannel_.once(sp,(function(t){e.log_.warn("connectSignalBeforeReJoin() signal setup failed"),n(t)})),e.signalChannel_.connect()}))}},{key:"reJoin",value:(C=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_){e.next=3;break}return this.log_.warn("reJoin() you haven't join room yet, abort reJoin"),e.abrupt("return");case 3:return this.isJoined_=!1,e.prev=4,this.log_.warn("reJoin() try to reJoin room: ".concat(this.joinOptions.roomId)),this.subscriptionManager_&&this.subscriptionManager_.markAllStream(),e.next=9,this.connectSignalBeforeReJoin();case 9:return e.next=11,this.doJoin(this.joinOptions);case 11:if(this.log_.warn("reJoin() reJoin successfully"),qc({eventType:Oo}),this.checkConnectionsToReconnect(),e.prev=14,!this.uplinkConnection_||!this.localStream_||this.uplinkConnection_.getIsReconnecting()){e.next=18;break}return e.next=18,this.republish();case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(14);case 22:e.next=29;break;case 24:e.prev=24,e.t1=e.catch(4),this.log_.warn("reJoin() reJoin failed"+e.t1),Kc({eventType:Oo,error:e.t1}),this.emitter_.emit(bv,new As({code:ws.JOIN_ROOM_FAILED,message:y_({key:em,data:{roomId:this.joinOptions.roomId}})}));case 29:case"end":return e.stop()}}),e,this,[[4,24],[14,20]])}))),function(){return C.apply(this,arguments)})},{key:"republish",value:(I=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.log_.warn("republish() try to re-publish localStream"),t=this.localStream_,e.next=5,this.doUnpublish(t);case 5:return e.next=7,this.publish(t);case 7:this.log_.warn("republish() re-publish localStream successfully"),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),this.log_.warn("republish() re-publish localStream failed "+e.t0),e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return I.apply(this,arguments)})},{key:"leave",value:(E=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xv.emit(Ov.LEAVE_START,{client:this}),Sf(this.userId_,{eventId:rf,eventDesc:"leaving room",timestamp:jc(),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(),xv.emit(Ov.LEAVE_SUCCESS,{client:this}),qc({eventType:No}),t=Math.floor((cu()-this.joinedTimestamp_)/1e3),qc({eventType:Mo,delta:t});case 14:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(){return E.apply(this,arguments)})},{key:"doLeave",value:function(){this.isJoined_&&(xv.emit(Ov.LEAVE_SEND_CMD,{client:this}),this.log_.info("leave() => leaving room"),this.signalChannel_.send(vp),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:"destroy",value:function(){if(this.isJoined_)throw this.log_.warn("please call leave() before destroy() client"),new As({code:ws.INVALID_OPERATION,message:y_({key:tm})});this.log_.info("destroying SignalChannel"),this.signalChannel_&&(this.signalChannel_.close(),this.signalChannel_=null)}},{key:"reset",value:function(){this.keyPointManager_&&this.keyPointManager_.prepareReport(),this.mixTranscodeManager_&&(this.mixTranscodeManager_.stop(),this.mixTranscodeManager_=null),this.publishCDNManager_&&(this.publishCDNManager_=null),this.userMap_.clear(),this.stopSyncUserListInterval(),this.stopHeartbeat(),this.closeConnections(),this.mutedStates_.clear(),this.clearNetworkQuality(),this.badCaseDetector_&&this.callDurationCalculator_&&this.uploadAllCallStats(),this.closeUplink(),this.isJoined_=!1,this.isSignalReady_=!1,this.destroy()}},{key:"startSyncUserListInterval",value:function(){"live"===this.mode_&&"audience"===this.role_&&-1===this.syncUserListInterval_&&(this.syncUserListInterval_=zd.setInterval(this.syncUserList.bind(this),1e4))}},{key:"stopSyncUserListInterval",value:function(){zd.clearInterval(this.syncUserListInterval_),this.syncUserListInterval_=-1}},{key:"syncUserList",value:(b=i(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.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&&(n.log_.info("peer leave detected: ".concat(e.userId)),n.cleanUser({userId:e.userId,tinyId:e.tinyId}))})),t.forEach((function(e){var t=e.userId;n.userMap_.has(t)||t===n.userId_||(n.userMap_.set(t,e),n.emitter_.emit(mv,{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 b.apply(this,arguments)})},{key:"getUserList",value:function(){var e=this;return new Promise((function(t,n){e.signalChannel_.send(Np),e.signalChannel_.once(fp.USER_LIST_RES,(function(e){var n=e.data.content.userlist.map((function(e){var t=e.userid,n=e.srctinyid,r=e.role;return new _g({userId:t,tinyId:n,role:r})}));t(n)})),setTimeout(n,2e3)}))}},{key:"publish",value:(R=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.setPublishState(Ss),this.isPublishing_=!0,n=cu(),xv.emit(Ov.PUBLISH_START,{client:this,stream:t}),this.log_.info("publish() => publishing local stream"),r=new ug({userId:this.userId_,tinyId:this.tinyId_,client:this,isUplink:!0,signalChannel:this.signalChannel_}),t.setConnection(r),r.initialize(),r.on(cv,(function(e){var t=e.getCode();t!==ws.ICE_TRANSPORT_ERROR&&(t===ws.UPLINK_RECONNECTION_FAILED&&o.closeUplink(),o.emitter_.emit(bv,e))})),e.prev=9,e.next=12,r.publish(t);case 12:this.localStream_=e.sent,this.localStream_.getBeautyStatus()&&this.log_.info("beauty stream is published successfully"),this.log_.info("local stream is published successfully"),this.isPublishing_=!1,t.setPublishState(ys),this.uplinkConnection_=r,i=cu(),a=i-n,qc({eventType:Lo}),qc({eventType:Vo,delta:a}),t.hasAudio()&&Sf(this.userId_,{eventId:Up,eventDesc:"publish audio track",timestamp:jc(),userId:this.userId_,tinyId:this.tinyId_}),t.hasVideo()&&Sf(this.userId_,{eventId:Vp,eventDesc:"publish video track",timestamp:jc(),userId:this.userId_,tinyId:this.tinyId_}),this.networkQuality_&&this.networkQuality_.setUplinkConnection(this.uplinkConnection_),this.deviceDetector_&&this.deviceDetector_.setLocalStream(this.localStream_),xv.emit(Ov.LOCAL_STREAM_PUBLISHED,{localStream:this.localStream_}),this.notPublishWithoutH264Supported_=!1,e.next=39;break;case 30:throw e.prev=30,e.t0=e.catch(9),e.t0 instanceof As&&e.t0.getCode()===ws.NOT_SUPPORTED_H264&&(this.notPublishWithoutH264Supported_=!0),t.setPublishState(gs),r.close(),this.log_.error("failed to publish stream "+e.t0),this.isPublishing_=!1,Kc({eventType:Lo,error:e.t0}),e.t0;case 39:case"end":return e.stop()}}),e,this,[[9,30]])}))),function(e){return R.apply(this,arguments)})},{key:"unpublish",value:(T=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.log_.info("unpublish() => unpublishing local stream"),e.prev=1,e.next=4,this.doUnpublish();case 4:qc({eventType:Uo}),e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(1),Kc({eventType:Uo,error:e.t0}),e.t0;case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return T.apply(this,arguments)})},{key:"doUnpublish",value:function(){var e=this;return this.signalChannel_.sendWaitForResponse({command:bp,commandDesc:"unpublish",responseCommand:fp.UNPUBLISH_RESULT}).then((function(){e.closeUplink()})).catch((function(){e.closeUplink()}))}},{key:"closeUplink",value:function(){this.uplinkConnection_&&(this.uplinkConnection_.getIsReconnecting()&&this.uplinkConnection_.stopReconnection(),this.uplinkConnection_.close(),this.uplinkConnection_=null,this.networkQuality_&&this.networkQuality_.setUplinkConnection(null),this.localStream_.hasAudio()&&Sf(this.userId_,{eventId:jp,eventDesc:"unpublish audio track",timestamp:jc(),userId:this.userId_,tinyId:this.tinyId_}),this.localStream_.hasVideo()&&Sf(this.userId_,{eventId:Fp,eventDesc:"unpublish video track",timestamp:jc(),userId:this.userId_,tinyId:this.tinyId_}),this.localStream_.setConnection(null),this.localStream_=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:(y=i(regeneratorRuntime.mark((function e(t,n){var r,i,a;return regeneratorRuntime.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(n))),nu(n)&&(n={audio:!0,video:!0}),nu(n.video)&&(n.video=!0),nu(n.audio)&&(n.audio=!0),e.prev=4,r=t.getConnection(),xv.emit(Ov.REMOTE_STREAM_SUBSCRIBE_START,{client:this,stream:t}),e.next=9,r.subscribe(t,n);case 9:this.subscriptionManager_&&this.subscriptionManager_.addSubscriptionRecord(t.getUserId(),t,n),this.notSubscribeWithoutH264Supported_=!1,qc({eventType:Fo}),e.next=22;break;case 14:throw e.prev=14,e.t0=e.catch(4),(i=e.t0 instanceof As?e.t0.getCode():ws.UNKNOWN)===ws.NOT_SUPPORTED_H264&&(this.notSubscribeWithoutH264Supported_=!0),a=new As({code:i,message:y_({key:cm,data:{message:e.t0.message}})}),Kc({eventType:Fo,error:a}),this.log_.error(a),a;case 22:case"end":return e.stop()}}),e,this,[[4,14]])}))),function(e,t){return y.apply(this,arguments)})},{key:"unsubscribe",value:(v=i(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.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,n=t.getConnection(),e.next=5,n.unsubscribe(t);case 5:this.subscriptionManager_&&this.subscriptionManager_.addUnsubscriptionRecord(t.getUserId(),t),xv.emit(Ov.REMOTE_STREAM_UNSUBSCRIBED,{client:this,stream:t}),qc({eventType:jo}),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(1),Kc({eventType:jo,error:e.t0}),e.t0;case 14:case"end":return e.stop()}}),e,this,[[1,10]])}))),function(e){return v.apply(this,arguments)})},{key:"switchRole",value:(_=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.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:if("audience"!==t||!this.localStream_){e.next=5;break}return e.next=5,this.unpublish(this.localStream_);case 5:return this.log_.info("switchRole() => switch role to: "+t),e.next=8,this.doSwitchRole(t);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"doSwitchRole",value:function(e){var t=this;return new Promise((function(n,r){var i={trtcscene:"live"===t.mode_?To:yo,trtcrole:"anchor"===e?ko:Ro};t.log_.info("switchRole signal data: "+JSON.stringify(i));var a=setTimeout((function(){t.log_.error("switchRole timeout observed"),t.signalChannel_.off(fp.SWITCH_ROLE_RES,o),r(new As({code:ws.SWITCH_ROLE_FAILED,message:y_({key:lm})}))}),5e3),o=function(i){clearTimeout(a);var o=i.data.content,s=o.errCode,c=o.errMsg;0===s?(t.role_=e,n()):(t.log_.error("switchRole failed, errCode: ".concat(s,", errMsg: ").concat(c)),r(new As({code:ws.SWITCH_ROLE_FAILED,message:y_({key:hm,data:{errMsg:c,errCode:s}})})))};t.signalChannel_.once(fp.SWITCH_ROLE_RES,o),t.signalChannel_.send(Mp,i)}))}},{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(r,i,a){var o=e.connections_.get(i);o&&n.push(t({userId:o.getUserId()},r))})),n}},{key:"getTransportStats",value:(m=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s;return regeneratorRuntime.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:n=e.sent,t.rtt=n.rtt;case 6:r=k(this.connections_),e.prev=7,r.s();case 9:if((i=r.n()).done){e.next=17;break}return(a=g(i.value,2))[0],o=a[1],e.next=13,this.stats_.getReceiverStats(o);case 13:s=e.sent,t.downlinksRTT[s.userId]=s.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 m.apply(this,arguments)})},{key:"getLocalAudioStats",value:(f=i(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.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:n=e.sent,t[this.userId_]={bytesSent:n.audio.bytesSent,packetsSent:n.audio.packetsSent};case 7:return e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"getLocalVideoStats",value:(p=i(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.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:n=e.sent,t[this.userId_]={bytesSent:n.video.bytesSent,packetsSent:n.video.packetsSent,framesEncoded:n.video.framesEncoded,framesSent:n.video.framesSent,frameWidth:n.video.frameWidth,frameHeight:n.video.frameHeight};case 7:return e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"getRemoteAudioStats",value:(h=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t={},n=k(this.connections_),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=12;break}return(i=g(r.value,2))[0],a=i[1],e.next=8,this.stats_.getReceiverStats(a);case 8:(o=e.sent).hasAudio&&(t[o.userId]={bytesReceived:o.audio.bytesReceived,packetsReceived:o.audio.packetsReceived,packetsLost:o.audio.packetsLost});case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),n.e(e.t0);case 17:return e.prev=17,n.f(),e.finish(17);case 20:return e.abrupt("return",t);case 21:case"end":return e.stop()}}),e,this,[[2,14,17,20]])}))),function(){return h.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(l=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=c.length>0&&void 0!==c[0]?c[0]:"main",n={},r=k(this.connections_),e.prev=3,r.s();case 5:if((i=r.n()).done){e.next=14;break}return(a=g(i.value,2))[0],o=a[1],e.next=9,this.stats_.getReceiverStats(o);case 9:s=e.sent,"main"===t&&s.hasVideo&&(n[s.userId]={bytesReceived:s.video.bytesReceived,packetsReceived:s.video.packetsReceived,packetsLost:s.video.packetsLost,framesDecoded:s.video.framesDecoded,frameWidth:s.video.frameWidth,frameHeight:s.video.frameHeight}),"auxiliary"===t&&s.hasAuxiliary&&(n[s.userId]={bytesReceived:s.auxiliary.bytesReceived,packetsReceived:s.auxiliary.packetsReceived,packetsLost:s.auxiliary.packetsLost,framesDecoded:s.auxiliary.framesDecoded,frameWidth:s.auxiliary.frameWidth,frameHeight:s.auxiliary.frameHeight});case 12:e.next=5;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(3),r.e(e.t0);case 19:return e.prev=19,r.f(),e.finish(19);case 22:return e.abrupt("return",n);case 23:case"end":return e.stop()}}),e,this,[[3,16,19,22]])}))),function(){return l.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(){if(-1===this.heartbeat_){this.log_.info("startHeartbeat..."),this.heartbeat_=zd.setInterval(this.doHeartbeat.bind(this),2e3)}}},{key:"stopHeartbeat",value:function(){-1!==this.heartbeat_&&(this.log_.info("stopHeartbeat"),zd.clearInterval(this.heartbeat_),this.heartbeat_=-1,this.lastHeartBeatTime_=-1)}},{key:"doHeartbeat",value:(d=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.badCaseDetector_.getMonitorFreeze(),e.next=3,this.stats_.getStatsReport({uplinkConnection:this.uplinkConnection_,downlinkConnections:this.connections_,freezeMap:t});case 3:if(n=e.sent,xv.emit(Ov.HEARTBEAT_STATS,{client:this,stats:n}),this.badCaseDetector_.resetMonitor(),this.signalChannel_){e.next=8;break}return e.abrupt("return");case 8:r=this.signalChannel_.isConnected()?yf(this.userId_):[],i={WebRTCQualityReq:n,eventList:r,sdkAppId:this.sdkAppId_,tinyid:this.tinyId_,roomid:this.roomId_,socketid:this.signalInfo_.socketId,clientip:this.signalInfo_.localIp,serverip:this.signalInfo_.relayIp,cpunumber:navigator.hardwareConcurrency||0,cpudevice:navigator.platform,devicename:navigator.platform,ostype:navigator.platform,mode:this.localStream_?this.localStream_.getScreen()?"screen":"video":""},a=0,this.localStream_&&this.localStream_.getMediaStream()&&(o=this.localStream_.getMediaStream().getAudioTracks(),a=o.length>0&&o[0].muted?3:1),i.WebRTCQualityReq.AudioReportState.uint32_microphone_status=a,this.signalChannel_.send(gp,i),s=Date.now(),this.lastHeartBeatTime_>0&&s-this.lastHeartBeatTime_>1e4&&this.log_.warn("heartbeat interval is over 10s"),this.lastHeartBeatTime_=s;case 17:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"onRemoteStreamAdded",value:function(e){var t=e.content,n=t.srcopenid,r=t.srctinyid;if(null!==n){this.userMap_.has(n)||(this.userMap_.set(n,new _g({userId:n,tinyId:r,role:"anchor"})),this.emitter_.emit(mv,{userId:n}));var i=this.connections_.get(r);if(i){if(i.getIsReconnecting())return;this.log_.warn("duplicated stream-added observed, rebuild the connection"),i.close(),this.connections_.delete(r)}var a={audio:t.audio,video:t.bigVideo,auxiliary:t.auxVideo};this.log_.info("remote peer [".concat(n,"] published stream. trackState: ").concat(JSON.stringify(a))),this.createDownlinkConnection({userId:n,tinyId:r,trackState:a})}else this.log_.warn("received null userId on stream added")}},{key:"createDownlinkConnection",value:function(e){var t=e.userId,n=e.tinyId,r=e.trackState,i=new dg({userId:t,tinyId:n,client:this,isUplink:!1,signalChannel:this.signalChannel_,autoSubscribe:this.autoSubscribe_,trackState:r});if(this.connections_.set(n,i),this.installDownlinkEvents(i,t,n),this.autoSubscribe_)i.initialize(),i.connect().catch((function(){}));else{if(r.audio||r.video){var a=new ig({type:"main",userId:t,client:this});a.setConnection(i),i.setRemoteStream(bo,a),a.setIsStreamAddedEventEmitted(!0),xv.emit(Ov.REMOTE_STREAM_ADDED,{client:this,stream:a}),this.emitter_.emit(dv,{stream:a})}if(r.auxiliary){var o=new ig({type:"auxiliary",userId:t,client:this});o.setConnection(i),i.setRemoteStream(Eo,o),o.setIsStreamAddedEventEmitted(!0),xv.emit(Ov.REMOTE_STREAM_ADDED,{client:this,stream:o}),this.emitter_.emit(dv,{stream:o})}}}},{key:"installDownlinkEvents",value:function(e,t,n){var r=this;e.on(iv,(function(e){e.stream.setIsStreamAddedEventEmitted(!0),xv.emit(Ov.REMOTE_STREAM_ADDED,{client:r,stream:e.stream}),r.emitter_.emit(dv,{stream:e.stream})})),e.on(av,(function(e){e.stream.stop(),e.stream.setIsStreamAddedEventEmitted(!1),r.subscriptionManager_&&r.subscriptionManager_.deleteAutoRecoveryFlag(e.stream.getUserId(),e.stream.getType()),xv.emit(Ov.REMOTE_STREAM_REMOVED,{client:r,stream:e.stream}),r.emitter_.emit(lv,{stream:e.stream})})),e.on(ov,(function(e){xv.emit(Ov.REMOTE_STREAM_UPDATED,{client:r,stream:e.stream}),r.emitter_.emit(hv,{stream:e.stream})})),e.on(sv,(function(e){xv.emit(Ov.REMOTE_STREAM_SUBSCRIBED,{client:r,stream:e.stream}),r.emitter_.emit(pv,{stream:e.stream})})),e.on(cv,(function(e){var t=e.getCode();t!==ws.ICE_TRANSPORT_ERROR&&(t===ws.DOWNLINK_RECONNECTION_FAILED&&r.closeDownLink(n),r.emitter_.emit(bv,e))}))}},{key:"onRemoteStreamRemoved",value:function(e){var t=e.content,n=t.srctinyid,r=t.srcopenid,i=this.connections_.get(n);i&&(void 0===r&&(r=i.getUserId()),this.log_.info("remote peer [".concat(r,"] unpublished stream")),this.closeDownLink(n))}},{key:"onPeerJoin",value:function(e){var t=e.data.content,n=t.srctinyid,r=t.userid,i=t.role;this.userMap_.has(r)||(this.userMap_.set(r,new _g({userId:r,tinyId:n,role:i})),this.emitter_.emit(mv,{userId:r}))}},{key:"onPeerLeave",value:function(e){var t=e.data.content,n=t.srctinyid,r=t.userid;this.log_.info("peer leave [".concat(r,"]")),this.cleanUser({userId:r,tinyId:n})}},{key:"cleanUser",value:function(e){var t=e.userId,n=e.tinyId;this.userMap_.delete(t),this.closeDownLink(n),this.emitter_.emit(_v,{userId:t})}},{key:"onPublishedUserList",value:function(e){var t=this;try{var n=e.content.userlist.map((function(e){return e.userid}));this.connections_.forEach((function(e){var r=e.getUserId(),i=e.getTinyId();n.findIndex((function(e){return e===r}))<0&&(t.log_.info("peer unpublished detected [".concat(r,"]")),t.closeDownLink(i))})),e.content.userlist.forEach((function(e){var n=e.userid,r=e.srctinyid,i=e.flag;if(n!==t.userId_){var a=!!(1&i),o=!!(8&i),s=!!(4&i);if(t.connections_.has(r)){var c=t.connections_.get(r).getTrackState(),u=c.audio,d=c.video,l=c.auxiliary;!d&&a&&xv.emit(Ov.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:ms,kind:ps}),!u&&o&&xv.emit(Ov.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:ms,kind:hs}),!l&&s&&xv.emit(Ov.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:ms,kind:fs}),d&&!a&&xv.emit(Ov.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:_s,kind:ps}),u&&!o&&xv.emit(Ov.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:_s,kind:hs}),l&&!s&&xv.emit(Ov.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:_s,kind:fs})}else t.log_.info("peer published detected [".concat(n,"]")),t.onRemoteStreamAdded({content:{audio:o,auxVideo:s,bigVideo:a,srcopenid:n,srctinyid:r}})}}))}catch(cS){}}},{key:"onUpdateRemoteMuteStat",value:function(e){var t=this;e.content.userlist.forEach((function(e){var n=e.srctinyid,r=e.userid;if(0!==n&&n!==t.tinyId_){var i=t.connections_.get(n);if(i){var a=i.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(gv,{userId:r}):t.emitter_.emit(yv,{userId:r}):t.emitter_.emit(gv,{userId:r}),void(s?u?t.emitter_.emit(vv,{userId:r}):t.emitter_.emit(Sv,{userId:r}):t.emitter_.emit(vv,{userId:r}));var h=!u&&s;(!l.audioMuted&&l.hasAudio)!==h&&(h?t.emitter_.emit(Sv,{userId:r}):t.emitter_.emit(vv,{userId:r}));var p=!d&&o;(!l.videoMuted&&l.hasVideo)!==p&&(p?t.emitter_.emit(yv,{userId:r}):t.emitter_.emit(gv,{userId:r})),t.mutedStates_.set(n,{hasAudio:s,hasVideo:o,hasSmall:c,audioMuted:u,videoMuted:d})}}else t.mutedStates_.delete(n)}}))}},{key:"onClientBanned",value:function(e){this.emitter_.emit(Tv,new As({code:ws.CLIENT_BANNED,message:y_({key:pm,data:{reason:e}})}))}},{key:"getEnv",value:function(){return this.env_}},{key:"getSubscriptionManager",value:function(){return this.subscriptionManager_}},{key:"startPublishCDNStream",value:(u=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.localStream_){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:fm})});case 2:if(nu(t.streamId)||ru(t.streamId)){e.next=4;break}throw new As({code:ws.INVALID_PARAMETER,message:y_({key:_m})});case 4:return this.log_.info("startPublishCDNStream params: ".concat(JSON.stringify(t))),e.prev=5,e.next=8,this.publishCDNManager_.startPublishTencentCDN(t.streamId);case 8:if(!(t.appId&&t.bizId&&t.url)){e.next=11;break}return e.next=11,this.publishCDNManager_.startPublishGivenCDN(t);case 11:e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(5),new As({code:ws.START_PUBLISH_CDN_FAILED,message:y_({key:vm,data:e.t0})});case 16:case"end":return e.stop()}}),e,this,[[5,13]])}))),function(e){return u.apply(this,arguments)})},{key:"stopPublishCDNStream",value:(c=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.publishCDNManager_.getIsPublishingTencentCDN()){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:mm})});case 2:return this.log_.info("stopPublishCDNStream"),e.prev=3,e.next=6,this.publishCDNManager_.stopPublishTencentCDN();case 6:if(!this.publishCDNManager_.getIsPublishingGivenCDN()){e.next=9;break}return e.next=9,this.publishCDNManager_.stopPublishGivenCDN();case 9:e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(3),new As({code:ws.STOP_PUBLISH_CDN_FAILED,message:y_({key:gm,data:e.t0})});case 14:case"end":return e.stop()}}),e,this,[[3,11]])}))),function(){return c.apply(this,arguments)})},{key:"startMixTranscode",value:(o=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_&&this.mixTranscodeManager_){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Sm})});case 2:return nu(t.mode)&&(t.mode=is.MANUAL),e.prev=3,this.log_.info("startMixTranscode with config ".concat(JSON.stringify(t))),Jc("mix-transcode-mode:".concat(t.mode)),e.next=8,this.mixTranscodeManager_.startMixTranscode(t);case 8:qc({eventType:Zo}),e.next=15;break;case 11:throw e.prev=11,e.t0=e.catch(3),Kc({eventType:Zo,error:e.t0}),e.t0;case 15:case"end":return e.stop()}}),e,this,[[3,11]])}))),function(e){return o.apply(this,arguments)})},{key:"stopMixTranscode",value:(r=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_&&this.mixTranscodeManager_){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:ym})});case 2:return e.prev=2,e.next=5,this.mixTranscodeManager_.stopMixTranscode();case 5:qc({eventType:es}),e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(2),Kc({eventType:es,error:e.t0}),e.t0;case 12:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(){return r.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(!iu(t))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Tm})});if(this.log_.info("enableAudioVolumeEvaluation with interval: "+t),t<=0)return this.enableAudioVolumeEvaluation_=!1,zd.clearInterval(this.audioVolumeIntervalId_),void(this.audioVolumeIntervalId_=null);t=Math.floor(Math.max(t,16)),this.audioVolumeIntervalId_&&(zd.clearInterval(this.audioVolumeIntervalId_),this.audioVolumeIntervalId_=null),this.enableAudioVolumeEvaluation_=!0,this.audioVolumeIntervalId_=zd.setInterval((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 r=Math.floor(100*n.getAudioLevel());t.push({userId:e.getUserId(),audioVolume:r,stream:n})}})),e.emitter_.emit(Rv,{result:t})}),t,n)}},{key:"uploadAllCallStats",value:function(){var e=this;this.callDurationCalculator_.getDurationMap().forEach((function(t,n){var r={userId:t.userId,type:t.type,duration:e.callDurationCalculator_.getDuration(n,"video"),dataFreeze:e.badCaseDetector_.getDataFreezeDuration(n).dataFreeze,renderFreeze:e.badCaseDetector_.getRenderFreezeDuration(n).renderFreeze};Jc("callStats-"+JSON.stringify(r))})),this.badCaseDetector_.stop(),this.callDurationCalculator_.reset()}},{key:"enableSmallStream",value:(n=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPublished()&&!this.isPublishing_){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:km})});case 2:if(!rv()){e.next=7;break}this.setIsEnableSmallStream(!0),this.log_.info("SmallStream successfully enabled"),e.next=8;break;case 7:throw new As({code:ws.INVALID_OPERATION,message:y_({key:bm})});case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"disableSmallStream",value:(e=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPublished()&&!this.isPublishing_){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Rm})});case 2:this.setIsEnableSmallStream(!1),this.log_.info("SmallStream successfully disabled");case 4:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"setSmallStreamProfile",value:function(e){var t=this;Object.keys(this.smallStreamConfig_).forEach((function(n){e[n]&&(t.smallStreamConfig_[n]=e[n])})),this.log_.info("setSmallStreamProfile: bitrate=".concat(this.smallStreamConfig_.bitrate,", framerate=").concat(this.smallStreamConfig_.framerate,", height=").concat(this.smallStreamConfig_.height,", width=").concat(this.smallStreamConfig_.width));var n=this.smallStreamConfig_,r=n.width,i=n.height,a=n.bitrate,o=n.framerate;if(r<0||i<0||a<0||o<0)throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Em})})}},{key:"setRemoteVideoStreamType",value:function(e,t){switch(this.log_.info("setRemoteVideoStreamType: streamType=".concat(e.getType(),", set ").concat(t)),t){case"big":case"small":this.changeVideoType(e,t)}}},{key:"changeVideoType",value:function(e,t){if(!(e instanceof ig))throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Im})});if(!e.getConnection())throw new As({code:ws.INVALID_OPERATION,message:y_({key:sm})});var n=this.getRemoteMutedState().filter((function(t){return t.userId===e.getUserId()}))[0];if("small"===t&&n&&!n.hasSmall)throw new As({code:ws.INVALID_OPERATION,message:y_({key:Cm})});this.log_.info("change video type: streamType=".concat(e.getType(),", set ").concat(t));var r=e.getConnection().getTinyId(),i=1;"big"===t&&(i=0),this.signalChannel_.send(Lp,{type:i,srctinyid:r})}},{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:"getAllConnections",value:function(){var e=S(this.connections_.values());return this.uplinkConnection_&&e.push(this.uplinkConnection_),e}},{key:"isRelayMaybeFailed",value:function(){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&&"closed"===n.connectionState&&(e.log_.warn("[".concat(t.getUserId(),"] pc is closed but not reconnect")),t.startReconnection())}}))}}]),Client}()).prototype,"join",[bg,Eg],Object.getOwnPropertyDescriptor(Mg.prototype,"join"),Mg.prototype),R(Mg.prototype,"leave",[Ig],Object.getOwnPropertyDescriptor(Mg.prototype,"leave"),Mg.prototype),R(Mg.prototype,"publish",[Cg,wg],Object.getOwnPropertyDescriptor(Mg.prototype,"publish"),Mg.prototype),R(Mg.prototype,"unpublish",[Ag,Dg],Object.getOwnPropertyDescriptor(Mg.prototype,"unpublish"),Mg.prototype),R(Mg.prototype,"subscribe",[Pg],Object.getOwnPropertyDescriptor(Mg.prototype,"subscribe"),Mg.prototype),R(Mg.prototype,"unsubscribe",[xg],Object.getOwnPropertyDescriptor(Mg.prototype,"unsubscribe"),Mg.prototype),R(Mg.prototype,"switchRole",[Og,Ng],Object.getOwnPropertyDescriptor(Mg.prototype,"switchRole"),Mg.prototype),Mg),Gg=vg({retryFunction:function(){var e=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Q_()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Jg(t);case 4:if(n=e.sent,gd.info("getUserMedia with constraints: "+JSON.stringify(n)),!n.audio){e.next=13;break}return e.next=9,sS.getMicrophones();case 9:if(r=e.sent,gd.info("microphones: ".concat(JSON.stringify(r))),0!==r.length){e.next=13;break}throw new As({code:ws.DEVICE_NOT_FOUND,message:y_({key:m_})});case 13:if(!n.video){e.next=20;break}return e.next=16,sS.getCameras();case 16:if(i=e.sent,gd.info("cameras: ".concat(JSON.stringify(i))),0!==i.length){e.next=20;break}throw new As({code:ws.DEVICE_NOT_FOUND,message:y_({key:__})});case 20:return e.next=22,navigator.mediaDevices.getUserMedia(n);case 22:return e.abrupt("return",e.sent);case 23:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),settings:{retries:3,timeout:500},onError:function(e,t,n){"NotReadableError"===e.name?t():n(e)},onRetrying:function(e){gd.warn("getUserMedia NotReadableError observed, retrying [".concat(e,"/3]"))}});function Jg(e){return zg.apply(this,arguments)}function zg(){return(zg=i(regeneratorRuntime.mark((function e(n){var r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r={echoCancellation:n.echoCancellation,autoGainControl:n.autoGainControl,noiseSuppression:n.noiseSuppression},n.audio){e.next=5;break}r=!1,e.next=15;break;case 5:if(kf(n.microphoneId)){e.next=9;break}r=t({deviceId:{exact:n.microphoneId},sampleRate:n.sampleRate,channelCount:n.channelCount},r),e.next=15;break;case 9:return r=t({sampleRate:n.sampleRate,channelCount:n.channelCount},r),e.next=12,sS.getMicrophones();case 12:i=e.sent,(a=i.filter((function(e){var t=e.deviceId;return t.length>0&&"default"!==t}))).length>0&&(r.deviceId={exact:a[0].deviceId});case 15:return o={},o=!nu(n.facingMode)&&n.video?{facingMode:n.facingMode,width:n.width,height:n.height,frameRate:n.frameRate}:!kf(n.cameraId)&&n.video?{deviceId:{exact:n.cameraId},width:n.width,height:n.height,frameRate:n.frameRate}:!!n.video&&(!!nu(n.width)||{width:n.width,height:n.height,frameRate:n.frameRate}),e.abrupt("return",{audio:r,video:o});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Wg=function(){var e=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Q_()){e.next=2;break}return e.abrupt("return");case 2:if(n=null,!(cd&&ud<74||ld)){e.next=27;break}return r=Kg(t),gd.info("getDisplayMedia with constraints: "+JSON.stringify(r)),e.next=8,navigator.mediaDevices.getDisplayMedia(r);case 8:if(i=e.sent,!t.screenAudio){e.next=14;break}return gd.warn("Your browser not support capture system audio"),e.abrupt("return",i);case 14:if(!t.audio){e.next=24;break}return a=qg(t),gd.info("getUserMedia with constraints: "+JSON.stringify(a)),e.next=19,navigator.mediaDevices.getUserMedia(a);case 19:return n=e.sent,i.addTrack(n.getAudioTracks()[0]),e.abrupt("return",i);case 24:return e.abrupt("return",i);case 25:e.next=53;break;case 27:if(!t.screenAudio){e.next=37;break}return t.audioConstraints={echoCancellation:!0,noiseSuppression:!0,sampleRate:44100},o=Kg(t),gd.info("getDisplayMedia with constraints: "+JSON.stringify(o)),e.next=33,navigator.mediaDevices.getDisplayMedia(o);case 33:return s=e.sent,e.abrupt("return",s);case 37:return c=Kg(t),gd.info("getDisplayMedia with constraints: "+JSON.stringify(c)),e.next=41,navigator.mediaDevices.getDisplayMedia(c);case 41:if(u=e.sent,!t.audio){e.next=52;break}return d=qg(t),gd.info("getUserMedia with constraints: "+JSON.stringify(d)),e.next=47,navigator.mediaDevices.getUserMedia(d);case 47:return n=e.sent,u.addTrack(n.getAudioTracks()[0]),e.abrupt("return",u);case 52:return e.abrupt("return",u);case 53:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function qg(e){var t={echoCancellation:e.echoCancellation,autoGainControl:e.autoGainControl,noiseSuppression:e.noiseSuppression,sampleRate:e.sampleRate,channelCount:e.channelCount};return nu(e.microphoneId)||(t.deviceId={exact:e.microphoneId}),{audio:t,video:!1}}function Kg(e){var t={},n={width:e.width,height:e.height,frameRate:e.frameRate};return nu(e.screenSource)||(n.displaySurface=e.screenSource),t.video=n,nu(e.audioConstraints)||(t.audio=e.audioConstraints),t}var Qg=new Map;Qg.set("120p",{width:160,height:120,frameRate:15,bitrate:200}),Qg.set("180p",{width:320,height:180,frameRate:15,bitrate:350}),Qg.set("240p",{width:320,height:240,frameRate:15,bitrate:400}),Qg.set("360p",{width:640,height:360,frameRate:15,bitrate:800}),Qg.set("480p",{width:640,height:480,frameRate:15,bitrate:900}),Qg.set("720p",{width:1280,height:720,frameRate:15,bitrate:1500}),Qg.set("1080p",{width:1920,height:1080,frameRate:15,bitrate:2e3}),Qg.set("1440p",{width:2560,height:1440,frameRate:30,bitrate:4860}),Qg.set("4K",{width:3840,height:2160,frameRate:30,bitrate:9e3});var Yg=new Map;Yg.set("480p",{width:640,height:480,frameRate:5,bitrate:900}),Yg.set("480p_2",{width:640,height:480,frameRate:30,bitrate:1e3}),Yg.set("720p",{width:1280,height:720,frameRate:5,bitrate:1200}),Yg.set("720p_2",{width:1280,height:720,frameRate:30,bitrate:3e3}),Yg.set("1080p",{width:1920,height:1080,frameRate:5,bitrate:1600}),Yg.set("1080p_2",{width:1920,height:1080,frameRate:30,bitrate:4e3});var Xg,$g,Zg=new Map;Zg.set("standard",{sampleRate:48e3,channelCount:1,bitrate:40}),Zg.set("standard-stereo",{sampleRate:48e3,channelCount:2,bitrate:64}),Zg.set("high",{sampleRate:48e3,channelCount:1,bitrate:192}),Zg.set("high-stereo",{sampleRate:48e3,channelCount:2,bitrate:192});var eS,tS,nS,rS=(Xg=eg.apply(void 0,S(Xv.LOCAL_STREAM.switchDevice)),R(($g=function(e){u(LocalStream,e);var r,o,c,l,h,p,f,m=_(LocalStream);function LocalStream(e){var n;a(this,LocalStream);var r=t(t({},e),{isRemote:!1,type:"local"});return e.screen&&(r.mirror=!1),(n=m.call(this,r)).name_=bs,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.videoSource_=e.videoSource,n.audioSource_=e.audioSource,n.screen_=e.screen,n.screenSource_=e.screenSource,n.screenAudio_=e.screenAudio,n.audioProfile_={echoCancellation:!!nu(e.echoCancellation)||e.echoCancellation,autoGainControl:!!nu(e.autoGainControl)||e.autoGainControl,noiseSuppression:!!nu(e.noiseSuppression)||e.noiseSuppression,sampleRate:48e3,channelCount:1,bitrate:40},n.videoProfile_={width:640,height:480,frameRate:15,bitrate:900},n.screenProfile_={width:1920,height:1080,frameRate:5,bitrate:1600},n.videoBitrate_=n.screen_?1600:900,n.videoSetting_=null,n.mutedFlag_=0,n.beautyStatus_=!1,n.recoverCaptureCount_=0,n.initState(),n.installEvents(),n.log_.debug("stream created: "+n.id_),n}return s(LocalStream,[{key:"initState",value:function(){this.isAddingTrack_=!1,this.isRemovingTrack_=!1,this.setIsReadyToPublish(!1),this.setPublishState(gs)}},{key:"installEvents",value:function(){xv.on(Ov.LOCAL_STREAM_PUBLISHED,this.onStreamPublished,this),xv.on(Ov.VIDEO_TRACK_ENDED,this.onVideoTrackStopped,this),xv.on(Ov.VIDEO_TRACK_MUTED,this.onVideoTrackStopped,this),xv.on(Ov.AUDIO_TRACK_ENDED,this.onAudioTrackStopped,this),xv.on(Ov.AUDIO_TRACK_MUTED,this.onAudioTrackStopped,this)}},{key:"uninstallEvents",value:function(){xv.off(Ov.LOCAL_STREAM_PUBLISHED,this.onStreamPublished,this),xv.off(Ov.VIDEO_TRACK_ENDED,this.onVideoTrackStopped,this),xv.off(Ov.VIDEO_TRACK_MUTED,this.onVideoTrackStopped,this),xv.off(Ov.AUDIO_TRACK_ENDED,this.onAudioTrackStopped,this),xv.off(Ov.AUDIO_TRACK_MUTED,this.onAudioTrackStopped,this)}},{key:"initialize",value:function(){var e=this;return new Promise((function(t,n){if(Y_())n(new As({code:ws.INVALID_OPERATION,message:y_({key:s_})}));else{if(nu(e.audio_)){var r=new MediaStream;return nu(e.audioSource_)||(r.addTrack(e.audioSource_),e.updateAudioPlayingState(!0)),nu(e.videoSource_)||(r.addTrack(e.videoSource_),e.updateVideoPlayingState(!0)),e.setMediaStream(r),qc({eventType:Ko,kind:"custom"}),e.setIsReadyToPublish(!0),t()}e.screen_?(e.log_.info("initialize stream audio: "+e.audio_+" screenAudio: "+e.screenAudio_+" screen: "+e.screen_),Wg({audio:e.audio_,screenAudio:e.screenAudio_,microphoneId:e.microphoneId_,screenSource:e.screenSource_,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){return e.setMediaStream(n),e.updateAudioPlayingState(e.audio_||e.screenAudio_),e.updateVideoPlayingState(!0),e.listenForScreenSharingStopped(e.getVideoTrack()),e.setVideoContentHint("detail"),e.updateDeviceIdInUse(),e.setIsReadyToPublish(!0),qc({eventType:Ko,kind:"getDisplayMedia"}),t()})).catch((function(t){Kc({eventType:Ko,kind:"getDisplayMedia",error:t}),e.log_.error("getDisplayMedia error observed "+t),n(t)}))):(xv.emit(Ov.LOCAL_STREAM_INITIALIZE_START,{stream:e,audio:e.audio_,video:e.video_}),e.log_.info("initialize stream audio: "+e.audio_+" video: "+e.video_),Gg({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}).then((function(n){return xv.emit(Ov.LOCAL_STREAM_INITIALIZE_END,{stream:e,audio:e.audio_,video:e.video_}),"getSettings"in MediaStreamTrack.prototype&&(e.videoSetting_=n.getVideoTracks().length>0&&n.getVideoTracks()[0].getSettings()),e.setMediaStream(n),e.updateAudioPlayingState(e.audio_),e.updateVideoPlayingState(e.video_),e.updateDeviceIdInUse(),e.log_.debug("gotStream hasAudio: "+e.hasAudio()+" hasVideo: "+e.hasVideo()),e.setIsReadyToPublish(!0),qc({eventType:Ko,kind:"getUserMedia"}),t()})).catch((function(t){xv.emit(Ov.LOCAL_STREAM_INITIALIZE_FAILED,{stream:e,audio:e.audio_,video:e.video_,error:t}),Kc({eventType:Ko,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(Iv)}))}},{key:"muteAudio",value:function(){var e=v(d(LocalStream.prototype),"muteAudio",this).call(this);return e&&(this.log_.info("localStream mute audio"),this.sendMutedFlag(hs,!0)),e}},{key:"muteVideo",value:function(){var e=v(d(LocalStream.prototype),"muteVideo",this).call(this);return e&&(this.log_.info("localStream mute video"),this.sendMutedFlag(ps,!0)),e}},{key:"unmuteAudio",value:function(){var e=v(d(LocalStream.prototype),"unmuteAudio",this).call(this);return e&&(this.log_.info("localStream unmute audio"),this.sendMutedFlag(hs,!1)),e}},{key:"unmuteVideo",value:function(){var e=v(d(LocalStream.prototype),"unmuteVideo",this).call(this);return e&&(this.log_.info("localStream unmute video"),this.sendMutedFlag(ps,!1)),e}},{key:"sendMutedFlag",value:function(e,t){this.setMutedFlag(e,t);var n=this.getConnection();if(n){n.sendMutedFlag(this.mutedFlag_);var r=n.getUserId(),i=n.getTinyId(),a="".concat(t?"mute":"unmute"," local ").concat(e," track");Sf(r,{eventId:e===hs?t?Bp:Gp:t?Hp:Jp,eventDesc:a,timestamp:jc(),userId:r,tinyId:i})}}},{key:"setMutedFlag",value:function(e,t){e===hs?t?this.mutedFlag_|=4:this.mutedFlag_&=-5:t?this.mutedFlag_|=1:this.mutedFlag_&=-2,this.log_.info("set ".concat(e," muted state: [").concat(t?"mute":"unmute","]"))}},{key:"setAudioProfile",value:function(e){var r;"object"===n(e)?r=e:void 0===(r=Zg.get(e))&&(r=Zg.get("standard")),this.log_.info("setAudioProfile: "+JSON.stringify(r)),this.audioProfile_=t(t({},this.audioProfile_),r)}},{key:"setVideoProfile",value:(f=i(regeneratorRuntime.mark((function e(n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.connection_||K_()){e.next=2;break}throw new As({code:ws.NOT_SUPPORTED,message:y_({key:d_})});case 2:if(Zc(n)?r=t(t({},this.videoProfile_),n):ru(n)&&(r=Qg.get(n),nu(r)&&(r=Qg.get("480p"))),this.log_.info("setVideoProfile "+JSON.stringify(r)),!(i=this.getVideoTrack())){e.next=8;break}return e.next=8,i.applyConstraints(r);case 8:if(this.videoBitrate_===r.bitrate){e.next=13;break}if(!this.connection_){e.next=12;break}return e.next=12,this.connection_.setBandwidth(r.bitrate,"video");case 12:this.videoBitrate_=r.bitrate;case 13:this.videoProfile_=r;case 14:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"getVideoBitrate",value:function(){return this.videoBitrate_}},{key:"getAudioBitrate",value:function(){return this.audioProfile_.bitrate}},{key:"setScreenProfile",value:function(e){var t=e;"object"!==n(e)&&void 0===(t=Yg.get(e))&&(t=Yg.get("1080p")),this.log_.info("setScreenProfile "+JSON.stringify(e)),this.screenProfile_=t,this.videoBitrate_=t.bitrate}},{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:(p=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,c,u,d,l,h,p,f,m,_,v,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("audio"===t&&this.microphoneId_===n||"video"===t&&this.cameraId_===n)){e.next=2;break}return e.abrupt("return");case 2:if("audio"===t&&(this.microphoneId_=n,this.audio_||(this.audio_=!0)),"video"===t&&("user"===n||"environment"===n?this.facingMode_=n:this.cameraId_=n,this.video_||(this.video_=!0)),this.getMediaStream()){e.next=6;break}return e.abrupt("return");case 6:return this.setIsReadyToPublish(!1),this.log_.info("switchDevice "+t+" to: "+n),"video"===t&&(Su||gu||Tu)&&((r=this.getVideoTrack())&&r.stop(),Zu&&(i=this.getAudioTrack())&&(this.log_.info("stop audio track first in huawei env"),i.stop())),"audio"===t&&Tu&&(a=this.getAudioTrack(),o=this.getMicrophoneTrackMixed(),a&&a.stop(),o&&o.stop()),e.next=12,Gg({audio:this.audio_&&"audio"===t||Zu,video:this.video_&&"video"===t,facingMode:"user"===n||"environment"===n?n:void 0,cameraId:this.cameraId_,microphoneId:this.microphoneId_,width:this.videoProfile_.width,height:this.videoProfile_.height,frameRate:this.videoProfile_.frameRate,sampleRate:this.audioProfile_.sampleRate,channelCount:this.audioProfile_.channelCount});case 12:if(s=e.sent,c=null,"audio"!==t){e.next=19;break}(u=s.getAudioTracks()[0])&&this.isAudioTrackMixed()?(d=this.getAudioTrack(),l=sS.AudioMixerPlugin.getAudioTrackMap(),h=sS.AudioMixerPlugin.mix({targetTrack:u,sourceList:l.get(d.id).sourceList,trackList:l.get(d.id).trackList}),c=h):c=u,e.next=25;break;case 19:if((c=s.getVideoTracks()[0])&&this.isVideoTrackBeautified()&&(c=this.generateBeautyTrack(c)),!(p=s.getAudioTracks()[0])||!Zu){e.next=25;break}return e.next=25,this.replaceTrack_(p);case 25:return e.next=27,this.replaceTrack_(c);case 27:this.updateDeviceIdInUse(),(f=this.getConnection())&&(m=f.getUserId(),_=f.getTinyId(),v=Kp,g="switch camera","audio"===t&&(v=Qp,g="switch microphone"),Sf(m,{eventId:v,eventDesc:g,timestamp:jc(),userId:m,tinyId:_})),this.log_.info("switch ".concat("audio"===t?"microphone":"camera"," success ")),this.setIsReadyToPublish(!0);case 32:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"addTrack",value:(h=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isAddingTrack_){e.next=2;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:xm})});case 2:if(!this.isRemovingTrack_){e.next=4;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Om})});case 4:if(this.publishState_!==Ss){e.next=6;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Nm})});case 6:if(n=this.getMediaStream()){e.next=9;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Mm})});case 9:if(!("audio"===t.kind&&n.getAudioTracks().length>0||"video"===t.kind&&n.getVideoTracks().length>0)){e.next=11;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Lm})});case 11:if("video"===t.kind&&"getSettings"in MediaStreamTrack.prototype&&(r=t.getSettings(),!this.videoSetting_||r.width===this.videoSetting_.width&&r.height===this.videoSetting_.height||this.log_.warn("video resolution of the track (".concat(r.width," x ").concat(r.height,") shall be kept the same as the previous: ").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,". It may cause abnormal Cloud Recording."))),e.prev=12,this.isAddingTrack_=!0,this.keepMuteState(t),!(i=this.getConnection())){e.next=19;break}return e.next=19,i.addTrack(t);case 19:n.addTrack(t),"audio"===t.kind?(this.audio_=!0,this.updateAudioPlayingState(!0)):(this.video_=!0,this.updateVideoPlayingState(!0)),this.isAddingTrack_=!1,e.next=28;break;case 24:throw e.prev=24,e.t0=e.catch(12),this.isAddingTrack_=!1,e.t0;case 28:case"end":return e.stop()}}),e,this,[[12,24]])}))),function(e){return h.apply(this,arguments)})},{key:"removeTrack",value:(l=i(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("audio"!==t.kind){e.next=2;break}throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Vm})});case 2:if(!this.isAddingTrack_){e.next=4;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Um})});case 4:if(!this.isRemovingTrack_){e.next=6;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Fm})});case 6:if(this.publishState_!==Ss){e.next=8;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:jm})});case 8:if(n=this.getMediaStream()){e.next=11;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Mm})});case 11:if(-1!==n.getTracks().indexOf(t)){e.next=13;break}throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Bm})});case 13:if(1!==n.getTracks().length){e.next=15;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Hm})});case 15:if(e.prev=15,this.isRemovingTrack_=!0,!(r=this.getConnection())){e.next=21;break}return e.next=21,r.removeTrack(t);case 21:n.removeTrack(t),"audio"===t.kind?(this.audio_=!1,this.updateAudioPlayingState(!1)):(this.video_=!1,this.updateVideoPlayingState(!1)),this.isRemovingTrack_=!1,e.next=30;break;case 26:throw e.prev=26,e.t0=e.catch(15),this.isRemovingTrack_=!1,e.t0;case 30:case"end":return e.stop()}}),e,this,[[15,26]])}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(c=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.getMediaStream()){e.next=3;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Pm})});case 3:if(this.publishState_!==Ss){e.next=5;break}throw new As({code:ws.INVALID_OPERATION,message:y_({key:Dm})});case 5:if(!("audio"===t.kind&&n.getAudioTracks().length<=0||"video"===t.kind&&n.getVideoTracks().length<=0)){e.next=7;break}throw new As({code:ws.INVALID_PARAMETER,message:y_({key:Gm,data:t})});case 7:if("video"===t.kind&&"getSettings"in MediaStreamTrack.prototype&&(r=t.getSettings(),!this.videoSetting_||r.width===this.videoSetting_.width&&r.height===this.videoSetting_.height||this.log_.warn("video resolution of the track (".concat(r.width," x ").concat(r.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),"audio"===t.kind?(n.removeTrack(n.getAudioTracks()[0]),n.addTrack(t),v(d(LocalStream.prototype),"restartAudio",this).call(this)):(n.removeTrack(n.getVideoTracks()[0]),n.addTrack(t),v(d(LocalStream.prototype),"restartVideo",this).call(this)),!(i=this.getConnection())){e.next=14;break}return e.next=14,i.replaceTrack(t);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"updateStream",value:(o=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u,d,l,h,p,f,m,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaStream_){e.next=2;break}return e.abrupt("return");case 2:return this.log_.info("updateStream() try to recover local stream"),e.prev=3,e.next=6,sS.getCameras();case 6:return n=e.sent,e.next=9,sS.getMicrophones();case 9:if(r=e.sent,i=this.audio_&&t.audio,(a=this.video_&&t.video)&&0===n.length&&(a=!1,this.log_.info("updateStream() video flag is true, but no camera detected, set video to false")),i&&0===r.length&&(i=!1,this.log_.info("updateStream() audio flag is true, but no microphone detected, set audio to false")),!1!==i||!1!==a){e.next=17;break}return this.log_.info("updateStream() both audio and video are false, recover stream aborted"),e.abrupt("return");case 17:return o=t&&n.findIndex((function(e){return e.deviceId===t.cameraId}))>=0,s=t&&r.findIndex((function(e){return e.deviceId===t.microphoneId}))>=0,e.next=21,Gg({audio:i,video:a,cameraId:o?t.cameraId:void 0,microphoneId:s?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});case 21:c=e.sent,u=c.getTracks(),d=0;case 24:if(!(d<u.length)){e.next=47;break}if("audio"!==(l=u[d]).kind||!this.isAudioTrackMixed()){e.next=37;break}if(h=this.getAudioTrack(),p=sS.AudioMixerPlugin.getAudioTrackMap(),(f=p.get(h.id)).hasMicrophone){e.next=33;break}return l.stop(),e.abrupt("continue",44);case 33:return m=sS.AudioMixerPlugin.mix({targetTrack:l,sourceList:f.sourceList,trackList:f.trackList}),e.next=36,this.replaceTrack_(m);case 36:return e.abrupt("continue",44);case 37:if("video"!==l.kind||!this.isVideoTrackBeautified()){e.next=42;break}return _=this.generateBeautyTrack(l),e.next=41,this.replaceTrack_(_);case 41:return e.abrupt("continue",44);case 42:return e.next=44,this.replaceTrack_(l);case 44:d++,e.next=24;break;case 47:this.updateDeviceIdInUse(),qc({eventType:Xo}),this.log_.info("updateStream() recover local stream successfully"),e.next=57;break;case 52:e.prev=52,e.t0=e.catch(3),Kc({eventType:Xo,error:e.t0}),this.log_.error("updateStream() failed to recover local stream, "+e.t0),this.emitter_.emit(wv,new As({code:ws.DEVICE_AUTO_RECOVER_FAILED,message:e.t0.message}));case 57:case"end":return e.stop()}}),e,this,[[3,52]])}))),function(e){return o.apply(this,arguments)})},{key:"replaceTrack_",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.mediaStream_.getAudioTracks(),r=this.mediaStream_.getVideoTracks(),!("audio"===t.kind&&n.length<=0||"video"===t.kind&&r.length<=0)){e.next=5;break}return this.log_.info("there is no previous ".concat(t.kind," track, replacement ignored")),e.abrupt("return");case 5:if(this.keepMuteState(t),"audio"===t.kind?(this.mediaStream_.removeTrack(n[0]),this.mediaStream_.addTrack(t),v(d(LocalStream.prototype),"restartAudio",this).call(this)):("getSettings"in MediaStreamTrack.prototype&&(i=t.getSettings(),!this.videoSetting_||i.width===this.videoSetting_.width&&i.height===this.videoSetting_.height||this.log_.warn("the resolution of video track to be replaced (".concat(i.width," x ").concat(i.height,") is different from the previous video settings (").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,"). It may cause a cloud recording exception"))),this.mediaStream_.removeTrack(r[0]),this.mediaStream_.addTrack(t),v(d(LocalStream.prototype),"restartVideo",this).call(this)),!(a=this.getConnection())){e.next=11;break}return e.next=11,a.replaceTrack(t);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"updateDeviceIdInUse",value:function(){var e=this;if(!this.mediaStream_)return this.cameraId_="",this.cameraGroupId_="",this.microphoneId_="",void(this.microphoneGroupId_="");"getSettings"in MediaStreamTrack.prototype&&this.mediaStream_.getTracks().forEach((function(t){if("audio"===t.kind&&e.isAudioTrackMixed()){var n=e.getMicrophoneTrackMixed();if(n){var r=n.getSettings(),i=r.deviceId,a=r.groupId;i&&(e.microphoneId_=i,e.microphoneGroupId_=a)}}else if("video"===t.kind&&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&&("audio"===t.kind?(e.microphoneId_=l,e.microphoneGroupId_=h):"video"!==t.kind||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(sS.AudioMixerPlugin){var e=sS.AudioMixerPlugin.getAudioTrackMap(),t=this.getAudioTrack();if(e&&t&&e.has(t.id))return!0}return!1}},{key:"getMicrophoneTrackMixed",value:function(){if(sS.AudioMixerPlugin){var e=sS.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(sS.beautyTrackMap){var e=sS.beautyTrackMap,t=this.getVideoTrack();if(t&&e.has(t.id))return!0}return!1}},{key:"getBeautyOriginTrack",value:function(){if(sS.beautyTrackMap){var e=sS.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:function(e){var t=this.getVideoTrack(),n=sS.beautyTrackMap.get(t.id).pluginInstance.generateBeautyTrack(e);return this.log_.info("regenerate beauty track, track id = ".concat(e.id)),n}},{key:"getScreen",value:function(){return this.screen_}},{key:"hasScreenTrack",value:function(){if(this.screen_)return!0;var e=this.getVideoTrack();return!!e&&("detail"===e.contentHint||"text"===e.contentHint)}},{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:"onStreamPublished",value:function(e){if(e.localStream===this){var t=this.getAudioTrack(),n=this.getVideoTrack();if(t){var r=!t.enabled;this.setMutedFlag(hs,r)}if(n){var i=!n.enabled;this.setMutedFlag(ps,i)}this.connection_&&this.connection_.sendMutedFlag(this.mutedFlag_)}}},{key:"keepMuteState",value:function(e){e instanceof MediaStreamTrack&&this.mutedFlag_&(e.kind===ps?1:4)&&(e.enabled=!1,this.log_.warn("prev ".concat(e.kind," track is muted, keep mute state")))}},{key:"onVideoTrackStopped",value:function(e){var t=e.stream,n=e.type;t!==this||!this.video_||!this.cameraId_||this.recoverCaptureCount_>10||(this.recoverCaptureCount_+=1,Jc("stat-local-video-".concat(n)),this.updateStream({audio:!1,video:!0,cameraId:this.cameraId_}))}},{key:"onAudioTrackStopped",value:function(e){var t=e.stream,n=e.type;t!==this||!this.audio_||!this.microphoneId_||this.recoverCaptureCount_>10||(this.recoverCaptureCount_+=1,Jc("stat-local-audio-".concat(n)),this.updateStream({audio:!0,video:!1,microphoneId:this.microphoneId_}))}},{key:"setAudioVolume",value:function(e){v(d(LocalStream.prototype),"setAudioVolume",this).call(this,e)}},{key:"close",value:function(){v(d(LocalStream.prototype),"close",this).call(this),this.uninstallEvents()}}]),LocalStream}(rg)).prototype,"switchDevice",[Xg],Object.getOwnPropertyDescriptor($g.prototype,"switchDevice"),$g.prototype),$g),iS=0,aS=0,oS=(eS=Zv(Xv.TRTC.createClient),tS=Zv(Xv.TRTC.createStream),R((nS=function(){function e(){a(this,e),this.name_=ks,this.VERSION="4.11.7",this.Logger={LogLevel:{TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5},setLogLevel:function(e){gd.setLogLevel(e),"zh"===(navigator.language||navigator.userLanguage).substr(0,2)&&e<=1&&S_()},enableUploadLog:function(){gd.enableUploadLog()},disableUploadLog:function(){gd.disableUploadLog()}}}var n,r,o,c,u;return s(e,[{key:"checkSystemRequirements",value:(u=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,G_();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),function(){return u.apply(this,arguments)})},{key:"isScreenShareSupported",value:function(){return J_()}},{key:"isSmallStreamSupported",value:function(){return rv()}},{key:"getDevices",value:(c=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Y_()&&!Q_()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.map((function(e,t){var n=e.label;e.label||(n=e.kind+"_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)}))),function(){return c.apply(this,arguments)})},{key:"getCameras",value:(o=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Y_()&&!Q_()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return"videoinput"===e.kind})).map((function(e,t){var n=e.label;e.label||(n="camera_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)}))),function(){return o.apply(this,arguments)})},{key:"getMicrophones",value:(r=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Y_()&&!Q_()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return"audioinput"===e.kind})).map((function(e,t){var n=e.label;e.label||(n="microphone_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})},{key:"getSpeakers",value:(n=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Y_()&&!Q_()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4: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 r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"createClient",value:function(e){hl&&(hl=!1,gd.getLogLevel()!=sS.Logger.LogLevel.NONE&&(console.info("******************************************************************************"),console.info("* 欢迎使用 TRTC Web SDK - 腾讯云实时音视频通信"),console.info("* API 文档:https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/index.html"),console.info("* 版本更新日志:https://cloud.tencent.com/document/product/647/38958"),console.info("* 反馈问题:https://github.com/tencentyun/TRTCSDK/issues"),console.info("******************************************************************************")),gd.info("TRTC Web SDK Version: 4.11.7"),gd.info("UserAgent: "+navigator.userAgent),gd.info("URL of current page: "+location.href));var n={version:this.VERSION};return new Hg(t(t(t({},n),e),{},{seq:++iS}))}},{key:"createStream",value:function(e){return new rS(t(t({},e),{},{seq:++aS}))}}]),e}()).prototype,"createClient",[eS],Object.getOwnPropertyDescriptor(nS.prototype,"createClient"),nS.prototype),R(nS.prototype,"createStream",[tS],Object.getOwnPropertyDescriptor(nS.prototype,"createStream"),nS.prototype),nS);Y_();var sS=new oS;return sS}));
273948
273975
 
273949
273976
  /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))
273950
273977
 
@@ -277161,20 +277188,6 @@ if(content.locals) module.exports = content.locals;
277161
277188
  var add = __webpack_require__("499e").default
277162
277189
  var update = add("c37737e4", content, true, {"sourceMap":false,"shadowMode":false});
277163
277190
 
277164
- /***/ }),
277165
-
277166
- /***/ "5e79":
277167
- /***/ (function(module, exports, __webpack_require__) {
277168
-
277169
- // Imports
277170
- var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("24fb");
277171
- exports = ___CSS_LOADER_API_IMPORT___(false);
277172
- // Module
277173
- exports.push([module.i, ".edit-label-content .edit-content .ant-tag-checkable span[data-v-9bef0184]{max-width:84px}.edit-content[data-v-9bef0184]{width:100%;margin-bottom:10px}.label-disable-wrap[data-v-9bef0184]{width:100%;font-size:14px;line-height:20px;display:flex;align-items:center;flex-direction:column}.label-disable-wrap .label-disable-img[data-v-9bef0184]{width:320px;height:248px}.tag-label[data-v-9bef0184] .ant-tag{margin-bottom:4px;border:1px solid #f1f1f1}.tag-label[data-v-9bef0184] .ant-tag .anticon-close{color:#fff}.common-label[data-v-9bef0184]{padding:8px 12px 4px;margin-top:8px;border-radius:4px;border:1px solid rgba(0,0,0,.1)}.common-label>span[data-v-9bef0184]{margin-right:16px;color:rgba(0,0,0,.9)}.common-label .ant-tag-checkable[data-v-9bef0184]{cursor:pointer;box-sizing:border-box}.common-label[data-v-9bef0184] .ant-tag{margin-bottom:4px}.form-add-icon-label[data-v-9bef0184]{margin-bottom:4px;color:#2d7aff;cursor:pointer}.anticon+.anticon[data-v-9bef0184]{margin-left:16px}", ""]);
277174
- // Exports
277175
- module.exports = exports;
277176
-
277177
-
277178
277191
  /***/ }),
277179
277192
 
277180
277193
  /***/ "5e89":
@@ -286524,22 +286537,6 @@ function contains(root, n) {
286524
286537
 
286525
286538
  /***/ }),
286526
286539
 
286527
- /***/ "6be7":
286528
- /***/ (function(module, exports, __webpack_require__) {
286529
-
286530
- // style-loader: Adds some css to the DOM by adding a <style> tag
286531
-
286532
- // load the styles
286533
- var content = __webpack_require__("7dcc");
286534
- if(content.__esModule) content = content.default;
286535
- if(typeof content === 'string') content = [[module.i, content, '']];
286536
- if(content.locals) module.exports = content.locals;
286537
- // add the styles to the DOM
286538
- var add = __webpack_require__("499e").default
286539
- var update = add("54d2ca0f", content, true, {"sourceMap":false,"shadowMode":false});
286540
-
286541
- /***/ }),
286542
-
286543
286540
  /***/ "6bf7":
286544
286541
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
286545
286542
 
@@ -318933,6 +318930,17 @@ var _default = {
318933
318930
  };
318934
318931
  exports.default = _default;
318935
318932
 
318933
+ /***/ }),
318934
+
318935
+ /***/ "7649":
318936
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
318937
+
318938
+ "use strict";
318939
+ /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_TableModal_vue_vue_type_style_index_0_id_4592973c_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("e496");
318940
+ /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_TableModal_vue_vue_type_style_index_0_id_4592973c_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_TableModal_vue_vue_type_style_index_0_id_4592973c_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
318941
+ /* unused harmony reexport * */
318942
+
318943
+
318936
318944
  /***/ }),
318937
318945
 
318938
318946
  /***/ "764b":
@@ -353009,20 +353017,6 @@ addToUnscopables(FIND);
353009
353017
 
353010
353018
  module.exports = __webpack_require__.p + "img/xb_big.7b2a9f5a.png";
353011
353019
 
353012
- /***/ }),
353013
-
353014
- /***/ "7dcc":
353015
- /***/ (function(module, exports, __webpack_require__) {
353016
-
353017
- // Imports
353018
- var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("24fb");
353019
- exports = ___CSS_LOADER_API_IMPORT___(false);
353020
- // Module
353021
- exports.push([module.i, ".list .list-title[data-v-47bef686]{display:flex;background-color:#f2f2f4;border:1px solid #e1dfdf;height:52px;line-height:52px}.list .list-title .list-title-item[data-v-47bef686]{width:25%;font-weight:700}.list .list-content li[data-v-47bef686]{display:flex;height:52px;line-height:52px}.list .list-content li .list-content-item[data-v-47bef686]{width:25%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}.list .list-content li .list-content-item .svg-icon-btn[data-v-47bef686]{margin-left:0;margin-right:8px}.list .list-content li.checked[data-v-47bef686],.list .list-content li.checked .text[data-v-47bef686]{background-color:#f2f2f2}.list .list-content li .text[data-v-47bef686]{position:relative;display:inline-block;padding:0 10px;background-color:#fff}.list .list-content li .list-content-line[data-v-47bef686]{width:75%;text-align:center;position:relative}.list .list-content li .list-content-line[data-v-47bef686]:before{content:\"\";position:absolute;border:1px solid #e8e8e8;width:100%;left:0;margin-top:20px}.list .list-content-item[data-v-47bef686],.list .list-title-item[data-v-47bef686]{margin-left:-1px;padding:0 10px}.list .list-content-item[data-v-47bef686]{border-bottom:1px solid #e1dfdf;margin-top:-1px}.list .list-content-item[data-v-47bef686] .ant-switch{width:28px;min-width:28px;height:16px}.list .list-content-item[data-v-47bef686] .ant-switch:after{width:12px;height:12px}.list .list-content-radio[data-v-47bef686],.list .list-content-switch[data-v-47bef686]{text-align:center}.list .anticon+.anticon[data-v-47bef686]{margin-left:8px}.btn-reset[data-v-47bef686]{float:left}", ""]);
353022
- // Exports
353023
- module.exports = exports;
353024
-
353025
-
353026
353020
  /***/ }),
353027
353021
 
353028
353022
  /***/ "7dd0":
@@ -353225,6 +353219,22 @@ module.exports = {
353225
353219
  };
353226
353220
 
353227
353221
 
353222
+ /***/ }),
353223
+
353224
+ /***/ "7e53":
353225
+ /***/ (function(module, exports, __webpack_require__) {
353226
+
353227
+ // style-loader: Adds some css to the DOM by adding a <style> tag
353228
+
353229
+ // load the styles
353230
+ var content = __webpack_require__("1fee");
353231
+ if(content.__esModule) content = content.default;
353232
+ if(typeof content === 'string') content = [[module.i, content, '']];
353233
+ if(content.locals) module.exports = content.locals;
353234
+ // add the styles to the DOM
353235
+ var add = __webpack_require__("499e").default
353236
+ var update = add("552fda36", content, true, {"sourceMap":false,"shadowMode":false});
353237
+
353228
353238
  /***/ }),
353229
353239
 
353230
353240
  /***/ "7e64":
@@ -361462,22 +361472,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
361462
361472
  /* unused harmony reexport * */
361463
361473
 
361464
361474
 
361465
- /***/ }),
361466
-
361467
- /***/ "88bb":
361468
- /***/ (function(module, exports, __webpack_require__) {
361469
-
361470
- // style-loader: Adds some css to the DOM by adding a <style> tag
361471
-
361472
- // load the styles
361473
- var content = __webpack_require__("ef03");
361474
- if(content.__esModule) content = content.default;
361475
- if(typeof content === 'string') content = [[module.i, content, '']];
361476
- if(content.locals) module.exports = content.locals;
361477
- // add the styles to the DOM
361478
- var add = __webpack_require__("499e").default
361479
- var update = add("4227159f", content, true, {"sourceMap":false,"shadowMode":false});
361480
-
361481
361475
  /***/ }),
361482
361476
 
361483
361477
  /***/ "88e0":
@@ -386796,6 +386790,20 @@ if(content.locals) module.exports = content.locals;
386796
386790
  var add = __webpack_require__("499e").default
386797
386791
  var update = add("490d8a49", content, true, {"sourceMap":false,"shadowMode":false});
386798
386792
 
386793
+ /***/ }),
386794
+
386795
+ /***/ "a1d4":
386796
+ /***/ (function(module, exports, __webpack_require__) {
386797
+
386798
+ // Imports
386799
+ var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("24fb");
386800
+ exports = ___CSS_LOADER_API_IMPORT___(false);
386801
+ // Module
386802
+ exports.push([module.i, ".form-box .quick-item[data-v-4fb614c6]{margin-bottom:10px;min-width:32px}.form-box .quick-item .quick-row[data-v-4fb614c6]{display:flex}.form-box .quick-item .quick-row>div[data-v-4fb614c6]{display:inline-block;box-sizing:border-box}.form-box .quick-item .quick-row .quick-item-title[data-v-4fb614c6]{min-width:80px;line-height:32px;text-align:right;padding-left:12px;color:#000}.form-box .quick-item .quick-row .quick-item-col[data-v-4fb614c6]{padding:0 12px}.form-box .quick-item .quick-row .quick-item-title-default[data-v-4fb614c6]{width:25%}.form-box .quick-item .quick-row .quick-item-col-default[data-v-4fb614c6]{width:75%}.form-box .quick-item .check-box[data-v-4fb614c6]{line-height:32px}.form-box .quick-item .check-date-btn[data-v-4fb614c6]{display:inline-block;line-height:32px;height:32px;padding:0 10px;background-color:#ddd;cursor:pointer}.form-box .quick-item .check-date-btn.ml[data-v-4fb614c6]{margin-left:20px}.form-box .quick-item .check-date-btn.mr[data-v-4fb614c6]{margin-right:20px}.form-box .quick-item .check-date[data-v-4fb614c6]{display:inline-block;line-height:33px}.form-box .quick-item .birthday-item>div[data-v-4fb614c6]{margin-top:5px}.form-box .quick-item .birthday-item>div p[data-v-4fb614c6]{display:inline-block;margin:0 20px}.form-box .quick-item .birthday-item>div>span[data-v-4fb614c6]{margin-top:5px}.form-box .quick-item .birthday-item .age-wrap[data-v-4fb614c6]{display:inline-block}.form-box .quick-item[data-v-4fb614c6] .ant-input-wrapper .ant-input-group-addon{border:1px solid #d9d9d9!important;border-left:0!important}.form-box .quick-item[data-v-4fb614c6] .num-picker{position:relative;display:flex}.form-box .quick-item[data-v-4fb614c6] .num-picker.num-picker-unit{padding-right:20px}.form-box .quick-item[data-v-4fb614c6] .num-picker input{text-align:left!important}.form-box .quick-item[data-v-4fb614c6] .num-picker:hover .clear-number-icon{display:block}.form-box .quick-item[data-v-4fb614c6] .num-picker /deep/ .ant-calendar-range-picker-input{text-align:left}.form-box .quick-item[data-v-4fb614c6] .num-picker .clear-number-icon{position:absolute;right:5px;top:6px;display:none;cursor:pointer;z-index:1000}.form-box .ant-radio-button-wrapper[data-v-4fb614c6]{padding:0 8px;height:30px;line-height:30px;margin-top:5px}.form-box .label-attr-container .edit-label[data-v-4fb614c6]{color:#000;font-size:14px;line-height:32px;padding-left:0}.form-box .label-attr-container .label-container-height[data-v-4fb614c6]{overflow:hidden;height:74px;flex:none}.form-box .label-attr-container .edit-content[data-v-4fb614c6]{padding:0}.form-box .label-attr-container .label-unfold-btn[data-v-4fb614c6]{margin:8px 0;color:rgba(0,0,0,.6);cursor:pointer}.form-box .label-attr-container .label-unfold-btn>span[data-v-4fb614c6]{display:flex;align-items:center;line-height:1}.form-box .label-attr-container .label-unfold-btn .anticon[data-v-4fb614c6]{font-size:16px;margin-left:8px}.form-box .label-attr-container .label-unfold-btn[data-v-4fb614c6]:active,.form-box .label-attr-container .label-unfold-btn[data-v-4fb614c6]:hover{color:#2d7aff}.form-box.quick-search-table .module-title[data-v-4fb614c6]{color:#506493;line-height:20px;padding-left:12px;border-left:4px solid #2d7aff}.form-box.quick-search-table .quick-item[data-v-4fb614c6]{display:inline-block}.form-box.quick-search-table .quick-item.quick-block[data-v-4fb614c6]{display:block}.form-box .psw-icon[data-v-4fb614c6]{cursor:pointer;color:#969696}.form-box .psw-icon[data-v-4fb614c6]:active{color:#5585f5}.form-box[data-v-4fb614c6] ::-webkit-input-placeholder{font-family:Avenir,Helvetica,Arial,sans-serif}.form-box[data-v-4fb614c6] ::-moz-placeholder{font-family:Avenir,Helvetica,Arial,sans-serif}.form-box[data-v-4fb614c6] :-ms-input-placeholder{font-family:Avenir,Helvetica,Arial,sans-serif}", ""]);
386803
+ // Exports
386804
+ module.exports = exports;
386805
+
386806
+
386799
386807
  /***/ }),
386800
386808
 
386801
386809
  /***/ "a1d9":
@@ -406563,22 +406571,6 @@ function isLength(value) {
406563
406571
  module.exports = isLength;
406564
406572
 
406565
406573
 
406566
- /***/ }),
406567
-
406568
- /***/ "b23a":
406569
- /***/ (function(module, exports, __webpack_require__) {
406570
-
406571
- // style-loader: Adds some css to the DOM by adding a <style> tag
406572
-
406573
- // load the styles
406574
- var content = __webpack_require__("d478");
406575
- if(content.__esModule) content = content.default;
406576
- if(typeof content === 'string') content = [[module.i, content, '']];
406577
- if(content.locals) module.exports = content.locals;
406578
- // add the styles to the DOM
406579
- var add = __webpack_require__("499e").default
406580
- var update = add("4663d8d2", content, true, {"sourceMap":false,"shadowMode":false});
406581
-
406582
406574
  /***/ }),
406583
406575
 
406584
406576
  /***/ "b24f":
@@ -415540,7 +415532,7 @@ module.exports = __webpack_require__("051b");
415540
415532
  /***/ "ba0c":
415541
415533
  /***/ (function(module) {
415542
415534
 
415543
- module.exports = JSON.parse("{\"_args\":[[\"websocket@1.0.34\",\"E:\\\\project\\\\cnhis-design-vue-chat\\\\cnhis-design-vue\"]],\"_from\":\"websocket@1.0.34\",\"_id\":\"websocket@1.0.34\",\"_inBundle\":false,\"_integrity\":\"sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==\",\"_location\":\"/websocket\",\"_optional\":true,\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"websocket@1.0.34\",\"name\":\"websocket\",\"escapedName\":\"websocket\",\"rawSpec\":\"1.0.34\",\"saveSpec\":null,\"fetchSpec\":\"1.0.34\"},\"_requiredBy\":[\"/stompjs\"],\"_resolved\":\"https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz\",\"_spec\":\"1.0.34\",\"_where\":\"E:\\\\project\\\\cnhis-design-vue-chat\\\\cnhis-design-vue\",\"author\":{\"name\":\"Brian McKelvey\",\"email\":\"theturtle32@gmail.com\",\"url\":\"https://github.com/theturtle32\"},\"browser\":\"lib/browser.js\",\"bugs\":{\"url\":\"https://github.com/theturtle32/WebSocket-Node/issues\"},\"config\":{\"verbose\":false},\"contributors\":[{\"name\":\"Iñaki Baz Castillo\",\"email\":\"ibc@aliax.net\",\"url\":\"http://dev.sipdoc.net\"}],\"dependencies\":{\"bufferutil\":\"^4.0.1\",\"debug\":\"^2.2.0\",\"es5-ext\":\"^0.10.50\",\"typedarray-to-buffer\":\"^3.1.5\",\"utf-8-validate\":\"^5.0.2\",\"yaeti\":\"^0.0.6\"},\"description\":\"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.\",\"devDependencies\":{\"buffer-equal\":\"^1.0.0\",\"gulp\":\"^4.0.2\",\"gulp-jshint\":\"^2.0.4\",\"jshint\":\"^2.0.0\",\"jshint-stylish\":\"^2.2.1\",\"tape\":\"^4.9.1\"},\"directories\":{\"lib\":\"./lib\"},\"engines\":{\"node\":\">=4.0.0\"},\"homepage\":\"https://github.com/theturtle32/WebSocket-Node\",\"keywords\":[\"websocket\",\"websockets\",\"socket\",\"networking\",\"comet\",\"push\",\"RFC-6455\",\"realtime\",\"server\",\"client\"],\"license\":\"Apache-2.0\",\"main\":\"index\",\"name\":\"websocket\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/theturtle32/WebSocket-Node.git\"},\"scripts\":{\"gulp\":\"gulp\",\"test\":\"tape test/unit/*.js\"},\"version\":\"1.0.34\"}");
415535
+ module.exports = JSON.parse("{\"_args\":[[\"websocket@1.0.34\",\"E:\\\\project\\\\cnhis-design-vue-chat\\\\cnhis-design-vue\"]],\"_development\":true,\"_from\":\"websocket@1.0.34\",\"_id\":\"websocket@1.0.34\",\"_inBundle\":false,\"_integrity\":\"sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==\",\"_location\":\"/websocket\",\"_optional\":true,\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"websocket@1.0.34\",\"name\":\"websocket\",\"escapedName\":\"websocket\",\"rawSpec\":\"1.0.34\",\"saveSpec\":null,\"fetchSpec\":\"1.0.34\"},\"_requiredBy\":[\"/stompjs\"],\"_resolved\":\"https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz\",\"_spec\":\"1.0.34\",\"_where\":\"E:\\\\project\\\\cnhis-design-vue-chat\\\\cnhis-design-vue\",\"author\":{\"name\":\"Brian McKelvey\",\"email\":\"theturtle32@gmail.com\",\"url\":\"https://github.com/theturtle32\"},\"browser\":\"lib/browser.js\",\"bugs\":{\"url\":\"https://github.com/theturtle32/WebSocket-Node/issues\"},\"config\":{\"verbose\":false},\"contributors\":[{\"name\":\"Iñaki Baz Castillo\",\"email\":\"ibc@aliax.net\",\"url\":\"http://dev.sipdoc.net\"}],\"dependencies\":{\"bufferutil\":\"^4.0.1\",\"debug\":\"^2.2.0\",\"es5-ext\":\"^0.10.50\",\"typedarray-to-buffer\":\"^3.1.5\",\"utf-8-validate\":\"^5.0.2\",\"yaeti\":\"^0.0.6\"},\"description\":\"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.\",\"devDependencies\":{\"buffer-equal\":\"^1.0.0\",\"gulp\":\"^4.0.2\",\"gulp-jshint\":\"^2.0.4\",\"jshint\":\"^2.0.0\",\"jshint-stylish\":\"^2.2.1\",\"tape\":\"^4.9.1\"},\"directories\":{\"lib\":\"./lib\"},\"engines\":{\"node\":\">=4.0.0\"},\"homepage\":\"https://github.com/theturtle32/WebSocket-Node\",\"keywords\":[\"websocket\",\"websockets\",\"socket\",\"networking\",\"comet\",\"push\",\"RFC-6455\",\"realtime\",\"server\",\"client\"],\"license\":\"Apache-2.0\",\"main\":\"index\",\"name\":\"websocket\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/theturtle32/WebSocket-Node.git\"},\"scripts\":{\"gulp\":\"gulp\",\"test\":\"tape test/unit/*.js\"},\"version\":\"1.0.34\"}");
415544
415536
 
415545
415537
  /***/ }),
415546
415538
 
@@ -427865,6 +427857,17 @@ module.exports = clear
427865
427857
  /* unused harmony reexport * */
427866
427858
 
427867
427859
 
427860
+ /***/ }),
427861
+
427862
+ /***/ "c23b":
427863
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
427864
+
427865
+ "use strict";
427866
+ /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_QuickSearch_vue_vue_type_style_index_0_id_4fb614c6_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f2b1");
427867
+ /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_QuickSearch_vue_vue_type_style_index_0_id_4fb614c6_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_QuickSearch_vue_vue_type_style_index_0_id_4fb614c6_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
427868
+ /* unused harmony reexport * */
427869
+
427870
+
427868
427871
  /***/ }),
427869
427872
 
427870
427873
  /***/ "c282":
@@ -452181,6 +452184,17 @@ exports.push([module.i, ".base-search[data-v-4a029b3a]{flex:1}.base-search .base
452181
452184
  module.exports = exports;
452182
452185
 
452183
452186
 
452187
+ /***/ }),
452188
+
452189
+ /***/ "cb08":
452190
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
452191
+
452192
+ "use strict";
452193
+ /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_select_label_vue_vue_type_style_index_0_id_0d391bef_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("7e53");
452194
+ /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_select_label_vue_vue_type_style_index_0_id_0d391bef_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_select_label_vue_vue_type_style_index_0_id_0d391bef_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
452195
+ /* unused harmony reexport * */
452196
+
452197
+
452184
452198
  /***/ }),
452185
452199
 
452186
452200
  /***/ "cb29":
@@ -452262,6 +452276,20 @@ if(content.locals) module.exports = content.locals;
452262
452276
  var add = __webpack_require__("499e").default
452263
452277
  var update = add("f660f7f6", content, true, {"sourceMap":false,"shadowMode":false});
452264
452278
 
452279
+ /***/ }),
452280
+
452281
+ /***/ "cbdc":
452282
+ /***/ (function(module, exports, __webpack_require__) {
452283
+
452284
+ // Imports
452285
+ var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("24fb");
452286
+ exports = ___CSS_LOADER_API_IMPORT___(false);
452287
+ // Module
452288
+ exports.push([module.i, ".classification[data-v-6f434f44]{cursor:pointer}.classification .tree-type[data-v-6f434f44]{height:100%;border:1px solid #d5d5d5;width:150px;margin-top:8px;border-radius:4px;line-height:32px;padding-bottom:80px}.classification .tree-type .tree[data-v-6f434f44]{height:calc(100% - 32px);overflow:auto}.classification .tree-type .tree[data-v-6f434f44]::-webkit-scrollbar{width:5px}.classification .tree-type .header[data-v-6f434f44]{display:flex;justify-content:space-between;padding:0 10px;font-size:14px;border-bottom:1px solid #e6eaef}.classification .tree-type .tree-item[data-v-6f434f44]{border-bottom:1px solid #d5d5d5;cursor:pointer}.classification .tree-type .tree-item.tree-header[data-v-6f434f44]{padding:0 10px;box-sizing:border-box}.classification .tree-type .tree-item .parent[data-v-6f434f44]{display:flex;justify-content:space-between;align-items:center;padding:0 10px;font-weight:600}.classification .tree-type .tree-item .parent.open[data-v-6f434f44]{background-color:#f2f2f2;border-bottom:1px solid #d5d5d5}.classification .tree-type .tree-item .header-item[data-v-6f434f44]{color:rgba(0,0,0,.6);box-sizing:border-box;border-bottom:1px solid transparent;line-height:1.4}.classification .tree-type .tree-item .header-item.selected[data-v-6f434f44],.classification .tree-type .tree-item .header-item[data-v-6f434f44]:hover{color:#2d7aff}.classification .tree-type .tree-item .header-item[data-v-6f434f44]:active{color:#000;border-color:transparent}.classification .tree-type .tree-item .children[data-v-6f434f44]{display:flex;align-items:center;padding-left:23px;padding-right:10px;height:32px}.classification .tree-type .tree-item .children .child-item[data-v-6f434f44]{display:flex;align-items:center;max-width:100%;color:#7c7c7c;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.5;border-bottom:1px solid transparent}.classification .tree-type .tree-item .children .child-item[data-v-6f434f44]:hover{color:#2d7aff}.classification .tree-type .tree-item .children .child-item.selected[data-v-6f434f44]{width:100%;display:flex;align-items:center;justify-content:space-between;color:#2d7aff}.classification .tree-type .tree-item .children .child-item[data-v-6f434f44]:active{color:#000;border-color:transparent}.classification .tree-type .tree-item .children .child-item.disabled[data-v-6f434f44]{color:rgba(0,0,0,.2)}.classification .tree-type .tree-item .children .child-item .child-item-content[data-v-6f434f44]{display:flex;align-items:center}.classification .tree-type .tree-item .children .child-item .child-item-name[data-v-6f434f44]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.classification .tree-type .tree-item .children .child-item .digital-span[data-v-6f434f44]{flex:1;margin-left:5px;text-align:left}.classification .tree-type .tree-type-footer[data-v-6f434f44]{position:absolute;bottom:0;width:100%;padding-left:16px;background:#fff}.classification .tree-type .tree-type-footer .selected-num[data-v-6f434f44]{margin-bottom:9px}.classification .tree-type .tree-type-footer .selected-item-del[data-v-6f434f44]{margin-left:0;margin-bottom:15px}.classification .tile-type[data-v-6f434f44]{border:1px solid #d5d5d5;border-radius:4px;margin-bottom:8px;padding:0 17px}.classification .tile-type .header[data-v-6f434f44]{width:100%;display:inline-flex;justify-content:space-between;align-items:center;line-height:44px;border-bottom:1px solid #d5d5d5}.classification .tile-type .header .all-data[data-v-6f434f44]{margin-right:auto;border-bottom:1px solid transparent;line-height:1.4;color:#000;font-size:14px;font-family:PingFangSC-Medium,PingFang SC;font-weight:500}.classification .tile-type .header .all-data[data-v-6f434f44]:hover{color:#2d7aff}.classification .tile-type .header .all-data[data-v-6f434f44]:active{color:#000;border-color:transparent}.classification .tile-type .header .selected[data-v-6f434f44]{color:#2d7aff}.classification .tile-type .header .right-setting[data-v-6f434f44]{color:#000}.classification .tile-type .header .right-setting .anticon[data-v-6f434f44]{color:rgba(0,0,0,.6);margin-right:6px}.classification .tile-type .header .right-setting .upack-up-btn[data-v-6f434f44]{color:#2d7aff}.classification .tile-type .tile[data-v-6f434f44]{border-bottom:1px solid #d5d5d5;padding:9px 0}.classification .tile-type .tile-item[data-v-6f434f44]{display:flex;line-height:38px;cursor:pointer}.classification .tile-type .tile-item .parent[data-v-6f434f44]{width:135px;padding-right:16px;color:#000;font-size:14px;font-weight:600;font-family:PingFangSC-Medium,PingFang SC;max-width:135px;box-sizing:border-box}.classification .tile-type .tile-item .children[data-v-6f434f44]{flex:1}.classification .tile-type .tile-item .children .child-item[data-v-6f434f44]{margin:0 5px;padding:1px 6px;color:#7c7c7c;font-size:14px;line-height:1.5;border-bottom:1px solid transparent;border-radius:4px;display:inline-block}.classification .tile-type .tile-item .children .child-item.selected[data-v-6f434f44],.classification .tile-type .tile-item .children .child-item[data-v-6f434f44]:hover{color:#2d7aff;background-color:rgba(45,122,255,.1)}.classification .tile-type .tile-item .children .child-item[data-v-6f434f44]:active{color:#000;border-color:transparent}.classification .tile-type .tile-item .children .child-item.disabled[data-v-6f434f44]{color:rgba(0,0,0,.2)}.classification .tile-type .tile-item .child-item.selected[data-v-6f434f44]{color:#2d7aff}.classification .select-type[data-v-6f434f44]{position:relative;width:100px;line-height:32px;height:32px;margin-right:8px;margin-bottom:8px}.classification .select-type .title[data-v-6f434f44]{display:flex;justify-content:space-between;align-items:center;width:100%;height:100%;padding:0 8px;border:1px solid #d5d5d5;border-radius:4px;color:#969696;font-size:12px;box-sizing:border-box}.classification .select-type .title>span[data-v-6f434f44]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#212121;font-size:14px}.classification .select-type .title i[data-v-6f434f44]{font-size:12px}.classification .select-type .main-wrapper[data-v-6f434f44]{position:absolute;z-index:3000;width:100%;min-width:270px;border:1px solid #d5d5d5;background-color:#fff;border-radius:4px;top:39px}.classification .select-type .main-wrapper[data-v-6f434f44]::-webkit-scrollbar{width:5px}.classification .select-type .main-wrapper .footer[data-v-6f434f44]{display:flex;align-items:center}.classification .select-type .main-wrapper .footer span[data-v-6f434f44]:first-child{margin-right:16px}.classification .select-type .tree[data-v-6f434f44]{padding:32px 0;max-height:300px;overflow:auto}.classification .select-type .tree-item[data-v-6f434f44]{border-bottom:1px solid #d5d5d5;cursor:pointer}.classification .select-type .tree-item.tree-header[data-v-6f434f44]{padding:0 10px;box-sizing:border-box;display:flex;align-items:center;position:absolute;width:100%;background-color:#fff;top:0;height:40px}.classification .select-type .tree-item .child-header[data-v-6f434f44]{flex:1}.classification .select-type .tree-item .parent[data-v-6f434f44]{display:flex;justify-content:space-between;align-items:center;padding:0 10px;font-weight:600}.classification .select-type .tree-item .parent.open[data-v-6f434f44]{background-color:#f2f2f2;border-bottom:1px solid #d5d5d5}.classification .select-type .tree-item .header-item[data-v-6f434f44]{color:rgba(0,0,0,.6);border-bottom:1px solid transparent}.classification .select-type .tree-item .header-item.selected[data-v-6f434f44],.classification .select-type .tree-item .header-item[data-v-6f434f44]:hover{color:#2d7aff}.classification .select-type .tree-item .header-item[data-v-6f434f44]:active{color:#000;border-color:transparent}.classification .select-type .tree-item .children[data-v-6f434f44]{display:flex;align-items:center;padding-left:23px;padding-right:10px;height:32px;line-height:32px}.classification .select-type .tree-item .children .child-item[data-v-6f434f44]{display:inline-block;max-width:100%;color:#7c7c7c;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.5;border-bottom:1px solid transparent}.classification .select-type .tree-item .children .child-item.child-header[data-v-6f434f44]{padding:0 10px}.classification .select-type .tree-item .children .child-item.header-item[data-v-6f434f44]{color:rgba(0,0,0,.6);border-bottom:1px solid transparent}.classification .select-type .tree-item .children .child-item.header-item.selected[data-v-6f434f44],.classification .select-type .tree-item .children .child-item.header-item[data-v-6f434f44]:hover{color:#2d7aff}.classification .select-type .tree-item .children .child-item.header-item[data-v-6f434f44]:active{color:#000;border-color:transparent}.classification .select-type .tree-item .children .child-item[data-v-6f434f44]:hover{color:#2d7aff}.classification .select-type .tree-item .children .child-item.selected[data-v-6f434f44]{width:100%;display:flex;align-items:center;justify-content:space-between;color:#2d7aff}.classification .select-type .tree-item .children .child-item[data-v-6f434f44]:active{color:#000;border-color:transparent}.classification .select-type .tree-item .children .child-item.disabled[data-v-6f434f44]{color:rgba(0,0,0,.2)}.classification .select-type .tree-item[data-v-6f434f44]:last-child{border-bottom:0}.classification .select-type .select-type-footer[data-v-6f434f44]{position:absolute;width:100%;bottom:0;display:flex;align-items:center;justify-content:space-between;height:40px;padding:0 12px;background-color:#fff;border-top:1px solid #d5d5d5}.classification .group-type .header .all-data[data-v-6f434f44]:active{color:#000}.classification .group-type .header .right-setting .upack-up-btn[data-v-6f434f44]{color:#2d7aff}.classification .group-type .group .child-item[data-v-6f434f44]{color:#7c7c7c;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom:1px solid transparent;margin-right:8px}.classification .group-type .group .child-item[data-v-6f434f44]:hover{color:#2d7aff;border-color:transparent}.classification .group-type .group .child-item.selected[data-v-6f434f44]{color:#2d7aff}.classification .group-type .group .child-item[data-v-6f434f44]:active{color:#000;border-color:transparent}.classification .group-type .group .child-item.disabled[data-v-6f434f44]{color:rgba(0,0,0,.2)}.classification .group-type .select-type-footer[data-v-6f434f44]{position:absolute;width:100%;bottom:0;display:flex;align-items:center;justify-content:space-between;height:32px;padding:0 12px;background-color:#fff}.classification .group-type[data-v-6f434f44]{border:1px solid #d5d5d5;padding:0 16px;border-radius:4px;margin-bottom:8px}.classification .group-type .header[data-v-6f434f44]{width:100%;display:inline-flex;justify-content:space-between;align-items:center;line-height:44px;border-bottom:1px solid #d5d5d5;padding-left:4px}.classification .group-type .header .all-data[data-v-6f434f44]{margin-right:auto;color:rgba(0,0,0,.6);border-bottom:1px solid transparent}.classification .group-type .header .all-data[data-v-6f434f44]:active,.classification .group-type .header .all-data[data-v-6f434f44]:hover{color:#2d7aff;border-color:transparent}.classification .group-type .header .selected[data-v-6f434f44]{color:#2d7aff}.classification .group-type .header .right-setting[data-v-6f434f44]{color:#000}.classification .group-type .header .right-setting .anticon[data-v-6f434f44]{color:rgba(0,0,0,.6);margin-right:6px}.classification .group-type .group[data-v-6f434f44]{padding:16px 0;border-bottom:1px solid #d5d5d5}.classification .group-type .group[data-v-6f434f44] .ant-select{width:130px;margin-right:8px;margin-bottom:8px}.classification .selected-list[data-v-6f434f44]{padding:11.5px 6px;display:flex;align-items:center}.classification .selected-list .selected-item[data-v-6f434f44]{display:flex;align-items:center;color:#2d7aff;padding:1px 6.5px 1px 8px;background-color:rgba(45,122,255,.1);border-radius:4px;margin-left:8px}.classification .selected-list .selected-item[data-v-6f434f44] .anticon-close{margin-left:13px;font-size:12px;color:#2474ff}.classification .selected-num[data-v-6f434f44]{font-size:14px;color:rgba(0,0,0,.6);line-height:20px;margin-right:8px}.classification .selected-item-del[data-v-6f434f44]{display:flex;align-items:center;font-size:14px;color:#2474ff;margin-left:22px;line-height:20px}.classification .selected-item-del .svg-icon-btn[data-v-6f434f44]{margin-right:6px}.classification .selected-item-del[data-v-6f434f44]:hover{color:rgba(36,116,255,.8)}.classification .disabled[data-v-6f434f44]{pointer-events:none}.classification .classify-4-container[data-v-6f434f44]{overflow:hidden;transition:height .2s ease-in}.classification div.classify-4[data-v-6f434f44]{margin-bottom:0;border:none;border-bottom:1px solid #d5d5d5}.classification div.classify-4 .header[data-v-6f434f44]{border-bottom:none!important}", ""]);
452289
+ // Exports
452290
+ module.exports = exports;
452291
+
452292
+
452265
452293
  /***/ }),
452266
452294
 
452267
452295
  /***/ "cc12":
@@ -457051,17 +457079,6 @@ module.exports = function (it) {
457051
457079
  };
457052
457080
 
457053
457081
 
457054
- /***/ }),
457055
-
457056
- /***/ "d1ca":
457057
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
457058
-
457059
- "use strict";
457060
- /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_select_label_vue_vue_type_style_index_0_id_9bef0184_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ff24");
457061
- /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_select_label_vue_vue_type_style_index_0_id_9bef0184_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_select_label_vue_vue_type_style_index_0_id_9bef0184_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
457062
- /* unused harmony reexport * */
457063
-
457064
-
457065
457082
  /***/ }),
457066
457083
 
457067
457084
  /***/ "d1e7":
@@ -458843,20 +458860,6 @@ var every = helperCreateIterateHandle('every', 1, 1, false, true)
458843
458860
  module.exports = every
458844
458861
 
458845
458862
 
458846
- /***/ }),
458847
-
458848
- /***/ "d478":
458849
- /***/ (function(module, exports, __webpack_require__) {
458850
-
458851
- // Imports
458852
- var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("24fb");
458853
- exports = ___CSS_LOADER_API_IMPORT___(false);
458854
- // Module
458855
- exports.push([module.i, ".classification[data-v-2cc2be68]{cursor:pointer}.classification .tree-type[data-v-2cc2be68]{height:100%;border:1px solid #d5d5d5;width:150px;margin-top:8px;border-radius:4px;line-height:32px;padding-bottom:80px}.classification .tree-type .tree[data-v-2cc2be68]{height:calc(100% - 32px);overflow:auto}.classification .tree-type .tree[data-v-2cc2be68]::-webkit-scrollbar{width:5px}.classification .tree-type .header[data-v-2cc2be68]{display:flex;justify-content:space-between;padding:0 10px;font-size:14px;border-bottom:1px solid #e6eaef}.classification .tree-type .tree-item[data-v-2cc2be68]{border-bottom:1px solid #d5d5d5;cursor:pointer}.classification .tree-type .tree-item.tree-header[data-v-2cc2be68]{padding:0 10px;box-sizing:border-box}.classification .tree-type .tree-item .parent[data-v-2cc2be68]{display:flex;justify-content:space-between;align-items:center;padding:0 10px;font-weight:600}.classification .tree-type .tree-item .parent.open[data-v-2cc2be68]{background-color:#f2f2f2;border-bottom:1px solid #d5d5d5}.classification .tree-type .tree-item .header-item[data-v-2cc2be68]{color:rgba(0,0,0,.6);box-sizing:border-box;border-bottom:1px solid transparent;line-height:1.4}.classification .tree-type .tree-item .header-item.selected[data-v-2cc2be68],.classification .tree-type .tree-item .header-item[data-v-2cc2be68]:hover{color:#2d7aff}.classification .tree-type .tree-item .header-item[data-v-2cc2be68]:active{color:#000;border-color:transparent}.classification .tree-type .tree-item .children[data-v-2cc2be68]{display:flex;align-items:center;padding-left:23px;padding-right:10px;height:32px}.classification .tree-type .tree-item .children .child-item[data-v-2cc2be68]{display:flex;align-items:center;max-width:100%;color:#7c7c7c;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.5;border-bottom:1px solid transparent}.classification .tree-type .tree-item .children .child-item[data-v-2cc2be68]:hover{color:#2d7aff}.classification .tree-type .tree-item .children .child-item.selected[data-v-2cc2be68]{width:100%;display:flex;align-items:center;justify-content:space-between;color:#2d7aff}.classification .tree-type .tree-item .children .child-item[data-v-2cc2be68]:active{color:#000;border-color:transparent}.classification .tree-type .tree-item .children .child-item.disabled[data-v-2cc2be68]{color:rgba(0,0,0,.2)}.classification .tree-type .tree-item .children .child-item .child-item-content[data-v-2cc2be68]{display:flex;align-items:center}.classification .tree-type .tree-item .children .child-item .child-item-name[data-v-2cc2be68]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.classification .tree-type .tree-item .children .child-item .digital-span[data-v-2cc2be68]{flex:1;margin-left:5px;text-align:left}.classification .tree-type .tree-type-footer[data-v-2cc2be68]{position:absolute;bottom:0;width:100%;padding-left:16px;background:#fff}.classification .tree-type .tree-type-footer .selected-num[data-v-2cc2be68]{margin-bottom:9px}.classification .tree-type .tree-type-footer .selected-item-del[data-v-2cc2be68]{margin-left:0;margin-bottom:15px}.classification .tile-type[data-v-2cc2be68]{border:1px solid #d5d5d5;border-radius:4px;margin-bottom:8px;padding:0 17px}.classification .tile-type .header[data-v-2cc2be68]{width:100%;display:inline-flex;justify-content:space-between;align-items:center;line-height:44px;border-bottom:1px solid #d5d5d5}.classification .tile-type .header .all-data[data-v-2cc2be68]{margin-right:auto;border-bottom:1px solid transparent;line-height:1.4;color:#000;font-size:14px;font-family:PingFangSC-Medium,PingFang SC;font-weight:500}.classification .tile-type .header .all-data[data-v-2cc2be68]:hover{color:#2d7aff}.classification .tile-type .header .all-data[data-v-2cc2be68]:active{color:#000;border-color:transparent}.classification .tile-type .header .selected[data-v-2cc2be68]{color:#2d7aff}.classification .tile-type .header .right-setting[data-v-2cc2be68]{color:#000}.classification .tile-type .header .right-setting .anticon[data-v-2cc2be68]{color:rgba(0,0,0,.6);margin-right:6px}.classification .tile-type .header .right-setting .upack-up-btn[data-v-2cc2be68]{color:#2d7aff}.classification .tile-type .tile[data-v-2cc2be68]{border-bottom:1px solid #d5d5d5;padding:9px 0}.classification .tile-type .tile-item[data-v-2cc2be68]{display:flex;line-height:38px;cursor:pointer}.classification .tile-type .tile-item .parent[data-v-2cc2be68]{width:135px;padding-right:16px;color:#000;font-size:14px;font-weight:600;font-family:PingFangSC-Medium,PingFang SC;max-width:135px;box-sizing:border-box}.classification .tile-type .tile-item .children[data-v-2cc2be68]{flex:1}.classification .tile-type .tile-item .children .child-item[data-v-2cc2be68]{margin:0 5px;padding:1px 6px;color:#7c7c7c;font-size:14px;line-height:1.5;border-bottom:1px solid transparent;border-radius:4px;display:inline-block}.classification .tile-type .tile-item .children .child-item.selected[data-v-2cc2be68],.classification .tile-type .tile-item .children .child-item[data-v-2cc2be68]:hover{color:#2d7aff;background-color:rgba(45,122,255,.1)}.classification .tile-type .tile-item .children .child-item[data-v-2cc2be68]:active{color:#000;border-color:transparent}.classification .tile-type .tile-item .children .child-item.disabled[data-v-2cc2be68]{color:rgba(0,0,0,.2)}.classification .tile-type .tile-item .child-item.selected[data-v-2cc2be68]{color:#2d7aff}.classification .select-type[data-v-2cc2be68]{position:relative;width:100px;line-height:32px;height:32px;margin-right:8px;margin-bottom:8px}.classification .select-type .title[data-v-2cc2be68]{display:flex;justify-content:space-between;align-items:center;width:100%;height:100%;padding:0 8px;border:1px solid #d5d5d5;border-radius:4px;color:#969696;font-size:12px;box-sizing:border-box}.classification .select-type .title>span[data-v-2cc2be68]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#212121;font-size:14px}.classification .select-type .title i[data-v-2cc2be68]{font-size:12px}.classification .select-type .main-wrapper[data-v-2cc2be68]{position:absolute;z-index:3000;width:100%;min-width:270px;border:1px solid #d5d5d5;background-color:#fff;border-radius:4px;top:39px}.classification .select-type .main-wrapper[data-v-2cc2be68]::-webkit-scrollbar{width:5px}.classification .select-type .main-wrapper .footer[data-v-2cc2be68]{display:flex;align-items:center}.classification .select-type .main-wrapper .footer span[data-v-2cc2be68]:first-child{margin-right:16px}.classification .select-type .tree[data-v-2cc2be68]{padding:32px 0;max-height:300px;overflow:auto}.classification .select-type .tree-item[data-v-2cc2be68]{border-bottom:1px solid #d5d5d5;cursor:pointer}.classification .select-type .tree-item.tree-header[data-v-2cc2be68]{padding:0 10px;box-sizing:border-box;display:flex;align-items:center;position:absolute;width:100%;background-color:#fff;top:0;height:40px}.classification .select-type .tree-item .child-header[data-v-2cc2be68]{flex:1}.classification .select-type .tree-item .parent[data-v-2cc2be68]{display:flex;justify-content:space-between;align-items:center;padding:0 10px;font-weight:600}.classification .select-type .tree-item .parent.open[data-v-2cc2be68]{background-color:#f2f2f2;border-bottom:1px solid #d5d5d5}.classification .select-type .tree-item .header-item[data-v-2cc2be68]{color:rgba(0,0,0,.6);border-bottom:1px solid transparent}.classification .select-type .tree-item .header-item.selected[data-v-2cc2be68],.classification .select-type .tree-item .header-item[data-v-2cc2be68]:hover{color:#2d7aff}.classification .select-type .tree-item .header-item[data-v-2cc2be68]:active{color:#000;border-color:transparent}.classification .select-type .tree-item .children[data-v-2cc2be68]{display:flex;align-items:center;padding-left:23px;padding-right:10px;height:32px;line-height:32px}.classification .select-type .tree-item .children .child-item[data-v-2cc2be68]{display:inline-block;max-width:100%;color:#7c7c7c;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.5;border-bottom:1px solid transparent}.classification .select-type .tree-item .children .child-item.child-header[data-v-2cc2be68]{padding:0 10px}.classification .select-type .tree-item .children .child-item.header-item[data-v-2cc2be68]{color:rgba(0,0,0,.6);border-bottom:1px solid transparent}.classification .select-type .tree-item .children .child-item.header-item.selected[data-v-2cc2be68],.classification .select-type .tree-item .children .child-item.header-item[data-v-2cc2be68]:hover{color:#2d7aff}.classification .select-type .tree-item .children .child-item.header-item[data-v-2cc2be68]:active{color:#000;border-color:transparent}.classification .select-type .tree-item .children .child-item[data-v-2cc2be68]:hover{color:#2d7aff}.classification .select-type .tree-item .children .child-item.selected[data-v-2cc2be68]{width:100%;display:flex;align-items:center;justify-content:space-between;color:#2d7aff}.classification .select-type .tree-item .children .child-item[data-v-2cc2be68]:active{color:#000;border-color:transparent}.classification .select-type .tree-item .children .child-item.disabled[data-v-2cc2be68]{color:rgba(0,0,0,.2)}.classification .select-type .tree-item[data-v-2cc2be68]:last-child{border-bottom:0}.classification .select-type .select-type-footer[data-v-2cc2be68]{position:absolute;width:100%;bottom:0;display:flex;align-items:center;justify-content:space-between;height:40px;padding:0 12px;background-color:#fff;border-top:1px solid #d5d5d5}.classification .group-type .header .all-data[data-v-2cc2be68]:active{color:#000}.classification .group-type .header .right-setting .upack-up-btn[data-v-2cc2be68]{color:#2d7aff}.classification .group-type .group .child-item[data-v-2cc2be68]{color:#7c7c7c;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom:1px solid transparent;margin-right:8px}.classification .group-type .group .child-item[data-v-2cc2be68]:hover{color:#2d7aff;border-color:transparent}.classification .group-type .group .child-item.selected[data-v-2cc2be68]{color:#2d7aff}.classification .group-type .group .child-item[data-v-2cc2be68]:active{color:#000;border-color:transparent}.classification .group-type .group .child-item.disabled[data-v-2cc2be68]{color:rgba(0,0,0,.2)}.classification .group-type .select-type-footer[data-v-2cc2be68]{position:absolute;width:100%;bottom:0;display:flex;align-items:center;justify-content:space-between;height:32px;padding:0 12px;background-color:#fff}.classification .group-type[data-v-2cc2be68]{border:1px solid #d5d5d5;padding:0 16px;border-radius:4px;margin-bottom:8px}.classification .group-type .header[data-v-2cc2be68]{width:100%;display:inline-flex;justify-content:space-between;align-items:center;line-height:44px;border-bottom:1px solid #d5d5d5;padding-left:4px}.classification .group-type .header .all-data[data-v-2cc2be68]{margin-right:auto;color:rgba(0,0,0,.6);border-bottom:1px solid transparent}.classification .group-type .header .all-data[data-v-2cc2be68]:active,.classification .group-type .header .all-data[data-v-2cc2be68]:hover{color:#2d7aff;border-color:transparent}.classification .group-type .header .selected[data-v-2cc2be68]{color:#2d7aff}.classification .group-type .header .right-setting[data-v-2cc2be68]{color:#000}.classification .group-type .header .right-setting .anticon[data-v-2cc2be68]{color:rgba(0,0,0,.6);margin-right:6px}.classification .group-type .group[data-v-2cc2be68]{padding:16px 0;border-bottom:1px solid #d5d5d5}.classification .group-type .group[data-v-2cc2be68] .ant-select{width:130px;margin-right:8px;margin-bottom:8px}.classification .selected-list[data-v-2cc2be68]{padding:11.5px 6px;display:flex;align-items:center}.classification .selected-list .selected-item[data-v-2cc2be68]{display:flex;align-items:center;color:#2d7aff;padding:1px 6.5px 1px 8px;background-color:rgba(45,122,255,.1);border-radius:4px;margin-left:8px}.classification .selected-list .selected-item[data-v-2cc2be68] .anticon-close{margin-left:13px;font-size:12px;color:#2474ff}.classification .selected-num[data-v-2cc2be68]{font-size:14px;color:rgba(0,0,0,.6);line-height:20px;margin-right:8px}.classification .selected-item-del[data-v-2cc2be68]{display:flex;align-items:center;font-size:14px;color:#2474ff;margin-left:22px;line-height:20px}.classification .selected-item-del .svg-icon-btn[data-v-2cc2be68]{margin-right:6px}.classification .selected-item-del[data-v-2cc2be68]:hover{color:rgba(36,116,255,.8)}.classification .disabled[data-v-2cc2be68]{pointer-events:none}.classification .classify-4-container[data-v-2cc2be68]{overflow:hidden;transition:height .2s ease-in}.classification div.classify-4[data-v-2cc2be68]{margin-bottom:0;border:none;border-bottom:1px solid #d5d5d5}.classification div.classify-4 .header[data-v-2cc2be68]{border-bottom:none!important}", ""]);
458856
- // Exports
458857
- module.exports = exports;
458858
-
458859
-
458860
458863
  /***/ }),
458861
458864
 
458862
458865
  /***/ "d4a2":
@@ -466837,6 +466840,20 @@ for (var COLLECTION_NAME in DOMIterables) {
466837
466840
  }
466838
466841
 
466839
466842
 
466843
+ /***/ }),
466844
+
466845
+ /***/ "ddf3":
466846
+ /***/ (function(module, exports, __webpack_require__) {
466847
+
466848
+ // Imports
466849
+ var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("24fb");
466850
+ exports = ___CSS_LOADER_API_IMPORT___(false);
466851
+ // Module
466852
+ exports.push([module.i, ".list .list-title[data-v-4592973c]{display:flex;background-color:#f2f2f4;border:1px solid #e1dfdf;height:52px;line-height:52px}.list .list-title .list-title-item[data-v-4592973c]{width:25%;font-weight:700}.list .list-content li[data-v-4592973c]{display:flex;height:52px;line-height:52px}.list .list-content li .list-content-item[data-v-4592973c]{width:25%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}.list .list-content li .list-content-item .svg-icon-btn[data-v-4592973c]{margin-left:0;margin-right:8px}.list .list-content li.checked[data-v-4592973c],.list .list-content li.checked .text[data-v-4592973c]{background-color:#f2f2f2}.list .list-content li .text[data-v-4592973c]{position:relative;display:inline-block;padding:0 10px;background-color:#fff}.list .list-content li .list-content-line[data-v-4592973c]{width:75%;text-align:center;position:relative}.list .list-content li .list-content-line[data-v-4592973c]:before{content:\"\";position:absolute;border:1px solid #e8e8e8;width:100%;left:0;margin-top:20px}.list .list-content-item[data-v-4592973c],.list .list-title-item[data-v-4592973c]{margin-left:-1px;padding:0 10px}.list .list-content-item[data-v-4592973c]{border-bottom:1px solid #e1dfdf;margin-top:-1px}.list .list-content-item[data-v-4592973c] .ant-switch{width:28px;min-width:28px;height:16px}.list .list-content-item[data-v-4592973c] .ant-switch:after{width:12px;height:12px}.list .list-content-radio[data-v-4592973c],.list .list-content-switch[data-v-4592973c]{text-align:center}.list .anticon+.anticon[data-v-4592973c]{margin-left:8px}.btn-reset[data-v-4592973c]{float:left}", ""]);
466853
+ // Exports
466854
+ module.exports = exports;
466855
+
466856
+
466840
466857
  /***/ }),
466841
466858
 
466842
466859
  /***/ "de09":
@@ -468043,6 +468060,22 @@ module.exports = function (name) {
468043
468060
  };
468044
468061
 
468045
468062
 
468063
+ /***/ }),
468064
+
468065
+ /***/ "e1c7":
468066
+ /***/ (function(module, exports, __webpack_require__) {
468067
+
468068
+ // style-loader: Adds some css to the DOM by adding a <style> tag
468069
+
468070
+ // load the styles
468071
+ var content = __webpack_require__("cbdc");
468072
+ if(content.__esModule) content = content.default;
468073
+ if(typeof content === 'string') content = [[module.i, content, '']];
468074
+ if(content.locals) module.exports = content.locals;
468075
+ // add the styles to the DOM
468076
+ var add = __webpack_require__("499e").default
468077
+ var update = add("4ba9b31b", content, true, {"sourceMap":false,"shadowMode":false});
468078
+
468046
468079
  /***/ }),
468047
468080
 
468048
468081
  /***/ "e1d3":
@@ -468491,17 +468524,6 @@ addToUnscopables('values');
468491
468524
  addToUnscopables('entries');
468492
468525
 
468493
468526
 
468494
- /***/ }),
468495
-
468496
- /***/ "e282":
468497
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
468498
-
468499
- "use strict";
468500
- /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_TableModal_vue_vue_type_style_index_0_id_47bef686_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("6be7");
468501
- /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_TableModal_vue_vue_type_style_index_0_id_47bef686_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_10_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_10_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_10_oneOf_1_3_node_modules_less_loader_dist_cjs_js_ref_10_oneOf_1_4_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_TableModal_vue_vue_type_style_index_0_id_47bef686_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
468502
- /* unused harmony reexport * */
468503
-
468504
-
468505
468527
  /***/ }),
468506
468528
 
468507
468529
  /***/ "e285":
@@ -470040,6 +470062,22 @@ $({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
470040
470062
  module.exports = true;
470041
470063
 
470042
470064
 
470065
+ /***/ }),
470066
+
470067
+ /***/ "e496":
470068
+ /***/ (function(module, exports, __webpack_require__) {
470069
+
470070
+ // style-loader: Adds some css to the DOM by adding a <style> tag
470071
+
470072
+ // load the styles
470073
+ var content = __webpack_require__("ddf3");
470074
+ if(content.__esModule) content = content.default;
470075
+ if(typeof content === 'string') content = [[module.i, content, '']];
470076
+ if(content.locals) module.exports = content.locals;
470077
+ // add the styles to the DOM
470078
+ var add = __webpack_require__("499e").default
470079
+ var update = add("fb9cb2ca", content, true, {"sourceMap":false,"shadowMode":false});
470080
+
470043
470081
  /***/ }),
470044
470082
 
470045
470083
  /***/ "e4a2":
@@ -476885,20 +476923,6 @@ exports.push([module.i, ".chat-footer-modal-big{padding:10px}.chat-footer-modal-
476885
476923
  module.exports = exports;
476886
476924
 
476887
476925
 
476888
- /***/ }),
476889
-
476890
- /***/ "ef03":
476891
- /***/ (function(module, exports, __webpack_require__) {
476892
-
476893
- // Imports
476894
- var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("24fb");
476895
- exports = ___CSS_LOADER_API_IMPORT___(false);
476896
- // Module
476897
- exports.push([module.i, ".form-box .quick-item[data-v-e5efab7c]{margin-bottom:10px;min-width:32px}.form-box .quick-item .quick-row[data-v-e5efab7c]{display:flex}.form-box .quick-item .quick-row>div[data-v-e5efab7c]{display:inline-block;box-sizing:border-box}.form-box .quick-item .quick-row .quick-item-title[data-v-e5efab7c]{min-width:80px;line-height:32px;text-align:right;padding-left:12px;color:#000}.form-box .quick-item .quick-row .quick-item-col[data-v-e5efab7c]{padding:0 12px}.form-box .quick-item .quick-row .quick-item-title-default[data-v-e5efab7c]{width:25%}.form-box .quick-item .quick-row .quick-item-col-default[data-v-e5efab7c]{width:75%}.form-box .quick-item .check-box[data-v-e5efab7c]{line-height:32px}.form-box .quick-item .check-date-btn[data-v-e5efab7c]{display:inline-block;line-height:32px;height:32px;padding:0 10px;background-color:#ddd;cursor:pointer}.form-box .quick-item .check-date-btn.ml[data-v-e5efab7c]{margin-left:20px}.form-box .quick-item .check-date-btn.mr[data-v-e5efab7c]{margin-right:20px}.form-box .quick-item .check-date[data-v-e5efab7c]{display:inline-block;line-height:33px}.form-box .quick-item .birthday-item>div[data-v-e5efab7c]{margin-top:5px}.form-box .quick-item .birthday-item>div p[data-v-e5efab7c]{display:inline-block;margin:0 20px}.form-box .quick-item .birthday-item>div>span[data-v-e5efab7c]{margin-top:5px}.form-box .quick-item .birthday-item .age-wrap[data-v-e5efab7c]{display:inline-block}.form-box .quick-item[data-v-e5efab7c] .ant-input-wrapper .ant-input-group-addon{border:1px solid #d9d9d9!important;border-left:0!important}.form-box .quick-item[data-v-e5efab7c] .num-picker{position:relative;display:flex}.form-box .quick-item[data-v-e5efab7c] .num-picker.num-picker-unit{padding-right:20px}.form-box .quick-item[data-v-e5efab7c] .num-picker input{text-align:left!important}.form-box .quick-item[data-v-e5efab7c] .num-picker:hover .clear-number-icon{display:block}.form-box .quick-item[data-v-e5efab7c] .num-picker /deep/ .ant-calendar-range-picker-input{text-align:left}.form-box .quick-item[data-v-e5efab7c] .num-picker .clear-number-icon{position:absolute;right:5px;top:6px;display:none;cursor:pointer;z-index:1000}.form-box .ant-radio-button-wrapper[data-v-e5efab7c]{padding:0 8px;height:30px;line-height:30px;margin-top:5px}.form-box .label-attr-container .edit-label[data-v-e5efab7c]{color:#000;font-size:14px;line-height:32px;padding-left:0}.form-box .label-attr-container .label-container-height[data-v-e5efab7c]{overflow:hidden;height:74px;flex:none}.form-box .label-attr-container .edit-content[data-v-e5efab7c]{padding:0}.form-box .label-attr-container .label-unfold-btn[data-v-e5efab7c]{margin:8px 0;color:rgba(0,0,0,.6);cursor:pointer}.form-box .label-attr-container .label-unfold-btn>span[data-v-e5efab7c]{display:flex;align-items:center;line-height:1}.form-box .label-attr-container .label-unfold-btn .anticon[data-v-e5efab7c]{font-size:16px;margin-left:8px}.form-box .label-attr-container .label-unfold-btn[data-v-e5efab7c]:active,.form-box .label-attr-container .label-unfold-btn[data-v-e5efab7c]:hover{color:#2d7aff}.form-box.quick-search-table .module-title[data-v-e5efab7c]{color:#506493;line-height:20px;padding-left:12px;border-left:4px solid #2d7aff}.form-box.quick-search-table .quick-item[data-v-e5efab7c]{display:inline-block}.form-box.quick-search-table .quick-item.quick-block[data-v-e5efab7c]{display:block}.form-box .psw-icon[data-v-e5efab7c]{cursor:pointer;color:#969696}.form-box .psw-icon[data-v-e5efab7c]:active{color:#5585f5}.form-box[data-v-e5efab7c] ::-webkit-input-placeholder{font-family:Avenir,Helvetica,Arial,sans-serif}.form-box[data-v-e5efab7c] ::-moz-placeholder{font-family:Avenir,Helvetica,Arial,sans-serif}.form-box[data-v-e5efab7c] :-ms-input-placeholder{font-family:Avenir,Helvetica,Arial,sans-serif}", ""]);
476898
- // Exports
476899
- module.exports = exports;
476900
-
476901
-
476902
476926
  /***/ }),
476903
476927
 
476904
476928
  /***/ "ef08":
@@ -477804,6 +477828,22 @@ var update = add("06a48b44", content, true, {"sourceMap":false,"shadowMode":fals
477804
477828
 
477805
477829
  /***/ }),
477806
477830
 
477831
+ /***/ "f2b1":
477832
+ /***/ (function(module, exports, __webpack_require__) {
477833
+
477834
+ // style-loader: Adds some css to the DOM by adding a <style> tag
477835
+
477836
+ // load the styles
477837
+ var content = __webpack_require__("a1d4");
477838
+ if(content.__esModule) content = content.default;
477839
+ if(typeof content === 'string') content = [[module.i, content, '']];
477840
+ if(content.locals) module.exports = content.locals;
477841
+ // add the styles to the DOM
477842
+ var add = __webpack_require__("499e").default
477843
+ var update = add("56711ffd", content, true, {"sourceMap":false,"shadowMode":false});
477844
+
477845
+ /***/ }),
477846
+
477807
477847
  /***/ "f2d9":
477808
477848
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
477809
477849
 
@@ -483783,22 +483823,6 @@ function toStringDate (str, format) {
483783
483823
  module.exports = toStringDate
483784
483824
 
483785
483825
 
483786
- /***/ }),
483787
-
483788
- /***/ "ff24":
483789
- /***/ (function(module, exports, __webpack_require__) {
483790
-
483791
- // style-loader: Adds some css to the DOM by adding a <style> tag
483792
-
483793
- // load the styles
483794
- var content = __webpack_require__("5e79");
483795
- if(content.__esModule) content = content.default;
483796
- if(typeof content === 'string') content = [[module.i, content, '']];
483797
- if(content.locals) module.exports = content.locals;
483798
- // add the styles to the DOM
483799
- var add = __webpack_require__("499e").default
483800
- var update = add("6e04dd00", content, true, {"sourceMap":false,"shadowMode":false});
483801
-
483802
483826
  /***/ }),
483803
483827
 
483804
483828
  /***/ "ff2d":